diff --git a/.rubocop.yml b/.rubocop.yml index b6deb4b..92c9ce7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -15,8 +15,6 @@ Metrics/LineLength: # the code easier to read (by naming things), but can also clutter the class Metrics/MethodLength: Max: 20 - Exclude: - - "lib/diaspora_federation/test/factories.rb" # The guiding principle of classes is SRP, SRP can't be accurately measured by LoC Metrics/ClassLength: @@ -27,8 +25,6 @@ Metrics/ModuleLength: # Raise AbcSize from 15 to 20 Metrics/AbcSize: Max: 20 - Exclude: - - "lib/diaspora_federation/test/factories.rb" # No space makes the method definition shorter and differentiates # from a regular assignment. @@ -165,7 +161,6 @@ Metrics/BlockLength: - "**/*.rake" - "spec/**/*.rb" - "test/dummy/config/**/*.rb" - - "lib/diaspora_federation/test/factories.rb" Rails/TimeZone: Exclude: diff --git a/Gemfile b/Gemfile index 3dae122..f214e7c 100644 --- a/Gemfile +++ b/Gemfile @@ -49,7 +49,6 @@ group :test do gem "simplecov-rcov", "0.2.3", require: false # test helpers - gem "factory_girl_rails", "~> 4.7" gem "fixture_builder", "0.5.0" gem "json-schema-rspec", "0.0.4" gem "rspec-collection_matchers", "~> 1.1.2" diff --git a/Gemfile.lock b/Gemfile.lock index cc83452..ae5b2e6 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,7 +13,7 @@ PATH rails (>= 4.2, < 6) diaspora_federation-test (0.1.8) diaspora_federation (= 0.1.8) - factory_girl (~> 4.7) + fabrication (~> 2.16.0) uuid (~> 2.3.8) GEM @@ -73,11 +73,7 @@ GEM erubis (2.7.0) ethon (0.10.1) ffi (>= 1.3.0) - factory_girl (4.8.0) - activesupport (>= 3.0.0) - factory_girl_rails (4.8.0) - factory_girl (~> 4.8.0) - railties (>= 3.0.0) + fabrication (2.16.1) faraday (0.12.0.1) multipart-post (>= 1.2, < 3) faraday_middleware (0.11.0.1) @@ -304,7 +300,6 @@ DEPENDENCIES diaspora_federation-json_schema! diaspora_federation-rails! diaspora_federation-test! - factory_girl_rails (~> 4.7) fixture_builder (= 0.5.0) fuubar (= 2.2.0) guard-rspec diff --git a/diaspora_federation-test.gemspec b/diaspora_federation-test.gemspec index e0b8cba..e7d946d 100644 --- a/diaspora_federation-test.gemspec +++ b/diaspora_federation-test.gemspec @@ -20,6 +20,6 @@ Gem::Specification.new do |s| s.required_ruby_version = "~> 2.1" s.add_dependency "diaspora_federation", DiasporaFederation::VERSION - s.add_dependency "factory_girl", "~> 4.7" + s.add_dependency "fabrication", "~> 2.16.0" s.add_dependency "uuid", "~> 2.3.8" end diff --git a/lib/diaspora_federation/test.rb b/lib/diaspora_federation/test.rb index 249c9d9..db81377 100644 --- a/lib/diaspora_federation/test.rb +++ b/lib/diaspora_federation/test.rb @@ -1,4 +1,7 @@ -require "diaspora_federation/test/factories" +require "fabrication" + +require "diaspora_federation" +require "diaspora_federation/test/entity_generator" module DiasporaFederation # This module encapsulates helper functions maybe wanted by a testsuite of a diaspora_federation gem user application. diff --git a/lib/diaspora_federation/test/entity_generator.rb b/lib/diaspora_federation/test/entity_generator.rb new file mode 100644 index 0000000..1f9c7e6 --- /dev/null +++ b/lib/diaspora_federation/test/entity_generator.rb @@ -0,0 +1,25 @@ +module DiasporaFederation + module Test + # Generator to instantiate entities + class EntityGenerator < Fabrication::Generator::Base + def self.supports?(klass) + klass.ancestors.include?(DiasporaFederation::Entity) + end + + def build_instance + self._instance = _klass.new(_attributes) + end + + def to_hash(attributes=[], _callbacks=[]) + process_attributes(attributes) + _attributes.each_with_object({}) do |(name, value), hash| + hash[name.to_sym] = value + end + end + end + + Fabrication.configure do |config| + config.generators << EntityGenerator + end + end +end diff --git a/lib/diaspora_federation/test/factories.rb b/lib/diaspora_federation/test/factories.rb index 673492e..299ee62 100644 --- a/lib/diaspora_federation/test/factories.rb +++ b/lib/diaspora_federation/test/factories.rb @@ -1,238 +1,228 @@ -require "diaspora_federation" -require "factory_girl" require "uuid" +require "securerandom" +require "diaspora_federation/test" module DiasporaFederation module Test # Factories for federation entities module Factories - # Defines the federation entity factories - def self.federation_factories - FactoryGirl.define do - initialize_with { new(attributes) } - sequence(:guid) { UUID.generate :compact } - sequence(:diaspora_id) {|n| "person-#{n}-#{SecureRandom.hex(3)}@localhost:3000" } - sequence(:public_key) { OpenSSL::PKey::RSA.generate(1024).public_key.export } + Fabricate.sequence(:guid) { UUID.generate(:compact) } + Fabricate.sequence(:diaspora_id) {|n| "person-#{n}-#{SecureRandom.hex(3)}@localhost:3000" } + Fabricate.sequence(:public_key) { OpenSSL::PKey::RSA.generate(1024).public_key.export } - factory :webfinger, class: DiasporaFederation::Discovery::WebFinger do - guid - acct_uri { "acct:#{generate(:diaspora_id)}" } - alias_url "http://localhost:3000/people/0123456789abcdef" - hcard_url "http://localhost:3000/hcard/users/user" - seed_url "http://localhost:3000/" - profile_url "http://localhost:3000/u/user" - atom_url "http://localhost:3000/public/user.atom" - salmon_url "http://localhost:3000/receive/users/0123456789abcdef" - public_key - subscribe_url "http://localhost:3000/people?q={uri}" - end + Fabricator(:webfinger, class_name: DiasporaFederation::Discovery::WebFinger) do + guid { Fabricate.sequence(:guid) } + acct_uri { "acct:#{Fabricate.sequence(:diaspora_id)}" } + alias_url "http://localhost:3000/people/0123456789abcdef" + hcard_url "http://localhost:3000/hcard/users/user" + seed_url "http://localhost:3000/" + profile_url "http://localhost:3000/u/user" + atom_url "http://localhost:3000/public/user.atom" + salmon_url "http://localhost:3000/receive/users/0123456789abcdef" + public_key { Fabricate.sequence(:public_key) } + subscribe_url "http://localhost:3000/people?q={uri}" + end - factory :h_card, class: DiasporaFederation::Discovery::HCard do - guid - nickname "some_name" - full_name "my name" - first_name "my name" - last_name "" - url "http://localhost:3000/" - public_key - photo_large_url "/assets/user/default.png" - photo_medium_url "/assets/user/default.png" - photo_small_url "/assets/user/default.png" - searchable true - end + Fabricator(:h_card, class_name: DiasporaFederation::Discovery::HCard) do + guid { Fabricate.sequence(:guid) } + nickname "some_name" + full_name "my name" + first_name "my name" + last_name "" + url "http://localhost:3000/" + public_key { Fabricate.sequence(:public_key) } + photo_large_url "/assets/user/default.png" + photo_medium_url "/assets/user/default.png" + photo_small_url "/assets/user/default.png" + searchable true + end - factory :account_migration_entity, class: DiasporaFederation::Entities::AccountMigration do - author { generate(:diaspora_id) } - profile { - FactoryGirl.build(:profile_entity) - } - end + Fabricator(:account_deletion_entity, class_name: DiasporaFederation::Entities::AccountDeletion) do + author { Fabricate.sequence(:diaspora_id) } + end - factory :person_entity, class: DiasporaFederation::Entities::Person do - guid - author { generate(:diaspora_id) } - url "http://localhost:3000/" - exported_key { generate(:public_key) } - profile { - FactoryGirl.build(:profile_entity, author: author) - } - end + Fabricator(:account_migration_entity, class_name: DiasporaFederation::Entities::AccountMigration) do + author { Fabricate.sequence(:diaspora_id) } + profile { Fabricate(:profile_entity) } + end - factory :profile_entity, class: DiasporaFederation::Entities::Profile do - author { generate(:diaspora_id) } - first_name "my name" - last_name "" - image_url "/assets/user/default.png" - image_url_medium "/assets/user/default.png" - image_url_small "/assets/user/default.png" - birthday "1988-07-15" - gender "Male" - bio "some text about me" - location "github" - searchable true - nsfw false - tag_string "#i #love #tags" - end + Fabricator(:person_entity, class_name: DiasporaFederation::Entities::Person) do + guid { Fabricate.sequence(:guid) } + author { Fabricate.sequence(:diaspora_id) } + url "http://localhost:3000/" + exported_key { Fabricate.sequence(:public_key) } + profile {|attrs| Fabricate(:profile_entity, author: attrs[:author]) } + end - factory :location_entity, class: DiasporaFederation::Entities::Location do - address "Vienna, Austria" - lat 48.208174.to_s - lng 16.373819.to_s - end + Fabricator(:profile_entity, class_name: DiasporaFederation::Entities::Profile) do + author { Fabricate.sequence(:diaspora_id) } + first_name "my name" + last_name "" + image_url "/assets/user/default.png" + image_url_medium "/assets/user/default.png" + image_url_small "/assets/user/default.png" + birthday "1988-07-15" + gender "Male" + bio "some text about me" + location "github" + searchable true + nsfw false + tag_string "#i #love #tags" + end - factory :photo_entity, class: DiasporaFederation::Entities::Photo do - guid - author { generate(:diaspora_id) } - public(true) - created_at { Time.now.utc } - remote_photo_path "https://diaspora.example.tld/uploads/images/" - remote_photo_name "f2a41e9d2db4d9a199c8.jpg" - text "what you see here..." - status_message_guid { generate(:guid) } - height 480 - width 800 - end + Fabricator(:location_entity, class_name: DiasporaFederation::Entities::Location) do + address "Vienna, Austria" + lat 48.208174.to_s + lng 16.373819.to_s + end - factory :relayable_entity, class: DiasporaFederation::Entities::Relayable do - parent_guid { generate(:guid) } - parent { FactoryGirl.build(:related_entity) } - end + Fabricator(:photo_entity, class_name: DiasporaFederation::Entities::Photo) do + guid { Fabricate.sequence(:guid) } + author { Fabricate.sequence(:diaspora_id) } + public true + created_at { Time.now.utc } + remote_photo_path "https://diaspora.example.tld/uploads/images/" + remote_photo_name "f2a41e9d2db4d9a199c8.jpg" + text "what you see here..." + status_message_guid { Fabricate.sequence(:guid) } + height 480 + width 800 + end - factory :participation_entity, - class: DiasporaFederation::Entities::Participation, parent: :relayable_entity do - author { generate(:diaspora_id) } - guid - parent_type "Post" - end + Fabricator(:relayable_entity, class_name: DiasporaFederation::Entities::Relayable) do + parent_guid { Fabricate.sequence(:guid) } + parent { Fabricate(:related_entity) } + end - factory :status_message_entity, class: DiasporaFederation::Entities::StatusMessage do - text "i am a very interesting status update" - author { generate(:diaspora_id) } - guid - public(true) - created_at { Time.now.utc } - end + Fabricator(:participation_entity, + class_name: DiasporaFederation::Entities::Participation, from: :relayable_entity) do + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + parent_type "Post" + end - factory :request_entity, class: DiasporaFederation::Entities::Request do - author { generate(:diaspora_id) } - recipient { generate(:diaspora_id) } - end + Fabricator(:status_message_entity, class_name: DiasporaFederation::Entities::StatusMessage) do + text "i am a very interesting status update" + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + public true + created_at { Time.now.utc } + end - factory :contact_entity, class: DiasporaFederation::Entities::Contact do - author { generate(:diaspora_id) } - recipient { generate(:diaspora_id) } - following true - sharing true - end + Fabricator(:request_entity, class_name: DiasporaFederation::Entities::Request) do + author { Fabricate.sequence(:diaspora_id) } + recipient { Fabricate.sequence(:diaspora_id) } + end - factory :comment_entity, class: DiasporaFederation::Entities::Comment, parent: :relayable_entity do - author { generate(:diaspora_id) } - guid - text "this is a very informative comment" - end + Fabricator(:contact_entity, class_name: DiasporaFederation::Entities::Contact) do + author { Fabricate.sequence(:diaspora_id) } + recipient { Fabricate.sequence(:diaspora_id) } + following true + sharing true + end - factory :like_entity, class: DiasporaFederation::Entities::Like, parent: :relayable_entity do - positive true - author { generate(:diaspora_id) } - guid - parent_type "Post" - end + Fabricator(:comment_entity, class_name: DiasporaFederation::Entities::Comment, from: :relayable_entity) do + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + text "this is a very informative comment" + end - factory :account_deletion_entity, class: DiasporaFederation::Entities::AccountDeletion do - author { generate(:diaspora_id) } - end + Fabricator(:like_entity, class_name: DiasporaFederation::Entities::Like, from: :relayable_entity) do + positive true + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + parent_type "Post" + end - factory :conversation_entity, class: DiasporaFederation::Entities::Conversation do - author { generate(:diaspora_id) } - guid - subject "this is a very informative subject" - created_at { Time.now.utc } - messages [] - participants { Array.new(3) { generate(:diaspora_id) }.join(";") } - end + Fabricator(:conversation_entity, class_name: DiasporaFederation::Entities::Conversation) do + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + subject "this is a very informative subject" + created_at { Time.now.utc } + messages [] + participants { Array.new(3) { Fabricate.sequence(:diaspora_id) }.join(";") } + end - factory :message_entity, class: DiasporaFederation::Entities::Message, parent: :relayable_entity do - guid - author { generate(:diaspora_id) } - text "this is a very informative text" - created_at { Time.now.utc } - conversation_guid { generate(:guid) } - end + Fabricator(:message_entity, class_name: DiasporaFederation::Entities::Message, from: :relayable_entity) do + guid { Fabricate.sequence(:guid) } + author { Fabricate.sequence(:diaspora_id) } + text "this is a very informative text" + created_at { Time.now.utc } + conversation_guid { Fabricate.sequence(:guid) } + end - factory :relayable_retraction_entity, class: DiasporaFederation::Entities::RelayableRetraction do - author { generate(:diaspora_id) } - target_guid { generate(:guid) } - target_type "Comment" - target { FactoryGirl.build(:related_entity, author: author) } - end + Fabricator(:relayable_retraction_entity, class_name: DiasporaFederation::Entities::RelayableRetraction) do + author { Fabricate.sequence(:diaspora_id) } + target_guid { Fabricate.sequence(:guid) } + target_type "Comment" + target {|attrs| Fabricate(:related_entity, author: attrs[:author]) } + end - factory :reshare_entity, class: DiasporaFederation::Entities::Reshare do - root_author { generate(:diaspora_id) } - root_guid { generate(:guid) } - guid - author { generate(:diaspora_id) } - public(true) - created_at { Time.now.utc } - provider_display_name { "the testsuite" } - end + Fabricator(:reshare_entity, class_name: DiasporaFederation::Entities::Reshare) do + root_author { Fabricate.sequence(:diaspora_id) } + root_guid { Fabricate.sequence(:guid) } + guid { Fabricate.sequence(:guid) } + author { Fabricate.sequence(:diaspora_id) } + public true + created_at { Time.now.utc } + provider_display_name { "the testsuite" } + end - factory :retraction_entity, class: DiasporaFederation::Entities::Retraction do - author { generate(:diaspora_id) } - target_guid { generate(:guid) } - target_type "Post" - target { FactoryGirl.build(:related_entity, author: author) } - end + Fabricator(:retraction_entity, class_name: DiasporaFederation::Entities::Retraction) do + author { Fabricate.sequence(:diaspora_id) } + target_guid { Fabricate.sequence(:guid) } + target_type "Post" + target {|attrs| Fabricate(:related_entity, author: attrs[:author]) } + end - factory :signed_retraction_entity, class: DiasporaFederation::Entities::SignedRetraction do - author { generate(:diaspora_id) } - target_guid { generate(:guid) } - target_type "Post" - target { FactoryGirl.build(:related_entity, author: author) } - end + Fabricator(:signed_retraction_entity, class_name: DiasporaFederation::Entities::SignedRetraction) do + author { Fabricate.sequence(:diaspora_id) } + target_guid { Fabricate.sequence(:guid) } + target_type "Post" + target {|attrs| Fabricate(:related_entity, author: attrs[:author]) } + end - factory :poll_answer_entity, class: DiasporaFederation::Entities::PollAnswer do - guid - answer { "Obama is a bicycle" } - end + Fabricator(:poll_answer_entity, class_name: DiasporaFederation::Entities::PollAnswer) do + guid { Fabricate.sequence(:guid) } + answer { "Obama is a bicycle" } + end - factory :poll_entity, class: DiasporaFederation::Entities::Poll do - guid - question { "Select an answer" } - poll_answers { Array.new(3) { FactoryGirl.build(:poll_answer_entity) } } - end + Fabricator(:poll_entity, class_name: DiasporaFederation::Entities::Poll) do + guid { Fabricate.sequence(:guid) } + question { "Select an answer" } + poll_answers { Array.new(3) { Fabricate(:poll_answer_entity) } } + end - factory :poll_participation_entity, - class: DiasporaFederation::Entities::PollParticipation, parent: :relayable_entity do - author { generate(:diaspora_id) } - guid - poll_answer_guid { generate(:guid) } - end + Fabricator(:poll_participation_entity, + class_name: DiasporaFederation::Entities::PollParticipation, from: :relayable_entity) do + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + poll_answer_guid { Fabricate.sequence(:guid) } + end - factory :event_entity, class: DiasporaFederation::Entities::Event do - author { generate(:diaspora_id) } - guid - summary "Cool event" - description "You need to see this!" - start { Time.now.utc.change(min: 0).change(sec: 0).change(usec: 0) - 1.hour } - add_attribute(:end) { Time.now.utc.change(min: 0).change(sec: 0).change(usec: 0) + 1.hour } - all_day false - timezone "Europe/Berlin" - end + Fabricator(:event_entity, class_name: DiasporaFederation::Entities::Event) do |f| + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + summary "Cool event" + description "You need to see this!" + start { Time.now.utc.change(min: 0).change(sec: 0).change(usec: 0) - 1.hour } + f.end { Time.now.utc.change(min: 0).change(sec: 0).change(usec: 0) + 1.hour } + all_day false + timezone "Europe/Berlin" + end - factory :event_participation_entity, - class: DiasporaFederation::Entities::EventParticipation, parent: :relayable_entity do - author { generate(:diaspora_id) } - guid - status "accepted" - end + Fabricator(:event_participation_entity, + class_name: DiasporaFederation::Entities::EventParticipation, from: :relayable_entity) do + author { Fabricate.sequence(:diaspora_id) } + guid { Fabricate.sequence(:guid) } + status "accepted" + end - factory :related_entity, class: DiasporaFederation::Entities::RelatedEntity do - author { generate(:diaspora_id) } - local true - public false - parent nil - end - end + Fabricator(:related_entity, class_name: DiasporaFederation::Entities::RelatedEntity) do + author { Fabricate.sequence(:diaspora_id) } + local true + public false + parent nil end end end diff --git a/spec/controllers/diaspora_federation/fetch_controller_spec.rb b/spec/controllers/diaspora_federation/fetch_controller_spec.rb index e9c35dc..5fa7e4e 100644 --- a/spec/controllers/diaspora_federation/fetch_controller_spec.rb +++ b/spec/controllers/diaspora_federation/fetch_controller_spec.rb @@ -3,7 +3,7 @@ module DiasporaFederation routes { DiasporaFederation::Engine.routes } let(:guid) { "12345678901234567890" } - let(:post) { FactoryGirl.build(:status_message_entity, guid: guid, author: alice.diaspora_id) } + let(:post) { Fabricate(:status_message_entity, guid: guid, author: alice.diaspora_id) } describe "GET #fetch" do it "returns the magic-envelope with the status message" do diff --git a/spec/factories.rb b/spec/factories.rb index cd2d5c5..681052e 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -1,46 +1,42 @@ -require "diaspora_federation/test" +require "diaspora_federation/test/factories" -DiasporaFederation::Test::Factories.federation_factories +Fabricator(:person) do + diaspora_id { Fabricate.sequence(:diaspora_id) } + url "http://somehost:3000/" + serialized_public_key { Fabricate.sequence(:public_key) } +end -FactoryGirl.define do - factory :person do - diaspora_id - url "http://somehost:3000/" - serialized_public_key { generate(:public_key) } - end - - factory :user, class: Person do - diaspora_id - url "http://localhost:3000/" - after(:build) do |user| - private_key = OpenSSL::PKey::RSA.generate(1024) - user.serialized_private_key = private_key.export - user.serialized_public_key = private_key.public_key.export - end - end - - factory :post, class: Entity do - entity_type "Post" - author { FactoryGirl.build(:person) } - end - - factory :comment, class: Entity do - entity_type "Comment" - author { FactoryGirl.build(:person) } - end - - factory :poll, class: Entity do - entity_type "Poll" - author { FactoryGirl.build(:person) } - end - - factory :event, class: Entity do - entity_type "Event" - author { FactoryGirl.build(:person) } - end - - factory :conversation, class: Entity do - entity_type "Conversation" - author { FactoryGirl.build(:person) } +Fabricator(:user, class_name: Person) do + diaspora_id { Fabricate.sequence(:diaspora_id) } + url "http://localhost:3000/" + after_build do |user| + private_key = OpenSSL::PKey::RSA.generate(1024) + user.serialized_private_key = private_key.export + user.serialized_public_key = private_key.public_key.export end end + +Fabricator(:post, class_name: Entity) do + on_init { init_with(entity_type: "Post") } + author { Fabricate(:person) } +end + +Fabricator(:comment, class_name: Entity) do + on_init { init_with(entity_type: "Comment") } + author { Fabricate(:person) } +end + +Fabricator(:poll, class_name: Entity) do + on_init { init_with(entity_type: "Poll") } + author { Fabricate(:person) } +end + +Fabricator(:event, class_name: Entity) do + on_init { init_with(entity_type: "Event") } + author { Fabricate(:person) } +end + +Fabricator(:conversation, class_name: Entity) do + on_init { init_with(entity_type: "Conversation") } + author { Fabricate(:person) } +end diff --git a/spec/integration/comment_integration_spec.rb b/spec/integration/comment_integration_spec.rb index 2d26f2e..f7d5c6a 100644 --- a/spec/integration/comment_integration_spec.rb +++ b/spec/integration/comment_integration_spec.rb @@ -56,7 +56,7 @@ KEY let(:new_data) { "foobar" } let(:text) { "this is a very informative comment" } - let(:parent) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:comment) { Entities::Comment.new( author: author, guid: guid, parent_guid: parent_guid, text: text, parent: parent, new_data: new_data @@ -210,7 +210,7 @@ XML end context "parsing on every other pod" do - let(:parent) { FactoryGirl.build(:related_entity, author: bob.diaspora_id, local: false) } + let(:parent) { Fabricate(:related_entity, author: bob.diaspora_id, local: false) } before do expect_callback(:fetch_public_key, author).and_return(author_key.public_key) diff --git a/spec/lib/diaspora_federation/discovery/h_card_spec.rb b/spec/lib/diaspora_federation/discovery/h_card_spec.rb index 487bae0..e614de4 100644 --- a/spec/lib/diaspora_federation/discovery/h_card_spec.rb +++ b/spec/lib/diaspora_federation/discovery/h_card_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Discovery::HCard do - let(:person) { FactoryGirl.create(:person) } + let(:person) { Fabricate(:person) } let(:photo_large_url) { "#{person.url}/upload/large.png" } let(:photo_medium_url) { "#{person.url}/upload/medium.png" } let(:photo_small_url) { "#{person.url}/upload/small.png" } diff --git a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb index 0f4a97f..69d920e 100644 --- a/spec/lib/diaspora_federation/discovery/web_finger_spec.rb +++ b/spec/lib/diaspora_federation/discovery/web_finger_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Discovery::WebFinger do - let(:person) { FactoryGirl.create(:person) } + let(:person) { Fabricate(:person) } let(:acct) { "acct:#{person.diaspora_id}" } let(:public_key_base64) { Base64.strict_encode64(person.serialized_public_key) } diff --git a/spec/lib/diaspora_federation/entities/account_deletion_spec.rb b/spec/lib/diaspora_federation/entities/account_deletion_spec.rb index 8ef5321..eaab619 100644 --- a/spec/lib/diaspora_federation/entities/account_deletion_spec.rb +++ b/spec/lib/diaspora_federation/entities/account_deletion_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::AccountDeletion do - let(:data) { FactoryGirl.attributes_for(:account_deletion_entity) } + let(:data) { Fabricate.attributes_for(:account_deletion_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/account_migration_spec.rb b/spec/lib/diaspora_federation/entities/account_migration_spec.rb index 560260e..09dca0d 100644 --- a/spec/lib/diaspora_federation/entities/account_migration_spec.rb +++ b/spec/lib/diaspora_federation/entities/account_migration_spec.rb @@ -3,9 +3,8 @@ module DiasporaFederation let(:new_diaspora_id) { alice.diaspora_id } let(:new_author_pkey) { alice.private_key } let(:hash) { - FactoryGirl.attributes_for( - :account_migration_entity, - profile: FactoryGirl.build(:profile_entity, author: new_diaspora_id) + Fabricate.attributes_for(:account_deletion_entity).merge( + profile: Fabricate(:profile_entity, author: new_diaspora_id) ) } let(:data) { diff --git a/spec/lib/diaspora_federation/entities/comment_spec.rb b/spec/lib/diaspora_federation/entities/comment_spec.rb index e47a364..ed3a5e5 100644 --- a/spec/lib/diaspora_federation/entities/comment_spec.rb +++ b/spec/lib/diaspora_federation/entities/comment_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::Comment do - let(:parent) { FactoryGirl.create(:post, author: bob) } - let(:parent_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:post, author: bob) } + let(:parent_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:data) { - FactoryGirl + Fabricate .attributes_for( :comment_entity, author: alice.diaspora_id, @@ -65,7 +65,7 @@ JSON it "parses the created_at from the xml if it is included and correctly signed" do created_at = Time.now.utc.change(usec: 0) - 1.minute - comment_data = FactoryGirl.attributes_for(:comment_entity, author: alice.diaspora_id, parent_guid: parent.guid) + comment_data = Fabricate.attributes_for(:comment_entity, author: alice.diaspora_id, parent_guid: parent.guid) comment_data[:created_at] = created_at comment_data[:parent] = parent_entity comment = described_class.new(comment_data, %i(author guid parent_guid text created_at)) diff --git a/spec/lib/diaspora_federation/entities/contact_spec.rb b/spec/lib/diaspora_federation/entities/contact_spec.rb index 8813aaa..bf188d5 100644 --- a/spec/lib/diaspora_federation/entities/contact_spec.rb +++ b/spec/lib/diaspora_federation/entities/contact_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::Contact do - let(:data) { FactoryGirl.attributes_for(:contact_entity) } + let(:data) { Fabricate.attributes_for(:contact_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/conversation_spec.rb b/spec/lib/diaspora_federation/entities/conversation_spec.rb index 90aa785..c77ba7d 100644 --- a/spec/lib/diaspora_federation/entities/conversation_spec.rb +++ b/spec/lib/diaspora_federation/entities/conversation_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::Conversation do - let(:parent) { FactoryGirl.create(:conversation, author: bob) } - let(:parent_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:conversation, author: bob) } + let(:parent_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:signed_msg1) { - FactoryGirl.attributes_for( + Fabricate.attributes_for( :message_entity, author: bob.diaspora_id, parent_guid: parent.guid, @@ -11,7 +11,7 @@ module DiasporaFederation ).tap {|hash| add_signatures(hash, Entities::Message) } } let(:signed_msg2) { - FactoryGirl.attributes_for( + Fabricate.attributes_for( :message_entity, author: bob.diaspora_id, parent_guid: parent.guid, @@ -19,11 +19,11 @@ module DiasporaFederation ).tap {|hash| add_signatures(hash, Entities::Message) } } let(:data) { - FactoryGirl.attributes_for(:conversation_entity).merge!( + Fabricate.attributes_for(:conversation_entity).merge!( messages: [Entities::Message.new(signed_msg1), Entities::Message.new(signed_msg2)], author: bob.diaspora_id, guid: parent.guid, - participants: "#{bob.diaspora_id};#{FactoryGirl.generate(:diaspora_id)}" + participants: "#{bob.diaspora_id};#{Fabricate.sequence(:diaspora_id)}" ) } diff --git a/spec/lib/diaspora_federation/entities/event_participation_spec.rb b/spec/lib/diaspora_federation/entities/event_participation_spec.rb index 7f5275d..8cc932f 100644 --- a/spec/lib/diaspora_federation/entities/event_participation_spec.rb +++ b/spec/lib/diaspora_federation/entities/event_participation_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::EventParticipation do - let(:parent) { FactoryGirl.create(:event, author: bob) } - let(:parent_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:event, author: bob) } + let(:parent_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:data) { - FactoryGirl.attributes_for( + Fabricate.attributes_for( :event_participation_entity, author: alice.diaspora_id, parent_guid: parent.guid, diff --git a/spec/lib/diaspora_federation/entities/event_spec.rb b/spec/lib/diaspora_federation/entities/event_spec.rb index 0507ae2..5a759e6 100644 --- a/spec/lib/diaspora_federation/entities/event_spec.rb +++ b/spec/lib/diaspora_federation/entities/event_spec.rb @@ -1,8 +1,8 @@ module DiasporaFederation describe Entities::Event do - let(:location) { FactoryGirl.build(:location_entity) } + let(:location) { Fabricate(:location_entity) } let(:data) { - FactoryGirl.attributes_for(:event_entity).merge(author: alice.diaspora_id, location: location) + Fabricate.attributes_for(:event_entity).merge(author: alice.diaspora_id, location: location) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/like_spec.rb b/spec/lib/diaspora_federation/entities/like_spec.rb index ae3534d..08fbc5b 100644 --- a/spec/lib/diaspora_federation/entities/like_spec.rb +++ b/spec/lib/diaspora_federation/entities/like_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::Like do - let(:parent) { FactoryGirl.create(:post, author: bob) } - let(:parent_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:post, author: bob) } + let(:parent_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:data) { - FactoryGirl.attributes_for( + Fabricate.attributes_for( :like_entity, author: alice.diaspora_id, parent_guid: parent.guid, diff --git a/spec/lib/diaspora_federation/entities/location_spec.rb b/spec/lib/diaspora_federation/entities/location_spec.rb index 053d3e6..0ba629e 100644 --- a/spec/lib/diaspora_federation/entities/location_spec.rb +++ b/spec/lib/diaspora_federation/entities/location_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::Location do - let(:data) { FactoryGirl.attributes_for(:location_entity) } + let(:data) { Fabricate.attributes_for(:location_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/message_spec.rb b/spec/lib/diaspora_federation/entities/message_spec.rb index a2df46d..67f9999 100644 --- a/spec/lib/diaspora_federation/entities/message_spec.rb +++ b/spec/lib/diaspora_federation/entities/message_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::Message do - let(:parent) { FactoryGirl.create(:conversation, author: bob) } - let(:parent_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:conversation, author: bob) } + let(:parent_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:data) { - FactoryGirl + Fabricate .attributes_for(:message_entity, author: alice.diaspora_id, parent_guid: parent.guid, parent: parent_entity) .tap {|hash| add_signatures(hash) } } @@ -44,7 +44,7 @@ XML it "does not allow any other person" do expect_callback(:fetch_related_entity, "Conversation", entity.conversation_guid).and_return(parent_entity) - invalid_sender = FactoryGirl.generate(:diaspora_id) + invalid_sender = Fabricate.sequence(:diaspora_id) expect(entity.sender_valid?(invalid_sender)).to be_falsey end diff --git a/spec/lib/diaspora_federation/entities/participation_spec.rb b/spec/lib/diaspora_federation/entities/participation_spec.rb index 4f7a34c..cc1276e 100644 --- a/spec/lib/diaspora_federation/entities/participation_spec.rb +++ b/spec/lib/diaspora_federation/entities/participation_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::Participation do - let(:parent) { FactoryGirl.create(:post, author: bob) } - let(:parent_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:post, author: bob) } + let(:parent_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:data) { - FactoryGirl.attributes_for( + Fabricate.attributes_for( :participation_entity, author: alice.diaspora_id, parent_guid: parent.guid, @@ -84,7 +84,7 @@ JSON } it "succeeds when the parent is local" do - local_parent = FactoryGirl.build(:related_entity, local: true) + local_parent = Fabricate(:related_entity, local: true) expect_callback(:fetch_related_entity, parent.entity_type, parent.guid).and_return(local_parent) expect { @@ -101,7 +101,7 @@ JSON end it "raises ParentNotLocal when the parent is not local" do - remote_parent = FactoryGirl.build(:related_entity, local: false) + remote_parent = Fabricate(:related_entity, local: false) expect_callback(:fetch_related_entity, parent.entity_type, parent.guid).and_return(remote_parent) expect { diff --git a/spec/lib/diaspora_federation/entities/person_spec.rb b/spec/lib/diaspora_federation/entities/person_spec.rb index fab067c..786992a 100644 --- a/spec/lib/diaspora_federation/entities/person_spec.rb +++ b/spec/lib/diaspora_federation/entities/person_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::Person do - let(:data) { FactoryGirl.attributes_for(:person_entity) } + let(:data) { Fabricate.attributes_for(:person_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/photo_spec.rb b/spec/lib/diaspora_federation/entities/photo_spec.rb index 0f8d71b..9c58728 100644 --- a/spec/lib/diaspora_federation/entities/photo_spec.rb +++ b/spec/lib/diaspora_federation/entities/photo_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::Photo do - let(:data) { FactoryGirl.attributes_for(:photo_entity) } + let(:data) { Fabricate.attributes_for(:photo_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/poll_answer_spec.rb b/spec/lib/diaspora_federation/entities/poll_answer_spec.rb index fd88740..b16d23e 100644 --- a/spec/lib/diaspora_federation/entities/poll_answer_spec.rb +++ b/spec/lib/diaspora_federation/entities/poll_answer_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::PollAnswer do - let(:data) { FactoryGirl.attributes_for(:poll_answer_entity) } + let(:data) { Fabricate.attributes_for(:poll_answer_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/poll_participation_spec.rb b/spec/lib/diaspora_federation/entities/poll_participation_spec.rb index e81c52e..b63f261 100644 --- a/spec/lib/diaspora_federation/entities/poll_participation_spec.rb +++ b/spec/lib/diaspora_federation/entities/poll_participation_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::PollParticipation do - let(:parent) { FactoryGirl.create(:poll, author: bob) } - let(:parent_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:parent) { Fabricate(:poll, author: bob) } + let(:parent_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:data) { - FactoryGirl.attributes_for( + Fabricate.attributes_for( :poll_participation_entity, author: alice.diaspora_id, parent_guid: parent.guid, diff --git a/spec/lib/diaspora_federation/entities/poll_spec.rb b/spec/lib/diaspora_federation/entities/poll_spec.rb index 7422d39..e6480fd 100644 --- a/spec/lib/diaspora_federation/entities/poll_spec.rb +++ b/spec/lib/diaspora_federation/entities/poll_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::Poll do - let(:data) { FactoryGirl.attributes_for(:poll_entity) } + let(:data) { Fabricate.attributes_for(:poll_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/profile_spec.rb b/spec/lib/diaspora_federation/entities/profile_spec.rb index 6aca890..b0b6873 100644 --- a/spec/lib/diaspora_federation/entities/profile_spec.rb +++ b/spec/lib/diaspora_federation/entities/profile_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::Profile do - let(:data) { FactoryGirl.attributes_for(:profile_entity) } + let(:data) { Fabricate.attributes_for(:profile_entity) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/related_entity_spec.rb b/spec/lib/diaspora_federation/entities/related_entity_spec.rb index 33301a6..977e4b1 100644 --- a/spec/lib/diaspora_federation/entities/related_entity_spec.rb +++ b/spec/lib/diaspora_federation/entities/related_entity_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::RelatedEntity do - let(:data) { FactoryGirl.attributes_for(:related_entity) } + let(:data) { Fabricate.attributes_for(:related_entity) } let(:string) { "RelatedEntity" } it_behaves_like "an Entity subclass" diff --git a/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb b/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb index ebcff4d..3f062c8 100644 --- a/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb +++ b/spec/lib/diaspora_federation/entities/relayable_retraction_spec.rb @@ -1,15 +1,15 @@ module DiasporaFederation describe Entities::RelayableRetraction do - let(:target) { FactoryGirl.create(:comment, author: bob) } + let(:target) { Fabricate(:comment, author: bob) } let(:target_entity) { - FactoryGirl.build( + Fabricate( :related_entity, author: bob.diaspora_id, - parent: FactoryGirl.build(:related_entity, author: alice.diaspora_id) + parent: Fabricate(:related_entity, author: alice.diaspora_id) ) } let(:data) { - FactoryGirl.build( + Fabricate( :relayable_retraction_entity, author: alice.diaspora_id, target_guid: target.guid, @@ -41,11 +41,11 @@ XML describe "#to_xml" do let(:author_pkey) { OpenSSL::PKey::RSA.generate(1024) } - let(:hash) { FactoryGirl.attributes_for(:relayable_retraction_entity) } + let(:hash) { Fabricate.attributes_for(:relayable_retraction_entity) } it "updates author signature when it was nil and key was supplied and author is not parent author" do - parent = FactoryGirl.build(:related_entity, author: bob.diaspora_id) - hash[:target] = FactoryGirl.build(:related_entity, author: hash[:author], parent: parent) + parent = Fabricate(:related_entity, author: bob.diaspora_id) + hash[:target] = Fabricate(:related_entity, author: hash[:author], parent: parent) expect_callback(:fetch_private_key, hash[:author]).and_return(author_pkey) @@ -58,8 +58,8 @@ XML end it "sets parent author signature when author is parent author" do - parent = FactoryGirl.build(:related_entity, author: hash[:author]) - hash[:target] = FactoryGirl.build(:related_entity, author: hash[:author], parent: parent) + parent = Fabricate(:related_entity, author: hash[:author]) + hash[:target] = Fabricate(:related_entity, author: hash[:author], parent: parent) expect_callback(:fetch_private_key, hash[:author]).and_return(author_pkey) @@ -72,8 +72,8 @@ XML end it "updates parent author signature when it was nil, key was supplied and sender is author of the parent" do - parent = FactoryGirl.build(:related_entity, author: hash[:author]) - hash[:target] = FactoryGirl.build(:related_entity, author: bob.diaspora_id, parent: parent) + parent = Fabricate(:related_entity, author: hash[:author]) + hash[:target] = Fabricate(:related_entity, author: bob.diaspora_id, parent: parent) expect_callback(:fetch_private_key, hash[:author]).and_return(author_pkey) @@ -105,7 +105,7 @@ XML describe "#to_retraction" do it "copies the attributes to a Retraction" do - relayable_retraction = FactoryGirl.build(:relayable_retraction_entity) + relayable_retraction = Fabricate(:relayable_retraction_entity) retraction = relayable_retraction.to_retraction expect(retraction).to be_a(Entities::Retraction) diff --git a/spec/lib/diaspora_federation/entities/relayable_spec.rb b/spec/lib/diaspora_federation/entities/relayable_spec.rb index 004d25e..0c02c4e 100644 --- a/spec/lib/diaspora_federation/entities/relayable_spec.rb +++ b/spec/lib/diaspora_federation/entities/relayable_spec.rb @@ -3,13 +3,13 @@ module DiasporaFederation let(:author_pkey) { OpenSSL::PKey::RSA.generate(1024) } let(:parent_pkey) { OpenSSL::PKey::RSA.generate(1024) } - let(:guid) { FactoryGirl.generate(:guid) } - let(:parent_guid) { FactoryGirl.generate(:guid) } - let(:author) { FactoryGirl.generate(:diaspora_id) } + let(:guid) { Fabricate.sequence(:guid) } + let(:parent_guid) { Fabricate.sequence(:guid) } + let(:author) { Fabricate.sequence(:diaspora_id) } let(:property) { "hello" } let(:new_property) { "some text" } - let(:local_parent) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } - let(:remote_parent) { FactoryGirl.build(:related_entity, author: bob.diaspora_id, local: false) } + let(:local_parent) { Fabricate(:related_entity, author: bob.diaspora_id) } + let(:remote_parent) { Fabricate(:related_entity, author: bob.diaspora_id, local: false) } let(:hash) { {guid: guid, author: author, parent_guid: parent_guid, parent: local_parent, property: property} } let(:hash_with_fake_signatures) { hash.merge!(author_signature: "aa", parent_author_signature: "bb") } @@ -521,7 +521,7 @@ XML it "does not allow any random author" do entity = Entities::SomeRelayable.new(hash) - invalid_author = FactoryGirl.generate(:diaspora_id) + invalid_author = Fabricate.sequence(:diaspora_id) expect(entity.sender_valid?(invalid_author)).to be_falsey end diff --git a/spec/lib/diaspora_federation/entities/request_spec.rb b/spec/lib/diaspora_federation/entities/request_spec.rb index d52a9a0..b59f7db 100644 --- a/spec/lib/diaspora_federation/entities/request_spec.rb +++ b/spec/lib/diaspora_federation/entities/request_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Entities::Request do - let(:data) { FactoryGirl.attributes_for(:request_entity) } + let(:data) { Fabricate.attributes_for(:request_entity) } let(:xml) { <<-XML } @@ -17,7 +17,7 @@ XML describe "#to_contact" do it "copies the attributes to a Contact" do - request = FactoryGirl.build(:request_entity) + request = Fabricate(:request_entity) contact = request.to_contact expect(contact).to be_a(Entities::Contact) diff --git a/spec/lib/diaspora_federation/entities/reshare_spec.rb b/spec/lib/diaspora_federation/entities/reshare_spec.rb index f0c9d96..bb680f7 100644 --- a/spec/lib/diaspora_federation/entities/reshare_spec.rb +++ b/spec/lib/diaspora_federation/entities/reshare_spec.rb @@ -1,7 +1,7 @@ module DiasporaFederation describe Entities::Reshare do - let(:root) { FactoryGirl.create(:post, author: bob) } - let(:data) { FactoryGirl.attributes_for(:reshare_entity, root_guid: root.guid, root_author: bob.diaspora_id) } + let(:root) { Fabricate(:post, author: bob) } + let(:data) { Fabricate.attributes_for(:reshare_entity, root_guid: root.guid, root_author: bob.diaspora_id) } let(:xml) { <<-XML } diff --git a/spec/lib/diaspora_federation/entities/retraction_spec.rb b/spec/lib/diaspora_federation/entities/retraction_spec.rb index 75f87c5..5b3aa73 100644 --- a/spec/lib/diaspora_federation/entities/retraction_spec.rb +++ b/spec/lib/diaspora_federation/entities/retraction_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::Retraction do - let(:target) { FactoryGirl.create(:post, author: bob) } - let(:target_entity) { FactoryGirl.build(:related_entity, author: bob.diaspora_id) } + let(:target) { Fabricate(:post, author: bob) } + let(:target_entity) { Fabricate(:related_entity, author: bob.diaspora_id) } let(:data) { - FactoryGirl.attributes_for( + Fabricate.attributes_for( :retraction_entity, target_guid: target.guid, target_type: target.entity_type, @@ -37,7 +37,7 @@ XML it "does not allow any random author" do entity = Entities::Retraction.new(data) - invalid_author = FactoryGirl.generate(:diaspora_id) + invalid_author = Fabricate.sequence(:diaspora_id) expect(entity.sender_valid?(invalid_author)).to be_falsey end @@ -46,10 +46,10 @@ XML %w(Comment Like PollParticipation).each do |target_type| context "#{target_type} target" do let(:relayable_target) { - FactoryGirl.build( + Fabricate( :related_entity, author: bob.diaspora_id, - parent: FactoryGirl.build(:related_entity, author: alice.diaspora_id) + parent: Fabricate(:related_entity, author: alice.diaspora_id) ) } let(:relayable_data) { data.merge(target_type: target_type, target: relayable_target) } @@ -68,7 +68,7 @@ XML it "does not allow any random author" do entity = Entities::Retraction.new(relayable_data) - invalid_author = FactoryGirl.generate(:diaspora_id) + invalid_author = Fabricate.sequence(:diaspora_id) expect(entity.sender_valid?(invalid_author)).to be_falsey end diff --git a/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb b/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb index a74ce6c..9daecef 100644 --- a/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb +++ b/spec/lib/diaspora_federation/entities/signed_retraction_spec.rb @@ -1,9 +1,9 @@ module DiasporaFederation describe Entities::SignedRetraction do - let(:target) { FactoryGirl.create(:post, author: alice) } - let(:target_entity) { FactoryGirl.build(:related_entity, author: alice.diaspora_id) } + let(:target) { Fabricate(:post, author: alice) } + let(:target_entity) { Fabricate(:related_entity, author: alice.diaspora_id) } let(:data) { - FactoryGirl.build( + Fabricate( :signed_retraction_entity, author: alice.diaspora_id, target_guid: target.guid, @@ -31,7 +31,7 @@ XML describe "#to_xml" do let(:author_pkey) { OpenSSL::PKey::RSA.generate(1024) } - let(:hash) { FactoryGirl.attributes_for(:signed_retraction_entity) } + let(:hash) { Fabricate.attributes_for(:signed_retraction_entity) } it "updates author signature when it was nil and key was supplied" do expect_callback(:fetch_private_key, hash[:author]).and_return(author_pkey) @@ -62,7 +62,7 @@ XML describe "#to_retraction" do it "copies the attributes to a Retraction" do - signed_retraction = FactoryGirl.build(:signed_retraction_entity) + signed_retraction = Fabricate(:signed_retraction_entity) retraction = signed_retraction.to_retraction expect(retraction).to be_a(Entities::Retraction) diff --git a/spec/lib/diaspora_federation/entities/status_message_spec.rb b/spec/lib/diaspora_federation/entities/status_message_spec.rb index 1df135d..1c1f8f4 100644 --- a/spec/lib/diaspora_federation/entities/status_message_spec.rb +++ b/spec/lib/diaspora_federation/entities/status_message_spec.rb @@ -1,10 +1,10 @@ module DiasporaFederation describe Entities::StatusMessage do - let(:photo1) { FactoryGirl.build(:photo_entity, author: alice.diaspora_id) } - let(:photo2) { FactoryGirl.build(:photo_entity, author: alice.diaspora_id) } - let(:location) { FactoryGirl.build(:location_entity) } + let(:photo1) { Fabricate(:photo_entity, author: alice.diaspora_id) } + let(:photo2) { Fabricate(:photo_entity, author: alice.diaspora_id) } + let(:location) { Fabricate(:location_entity) } let(:data) { - FactoryGirl.attributes_for(:status_message_entity).merge( + Fabricate.attributes_for(:status_message_entity).merge( author: alice.diaspora_id, photos: [photo1, photo2], location: location, @@ -140,7 +140,7 @@ XML context "nested entities" do it "validates that nested photos have the same author" do - invalid_data = data.merge(author: FactoryGirl.generate(:diaspora_id)) + invalid_data = data.merge(author: Fabricate.sequence(:diaspora_id)) expect { Entities::StatusMessage.new(invalid_data) }.to raise_error Entity::ValidationError diff --git a/spec/lib/diaspora_federation/entity_spec.rb b/spec/lib/diaspora_federation/entity_spec.rb index 63d76bf..d875791 100644 --- a/spec/lib/diaspora_federation/entity_spec.rb +++ b/spec/lib/diaspora_federation/entity_spec.rb @@ -417,7 +417,7 @@ JSON end it "is not added to xml if #to_xml returns nil" do - entity = Entities::TestEntityWithRelatedEntity.new(test: "test", parent: FactoryGirl.build(:related_entity)) + entity = Entities::TestEntityWithRelatedEntity.new(test: "test", parent: Fabricate(:related_entity)) xml = entity.to_xml expect(xml.children).to have_exactly(1).items xml.children.first.name = "test" diff --git a/spec/lib/diaspora_federation/federation/fetcher_spec.rb b/spec/lib/diaspora_federation/federation/fetcher_spec.rb index b04b170..22898f5 100644 --- a/spec/lib/diaspora_federation/federation/fetcher_spec.rb +++ b/spec/lib/diaspora_federation/federation/fetcher_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Federation::Fetcher do - let(:post) { FactoryGirl.build(:status_message_entity, public: true) } + let(:post) { Fabricate(:status_message_entity, public: true) } let(:post_magic_env) { Salmon::MagicEnvelope.new(post, post.author).envelop(alice.private_key).to_xml } describe ".fetch_public" do diff --git a/spec/lib/diaspora_federation/federation/receiver/private_spec.rb b/spec/lib/diaspora_federation/federation/receiver/private_spec.rb index 8a99f31..2deda9d 100644 --- a/spec/lib/diaspora_federation/federation/receiver/private_spec.rb +++ b/spec/lib/diaspora_federation/federation/receiver/private_spec.rb @@ -1,7 +1,7 @@ module DiasporaFederation describe Federation::Receiver::Private do let(:recipient) { 42 } - let(:post) { FactoryGirl.build(:status_message_entity, public: false) } + let(:post) { Fabricate(:status_message_entity, public: false) } let(:magic_env) { Salmon::MagicEnvelope.new(post, post.author) } describe "#receive" do @@ -12,7 +12,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(post, sender) expect { @@ -27,7 +27,7 @@ module DiasporaFederation end context "with relayable" do - let(:comment) { FactoryGirl.build(:comment_entity, parent: FactoryGirl.build(:related_entity, public: false)) } + let(:comment) { Fabricate(:comment_entity, parent: Fabricate(:related_entity, public: false)) } it "receives a comment from the author" do magic_env = Salmon::MagicEnvelope.new(comment, comment.author) @@ -46,7 +46,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(comment, sender) expect { @@ -57,7 +57,7 @@ module DiasporaFederation context "with retraction" do context "for a post" do - let(:retraction) { FactoryGirl.build(:retraction_entity, target_type: "Post") } + let(:retraction) { Fabricate(:retraction_entity, target_type: "Post") } it "retracts a post from the author" do magic_env = Salmon::MagicEnvelope.new(retraction, retraction.target.author) @@ -68,7 +68,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(retraction, sender) expect { @@ -79,10 +79,10 @@ module DiasporaFederation context "for a comment" do let(:retraction) { - FactoryGirl.build( + Fabricate( :retraction_entity, target_type: "Comment", - target: FactoryGirl.build(:related_entity, parent: FactoryGirl.build(:related_entity)) + target: Fabricate(:related_entity, parent: Fabricate(:related_entity)) ) } @@ -103,7 +103,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(retraction, sender) expect { diff --git a/spec/lib/diaspora_federation/federation/receiver/public_spec.rb b/spec/lib/diaspora_federation/federation/receiver/public_spec.rb index 8ec88e1..298cd47 100644 --- a/spec/lib/diaspora_federation/federation/receiver/public_spec.rb +++ b/spec/lib/diaspora_federation/federation/receiver/public_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Federation::Receiver::Public do - let(:post) { FactoryGirl.build(:status_message_entity) } + let(:post) { Fabricate(:status_message_entity) } let(:magic_env) { Salmon::MagicEnvelope.new(post, post.author) } describe "#receive" do @@ -11,7 +11,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(post, sender) expect { @@ -20,7 +20,7 @@ module DiasporaFederation end context "with relayable" do - let(:comment) { FactoryGirl.build(:comment_entity) } + let(:comment) { Fabricate(:comment_entity) } it "receives a comment from the author" do magic_env = Salmon::MagicEnvelope.new(comment, comment.author) @@ -39,7 +39,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(comment, sender) expect { @@ -50,7 +50,7 @@ module DiasporaFederation context "with retraction" do context "for a post" do - let(:retraction) { FactoryGirl.build(:retraction_entity, target_type: "Post") } + let(:retraction) { Fabricate(:retraction_entity, target_type: "Post") } it "retracts a post from the author" do magic_env = Salmon::MagicEnvelope.new(retraction, retraction.author) @@ -61,7 +61,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(retraction, sender) expect { @@ -72,10 +72,10 @@ module DiasporaFederation context "for a comment" do let(:retraction) { - FactoryGirl.build( + Fabricate( :retraction_entity, target_type: "Comment", - target: FactoryGirl.build(:related_entity, parent: FactoryGirl.build(:related_entity)) + target: Fabricate(:related_entity, parent: Fabricate(:related_entity)) ) } @@ -96,7 +96,7 @@ module DiasporaFederation end it "validates the sender" do - sender = FactoryGirl.generate(:diaspora_id) + sender = Fabricate.sequence(:diaspora_id) bad_env = Salmon::MagicEnvelope.new(retraction, sender) expect { @@ -108,7 +108,7 @@ module DiasporaFederation context "validates if it is public" do it "allows public entities" do - public_post = FactoryGirl.build(:status_message_entity, public: true) + public_post = Fabricate(:status_message_entity, public: true) magic_env = Salmon::MagicEnvelope.new(public_post, public_post.author) expect_callback(:receive_entity, public_post, public_post.author, nil) @@ -117,7 +117,7 @@ module DiasporaFederation end it "does not allow non-public entities" do - private_post = FactoryGirl.build(:status_message_entity, public: false) + private_post = Fabricate(:status_message_entity, public: false) magic_env = Salmon::MagicEnvelope.new(private_post, private_post.author) expect { @@ -126,7 +126,7 @@ module DiasporaFederation end it "allows entities without public flag" do - profile = FactoryGirl.build(:profile_entity) + profile = Fabricate(:profile_entity) magic_env = Salmon::MagicEnvelope.new(profile, profile.author) expect_callback(:receive_entity, profile, profile.author, nil) diff --git a/spec/lib/diaspora_federation/federation/receiver_spec.rb b/spec/lib/diaspora_federation/federation/receiver_spec.rb index 3da808f..0c924c8 100644 --- a/spec/lib/diaspora_federation/federation/receiver_spec.rb +++ b/spec/lib/diaspora_federation/federation/receiver_spec.rb @@ -4,7 +4,7 @@ module DiasporaFederation let(:recipient_key) { OpenSSL::PKey::RSA.generate(1024) } describe ".receive_public" do - let(:post) { FactoryGirl.build(:status_message_entity) } + let(:post) { Fabricate(:status_message_entity) } it "parses the entity with magic envelope receiver" do expect_callback(:fetch_public_key, post.author).and_return(sender_key) @@ -44,7 +44,7 @@ module DiasporaFederation end describe ".receive_private" do - let(:post) { FactoryGirl.build(:status_message_entity, public: false) } + let(:post) { Fabricate(:status_message_entity, public: false) } it "parses the entity with magic envelope receiver" do expect_callback(:fetch_public_key, post.author).and_return(sender_key) diff --git a/spec/lib/diaspora_federation/federation/sender/hydra_wrapper_spec.rb b/spec/lib/diaspora_federation/federation/sender/hydra_wrapper_spec.rb index b60ec75..ed5203a 100644 --- a/spec/lib/diaspora_federation/federation/sender/hydra_wrapper_spec.rb +++ b/spec/lib/diaspora_federation/federation/sender/hydra_wrapper_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Federation::Sender::HydraWrapper do - let(:sender_id) { FactoryGirl.generate(:diaspora_id) } + let(:sender_id) { Fabricate.sequence(:diaspora_id) } let(:obj_str) { "status_message@guid" } let(:xml) { "post" } let(:url) { "http://example.org/receive/public" } diff --git a/spec/lib/diaspora_federation/federation/sender_spec.rb b/spec/lib/diaspora_federation/federation/sender_spec.rb index 9cb59cb..29a6a61 100644 --- a/spec/lib/diaspora_federation/federation/sender_spec.rb +++ b/spec/lib/diaspora_federation/federation/sender_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Federation::Sender do - let(:sender_id) { FactoryGirl.generate(:diaspora_id) } + let(:sender_id) { Fabricate.sequence(:diaspora_id) } let(:obj_str) { "status_message@guid" } let(:hydra_wrapper) { double } diff --git a/spec/lib/diaspora_federation/salmon/encrypted_magic_envelope_spec.rb b/spec/lib/diaspora_federation/salmon/encrypted_magic_envelope_spec.rb index eaddd85..2c5bafd 100644 --- a/spec/lib/diaspora_federation/salmon/encrypted_magic_envelope_spec.rb +++ b/spec/lib/diaspora_federation/salmon/encrypted_magic_envelope_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Salmon::EncryptedMagicEnvelope do - let(:sender_id) { FactoryGirl.generate(:diaspora_id) } + let(:sender_id) { Fabricate.sequence(:diaspora_id) } let(:sender_key) { OpenSSL::PKey::RSA.generate(512) } # use small key for speedy specs let(:entity) { Entities::TestEntity.new(test: "abcd") } let(:magic_env) { Salmon::MagicEnvelope.new(entity, sender_id).envelop(sender_key) } diff --git a/spec/lib/diaspora_federation/salmon/magic_envelope_spec.rb b/spec/lib/diaspora_federation/salmon/magic_envelope_spec.rb index b7b305d..47a5955 100644 --- a/spec/lib/diaspora_federation/salmon/magic_envelope_spec.rb +++ b/spec/lib/diaspora_federation/salmon/magic_envelope_spec.rb @@ -1,6 +1,6 @@ module DiasporaFederation describe Salmon::MagicEnvelope do - let(:sender) { FactoryGirl.generate(:diaspora_id) } + let(:sender) { Fabricate.sequence(:diaspora_id) } let(:privkey) { OpenSSL::PKey::RSA.generate(512) } # use small key for speedy specs let(:payload) { Entities::TestEntity.new(test: "asdf") } let(:envelope) { Salmon::MagicEnvelope.new(payload, sender) } @@ -139,7 +139,7 @@ module DiasporaFederation end it "verifies the signature" do - other_sender = FactoryGirl.generate(:diaspora_id) + other_sender = Fabricate.sequence(:diaspora_id) other_key = OpenSSL::PKey::RSA.generate(512) expect_callback(:fetch_public_key, other_sender).and_return(other_key) diff --git a/spec/lib/diaspora_federation/validators/conversation_validator_spec.rb b/spec/lib/diaspora_federation/validators/conversation_validator_spec.rb index 2c32182..7891159 100644 --- a/spec/lib/diaspora_federation/validators/conversation_validator_spec.rb +++ b/spec/lib/diaspora_federation/validators/conversation_validator_spec.rb @@ -25,7 +25,7 @@ module DiasporaFederation it_behaves_like "a property with a value validation/restriction" do let(:property) { :messages } let(:wrong_values) { [nil] } - let(:correct_values) { [[], [FactoryGirl.build(:message_entity)]] } + let(:correct_values) { [[], [Fabricate(:message_entity)]] } end end @@ -33,8 +33,8 @@ module DiasporaFederation # must not contain more than 20 participant handles it_behaves_like "a property with a value validation/restriction" do let(:property) { :participants } - let(:wrong_values) { [Array.new(21) { FactoryGirl.generate(:diaspora_id) }.join(";")] } - let(:correct_values) { [Array.new(20) { FactoryGirl.generate(:diaspora_id) }.join(";")] } + let(:wrong_values) { [Array.new(21) { Fabricate.sequence(:diaspora_id) }.join(";")] } + let(:correct_values) { [Array.new(20) { Fabricate.sequence(:diaspora_id) }.join(";")] } end end end diff --git a/spec/lib/diaspora_federation/validators/poll_validator_spec.rb b/spec/lib/diaspora_federation/validators/poll_validator_spec.rb index a0ae57f..2b26b55 100644 --- a/spec/lib/diaspora_federation/validators/poll_validator_spec.rb +++ b/spec/lib/diaspora_federation/validators/poll_validator_spec.rb @@ -21,11 +21,11 @@ module DiasporaFederation describe "#poll_answers" do it_behaves_like "a property with a value validation/restriction" do let(:property) { :poll_answers } - let(:wrong_values) { [nil, [FactoryGirl.attributes_for(:poll_answer_entity)]] } + let(:wrong_values) { [nil, [Fabricate.attributes_for(:poll_answer_entity)]] } let(:correct_values) { [ - Array.new(2) { FactoryGirl.build(:poll_answer_entity) }, - Array.new(5) { FactoryGirl.build(:poll_answer_entity) } + Array.new(2) { Fabricate(:poll_answer_entity) }, + Array.new(5) { Fabricate(:poll_answer_entity) } ] } end diff --git a/spec/lib/diaspora_federation/validators/relayable_retraction_validator_spec.rb b/spec/lib/diaspora_federation/validators/relayable_retraction_validator_spec.rb index 3f3e300..6d1495c 100644 --- a/spec/lib/diaspora_federation/validators/relayable_retraction_validator_spec.rb +++ b/spec/lib/diaspora_federation/validators/relayable_retraction_validator_spec.rb @@ -22,7 +22,7 @@ module DiasporaFederation it_behaves_like "a property with a value validation/restriction" do let(:property) { :target } let(:wrong_values) { [nil] } - let(:correct_values) { [FactoryGirl.build(:related_entity)] } + let(:correct_values) { [Fabricate(:related_entity)] } end end end diff --git a/spec/lib/diaspora_federation/validators/retraction_validator_spec.rb b/spec/lib/diaspora_federation/validators/retraction_validator_spec.rb index 8b92a35..a0bb5c8 100644 --- a/spec/lib/diaspora_federation/validators/retraction_validator_spec.rb +++ b/spec/lib/diaspora_federation/validators/retraction_validator_spec.rb @@ -22,7 +22,7 @@ module DiasporaFederation it_behaves_like "a property with a value validation/restriction" do let(:property) { :target } let(:wrong_values) { [nil] } - let(:correct_values) { [FactoryGirl.build(:related_entity)] } + let(:correct_values) { [Fabricate(:related_entity)] } end end end diff --git a/spec/lib/diaspora_federation/validators/rules/diaspora_id_count_spec.rb b/spec/lib/diaspora_federation/validators/rules/diaspora_id_count_spec.rb index d1180b0..5d927b4 100644 --- a/spec/lib/diaspora_federation/validators/rules/diaspora_id_count_spec.rb +++ b/spec/lib/diaspora_federation/validators/rules/diaspora_id_count_spec.rb @@ -1,5 +1,5 @@ describe Validation::Rule::DiasporaIdCount do - let(:id_str) { Array.new(3) { FactoryGirl.generate(:diaspora_id) }.join(";") } + let(:id_str) { Array.new(3) { Fabricate.sequence(:diaspora_id) }.join(";") } it "requires a parameter" do validator = Validation::Validator.new({}) diff --git a/spec/lib/diaspora_federation/validators/signed_retraction_validator_spec.rb b/spec/lib/diaspora_federation/validators/signed_retraction_validator_spec.rb index f304c67..27e9fcf 100644 --- a/spec/lib/diaspora_federation/validators/signed_retraction_validator_spec.rb +++ b/spec/lib/diaspora_federation/validators/signed_retraction_validator_spec.rb @@ -22,7 +22,7 @@ module DiasporaFederation it_behaves_like "a property with a value validation/restriction" do let(:property) { :target } let(:wrong_values) { [nil] } - let(:correct_values) { [FactoryGirl.build(:related_entity)] } + let(:correct_values) { [Fabricate(:related_entity)] } end end end diff --git a/spec/lib/diaspora_federation/validators/status_message_validator_spec.rb b/spec/lib/diaspora_federation/validators/status_message_validator_spec.rb index 368386c..2fb5873 100644 --- a/spec/lib/diaspora_federation/validators/status_message_validator_spec.rb +++ b/spec/lib/diaspora_federation/validators/status_message_validator_spec.rb @@ -17,7 +17,7 @@ module DiasporaFederation it_behaves_like "a property with a value validation/restriction" do let(:property) { :photos } let(:wrong_values) { [nil] } - let(:correct_values) { [[], [FactoryGirl.build(:photo_entity)]] } + let(:correct_values) { [[], [Fabricate(:photo_entity)]] } end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c5f7454..94531e9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -19,7 +19,7 @@ require "rspec/rails" require "webmock/rspec" require "rspec/json_expectations" -# load factory girl factories +# load factories require "factories" # load test entities @@ -74,7 +74,6 @@ RSpec.configure do |config| expect_config.syntax = :expect end - config.include FactoryGirl::Syntax::Methods config.use_transactional_fixtures = true # load fixtures diff --git a/spec/support/fixture_builder.rb b/spec/support/fixture_builder.rb index 9f729ac..095e65b 100644 --- a/spec/support/fixture_builder.rb +++ b/spec/support/fixture_builder.rb @@ -11,7 +11,7 @@ FixtureBuilder.configure do |fbuilder| # now declare objects fbuilder.factory do - FactoryGirl.create(:user, diaspora_id: "alice@localhost:3000") - FactoryGirl.create(:user, diaspora_id: "bob@localhost:3000") + Fabricate(:user, diaspora_id: "alice@localhost:3000") + Fabricate(:user, diaspora_id: "bob@localhost:3000") end end diff --git a/spec/support/shared_entity_specs.rb b/spec/support/shared_entity_specs.rb index b869fc0..43800ff 100644 --- a/spec/support/shared_entity_specs.rb +++ b/spec/support/shared_entity_specs.rb @@ -121,7 +121,7 @@ end shared_examples "a retraction" do context "receive with no target found" do - let(:unknown_guid) { FactoryGirl.generate(:guid) } + let(:unknown_guid) { Fabricate.sequence(:guid) } let(:instance) { described_class.new(data.merge(target_guid: unknown_guid)) } it "raises when no target is found" do diff --git a/spec/support/shared_validator_specs.rb b/spec/support/shared_validator_specs.rb index f8b2e95..1a09655 100644 --- a/spec/support/shared_validator_specs.rb +++ b/spec/support/shared_validator_specs.rb @@ -1,6 +1,6 @@ def entity_stub(entity, data={}) - OpenStruct.new(FactoryGirl.factory_by_name(entity).build_class.default_values - .merge(FactoryGirl.attributes_for(entity)).merge(data)) + OpenStruct.new(Fabricate.schematic(entity).options[:class_name].default_values + .merge(Fabricate.attributes_for(entity)).merge(data)) end ALPHANUMERIC_RANGE = [*"0".."9", *"A".."Z", *"a".."z"].freeze @@ -39,7 +39,7 @@ shared_examples "a relayable validator" do it_behaves_like "a property with a value validation/restriction" do let(:property) { :parent } let(:wrong_values) { [nil] } - let(:correct_values) { [FactoryGirl.build(:related_entity)] } + let(:correct_values) { [Fabricate(:related_entity)] } end end end diff --git a/test/dummy/config/initializers/diaspora_federation.rb b/test/dummy/config/initializers/diaspora_federation.rb index c42cfc6..1442aab 100644 --- a/test/dummy/config/initializers/diaspora_federation.rb +++ b/test/dummy/config/initializers/diaspora_federation.rb @@ -94,7 +94,7 @@ DiasporaFederation.configure do |config| on :fetch_public_entity do |entity_type, guid| type = DiasporaFederation::Entities.const_get(entity_type).entity_name - FactoryGirl.build("#{type}_entity", guid: guid) + Fabricate("#{type}_entity", guid: guid) end on :fetch_person_url_to do |diaspora_id, path|