From: Tom Hughes Date: Tue, 28 Aug 2018 18:12:01 +0000 (+0100) Subject: Fix FactoryBot deprecation warnings X-Git-Tag: live~3494 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/06915a77b5af2ab0354e895c3c1ceb0e028f37fb?hp=--cc Fix FactoryBot deprecation warnings --- 06915a77b5af2ab0354e895c3c1ceb0e028f37fb diff --git a/test/factories/changeset_comments.rb b/test/factories/changeset_comments.rb index fb3eef895..673a0a9d6 100644 --- a/test/factories/changeset_comments.rb +++ b/test/factories/changeset_comments.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :changeset_comment do sequence(:body) { |n| "Changeset comment #{n}" } - visible true + visible { true } changeset diff --git a/test/factories/changesets.rb b/test/factories/changesets.rb index f42242e78..d4ebdcee1 100644 --- a/test/factories/changesets.rb +++ b/test/factories/changesets.rb @@ -1,13 +1,13 @@ FactoryBot.define do factory :changeset do - created_at Time.now.utc - closed_at Time.now.utc + 1.day + created_at { Time.now.utc } + closed_at { Time.now.utc + 1.day } user trait :closed do - created_at Time.now.utc - 5.hours - closed_at Time.now.utc - 4.hours + created_at { Time.now.utc - 5.hours } + closed_at { Time.now.utc - 4.hours } end end end diff --git a/test/factories/issues.rb b/test/factories/issues.rb index e209bd25d..c575c3398 100644 --- a/test/factories/issues.rb +++ b/test/factories/issues.rb @@ -5,6 +5,6 @@ FactoryBot.define do association :reported_user, :factory => :user # Default to assigning to an administrator - assigned_role "administrator" + assigned_role { "administrator" } end end diff --git a/test/factories/languages.rb b/test/factories/languages.rb index ddf4588e9..c97904259 100644 --- a/test/factories/languages.rb +++ b/test/factories/languages.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :language do - code "en" - english_name "English" - native_name "English" + code { "en" } + english_name { "English" } + native_name { "English" } end end diff --git a/test/factories/messages.rb b/test/factories/messages.rb index ece10ae72..57a434fa1 100644 --- a/test/factories/messages.rb +++ b/test/factories/messages.rb @@ -2,17 +2,17 @@ FactoryBot.define do factory :message do sequence(:title) { |n| "Message #{n}" } sequence(:body) { |n| "Body text for message #{n}" } - sent_on Time.now + sent_on { Time.now } association :sender, :factory => :user association :recipient, :factory => :user trait :unread do - message_read false + message_read { false } end trait :read do - message_read true + message_read { true } end end end diff --git a/test/factories/node.rb b/test/factories/node.rb index d849755cd..ae32926cd 100644 --- a/test/factories/node.rb +++ b/test/factories/node.rb @@ -1,16 +1,16 @@ FactoryBot.define do factory :node do - latitude 1 * GeoRecord::SCALE - longitude 1 * GeoRecord::SCALE + latitude { 1 * GeoRecord::SCALE } + longitude { 1 * GeoRecord::SCALE } changeset - visible true - timestamp Time.now - version 1 + visible { true } + timestamp { Time.now } + version { 1 } trait :deleted do - visible false + visible { false } end trait :with_history do diff --git a/test/factories/note_comments.rb b/test/factories/note_comments.rb index d3fb3ce96..da51c0228 100644 --- a/test/factories/note_comments.rb +++ b/test/factories/note_comments.rb @@ -1,8 +1,8 @@ FactoryBot.define do factory :note_comment do sequence(:body) { |n| "This is note comment #{n}" } - visible true - event "opened" + visible { true } + event { "opened" } note end end diff --git a/test/factories/notes.rb b/test/factories/notes.rb index 56a9541dc..77b4245aa 100644 --- a/test/factories/notes.rb +++ b/test/factories/notes.rb @@ -1,12 +1,12 @@ FactoryBot.define do factory :note do - latitude 1 * GeoRecord::SCALE - longitude 1 * GeoRecord::SCALE - # tile QuadTile.tile_for_point(1,1) + latitude { 1 * GeoRecord::SCALE } + longitude { 1 * GeoRecord::SCALE } + # tile { QuadTile.tile_for_point(1,1) } factory :note_with_comments do transient do - comments_count 1 + comments_count { 1 } end after(:create) do |note, evaluator| diff --git a/test/factories/old_node.rb b/test/factories/old_node.rb index 089363397..e129b62f7 100644 --- a/test/factories/old_node.rb +++ b/test/factories/old_node.rb @@ -1,13 +1,13 @@ FactoryBot.define do factory :old_node do - latitude 1 * GeoRecord::SCALE - longitude 1 * GeoRecord::SCALE + latitude { 1 * GeoRecord::SCALE } + longitude { 1 * GeoRecord::SCALE } changeset association :current_node, :factory => :node - visible true - timestamp Time.now - version 1 + visible { true } + timestamp { Time.now } + version { 1 } end end diff --git a/test/factories/old_relation.rb b/test/factories/old_relation.rb index a6e87a38b..8fdb23f58 100644 --- a/test/factories/old_relation.rb +++ b/test/factories/old_relation.rb @@ -1,8 +1,8 @@ FactoryBot.define do factory :old_relation do - timestamp Time.now - visible true - version 1 + timestamp { Time.now } + visible { true } + version { 1 } changeset association :current_relation, :factory => :relation diff --git a/test/factories/old_relation_member.rb b/test/factories/old_relation_member.rb index 524a71074..17495d7ea 100644 --- a/test/factories/old_relation_member.rb +++ b/test/factories/old_relation_member.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :old_relation_member do - member_role "" + member_role { "" } old_relation # Default to creating nodes, but could be ways or relations as members diff --git a/test/factories/old_way.rb b/test/factories/old_way.rb index a57ccb713..4fc0721d7 100644 --- a/test/factories/old_way.rb +++ b/test/factories/old_way.rb @@ -1,8 +1,8 @@ FactoryBot.define do factory :old_way do - timestamp Time.now - visible true - version 1 + timestamp { Time.now } + visible { true } + version { 1 } changeset association :current_way, :factory => :way diff --git a/test/factories/old_way_node.rb b/test/factories/old_way_node.rb index 0a544aaf7..80bc8316f 100644 --- a/test/factories/old_way_node.rb +++ b/test/factories/old_way_node.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :old_way_node do - sequence_id 1 + sequence_id { 1 } old_way node diff --git a/test/factories/relation.rb b/test/factories/relation.rb index c4c947a4f..8bb00e287 100644 --- a/test/factories/relation.rb +++ b/test/factories/relation.rb @@ -1,13 +1,13 @@ FactoryBot.define do factory :relation do - timestamp Time.now - visible true - version 1 + timestamp { Time.now } + visible { true } + version { 1 } changeset trait :deleted do - visible false + visible { false } end trait :with_history do diff --git a/test/factories/relation_member.rb b/test/factories/relation_member.rb index 4357f3de7..b4498a28d 100644 --- a/test/factories/relation_member.rb +++ b/test/factories/relation_member.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :relation_member do - member_role "" + member_role { "" } relation # Default to creating nodes, but could be ways or relations as members diff --git a/test/factories/reports.rb b/test/factories/reports.rb index 7936d46b2..084c2d1ac 100644 --- a/test/factories/reports.rb +++ b/test/factories/reports.rb @@ -1,7 +1,7 @@ FactoryBot.define do factory :report do sequence(:details) { |n| "Report details #{n}" } - category "other" + category { "other" } issue user end diff --git a/test/factories/tracepoints.rb b/test/factories/tracepoints.rb index ad520ea1f..4ba152f6e 100644 --- a/test/factories/tracepoints.rb +++ b/test/factories/tracepoints.rb @@ -1,10 +1,10 @@ FactoryBot.define do factory :tracepoint do - trackid 1 - latitude 1 * GeoRecord::SCALE - longitude 1 * GeoRecord::SCALE - # tile QuadTile.tile_for_point(1,1) - timestamp Time.now + trackid { 1 } + latitude { 1 * GeoRecord::SCALE } + longitude { 1 * GeoRecord::SCALE } + # tile { QuadTile.tile_for_point(1,1) } + timestamp { Time.now } trace end diff --git a/test/factories/traces.rb b/test/factories/traces.rb index efc1180cd..8663ccf27 100644 --- a/test/factories/traces.rb +++ b/test/factories/traces.rb @@ -5,15 +5,15 @@ FactoryBot.define do user - timestamp Time.now - inserted true + timestamp { Time.now } + inserted { true } trait :deleted do - visible false + visible { false } end transient do - fixture nil + fixture { nil } end after(:create) do |trace, evaluator| diff --git a/test/factories/user.rb b/test/factories/user.rb index d6ee1fa8c..69d5ba376 100644 --- a/test/factories/user.rb +++ b/test/factories/user.rb @@ -2,13 +2,13 @@ FactoryBot.define do factory :user do sequence(:email) { |n| "user#{n}@example.com" } sequence(:display_name) { |n| "User #{n}" } - pass_crypt Digest::MD5.hexdigest("test") + pass_crypt { Digest::MD5.hexdigest("test") } # These attributes are not the defaults, but in most tests we want # a 'normal' user who can log in without being redirected etc. - status "active" - terms_seen true - data_public true + status { "active" } + terms_seen { true } + data_public { true } trait :with_home_location do home_lat { rand(-90.0...90.0) } @@ -16,23 +16,23 @@ FactoryBot.define do end trait :pending do - status "pending" + status { "pending" } end trait :active do - status "active" + status { "active" } end trait :confirmed do - status "confirmed" + status { "confirmed" } end trait :suspended do - status "suspended" + status { "suspended" } end trait :deleted do - status "deleted" + status { "deleted" } end factory :moderator_user do diff --git a/test/factories/user_blocks.rb b/test/factories/user_blocks.rb index d206511b4..53864bb0e 100644 --- a/test/factories/user_blocks.rb +++ b/test/factories/user_blocks.rb @@ -1,17 +1,17 @@ FactoryBot.define do factory :user_block do sequence(:reason) { |n| "User Block #{n}" } - ends_at Time.now + 1.day + ends_at { Time.now + 1.day } user association :creator, :factory => :moderator_user trait :needs_view do - needs_view true + needs_view { true } end trait :expired do - ends_at Time.now - 1.day + ends_at { Time.now - 1.day } end trait :revoked do diff --git a/test/factories/way.rb b/test/factories/way.rb index 68826e919..1b6b18dc9 100644 --- a/test/factories/way.rb +++ b/test/factories/way.rb @@ -1,13 +1,13 @@ FactoryBot.define do factory :way do - timestamp Time.now - visible true - version 1 + timestamp { Time.now } + visible { true } + version { 1 } changeset trait :deleted do - visible false + visible { false } end trait :with_history do @@ -27,7 +27,7 @@ FactoryBot.define do factory :way_with_nodes do transient do - nodes_count 1 + nodes_count { 1 } end after(:create) do |way, evaluator| diff --git a/test/factories/way_node.rb b/test/factories/way_node.rb index 770de02d9..230fe1270 100644 --- a/test/factories/way_node.rb +++ b/test/factories/way_node.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :way_node do - sequence_id 1 + sequence_id { 1 } way node