mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-26 10:45:04 -04:00
Auto corrected by following Ruby FactoryBot/AttributeDefinedStatically
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 '<a href="http://evil.com">EVIL</a>'
|
||||
body { '<a href="http://evil.com">EVIL</a>' }
|
||||
end
|
||||
|
||||
factory :forum_post do
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user