Merge remote-tracking branch 'upstream/pull/4232'

This commit is contained in:
Tom Hughes 2023-09-06 10:43:43 +01:00
commit 368465287d
15 changed files with 24 additions and 19 deletions

View file

@ -17,6 +17,11 @@ AllCops:
Rails:
Enabled: true
# Config can be removed after https://github.com/rubocop/rubocop-factory_bot/issues/53
FactoryBot/AssociationStyle:
Include:
- 'test/factories/**/*'
Layout/ExtraSpacing:
AllowForAlignment: true

View file

@ -5,6 +5,6 @@ FactoryBot.define do
changeset
association :author, :factory => :user
author :factory => :user
end
end

View file

@ -1,6 +1,6 @@
FactoryBot.define do
factory :friendship do
association :befriender, :factory => :user
association :befriendee, :factory => :user
befriender :factory => :user
befriendee :factory => :user
end
end

View file

@ -1,8 +1,8 @@
FactoryBot.define do
factory :issue do
# Default to reporting users
association :reportable, :factory => :user
association :reported_user, :factory => :user
reportable :factory => :user
reported_user :factory => :user
# Default to assigning to an administrator
assigned_role { "administrator" }

View file

@ -4,8 +4,8 @@ FactoryBot.define do
sequence(:body) { |n| "Body text for message #{n}" }
sent_on { Time.now.utc }
association :sender, :factory => :user
association :recipient, :factory => :user
sender :factory => :user
recipient :factory => :user
trait :unread do
message_read { false }

View file

@ -1,7 +1,7 @@
FactoryBot.define do
factory :oauth_access_grant, :class => "Doorkeeper::AccessGrant" do
association :resource_owner_id, :factory => :user
association :application, :factory => :oauth_application
resource_owner_id :factory => :user
application :factory => :oauth_application
expires_in { 86400 }
redirect_uri { application.redirect_uri }

View file

@ -1,5 +1,5 @@
FactoryBot.define do
factory :oauth_access_token, :class => "Doorkeeper::AccessToken" do
association :application, :factory => :oauth_application
application :factory => :oauth_application
end
end

View file

@ -3,6 +3,6 @@ FactoryBot.define do
sequence(:name) { |n| "OAuth application #{n}" }
sequence(:redirect_uri) { |n| "https://example.com/app/#{n}" }
association :owner, :factory => :user
owner :factory => :user
end
end

View file

@ -4,7 +4,7 @@ FactoryBot.define do
longitude { 1 * GeoRecord::SCALE }
changeset
association :current_node, :factory => :node
current_node :factory => :node
visible { true }
timestamp { Time.now.utc }

View file

@ -5,6 +5,6 @@ FactoryBot.define do
version { 1 }
changeset
association :current_relation, :factory => :relation
current_relation :factory => :relation
end
end

View file

@ -4,6 +4,6 @@ FactoryBot.define do
old_relation
# Default to creating nodes, but could be ways or relations as members
association :member, :factory => :node
member :factory => :node
end
end

View file

@ -5,6 +5,6 @@ FactoryBot.define do
version { 1 }
changeset
association :current_way, :factory => :way
current_way :factory => :way
end
end

View file

@ -4,6 +4,6 @@ FactoryBot.define do
relation
# Default to creating nodes, but could be ways or relations as members
association :member, :factory => :node
member :factory => :node
end
end

View file

@ -4,7 +4,7 @@ FactoryBot.define do
ends_at { Time.now.utc + 1.day }
user
association :creator, :factory => :moderator_user
creator :factory => :moderator_user
trait :needs_view do
needs_view { true }
@ -15,7 +15,7 @@ FactoryBot.define do
end
trait :revoked do
association :revoker, :factory => :moderator_user
revoker :factory => :moderator_user
end
end
end

View file

@ -1,6 +1,6 @@
FactoryBot.define do
factory :user_role do
user
association :granter, :factory => :user
granter :factory => :user
end
end