FactoryBot.define do
factory :changeset_comment do
sequence(:body) { |n| "Changeset comment #{n}" }
- visible true
+ visible { true }
changeset
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
association :reported_user, :factory => :user
# Default to assigning to an administrator
- assigned_role "administrator"
+ assigned_role { "administrator" }
end
end
FactoryBot.define do
factory :language do
- code "en"
- english_name "English"
- native_name "English"
+ code { "en" }
+ english_name { "English" }
+ native_name { "English" }
end
end
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
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
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
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|
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
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
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
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
FactoryBot.define do
factory :old_way_node do
- sequence_id 1
+ sequence_id { 1 }
old_way
node
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
FactoryBot.define do
factory :relation_member do
- member_role ""
+ member_role { "" }
relation
# Default to creating nodes, but could be ways or relations as members
FactoryBot.define do
factory :report do
sequence(:details) { |n| "Report details #{n}" }
- category "other"
+ category { "other" }
issue
user
end
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
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|
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) }
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
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
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
factory :way_with_nodes do
transient do
- nodes_count 1
+ nodes_count { 1 }
end
after(:create) do |way, evaluator|
FactoryBot.define do
factory :way_node do
- sequence_id 1
+ sequence_id { 1 }
way
node