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
changeset
- association :author, :factory => :user
+ author :factory => :user
end
end
FactoryBot.define do
factory :friendship do
- association :befriender, :factory => :user
- association :befriendee, :factory => :user
+ befriender :factory => :user
+ befriendee :factory => :user
end
end
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" }
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 }
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 }
FactoryBot.define do
factory :oauth_access_token, :class => "Doorkeeper::AccessToken" do
- association :application, :factory => :oauth_application
+ application :factory => :oauth_application
end
end
sequence(:name) { |n| "OAuth application #{n}" }
sequence(:redirect_uri) { |n| "https://example.com/app/#{n}" }
- association :owner, :factory => :user
+ owner :factory => :user
end
end
longitude { 1 * GeoRecord::SCALE }
changeset
- association :current_node, :factory => :node
+ current_node :factory => :node
visible { true }
timestamp { Time.now.utc }
version { 1 }
changeset
- association :current_relation, :factory => :relation
+ current_relation :factory => :relation
end
end
old_relation
# Default to creating nodes, but could be ways or relations as members
- association :member, :factory => :node
+ member :factory => :node
end
end
version { 1 }
changeset
- association :current_way, :factory => :way
+ current_way :factory => :way
end
end
relation
# Default to creating nodes, but could be ways or relations as members
- association :member, :factory => :node
+ member :factory => :node
end
end
ends_at { Time.now.utc + 1.day }
user
- association :creator, :factory => :moderator_user
+ creator :factory => :moderator_user
trait :needs_view do
needs_view { true }
end
trait :revoked do
- association :revoker, :factory => :moderator_user
+ revoker :factory => :moderator_user
end
end
end
FactoryBot.define do
factory :user_role do
user
- association :granter, :factory => :user
+ granter :factory => :user
end
end