From 812fe90ecaef58f1dbe16c3fdfea79e14e7bbc9d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 20 May 2017 17:09:40 +0200 Subject: [PATCH] Ensure unique identifiers in fabricated objects in tests (#3173) --- spec/fabricators/account_domain_block_fabricator.rb | 4 ++-- spec/fabricators/account_fabricator.rb | 2 +- spec/fabricators/preview_card_fabricator.rb | 5 ++--- spec/fabricators/tag_fabricator.rb | 2 +- spec/fabricators/user_fabricator.rb | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/fabricators/account_domain_block_fabricator.rb b/spec/fabricators/account_domain_block_fabricator.rb index fbbddadd5d2..2ad4b67a99b 100644 --- a/spec/fabricators/account_domain_block_fabricator.rb +++ b/spec/fabricators/account_domain_block_fabricator.rb @@ -1,4 +1,4 @@ Fabricator(:account_domain_block) do - account_id 1 - domain "MyString" + account + domain 'example.com' end diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb index 68a75807957..446f8ea2793 100644 --- a/spec/fabricators/account_fabricator.rb +++ b/spec/fabricators/account_fabricator.rb @@ -1,4 +1,4 @@ Fabricator(:account) do - username { Faker::Internet.user_name(nil, %w(_)) } + username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } } last_webfingered_at { Time.now.utc } end diff --git a/spec/fabricators/preview_card_fabricator.rb b/spec/fabricators/preview_card_fabricator.rb index 448a94e7ed8..15b33815c6d 100644 --- a/spec/fabricators/preview_card_fabricator.rb +++ b/spec/fabricators/preview_card_fabricator.rb @@ -1,5 +1,4 @@ Fabricator(:preview_card) do - status_id 1 - url "MyString" - html "MyText" + status + url 'http://example.com' end diff --git a/spec/fabricators/tag_fabricator.rb b/spec/fabricators/tag_fabricator.rb index d8304099097..33d57c9281f 100644 --- a/spec/fabricators/tag_fabricator.rb +++ b/spec/fabricators/tag_fabricator.rb @@ -1,3 +1,3 @@ Fabricator(:tag) do - name "MyString" + name { sequence(:hashtag) { |i| "#{Faker::Lorem.word}#{i}" } } end diff --git a/spec/fabricators/user_fabricator.rb b/spec/fabricators/user_fabricator.rb index 16b3b1f6f65..cf51fe81d0e 100644 --- a/spec/fabricators/user_fabricator.rb +++ b/spec/fabricators/user_fabricator.rb @@ -1,6 +1,6 @@ Fabricator(:user) do account - email { Faker::Internet.email } + email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } } password "123456789" confirmed_at { Time.now } end