0
I have an object user
generated by FactoryGirl
like the below:
FactoryGirl.define do
factory :user do
name { FFaker::NameBR.name }
image { FFaker::Avatar.image }
email { FFaker::Internet.email }
password 'Passw0rd!'
end
end
My serializer does not bring image
:
module Api::V1
class UserSerializer < ActiveModel::Serializer
attributes :id, :name, :email
end
end
When trying to compare the object generated by the controller and a mock of FactoryGirl
I get a comparison error.
expect(json).to eq(JSON.parse(@user.to_json))
My question is how to apply serializer to mock FactoryGirl
? Thank you.
Maybe the way I’m thinking is wrong, maybe there’s a better alternative, I’d like that feedback. :]
– Bruno Wego
Put here the generated jsons so that we can see the differences
– Juliano Alves