From 31744491ea46d1ca57a3dccd27c532101bf2464a Mon Sep 17 00:00:00 2001 From: Awesome Code Date: Sun, 9 Sep 2018 21:53:57 +0000 Subject: [PATCH] Auto corrected by following Ruby FactoryBot/AttributeDefinedStatically --- spec/factories/alternate_names.rb | 4 +-- spec/factories/authentications.rb | 12 +++---- spec/factories/crop.rb | 52 ++++++++++++++--------------- spec/factories/forums.rb | 4 +-- spec/factories/garden.rb | 16 ++++----- spec/factories/harvests.rb | 16 ++++----- spec/factories/member.rb | 54 +++++++++++++++---------------- spec/factories/notifications.rb | 6 ++-- spec/factories/photos.rb | 10 +++--- spec/factories/planting.rb | 22 ++++++------- spec/factories/post.rb | 8 ++--- spec/factories/roles.rb | 10 +++--- spec/factories/scientific_name.rb | 6 ++-- spec/factories/seeds.rb | 30 ++++++++--------- 14 files changed, 125 insertions(+), 125 deletions(-) diff --git a/spec/factories/alternate_names.rb b/spec/factories/alternate_names.rb index 32c609cc3..44cee8a21 100644 --- a/spec/factories/alternate_names.rb +++ b/spec/factories/alternate_names.rb @@ -2,13 +2,13 @@ FactoryBot.define do factory :alternate_name do - name "alternate name" + name { "alternate name" } crop creator factory :alternate_eggplant do association :crop, factory: :eggplant - name "aubergine" + name { "aubergine" } end end end diff --git a/spec/factories/authentications.rb b/spec/factories/authentications.rb index 0f385f680..97a34f6c4 100644 --- a/spec/factories/authentications.rb +++ b/spec/factories/authentications.rb @@ -3,14 +3,14 @@ FactoryBot.define do factory :authentication do member - provider 'twitter' - uid 'foo' - secret 'bar' - name 'baz' + provider { 'twitter' } + uid { 'foo' } + secret { 'bar' } + name { 'baz' } factory :flickr_authentication do - provider 'flickr' - uid 'blah@blah' + provider { 'flickr' } + uid { 'blah@blah' } end end end diff --git a/spec/factories/crop.rb b/spec/factories/crop.rb index 2a8c6b656..b1c23a95b 100644 --- a/spec/factories/crop.rb +++ b/spec/factories/crop.rb @@ -1,83 +1,83 @@ FactoryBot.define do factory :crop do - name "magic bean" - en_wikipedia_url "http://en.wikipedia.org/wiki/Magic_bean" - approval_status "approved" + name { "magic bean" } + en_wikipedia_url { "http://en.wikipedia.org/wiki/Magic_bean" } + approval_status { "approved" } creator factory :annual_crop, parent: :crop do - perennial false + perennial { false } end factory :perennial_crop, parent: :crop do - perennial true + perennial { true } end factory :tomato do - name "tomato" - en_wikipedia_url "http://en.wikipedia.org/wiki/Tomato" + name { "tomato" } + en_wikipedia_url { "http://en.wikipedia.org/wiki/Tomato" } end factory :maize do - name "maize" - en_wikipedia_url "http://en.wikipedia.org/wiki/Maize" + name { "maize" } + en_wikipedia_url { "http://en.wikipedia.org/wiki/Maize" } end factory :chard do - name "chard" + name { "chard" } end factory :walnut do - name "walnut" + name { "walnut" } end factory :apple do - name "apple" + name { "apple" } end factory :pear do - name "pear" + name { "pear" } end # for testing varieties factory :roma do - name "roma tomato" + name { "roma tomato" } end factory :popcorn do - name "popcorn" + name { "popcorn" } end factory :eggplant do - name "eggplant" + name { "eggplant" } end # This should have a name that is alphabetically earlier than :uppercase # crop to ensure that the ordering tests work. factory :lowercasecrop do - name "ffrench bean" + name { "ffrench bean" } end factory :uppercasecrop do - name "Swiss chard" + name { "Swiss chard" } end factory :autoloaded_crop do - creator "cropbot" + creator { "cropbot" } end # for testing crop request factory :crop_request do - name "Ultra berry" - en_wikipedia_url "" - approval_status "pending" + name { "Ultra berry" } + en_wikipedia_url { "" } + approval_status { "pending" } association :requester, factory: :member - request_notes "Please approve this even though it's fake." + request_notes { "Please approve this even though it's fake." } end factory :rejected_crop do - name "Fail bean" - approval_status "rejected" - reason_for_rejection "Totally fake" + name { "Fail bean" } + approval_status { "rejected" } + reason_for_rejection { "Totally fake" } end end end diff --git a/spec/factories/forums.rb b/spec/factories/forums.rb index 5636981fb..ba1e6cf82 100644 --- a/spec/factories/forums.rb +++ b/spec/factories/forums.rb @@ -2,8 +2,8 @@ FactoryBot.define do factory :forum do - name "Permaculture" - description "*Everything* about permaculture!" + name { "Permaculture" } + description { "*Everything* about permaculture!" } owner end end diff --git a/spec/factories/garden.rb b/spec/factories/garden.rb index f93107361..d11dcd0d7 100644 --- a/spec/factories/garden.rb +++ b/spec/factories/garden.rb @@ -1,24 +1,24 @@ FactoryBot.define do factory :garden do name { Faker::Vehicle.vin } - description "This is a **totally** cool garden" + description { "This is a **totally** cool garden" } owner - active true - area 23 - area_unit "acre" - location "Greenwich, UK" + active { true } + area { 23 } + area_unit { "acre" } + location { "Greenwich, UK" } factory :inactive_garden do - active false + active { false } end # the following are used for testing alphabetical ordering factory :garden_a do - name 'A garden starting with A' + name { 'A garden starting with A' } end factory :garden_z do - name 'Zzzz this garden makes me sleepy' + name { 'Zzzz this garden makes me sleepy' } end end end diff --git a/spec/factories/harvests.rb b/spec/factories/harvests.rb index 7ed88375a..426c3d24c 100644 --- a/spec/factories/harvests.rb +++ b/spec/factories/harvests.rb @@ -4,14 +4,14 @@ FactoryBot.define do factory :harvest do crop { planting.present? ? planting.crop : FactoryBot.create(:crop) } plant_part { FactoryBot.create :plant_part } - planting nil + planting { nil } owner { planting.present? ? planting.owner : FactoryBot.create(:member) } harvested_at { Time.zone.local(2015, 9, 17) } - quantity "3" - unit "individual" - weight_quantity 6 - weight_unit "kg" - description "A lovely harvest" + quantity { "3" } + unit { "individual" } + weight_quantity { 6 } + weight_unit { "kg" } + description { "A lovely harvest" } factory :harvest_with_planting do planting @@ -19,10 +19,10 @@ FactoryBot.define do end trait :long_description do - description "This is a very long description that is so very long that it will need to be cut off" + description { "This is a very long description that is so very long that it will need to be cut off" } end trait :no_description do - description "" + description { "" } end end diff --git a/spec/factories/member.rb b/spec/factories/member.rb index 70aaaaab8..295d1a408 100644 --- a/spec/factories/member.rb +++ b/spec/factories/member.rb @@ -4,57 +4,57 @@ FactoryBot.define do factory :member, aliases: %i(author owner sender recipient creator) do login_name { generate(:login_name) } - password 'password1' + password { 'password1' } email { generate(:email) } - tos_agreement true + tos_agreement { true } confirmed_at { Time.now } - show_email false - bio 'I love seeds' + show_email { false } + bio { 'I love seeds' } # cropbot is needed for certain tests, eg. Crop.create_from_csv factory :cropbot do - login_name 'cropbot' + login_name { 'cropbot' } end factory :no_tos_member do - tos_agreement false + tos_agreement { false } end factory :newsletter_recipient_member do - newsletter true + newsletter { true } end factory :no_bio_member do - bio nil + bio { nil } end factory :unconfirmed_member do - confirmed_at nil + confirmed_at { nil } end # this member has very loose privacy settings factory :public_member do - login_name 'NothingToHide' - show_email true + login_name { 'NothingToHide' } + show_email { true } end factory :london_member do sequence(:login_name) { |n| "JohnH#{n}" } # for the astronomer who figured out longitude - location 'Greenwich, UK' + location { 'Greenwich, UK' } # including lat/long explicitly because geocoder doesn't work with FG - latitude 51.483 - longitude 0.004 + latitude { 51.483 } + longitude { 0.004 } end factory :edinburgh_member do - location 'Edinburgh' - latitude 55.953252 - longitude -3.188267 + location { 'Edinburgh' } + latitude { 55.953252 } + longitude { -3.188267 } end factory :south_pole_member do sequence(:login_name) { |n| "ScottRF#{n}" } - location 'Amundsen-Scott Base, Antarctica' + location { 'Amundsen-Scott Base, Antarctica' } latitude { -90 } longitude { 0 } end @@ -69,39 +69,39 @@ FactoryBot.define do end factory :invalid_member_shortname do - login_name 'a' + login_name { 'a' } end factory :invalid_member_longname do - login_name 'MarmadukeBlundellHollinsheadBlundellTolemachePlantagenetWhistlebinkie3rdDukeofMarmoset' + login_name { 'MarmadukeBlundellHollinsheadBlundellTolemachePlantagenetWhistlebinkie3rdDukeofMarmoset' } end factory :invalid_member_spaces do - login_name "a b" + login_name { "a b" } end factory :invalid_member_badchars do - login_name 'aa%$' + login_name { 'aa%$' } end factory :invalid_member_badname do - login_name 'admin' + login_name { 'admin' } end factory :valid_member_alphanumeric do - login_name 'abc123' + login_name { 'abc123' } end factory :valid_member_uppercase do - login_name 'ABC123' + login_name { 'ABC123' } end factory :valid_member_underscore do - login_name 'abc_123' + login_name { 'abc_123' } end factory :no_email_notifications_member do - send_notification_email false + send_notification_email { false } end end end diff --git a/spec/factories/notifications.rb b/spec/factories/notifications.rb index b893fcc1b..7903035d2 100644 --- a/spec/factories/notifications.rb +++ b/spec/factories/notifications.rb @@ -4,9 +4,9 @@ FactoryBot.define do factory :notification, aliases: [:message] do sender recipient - subject "MyString" - body "MyText" - read false + subject { "MyString" } + body { "MyText" } + read { false } post factory :no_email_notification do diff --git a/spec/factories/photos.rb b/spec/factories/photos.rb index 455d721c7..5d3ef467c 100644 --- a/spec/factories/photos.rb +++ b/spec/factories/photos.rb @@ -3,17 +3,17 @@ FactoryBot.define do factory :photo do owner - flickr_photo_id 1 + flickr_photo_id { 1 } title { Faker::HarryPotter.quote } - license_name "CC-BY" - license_url "http://example.com/license.html" + license_name { "CC-BY" } + license_url { "http://example.com/license.html" } thumbnail_url { "http://example.com/#{Faker::File.file_name}.jpg" } fullsize_url { "http://example.com/#{Faker::File.file_name}.jpg" } link_url { Faker::Internet.url } factory :unlicensed_photo do - license_name "All rights reserved" - license_url "" + license_name { "All rights reserved" } + license_url { "" } end end end diff --git a/spec/factories/planting.rb b/spec/factories/planting.rb index 27a2b179d..24c092f82 100644 --- a/spec/factories/planting.rb +++ b/spec/factories/planting.rb @@ -4,37 +4,37 @@ FactoryBot.define do garden { FactoryBot.create :garden, owner: owner } crop planted_at { Time.zone.local(2014, 7, 30) } - quantity 33 - description "This is a *really* good plant." - finished false - finished_at nil + quantity { 33 } + description { "This is a *really* good plant." } + finished { false } + finished_at { nil } factory :seed_planting do - planted_from 'seed' + planted_from { 'seed' } end factory :seedling_planting do - planted_from 'seedling' + planted_from { 'seedling' } end factory :cutting_planting do - planted_from 'cutting' + planted_from { 'cutting' } end factory :sunny_planting do - sunniness 'sun' + sunniness { 'sun' } end factory :semi_shady_planting do - sunniness 'semi-shade' + sunniness { 'semi-shade' } end factory :shady_planting do - sunniness 'shade' + sunniness { 'shade' } end factory :finished_planting do - finished true + finished { true } planted_at { Time.zone.local(2014, 7, 30) } finished_at { Time.zone.local(2014, 8, 30) } end diff --git a/spec/factories/post.rb b/spec/factories/post.rb index da6390ef8..6a955b95a 100644 --- a/spec/factories/post.rb +++ b/spec/factories/post.rb @@ -1,18 +1,18 @@ FactoryBot.define do factory :post do - subject "A Post" - body "This is some text." + subject { "A Post" } + body { "This is some text." } author created_at { Time.now } # Markdown is allowed in posts factory :markdown_post do - body "This is some **strong** text." + body { "This is some **strong** text." } end # HTML isn't allowed in posts factory :html_post do - body 'EVIL' + body { 'EVIL' } end factory :forum_post do diff --git a/spec/factories/roles.rb b/spec/factories/roles.rb index fed5e5e00..3e33d9720 100644 --- a/spec/factories/roles.rb +++ b/spec/factories/roles.rb @@ -2,17 +2,17 @@ FactoryBot.define do factory :role do - name "Moderator" - description "These people moderate the forums" + name { "Moderator" } + description { "These people moderate the forums" } initialize_with { Role.find_or_create_by(name: name) } factory :admin do - name "admin" + name { "admin" } end factory :crop_wrangler do - name "Crop Wrangler" - description "they wrangle crops" + name { "Crop Wrangler" } + description { "they wrangle crops" } end end end diff --git a/spec/factories/scientific_name.rb b/spec/factories/scientific_name.rb index aa0911504..7e0e04462 100644 --- a/spec/factories/scientific_name.rb +++ b/spec/factories/scientific_name.rb @@ -1,17 +1,17 @@ FactoryBot.define do factory :scientific_name do association :crop, factory: :crop - name "Beanus Magicus" + name { "Beanus Magicus" } creator factory :zea_mays do association :crop, factory: :maize - name "Zea mays" + name { "Zea mays" } end factory :solanum_lycopersicum do association :crop, factory: :tomato - name "Solanum lycopersicum" + name { "Solanum lycopersicum" } end end end diff --git a/spec/factories/seeds.rb b/spec/factories/seeds.rb index b58193671..2f5238591 100644 --- a/spec/factories/seeds.rb +++ b/spec/factories/seeds.rb @@ -4,30 +4,30 @@ FactoryBot.define do factory :seed do owner crop - description "MyText" - quantity 1 - plant_before "2013-07-15" - tradable_to 'nowhere' - organic 'unknown' - gmo 'unknown' - heirloom 'unknown' - days_until_maturity_min nil - days_until_maturity_max nil - finished_at nil + description { "MyText" } + quantity { 1 } + plant_before { "2013-07-15" } + tradable_to { 'nowhere' } + organic { 'unknown' } + gmo { 'unknown' } + heirloom { 'unknown' } + days_until_maturity_min { nil } + days_until_maturity_max { nil } + finished_at { nil } factory :finished_seed do - finished true + finished { true } finished_at { Date.new } end factory :tradable_seed do - tradable_to "locally" - finished false - finished_at nil + tradable_to { "locally" } + finished { false } + finished_at { nil } end factory :untradable_seed do - tradable_to "nowhere" + tradable_to { "nowhere" } end end end