Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/pull/4232'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Sep 6, 2023
2 parents 8aba3c4 + cb4f99f commit 3684652
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/factories/changeset_comments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

changeset

association :author, :factory => :user
author :factory => :user
end
end
4 changes: 2 additions & 2 deletions test/factories/friendships.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions test/factories/issues.rb
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down
4 changes: 2 additions & 2 deletions test/factories/messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
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 }
Expand Down
4 changes: 2 additions & 2 deletions test/factories/oauth_access_grant.rb
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
2 changes: 1 addition & 1 deletion test/factories/oauth_access_token.rb
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/factories/oauth_applications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
sequence(:name) { |n| "OAuth application #{n}" }
sequence(:redirect_uri) { |n| "https://example.com/app/#{n}" }

association :owner, :factory => :user
owner :factory => :user
end
end
2 changes: 1 addition & 1 deletion test/factories/old_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
longitude { 1 * GeoRecord::SCALE }

changeset
association :current_node, :factory => :node
current_node :factory => :node

visible { true }
timestamp { Time.now.utc }
Expand Down
2 changes: 1 addition & 1 deletion test/factories/old_relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
version { 1 }

changeset
association :current_relation, :factory => :relation
current_relation :factory => :relation
end
end
2 changes: 1 addition & 1 deletion test/factories/old_relation_member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

old_relation
# Default to creating nodes, but could be ways or relations as members
association :member, :factory => :node
member :factory => :node
end
end
2 changes: 1 addition & 1 deletion test/factories/old_way.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
version { 1 }

changeset
association :current_way, :factory => :way
current_way :factory => :way
end
end
2 changes: 1 addition & 1 deletion test/factories/relation_member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

relation
# Default to creating nodes, but could be ways or relations as members
association :member, :factory => :node
member :factory => :node
end
end
4 changes: 2 additions & 2 deletions test/factories/user_blocks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ends_at { Time.now.utc + 1.day }

user
association :creator, :factory => :moderator_user
creator :factory => :moderator_user

trait :needs_view do
needs_view { true }
Expand All @@ -15,7 +15,7 @@
end

trait :revoked do
association :revoker, :factory => :moderator_user
revoker :factory => :moderator_user
end
end
end
2 changes: 1 addition & 1 deletion test/factories/user_role.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FactoryBot.define do
factory :user_role do
user
association :granter, :factory => :user
granter :factory => :user
end
end

0 comments on commit 3684652

Please sign in to comment.