mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-19 07:57:00 +00:00
Ensure unique values in fabricators (#29515)
This commit is contained in:
parent
6f8ec6d7f8
commit
98ef38e34e
|
@ -6,9 +6,9 @@ Fabrication.manager.load_definitions if Fabrication.manager.empty?
|
||||||
|
|
||||||
Fabrication.manager.schematics.map(&:first).each do |factory_name|
|
Fabrication.manager.schematics.map(&:first).each do |factory_name|
|
||||||
describe "The #{factory_name} factory" do
|
describe "The #{factory_name} factory" do
|
||||||
it 'is valid' do
|
it 'is able to create valid records' do
|
||||||
factory = Fabricate(factory_name)
|
records = Fabricate.times(2, factory_name) # Create multiple of each to uncover uniqueness issues
|
||||||
expect(factory).to be_valid
|
expect(records).to all(be_valid)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
Fabricator(:identity) do
|
Fabricator(:identity) do
|
||||||
user { Fabricate.build(:user) }
|
user { Fabricate.build(:user) }
|
||||||
provider 'MyString'
|
provider 'MyString'
|
||||||
uid 'MyString'
|
uid { sequence(:uid) { |i| "uid_string_#{i}" } }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:relay) do
|
Fabricator(:relay) do
|
||||||
inbox_url 'https://example.com/inbox'
|
inbox_url { sequence(:inbox_url) { |i| "https://example.com/inboxes/#{i}" } }
|
||||||
state :idle
|
state :idle
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
Fabricator(:site_upload) do
|
Fabricator(:site_upload) do
|
||||||
file { Rails.root.join('spec', 'fabricators', 'assets', 'utah_teapot.png').open }
|
file { Rails.root.join('spec', 'fabricators', 'assets', 'utah_teapot.png').open }
|
||||||
var 'thumbnail'
|
var { sequence(:var) { |i| "thumbnail_#{i}" } }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue