Adding initialize_with to FactoryGirl config in previous commit allowed

to call FactoryGirl.build for entities, so use it wherever possible.
This commit is contained in:
cmrd Senya 2015-11-06 23:45:08 +03:00
parent e8fa25c6a6
commit c9e641f3c5
3 changed files with 6 additions and 7 deletions

View file

@ -54,8 +54,7 @@ FactoryGirl.define do
url "http://localhost:3000/"
exported_key { generate(:public_key) }
profile {
DiasporaFederation::Entities::Profile.new(
FactoryGirl.attributes_for(:profile_entity, diaspora_id: diaspora_id))
FactoryGirl.build(:profile_entity, diaspora_id: diaspora_id)
}
end

View file

@ -4,8 +4,8 @@ module DiasporaFederation
@datetime = DateTime.now.utc
end
let(:msg1) { Entities::Message.new(FactoryGirl.attributes_for(:message_entity)) }
let(:msg2) { Entities::Message.new(FactoryGirl.attributes_for(:message_entity)) }
let(:msg1) { FactoryGirl.build(:message_entity) }
let(:msg2) { FactoryGirl.build(:message_entity) }
let(:data) {
{guid: FactoryGirl.generate(:guid),
subject: "very interesting conversation subject",

View file

@ -1,8 +1,8 @@
module DiasporaFederation
describe Entities::StatusMessage do
let(:photo1) { Entities::Photo.new(FactoryGirl.attributes_for(:photo_entity)) }
let(:photo2) { Entities::Photo.new(FactoryGirl.attributes_for(:photo_entity)) }
let(:location) { Entities::Location.new(FactoryGirl.attributes_for(:location_entity)) }
let(:photo1) { FactoryGirl.build(:photo_entity) }
let(:photo2) { FactoryGirl.build(:photo_entity) }
let(:location) { FactoryGirl.build(:location_entity) }
let(:data) {
{
raw_message: "this is such an interesting text",