From c4f30736db6109369c750967597daeb3bbab9222 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2020 08:23:04 +0000 Subject: [PATCH 1/8] Bump byebug from 11.0.1 to 11.1.0 Bumps [byebug](https://github.com/deivid-rodriguez/byebug) from 11.0.1 to 11.1.0. - [Release notes](https://github.com/deivid-rodriguez/byebug/releases) - [Changelog](https://github.com/deivid-rodriguez/byebug/blob/master/CHANGELOG.md) - [Commits](https://github.com/deivid-rodriguez/byebug/compare/v11.0.1...v11.1.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 82d139dc2..f3250321e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,7 +89,7 @@ GEM bullet (6.1.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) - byebug (11.0.1) + byebug (11.1.0) cancancan (3.0.1) capybara (3.30.0) addressable From 34ddf8e98f224f999e8eee7fed8ba01f48d2002f Mon Sep 17 00:00:00 2001 From: codefactor-io Date: Mon, 20 Jan 2020 12:50:14 +0000 Subject: [PATCH 2/8] [CodeFactor] Apply fixes --- app/controllers/authentications_controller.rb | 8 +-- app/controllers/conversations_controller.rb | 2 +- app/helpers/application_helper.rb | 4 +- app/mailers/notifier.rb | 2 +- app/models/comment.rb | 8 +-- app/models/crop.rb | 4 +- app/models/csv_importer.rb | 2 +- app/models/follow.rb | 6 +- app/models/garden.rb | 12 ++-- app/models/harvest.rb | 18 ++--- app/models/member.rb | 6 +- app/models/photo.rb | 16 ++--- app/models/planting.rb | 12 ++-- app/models/post.rb | 6 +- app/models/seed.rb | 14 ++-- app/services/openfarm_service.rb | 14 ++-- config/environments/production.rb | 22 +++--- config/environments/test.rb | 32 ++++----- config/initializers/geocoder.rb | 6 +- config/routes.rb | 6 +- db/migrate/20150201052245_create_cms.rb | 4 +- db/migrate/20180213005731_seed_usage.rb | 12 ++-- db/seeds.rb | 34 ++++----- lib/actions/oauth_signup_action.rb | 10 +-- .../api/v1/plantings_controller_spec.rb | 72 +++++++++---------- .../authentications_controller_spec.rb | 6 +- spec/controllers/forums_controller_spec.rb | 4 +- .../photo_associations_controller_spec.rb | 4 +- spec/controllers/photos_controller_spec.rb | 10 +-- spec/controllers/plantings_controller_spec.rb | 2 +- spec/features/crops/crop_detail_page_spec.rb | 4 +- spec/features/gardens/index_spec.rb | 16 ++--- spec/features/percy/percy_spec.rb | 22 +++--- spec/helpers/harvests_helper_spec.rb | 32 ++++----- spec/helpers/plantings_helper_spec.rb | 24 +++---- spec/lib/actions/oauth_signup_action_spec.rb | 28 ++++---- spec/models/ability_spec.rb | 4 +- spec/models/alternate_name_spec.rb | 4 +- spec/models/crop_spec.rb | 22 +++--- spec/models/harvest_spec.rb | 64 ++++++++--------- spec/models/plant_part_spec.rb | 8 +-- spec/models/post_spec.rb | 2 +- spec/requests/api/v1/crop_request_spec.rb | 36 +++++----- spec/requests/api/v1/gardens_request_spec.rb | 18 ++--- spec/requests/api/v1/harvest_request_spec.rb | 32 ++++----- spec/requests/api/v1/member_request_spec.rb | 30 ++++---- spec/requests/api/v1/photos_request_spec.rb | 30 ++++---- .../requests/api/v1/plantings_request_spec.rb | 62 ++++++++-------- spec/requests/api/v1/seeds_request_spec.rb | 28 ++++---- spec/swagger_helper.rb | 6 +- spec/views/admin/roles/edit.html.haml_spec.rb | 2 +- .../views/admin/roles/index.html.haml_spec.rb | 4 +- spec/views/admin/roles/new.html.haml_spec.rb | 2 +- spec/views/crops/_grown_for.html.haml_spec.rb | 2 +- spec/views/forums/edit.html.haml_spec.rb | 4 +- spec/views/harvests/edit.html.haml_spec.rb | 2 +- spec/views/harvests/index.html.haml_spec.rb | 6 +- spec/views/harvests/new.html.haml_spec.rb | 2 +- spec/views/photos/edit.html.haml_spec.rb | 6 +- spec/views/plantings/_form.html.haml_spec.rb | 6 +- spec/views/plantings/edit.html.haml_spec.rb | 2 +- spec/views/plantings/index.html.haml_spec.rb | 22 +++--- spec/views/posts/edit.html.haml_spec.rb | 2 +- 63 files changed, 446 insertions(+), 446 deletions(-) diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb index 31056c6e1..94f40e25f 100644 --- a/app/controllers/authentications_controller.rb +++ b/app/controllers/authentications_controller.rb @@ -14,14 +14,14 @@ class AuthenticationsController < ApplicationController @authentication = current_member.authentications .create_with( - name: name, - token: auth['credentials']['token'], + name: name, + token: auth['credentials']['token'], secret: auth['credentials']['secret'] ) .find_or_create_by( provider: auth['provider'], - uid: auth['uid'], - name: name + uid: auth['uid'], + name: name ) flash[:notice] = "Authentication successful." diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb index 14b51e8ff..2f794aaf2 100644 --- a/app/controllers/conversations_controller.rb +++ b/app/controllers/conversations_controller.rb @@ -56,7 +56,7 @@ class ConversationsController < ApplicationController def set_box @boxes = { 'inbox' => { 'total' => mailbox.inbox.size, 'unread' => current_member.receipts.where(is_read: false).count }, - 'sent' => { 'total' => mailbox.sentbox.size, 'unread' => 0 }, + 'sent' => { 'total' => mailbox.sentbox.size, 'unread' => 0 }, 'trash' => { 'total' => mailbox.trash.size, 'unread' => 0 } } @box = if params[:box].blank? || !@boxes.keys.include?(params[:box]) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 0e3a9d86b..d47919429 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -55,9 +55,9 @@ module ApplicationHelper return uri.to_s end - Gravatar.new(member.email).image_url(size: size, + Gravatar.new(member.email).image_url(size: size, default: :identicon, - ssl: true) + ssl: true) end # Returns a string with the quantity and the right pluralization for a diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index c9727be3a..c2b68d796 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -21,7 +21,7 @@ class Notifier < ApplicationMailer message = { member_id: @notification.recipient.id, type: :send_notification_email } @signed_message = verifier.generate(message) - mail(to: @notification.recipient.email, + mail(to: @notification.recipient.email, subject: @notification.subject) end diff --git a/app/models/comment.rb b/app/models/comment.rb index 7b85f4c0d..4ac02ba34 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -13,10 +13,10 @@ class Comment < ApplicationRecord if recipient != sender Notification.create( recipient_id: recipient, - sender_id: sender, - subject: "#{author} commented on #{post.subject}", - body: body, - post_id: post.id + sender_id: sender, + subject: "#{author} commented on #{post.subject}", + body: body, + post_id: post.id ) end end diff --git a/app/models/crop.rb b/app/models/crop.rb index 0df63cf85..c5de8aa2c 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -50,10 +50,10 @@ class Crop < ApplicationRecord ## Wikipedia urls are only necessary when approving a crop validates :en_wikipedia_url, format: { - with: %r{\Ahttps?:\/\/en\.wikipedia\.org\/wiki\/[[:alnum:]%_\.()-]+\z}, + with: %r{\Ahttps?:\/\/en\.wikipedia\.org\/wiki\/[[:alnum:]%_\.()-]+\z}, message: 'is not a valid English Wikipedia URL' }, - if: :approved? + if: :approved? def to_s name diff --git a/app/models/csv_importer.rb b/app/models/csv_importer.rb index 41ab325ce..7b8dfbecd 100644 --- a/app/models/csv_importer.rb +++ b/app/models/csv_importer.rb @@ -13,7 +13,7 @@ class CsvImporter @crop = Crop.find_or_create_by(name: name) @crop.update( en_wikipedia_url: en_wikipedia_url, - creator_id: cropbot.id + creator_id: cropbot.id ) add_parent(parent_name) if parent_name diff --git a/app/models/follow.rb b/app/models/follow.rb index 1ee678ef2..1c7f56be1 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -8,9 +8,9 @@ class Follow < ApplicationRecord after_create do Notification.create( recipient_id: followed_id, - sender_id: follower_id, - subject: "#{follower.login_name} is now following you", - body: "#{follower.login_name} just followed you on #{ENV['GROWSTUFF_SITE_NAME']}. " + sender_id: follower_id, + subject: "#{follower.login_name} is now following you", + body: "#{follower.login_name} just followed you on #{ENV['GROWSTUFF_SITE_NAME']}. " ) end end diff --git a/app/models/garden.rb b/app/models/garden.rb index 6490bb411..bbf2e7c72 100644 --- a/app/models/garden.rb +++ b/app/models/garden.rb @@ -34,7 +34,7 @@ class Garden < ApplicationRecord validates :area, numericality: { only_integer: false, greater_than_or_equal_to: 0 }, - allow_nil: true + allow_nil: true scope :located, lambda { where.not(gardens: { location: '' }) @@ -43,12 +43,12 @@ class Garden < ApplicationRecord } AREA_UNITS_VALUES = { "square metres" => "square metre", - "square feet" => "square foot", - "hectares" => "hectare", - "acres" => "acre" + "square feet" => "square foot", + "hectares" => "hectare", + "acres" => "acre" }.freeze - validates :area_unit, inclusion: { in: AREA_UNITS_VALUES.values, - message: "%s is not a valid area unit" }, + validates :area_unit, inclusion: { in: AREA_UNITS_VALUES.values, + message: "%s is not a valid area unit" }, allow_blank: true after_validation :cleanup_area diff --git a/app/models/harvest.rb b/app/models/harvest.rb index 338984dd2..399194610 100644 --- a/app/models/harvest.rb +++ b/app/models/harvest.rb @@ -12,15 +12,15 @@ class Harvest < ApplicationRecord # Constants UNITS_VALUES = { "individual" => "individual", - "bunches" => "bunch", - "sprigs" => "sprig", - "handfuls" => "handful", - "litres" => "litre", - "pints" => "pint", - "quarts" => "quart", - "buckets" => "bucket", - "baskets" => "basket", - "bushels" => "bushel" + "bunches" => "bunch", + "sprigs" => "sprig", + "handfuls" => "handful", + "litres" => "litre", + "pints" => "pint", + "quarts" => "quart", + "buckets" => "bucket", + "baskets" => "basket", + "bushels" => "bushel" }.freeze WEIGHT_UNITS_VALUES = { diff --git a/app/models/member.rb b/app/models/member.rb index 5d373000c..feb9c68dc 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -78,13 +78,13 @@ class Member < ApplicationRecord # Requires acceptance of the Terms of Service validates :tos_agreement, acceptance: { allow_nil: true, accept: true } validates :login_name, - length: { + length: { minimum: 2, maximum: 25, message: "should be between 2 and 25 characters long" }, - exclusion: { + exclusion: { in: %w(growstuff admin moderator staff nearby), message: "name is reserved" }, - format: { + format: { with: /\A\w+\z/, message: "may only include letters, numbers, or underscores" }, uniqueness: { diff --git a/app/models/photo.rb b/app/models/photo.rb index 508a93615..e58c11cd3 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -22,8 +22,8 @@ class Photo < ApplicationRecord # creates a relationship for each assignee type PHOTO_CAPABLE.each do |type| has_many type.downcase.pluralize.to_s.to_sym, - through: :photo_associations, - source: :photographable, + through: :photo_associations, + source: :photographable, source_type: type end @@ -42,13 +42,13 @@ class Photo < ApplicationRecord licenses = flickr.photos.licenses.getInfo license = licenses.find { |l| l.id == info.license } { - title: calculate_title(info), - license_name: license.name, - license_url: license.url, + title: calculate_title(info), + license_name: license.name, + license_url: license.url, thumbnail_url: FlickRaw.url_q(info), - fullsize_url: FlickRaw.url_z(info), - link_url: FlickRaw.url_photopage(info), - date_taken: info.dates.taken + fullsize_url: FlickRaw.url_z(info), + link_url: FlickRaw.url_photopage(info), + date_taken: info.dates.taken } end diff --git a/app/models/planting.rb b/app/models/planting.rb index 790adc4fc..c45c89c39 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -25,14 +25,14 @@ class Planting < ApplicationRecord # # Ancestry of food - belongs_to :parent_seed, class_name: 'Seed', # parent + belongs_to :parent_seed, class_name: 'Seed', # parent foreign_key: 'parent_seed_id', - optional: true, - inverse_of: :child_plantings - has_many :child_seeds, class_name: 'Seed', # children + optional: true, + inverse_of: :child_plantings + has_many :child_seeds, class_name: 'Seed', # children foreign_key: 'parent_planting_id', - inverse_of: :parent_planting, - dependent: :nullify + inverse_of: :parent_planting, + dependent: :nullify ## ## Scopes diff --git a/app/models/post.rb b/app/models/post.rb index 0fbdf3533..e5a84c82e 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -91,9 +91,9 @@ class Post < ApplicationRecord Notification.create( recipient_id: recipient_id, - sender_id: sender, - subject: "#{author} mentioned you in their post #{subject}", - body: body + sender_id: sender, + subject: "#{author} mentioned you in their post #{subject}", + body: body ) end end diff --git a/app/models/seed.rb b/app/models/seed.rb index b212d6acb..2e853462f 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -26,23 +26,23 @@ class Seed < ApplicationRecord # Validations validates :crop, approved: true validates :crop, presence: { message: "must be present and exist in our database" } - validates :quantity, allow_nil: true, + validates :quantity, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } - validates :days_until_maturity_min, allow_nil: true, + validates :days_until_maturity_min, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } - validates :days_until_maturity_max, allow_nil: true, + validates :days_until_maturity_max, allow_nil: true, numericality: { only_integer: true, greater_than_or_equal_to: 0 } validates :tradable_to, allow_blank: false, - inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, "\ + inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, "\ "locally, nationally, or internationally" } validates :organic, allow_blank: false, - inclusion: { in: ORGANIC_VALUES, message: "You must say whether the seeds "\ + inclusion: { in: ORGANIC_VALUES, message: "You must say whether the seeds "\ "are organic or not, or that you don't know" } validates :gmo, allow_blank: false, - inclusion: { in: GMO_VALUES, message: "You must say whether the seeds are "\ + inclusion: { in: GMO_VALUES, message: "You must say whether the seeds are "\ "genetically modified or not, or that you don't know" } validates :heirloom, allow_blank: false, - inclusion: { in: HEIRLOOM_VALUES, message: "You must say whether the seeds"\ + inclusion: { in: HEIRLOOM_VALUES, message: "You must say whether the seeds"\ "are heirloom, hybrid, or unknown" } # diff --git a/app/services/openfarm_service.rb b/app/services/openfarm_service.rb index 0b408fe63..b9cd243c6 100644 --- a/app/services/openfarm_service.rb +++ b/app/services/openfarm_service.rb @@ -52,14 +52,14 @@ class OpenfarmService next if Photo.find_by(source_id: picture.fetch('id'), source: 'openfarm') photo = Photo.new( - source_id: picture.fetch('id'), - source: 'openfarm', - owner: @cropbot, + source_id: picture.fetch('id'), + source: 'openfarm', + owner: @cropbot, thumbnail_url: data.fetch('thumbnail_url'), - fullsize_url: data.fetch('image_url'), - title: 'Open Farm photo', - license_name: 'No rights reserved', - link_url: "https://openfarm.cc/en/crops/#{name_to_slug(crop.name)}" + fullsize_url: data.fetch('image_url'), + title: 'Open Farm photo', + license_name: 'No rights reserved', + link_url: "https://openfarm.cc/en/crops/#{name_to_slug(crop.name)}" ) if photo.valid? Photo.transaction do diff --git a/config/environments/production.rb b/config/environments/production.rb index 882d7a463..b0ad1ebf5 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -59,12 +59,12 @@ Rails.application.configure do # Use a different cache store in production. config.cache_store = :mem_cache_store, (ENV["MEMCACHIER_SERVERS"] || "").split(","), - { username: ENV["MEMCACHIER_USERNAME"], - password: ENV["MEMCACHIER_PASSWORD"], - failover: true, - socket_timeout: 1.5, + { username: ENV["MEMCACHIER_USERNAME"], + password: ENV["MEMCACHIER_PASSWORD"], + failover: true, + socket_timeout: 1.5, socket_failure_delay: 0.2, - down_retry_delay: 60 } + down_retry_delay: 60 } # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque @@ -92,12 +92,12 @@ Rails.application.configure do config.action_mailer.default_url_options = { host: ENV['HOST'] } config.action_mailer.smtp_settings = { - user_name: ENV['SENDGRID_USERNAME'], - password: ENV['SENDGRID_PASSWORD'], - domain: ENV['GROWSTUFF_EMAIL_DOMAIN'], - address: 'smtp.sendgrid.net', - port: 587, - authentication: :plain, + user_name: ENV['SENDGRID_USERNAME'], + password: ENV['SENDGRID_PASSWORD'], + domain: ENV['GROWSTUFF_EMAIL_DOMAIN'], + address: 'smtp.sendgrid.net', + port: 587, + authentication: :plain, enable_starttls_auto: true } ActionMailer::Base.delivery_method = :smtp diff --git a/config/environments/test.rb b/config/environments/test.rb index 8c31b6991..15c30246b 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -61,7 +61,7 @@ Geocoder.configure(lookup: :test) Geocoder::Lookup::Test.add_stub( "Amundsen-Scott Base, Antarctica", [ { - 'latitude' => -90.0, + 'latitude' => -90.0, 'longitude' => 0.0 } ] @@ -70,12 +70,12 @@ Geocoder::Lookup::Test.add_stub( Geocoder::Lookup::Test.add_stub( "Philippines", [ { - 'latitude' => 12.7503486, - 'longitude' => 122.7312101, - 'address' => 'Manila, Mnl, Philippines', - 'state' => 'Manila', - 'state_code' => 'Mnl', - 'country' => 'Philippines', + 'latitude' => 12.7503486, + 'longitude' => 122.7312101, + 'address' => 'Manila, Mnl, Philippines', + 'state' => 'Manila', + 'state_code' => 'Mnl', + 'country' => 'Philippines', 'country_code' => 'PH' } ] @@ -84,7 +84,7 @@ Geocoder::Lookup::Test.add_stub( Geocoder::Lookup::Test.add_stub( "Greenwich, UK", [ { - 'latitude' => 51.483061, + 'latitude' => 51.483061, 'longitude' => -0.004151 } ] @@ -93,7 +93,7 @@ Geocoder::Lookup::Test.add_stub( Geocoder::Lookup::Test.add_stub( "Edinburgh", [ { - 'latitude' => 55.953252, + 'latitude' => 55.953252, 'longitude' => -3.188267 } ] @@ -109,15 +109,15 @@ end OmniAuth.config.test_mode = true # Fake the omniauth -OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(provider: 'facebook', - uid: '123545', - info: { - name: "John Testerson", +OmniAuth.config.mock_auth[:facebook] = OmniAuth::AuthHash.new(provider: 'facebook', + uid: '123545', + info: { + name: "John Testerson", nickname: 'JohnnyT', - email: 'example.oauth.facebook@example.com', - image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png' + email: 'example.oauth.facebook@example.com', + image: 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png' }, credentials: { - token: "token", + token: "token", secret: "donttell" }) diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb index ef916e735..f12c8c452 100644 --- a/config/initializers/geocoder.rb +++ b/config/initializers/geocoder.rb @@ -3,12 +3,12 @@ require 'geocodable' Geocoder.configure( - units: :km, - timeout: 10, + units: :km, + timeout: 10, http_headers: { "User-Agent" => "#{Rails.application.config.user_agent} #{Rails.application.config.user_agent_email}", - "From" => Rails.application.config.user_agent_email + "From" => Rails.application.config.user_agent_email } ) # This configuration takes precedence over environment/test.rb diff --git a/config/routes.rb b/config/routes.rb index 118bf59ae..e21ada9be 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -9,9 +9,9 @@ Rails.application.routes.draw do resources :plant_parts devise_for :members, controllers: { - registrations: "registrations", - passwords: "passwords", - sessions: "sessions", + registrations: "registrations", + passwords: "passwords", + sessions: "sessions", omniauth_callbacks: "omniauth_callbacks" } devise_scope :member do diff --git a/db/migrate/20150201052245_create_cms.rb b/db/migrate/20150201052245_create_cms.rb index 9a1937516..ea6a435f0 100644 --- a/db/migrate/20150201052245_create_cms.rb +++ b/db/migrate/20150201052245_create_cms.rb @@ -115,7 +115,7 @@ class CreateCms < ActiveRecord::Migration[4.2] end add_index :comfy_cms_categories, %i(site_id categorized_type label), unique: true, - name: 'index_cms_categories_on_site_id_and_cat_type_and_label' + name: 'index_cms_categories_on_site_id_and_cat_type_and_label' create_table :comfy_cms_categorizations, force: true do |t| t.integer :category_id, null: false @@ -124,7 +124,7 @@ class CreateCms < ActiveRecord::Migration[4.2] end add_index :comfy_cms_categorizations, %i(category_id categorized_type categorized_id), unique: true, - name: 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id' + name: 'index_cms_categorizations_on_cat_id_and_catd_type_and_catd_id' end def self.down diff --git a/db/migrate/20180213005731_seed_usage.rb b/db/migrate/20180213005731_seed_usage.rb index ddb2c2378..03240e098 100644 --- a/db/migrate/20180213005731_seed_usage.rb +++ b/db/migrate/20180213005731_seed_usage.rb @@ -9,16 +9,16 @@ class SeedUsage < ActiveRecord::Migration[4.2] # plantings can be grown from a seed add_column(:plantings, :parent_seed_id, :integer) add_foreign_key(:plantings, :seeds, - column: :parent_seed_id, + column: :parent_seed_id, primary_key: :id, - name: :parent_seed, - on_delete: :nullify) + name: :parent_seed, + on_delete: :nullify) # seeds can be harvest from planting add_column(:seeds, :parent_planting_id, :integer) add_foreign_key(:seeds, :plantings, - column: :parent_planting_id, + column: :parent_planting_id, primary_key: :id, - name: :parent_planting, - on_delete: :nullify) + name: :parent_planting, + on_delete: :nullify) end end diff --git a/db/seeds.rb b/db/seeds.rb index d3ac333b3..77eaff05b 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -59,9 +59,9 @@ def load_test_users # rubocop:disable Metrics/AbcSize (1..member_size).each do |i| @user = Member.new( - login_name: "test#{i}", - email: "test#{i}@example.com", - password: "password#{i}", + login_name: "test#{i}", + email: "test#{i}@example.com", + password: "password#{i}", tos_agreement: true ) @user.skip_confirmation! @@ -81,11 +81,11 @@ def load_test_users # rubocop:disable Metrics/AbcSize # Create a planting by the member Planting.create( - owner_id: @user.id, - garden_id: @user.gardens.first.id, - planted_at: Time.zone.today, - crop_id: Crop.find(i % Crop.all.size + 1).id, - sunniness: select_random_item(Planting::SUNNINESS_VALUES), + owner_id: @user.id, + garden_id: @user.gardens.first.id, + planted_at: Time.zone.today, + crop_id: Crop.find(i % Crop.all.size + 1).id, + sunniness: select_random_item(Planting::SUNNINESS_VALUES), planted_from: select_random_item(Planting::PLANTED_FROM_VALUES) ) end @@ -96,9 +96,9 @@ end def load_admin_users puts "Adding admin and crop wrangler members..." @admin_user = Member.new( - login_name: "admin1", - email: "admin1@example.com", - password: "password1", + login_name: "admin1", + email: "admin1@example.com", + password: "password1", tos_agreement: true ) @admin_user.skip_confirmation! @@ -106,9 +106,9 @@ def load_admin_users @admin_user.save! @wrangler_user = Member.new( - login_name: "wrangler1", - email: "wrangler1@example.com", - password: "password1", + login_name: "wrangler1", + email: "wrangler1@example.com", + password: "password1", tos_agreement: true ) @wrangler_user.skip_confirmation! @@ -120,9 +120,9 @@ def create_cropbot return if Member.find_by(login_name: 'cropbot') @cropbot_user = Member.new( - login_name: "cropbot", - email: Rails.application.config.bot_email, - password: SecureRandom.urlsafe_base64(64), + login_name: "cropbot", + email: Rails.application.config.bot_email, + password: SecureRandom.urlsafe_base64(64), tos_agreement: true ) @cropbot_user.skip_confirmation! diff --git a/lib/actions/oauth_signup_action.rb b/lib/actions/oauth_signup_action.rb index cd1f7d768..dd81d2ec9 100644 --- a/lib/actions/oauth_signup_action.rb +++ b/lib/actions/oauth_signup_action.rb @@ -43,14 +43,14 @@ class Growstuff::OauthSignupAction authentication = member.authentications .create_with( - name: name, - token: auth['credentials']['token'], + name: name, + token: auth['credentials']['token'], secret: auth['credentials']['secret'] ) .find_or_create_by( - provider: auth['provider'], - uid: auth['uid'], - name: name, + provider: auth['provider'], + uid: auth['uid'], + name: name, member_id: member.id ) diff --git a/spec/controllers/api/v1/plantings_controller_spec.rb b/spec/controllers/api/v1/plantings_controller_spec.rb index 4ede14391..b807c724e 100644 --- a/spec/controllers/api/v1/plantings_controller_spec.rb +++ b/spec/controllers/api/v1/plantings_controller_spec.rb @@ -15,25 +15,25 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do let!(:my_planting) { FactoryBot.create(:planting, owner: member, planted_at: '2000-01-01') } let(:expected_attributes) do { - 'crop-name' => my_planting.crop.name, - 'crop-slug' => my_planting.crop.slug, - 'description' => my_planting.description, - 'expected-lifespan' => nil, + 'crop-name' => my_planting.crop.name, + 'crop-slug' => my_planting.crop.slug, + 'description' => my_planting.description, + 'expected-lifespan' => nil, 'finish-predicted-at' => nil, - 'finished' => my_planting.finished, - 'finished-at' => my_planting.finished_at, - 'first-harvest-date' => nil, - 'last-harvest-date' => nil, - 'latitude' => my_planting.garden.latitude, - 'longitude' => my_planting.garden.longitude, - 'location' => my_planting.garden.location, - 'percentage-grown' => nil, - 'planted-at' => '2000-01-01', - 'planted-from' => my_planting.planted_from, - 'quantity' => my_planting.quantity, - 'slug' => my_planting.slug, - 'sunniness' => nil, - 'thumbnail' => nil + 'finished' => my_planting.finished, + 'finished-at' => my_planting.finished_at, + 'first-harvest-date' => nil, + 'last-harvest-date' => nil, + 'latitude' => my_planting.garden.latitude, + 'longitude' => my_planting.garden.longitude, + 'location' => my_planting.garden.location, + 'percentage-grown' => nil, + 'planted-at' => '2000-01-01', + 'planted-from' => my_planting.planted_from, + 'quantity' => my_planting.quantity, + 'slug' => my_planting.slug, + 'sunniness' => nil, + 'thumbnail' => nil } end @@ -49,25 +49,25 @@ RSpec.describe Api::V1::PlantingsController, type: :controller do let(:expected_attributes) do { - 'crop-name' => my_planting.crop.name, - 'crop-slug' => my_planting.crop.slug, - 'description' => my_planting.description, - 'expected-lifespan' => nil, + 'crop-name' => my_planting.crop.name, + 'crop-slug' => my_planting.crop.slug, + 'description' => my_planting.description, + 'expected-lifespan' => nil, 'finish-predicted-at' => nil, - 'finished' => my_planting.finished, - 'finished-at' => my_planting.finished_at, - 'first-harvest-date' => nil, - 'last-harvest-date' => nil, - 'latitude' => my_planting.garden.latitude, - 'longitude' => my_planting.garden.longitude, - 'location' => my_planting.garden.location, - 'percentage-grown' => nil, - 'planted-at' => '2000-01-01', - 'planted-from' => my_planting.planted_from, - 'quantity' => my_planting.quantity, - 'slug' => my_planting.slug, - 'sunniness' => nil, - 'thumbnail' => photo.thumbnail_url + 'finished' => my_planting.finished, + 'finished-at' => my_planting.finished_at, + 'first-harvest-date' => nil, + 'last-harvest-date' => nil, + 'latitude' => my_planting.garden.latitude, + 'longitude' => my_planting.garden.longitude, + 'location' => my_planting.garden.location, + 'percentage-grown' => nil, + 'planted-at' => '2000-01-01', + 'planted-from' => my_planting.planted_from, + 'quantity' => my_planting.quantity, + 'slug' => my_planting.slug, + 'sunniness' => nil, + 'thumbnail' => photo.thumbnail_url } end let(:photo) { FactoryBot.create(:photo, owner: my_planting.owner) } diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb index d4bc8ad50..661c7e3e1 100644 --- a/spec/controllers/authentications_controller_spec.rb +++ b/spec/controllers/authentications_controller_spec.rb @@ -9,9 +9,9 @@ describe AuthenticationsController do controller.stub(:current_member) { @member } @auth = FactoryBot.create(:authentication, member: @member) request.env['omniauth.auth'] = { - 'provider' => 'foo', - 'uid' => 'bar', - 'info' => { 'nickname' => 'blah' }, + 'provider' => 'foo', + 'uid' => 'bar', + 'info' => { 'nickname' => 'blah' }, 'credentials' => { 'token' => 'blah', 'secret' => 'blah' } } end diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb index 065ff32d7..2e7869c1f 100644 --- a/spec/controllers/forums_controller_spec.rb +++ b/spec/controllers/forums_controller_spec.rb @@ -7,9 +7,9 @@ describe ForumsController do def valid_attributes { - "name" => "MyString", + "name" => "MyString", "description" => "Something", - "owner_id" => 1 + "owner_id" => 1 } end diff --git a/spec/controllers/photo_associations_controller_spec.rb b/spec/controllers/photo_associations_controller_spec.rb index 65d89e9f2..f91e2d777 100644 --- a/spec/controllers/photo_associations_controller_spec.rb +++ b/spec/controllers/photo_associations_controller_spec.rb @@ -8,8 +8,8 @@ describe PhotoAssociationsController do describe "destroy" do let(:valid_params) do { - id: harvest.id, - type: 'harvest', + id: harvest.id, + type: 'harvest', photo_id: photo.id } end diff --git a/spec/controllers/photos_controller_spec.rb b/spec/controllers/photos_controller_spec.rb index 4e5667180..6629c69e9 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -88,12 +88,12 @@ describe PhotosController, :search do describe "POST create" do before do - Photo.any_instance.stub(:flickr_metadata).and_return(title: "A Heartbreaking work of staggering genius", - license_name: "CC-BY", - license_url: "http://example.com/aybpl", + Photo.any_instance.stub(:flickr_metadata).and_return(title: "A Heartbreaking work of staggering genius", + license_name: "CC-BY", + license_url: "http://example.com/aybpl", thumbnail_url: "http://example.com/thumb.jpg", - fullsize_url: "http://example.com/full.jpg", - link_url: "http://example.com") + fullsize_url: "http://example.com/full.jpg", + link_url: "http://example.com") end let(:member) { FactoryBot.create(:member) } diff --git a/spec/controllers/plantings_controller_spec.rb b/spec/controllers/plantings_controller_spec.rb index 4b5f2a651..f7d9a0a21 100644 --- a/spec/controllers/plantings_controller_spec.rb +++ b/spec/controllers/plantings_controller_spec.rb @@ -8,7 +8,7 @@ describe PlantingsController, :search do def valid_attributes { garden_id: FactoryBot.create(:garden, owner: subject.current_member).id, - crop_id: FactoryBot.create(:crop).id + crop_id: FactoryBot.create(:crop).id } end diff --git a/spec/features/crops/crop_detail_page_spec.rb b/spec/features/crops/crop_detail_page_spec.rb index ec1ff63cd..b12cdcd70 100644 --- a/spec/features/crops/crop_detail_page_spec.rb +++ b/spec/features/crops/crop_detail_page_spec.rb @@ -125,8 +125,8 @@ describe "crop detail page", js: true do context 'predictions' do let!(:planting) do - FactoryBot.create(:planting, crop: crop, - planted_at: 100.days.ago, + FactoryBot.create(:planting, crop: crop, + planted_at: 100.days.ago, finished_at: 1.day.ago) end diff --git a/spec/features/gardens/index_spec.rb b/spec/features/gardens/index_spec.rb index 00cfad3af..c28159f82 100644 --- a/spec/features/gardens/index_spec.rb +++ b/spec/features/gardens/index_spec.rb @@ -80,11 +80,11 @@ describe "Gardens#index", :js do # time to finished = 90 days FactoryBot.create(:harvest, harvested_at: 50.days.ago, - crop: crop, - planting: FactoryBot.create(:planting, - crop: crop, - planted_at: 100.days.ago, - finished_at: 10.days.ago)) + crop: crop, + planting: FactoryBot.create(:planting, + crop: crop, + planted_at: 100.days.ago, + finished_at: 10.days.ago)) crop.plantings.each(&:update_harvest_days!) crop.update_lifespan_medians crop.update_harvest_medians @@ -97,9 +97,9 @@ describe "Gardens#index", :js do describe 'harvest still growing' do let!(:planting) do FactoryBot.create :planting, - crop: crop, - owner: member, - garden: garden, + crop: crop, + owner: member, + garden: garden, planted_at: Time.zone.today end diff --git a/spec/features/percy/percy_spec.rb b/spec/features/percy/percy_spec.rb index 530a6b540..5b129d933 100644 --- a/spec/features/percy/percy_spec.rb +++ b/spec/features/percy/percy_spec.rb @@ -21,9 +21,9 @@ describe 'Test with visual testing', type: :feature, js: true do let(:tomato_photo) do FactoryBot.create :photo, - title: 'look at my tomatoes', - owner: member, - fullsize_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_z.jpg', + title: 'look at my tomatoes', + owner: member, + fullsize_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_z.jpg', thumbnail_url: 'https://farm1.staticflickr.com/177/432250619_2fe19d067d_q.jpg' end let(:post_body) do @@ -71,12 +71,12 @@ rest of the garden. Timecop.freeze(Time.zone.local(2019, 1, 1)) { - chard: 'https://farm9.staticflickr.com/8516/8519911893_1759c28965_q.jpg', - apple: 'https://farm5.staticflickr.com/4748/38932178855_6fe9bcdb48_q.jpg', - pear: 'https://farm1.staticflickr.com/113/250984726_0fc31fea6d_q.jpg', - popcorn: 'https://farm8.staticflickr.com/7893/33150160528_24a689c6bc_q.jpg', + chard: 'https://farm9.staticflickr.com/8516/8519911893_1759c28965_q.jpg', + apple: 'https://farm5.staticflickr.com/4748/38932178855_6fe9bcdb48_q.jpg', + pear: 'https://farm1.staticflickr.com/113/250984726_0fc31fea6d_q.jpg', + popcorn: 'https://farm8.staticflickr.com/7893/33150160528_24a689c6bc_q.jpg', eggplant: 'https://farm8.staticflickr.com/7856/47068736892_1af9b8a4ba_q.jpg', - maize: 'https://farm66.staticflickr.com/65535/46739264475_7cb55b2cbb_q.jpg' + maize: 'https://farm66.staticflickr.com/65535/46739264475_7cb55b2cbb_q.jpg' }.each do |crop_type, photo_url| crop = FactoryBot.create crop_type, creator: someone_else crop.reindex @@ -112,9 +112,9 @@ rest of the garden. planting = FactoryBot.create :planting, planted_at: 1.year.ago, sunniness: 'sun', planted_from: 'seed', crop: tomato FactoryBot.create(:harvest, - crop: tomato, - plant_part: FactoryBot.create(:plant_part, name: 'berry'), - planting: planting, + crop: tomato, + plant_part: FactoryBot.create(:plant_part, name: 'berry'), + planting: planting, harvested_at: 1.day.ago) post = FactoryBot.create :post, subject: 'tomatoes are delicious' diff --git a/spec/helpers/harvests_helper_spec.rb b/spec/helpers/harvests_helper_spec.rb index 25be2d248..455e57e9c 100644 --- a/spec/helpers/harvests_helper_spec.rb +++ b/spec/helpers/harvests_helper_spec.rb @@ -6,7 +6,7 @@ describe HarvestsHelper do describe "display_quantity" do it "blank" do harvest = FactoryBot.create(:harvest, - quantity: nil, + quantity: nil, weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq 'not specified' @@ -14,8 +14,8 @@ describe HarvestsHelper do it '3 individual' do harvest = FactoryBot.create(:harvest, - quantity: 3, - unit: 'individual', + quantity: 3, + unit: 'individual', weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq '3' @@ -23,8 +23,8 @@ describe HarvestsHelper do it '1 bunch' do harvest = FactoryBot.create(:harvest, - quantity: 1, - unit: 'bunch', + quantity: 1, + unit: 'bunch', weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq '1 bunch' @@ -32,8 +32,8 @@ describe HarvestsHelper do it '3 bunches' do harvest = FactoryBot.create(:harvest, - quantity: 3, - unit: 'bunch', + quantity: 3, + unit: 'bunch', weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq '3 bunches' @@ -41,30 +41,30 @@ describe HarvestsHelper do it '3 kg' do harvest = FactoryBot.create(:harvest, - quantity: nil, - unit: nil, + quantity: nil, + unit: nil, weight_quantity: 3, - weight_unit: 'kg') + weight_unit: 'kg') result = helper.display_quantity(harvest) result.should eq '3 kg' end it '3 individual weighing 3 kg' do harvest = FactoryBot.create(:harvest, - quantity: 3, - unit: 'individual', + quantity: 3, + unit: 'individual', weight_quantity: 3, - weight_unit: 'kg') + weight_unit: 'kg') result = helper.display_quantity(harvest) result.should eq '3, weighing 3 kg' end it '3 bunches weighing 3 kg' do harvest = FactoryBot.create(:harvest, - quantity: 3, - unit: 'bunch', + quantity: 3, + unit: 'bunch', weight_quantity: 3, - weight_unit: 'kg') + weight_unit: 'kg') result = helper.display_quantity(harvest) result.should eq '3 bunches, weighing 3 kg' end diff --git a/spec/helpers/plantings_helper_spec.rb b/spec/helpers/plantings_helper_spec.rb index 14192bb14..2502aeb8d 100644 --- a/spec/helpers/plantings_helper_spec.rb +++ b/spec/helpers/plantings_helper_spec.rb @@ -8,18 +8,18 @@ describe PlantingsHelper do it "does not have a quantity nor a planted from value provided" do planting = FactoryBot.build(:planting, - quantity: nil, + quantity: nil, planted_from: '', - owner: member) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted magic bean." end it "does not have a quantity provided" do planting = FactoryBot.build(:planting, - quantity: nil, + quantity: nil, planted_from: 'seed', - owner: member) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted seeds." end @@ -27,18 +27,18 @@ describe PlantingsHelper do context "when quantity is greater than 1" do it "does not have a planted from value provided" do planting = FactoryBot.build(:planting, - quantity: 10, + quantity: 10, planted_from: '', - owner: member) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted 10 units." end it "does have a planted from value provided" do planting = FactoryBot.build(:planting, - quantity: 5, + quantity: 5, planted_from: 'seed', - owner: member) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted 5 seeds." end @@ -47,18 +47,18 @@ describe PlantingsHelper do context "when quantity is 1" do it "does not have a planted from value provided" do planting = FactoryBot.build(:planting, - quantity: 1, + quantity: 1, planted_from: '', - owner: member) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted 1 unit." end it "does have a planted from value provided" do planting = FactoryBot.build(:planting, - quantity: 1, + quantity: 1, planted_from: 'seed', - owner: member) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted 1 seed." end diff --git a/spec/lib/actions/oauth_signup_action_spec.rb b/spec/lib/actions/oauth_signup_action_spec.rb index 621b29af1..6e9cc6b3a 100644 --- a/spec/lib/actions/oauth_signup_action_spec.rb +++ b/spec/lib/actions/oauth_signup_action_spec.rb @@ -10,16 +10,16 @@ describe 'Growstuff::OauthSignupAction' do context 'with a valid authentication' do before do - @auth = OmniAuth::AuthHash.new('provider' => 'facebook', - 'uid' => '123545', - 'info' => { - 'name' => "John Testerson's Brother", + @auth = OmniAuth::AuthHash.new('provider' => 'facebook', + 'uid' => '123545', + 'info' => { + 'name' => "John Testerson's Brother", 'nickname' => 'JohnnyB', - 'email' => 'example.oauth.facebook@example.com', - 'image' => 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png' + 'email' => 'example.oauth.facebook@example.com', + 'image' => 'http://findicons.com/files/icons/1072/face_avatars/300/i04.png' }, 'credentials' => { - 'token' => "token", + 'token' => "token", 'secret' => "donttell" }) end @@ -76,8 +76,8 @@ describe 'Growstuff::OauthSignupAction' do @auth['info']['email'] = 'never.used.oauth@yahoo.com' Member.where(email: @auth['info']['email']).delete_all - @existing_member = create :member, email: @auth['info']['email'], - login_name: 'existing', + @existing_member = create :member, email: @auth['info']['email'], + login_name: 'existing', preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg' @member = @action.find_or_create_from_authorization(@auth) @@ -120,13 +120,13 @@ describe 'Growstuff::OauthSignupAction' do Member.where(email: @auth['info']['email']).delete_all Authentication.delete_all - @existing_member = create :member, email: @auth['info']['email'], - login_name: 'schrodingerscat', + @existing_member = create :member, email: @auth['info']['email'], + login_name: 'schrodingerscat', preferred_avatar_uri: 'http://cl.jroo.me/z3/W/H/K/e/a.baa-very-cool-hat-you-.jpg' - @existing_authentication = @existing_member.authentications.create(provider: 'facebook', - uid: '123545', - name: "John Testerson's Brother", + @existing_authentication = @existing_member.authentications.create(provider: 'facebook', + uid: '123545', + name: "John Testerson's Brother", member_id: @existing_member.id) @member = @action.find_or_create_from_authorization(@auth) diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index c2c206a64..adb858900 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -22,13 +22,13 @@ describe Ability do ability.should_not be_able_to(:create, FactoryBot.create(:notification, recipient: member, - sender: member)) + sender: member)) end it "member can send messages to someone else" do ability.should be_able_to(:create, FactoryBot.create(:notification, recipient: FactoryBot.create(:member), - sender: member)) + sender: member)) end end diff --git a/spec/models/alternate_name_spec.rb b/spec/models/alternate_name_spec.rb index 515fdaa7a..acde9e8e0 100644 --- a/spec/models/alternate_name_spec.rb +++ b/spec/models/alternate_name_spec.rb @@ -12,8 +12,8 @@ describe AlternateName do it 'is possible to add multiple alternate names to a crop' do crop = an.crop an2 = AlternateName.create( - name: "really alternative tomato", - crop_id: crop.id, + name: "really alternative tomato", + crop_id: crop.id, creator_id: an.creator.id ) crop.alternate_names << an2 diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index bb3c07b0d..a80a17285 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -273,20 +273,20 @@ describe Crop do @root = FactoryBot.create(:plant_part, name: 'root') @bulb = FactoryBot.create(:plant_part, name: 'bulb') @harvest1 = FactoryBot.create(:harvest, - crop: crop, + crop: crop, plant_part: @fruit) @harvest2 = FactoryBot.create(:harvest, - crop: crop, + crop: crop, plant_part: @fruit) @harvest3 = FactoryBot.create(:harvest, - crop: crop, + crop: crop, plant_part: @seed) @harvest4 = FactoryBot.create(:harvest, - crop: crop, + crop: crop, plant_part: @root) crop.popular_plant_parts.should == { [@fruit.id, @fruit.name] => 2, - [@seed.id, @seed.name] => 1, - [@root.id, @root.name] => 1 } + [@seed.id, @seed.name] => 1, + [@root.id, @root.name] => 1 } end end @@ -542,15 +542,15 @@ describe Crop do context "crop rejections" do let!(:rejected_reason) do - FactoryBot.create(:crop, name: 'tomato', - approval_status: 'rejected', + FactoryBot.create(:crop, name: 'tomato', + approval_status: 'rejected', reason_for_rejection: 'not edible') end let!(:rejected_other) do - FactoryBot.create(:crop, name: 'tomato', - approval_status: 'rejected', + FactoryBot.create(:crop, name: 'tomato', + approval_status: 'rejected', reason_for_rejection: 'other', - rejection_notes: 'blah blah blah') + rejection_notes: 'blah blah blah') end describe "rejecting a crop" do diff --git a/spec/models/harvest_spec.rb b/spec/models/harvest_spec.rb index 5465b43e0..473382de5 100644 --- a/spec/models/harvest_spec.rb +++ b/spec/models/harvest_spec.rb @@ -152,74 +152,74 @@ describe Harvest do let(:crop) { FactoryBot.create(:crop, name: "apricot") } it "apricots" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: nil, - unit: nil, + @h = FactoryBot.create(:harvest, crop: crop, + quantity: nil, + unit: nil, weight_quantity: nil, - weight_unit: nil) + weight_unit: nil) expect(@h.to_s).to eq "apricots" end it "1 individual apricot" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: 1, - unit: 'individual', + @h = FactoryBot.create(:harvest, crop: crop, + quantity: 1, + unit: 'individual', weight_quantity: nil, - weight_unit: nil) + weight_unit: nil) expect(@h.to_s).to eq "1 individual apricot" end it "10 individual apricots" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: 10, - unit: 'individual', + @h = FactoryBot.create(:harvest, crop: crop, + quantity: 10, + unit: 'individual', weight_quantity: nil, - weight_unit: nil) + weight_unit: nil) expect(@h.to_s).to eq "10 individual apricots" end it "1 bushel of apricots" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: 1, - unit: 'bushel', + @h = FactoryBot.create(:harvest, crop: crop, + quantity: 1, + unit: 'bushel', weight_quantity: nil, - weight_unit: nil) + weight_unit: nil) expect(@h.to_s).to eq "1 bushel of apricots" end it "1.5 bushels of apricots" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: 1.5, - unit: 'bushel', + @h = FactoryBot.create(:harvest, crop: crop, + quantity: 1.5, + unit: 'bushel', weight_quantity: nil, - weight_unit: nil) + weight_unit: nil) expect(@h.to_s).to eq "1.5 bushels of apricots" end it "10 bushels of apricots" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: 10, - unit: 'bushel', + @h = FactoryBot.create(:harvest, crop: crop, + quantity: 10, + unit: 'bushel', weight_quantity: nil, - weight_unit: nil) + weight_unit: nil) expect(@h.to_s).to eq "10 bushels of apricots" end it "apricots weighing 1.2 kg" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: nil, - unit: nil, + @h = FactoryBot.create(:harvest, crop: crop, + quantity: nil, + unit: nil, weight_quantity: 1.2, - weight_unit: 'kg') + weight_unit: 'kg') expect(@h.to_s).to eq "apricots weighing 1.2 kg" end it "10 bushels of apricots weighing 100 kg" do - @h = FactoryBot.create(:harvest, crop: crop, - quantity: 10, - unit: 'bushel', + @h = FactoryBot.create(:harvest, crop: crop, + quantity: 10, + unit: 'bushel', weight_quantity: 100, - weight_unit: 'kg') + weight_unit: 'kg') expect(@h.to_s).to eq "10 bushels of apricots weighing 100 kg" end end diff --git a/spec/models/plant_part_spec.rb b/spec/models/plant_part_spec.rb index 7747ec4e3..26e36feb2 100644 --- a/spec/models/plant_part_spec.rb +++ b/spec/models/plant_part_spec.rb @@ -13,10 +13,10 @@ describe PlantPart do @tomato = FactoryBot.create(:tomato) @pp1 = FactoryBot.create(:plant_part) @h1 = FactoryBot.create(:harvest, - crop: @tomato, + crop: @tomato, plant_part: @pp1) @h2 = FactoryBot.create(:harvest, - crop: @maize, + crop: @maize, plant_part: @pp1) @pp1.crops.should include @tomato @pp1.crops.should include @maize @@ -26,10 +26,10 @@ describe PlantPart do @maize = FactoryBot.create(:maize) @pp1 = FactoryBot.create(:plant_part) @h1 = FactoryBot.create(:harvest, - crop: @maize, + crop: @maize, plant_part: @pp1) @h2 = FactoryBot.create(:harvest, - crop: @maize, + crop: @maize, plant_part: @pp1) @pp1.crops.should eq [@maize] end diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 5fd8c8f62..069798378 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -73,7 +73,7 @@ describe Post do end it "sets recent activity to comment time" do - comment = FactoryBot.create(:comment, post: post, + comment = FactoryBot.create(:comment, post: post, created_at: 1.hour.ago) post.recent_activity.to_i.should eq comment.created_at.to_i end diff --git a/spec/requests/api/v1/crop_request_spec.rb b/spec/requests/api/v1/crop_request_spec.rb index 06dd0311f..491b93c71 100644 --- a/spec/requests/api/v1/crop_request_spec.rb +++ b/spec/requests/api/v1/crop_request_spec.rb @@ -8,16 +8,16 @@ RSpec.describe 'Crops', type: :request do let(:headers) { { 'Accept' => 'application/vnd.api+json' } } let!(:crop) { FactoryBot.create :crop } let(:crop_encoded_as_json_api) do - { "id" => crop.id.to_s, - "type" => "crops", - "links" => { "self" => resource_url }, - "attributes" => attributes, + { "id" => crop.id.to_s, + "type" => "crops", + "links" => { "self" => resource_url }, + "attributes" => attributes, "relationships" => { "plantings" => plantings_as_json_api, - "parent" => parent_as_json_api, - "harvests" => harvests_as_json_api, - "seeds" => seeds_as_json_api, - "photos" => photos_as_json_api + "parent" => parent_as_json_api, + "harvests" => harvests_as_json_api, + "seeds" => seeds_as_json_api, + "photos" => photos_as_json_api } } end @@ -25,43 +25,43 @@ RSpec.describe 'Crops', type: :request do let(:seeds_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/seeds", + { "self" => "#{resource_url}/relationships/seeds", "related" => "#{resource_url}/seeds" } } end let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", + { "self" => "#{resource_url}/relationships/harvests", "related" => "#{resource_url}/harvests" } } end let(:parent_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/parent", + { "self" => "#{resource_url}/relationships/parent", "related" => "#{resource_url}/parent" } } end let(:plantings_as_json_api) do { "links" => - { "self" => + { "self" => "#{resource_url}/relationships/plantings", "related" => "#{resource_url}/plantings" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", + { "self" => "#{resource_url}/relationships/photos", "related" => "#{resource_url}/photos" } } end let(:attributes) do { - "name" => crop.name, - "en-wikipedia-url" => crop.en_wikipedia_url, - "perennial" => false, - "median-lifespan" => nil, + "name" => crop.name, + "en-wikipedia-url" => crop.en_wikipedia_url, + "perennial" => false, + "median-lifespan" => nil, "median-days-to-first-harvest" => nil, - "median-days-to-last-harvest" => nil + "median-days-to-last-harvest" => nil } end diff --git a/spec/requests/api/v1/gardens_request_spec.rb b/spec/requests/api/v1/gardens_request_spec.rb index 3116aa208..9208fc2b7 100644 --- a/spec/requests/api/v1/gardens_request_spec.rb +++ b/spec/requests/api/v1/gardens_request_spec.rb @@ -8,35 +8,35 @@ RSpec.describe 'Gardens', type: :request do let(:headers) { { 'Accept' => 'application/vnd.api+json' } } let!(:garden) { FactoryBot.create :garden } let(:garden_encoded_as_json_api) do - { "id" => garden.id.to_s, - "type" => "gardens", - "links" => { "self" => resource_url }, - "attributes" => { "name" => garden.name }, + { "id" => garden.id.to_s, + "type" => "gardens", + "links" => { "self" => resource_url }, + "attributes" => { "name" => garden.name }, "relationships" => { - "owner" => owner_as_json_api, + "owner" => owner_as_json_api, "plantings" => plantings_as_json_api, - "photos" => photos_as_json_api + "photos" => photos_as_json_api } } end let(:resource_url) { "http://www.example.com/api/v1/gardens/#{garden.id}" } let(:plantings_as_json_api) do { "links" => - { "self" => + { "self" => "#{resource_url}/relationships/plantings", "related" => "#{resource_url}/plantings" } } end let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", + { "self" => "#{resource_url}/relationships/owner", "related" => "#{resource_url}/owner" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", + { "self" => "#{resource_url}/relationships/photos", "related" => "#{resource_url}/photos" } } end diff --git a/spec/requests/api/v1/harvest_request_spec.rb b/spec/requests/api/v1/harvest_request_spec.rb index eb6a6e483..33aebd68e 100644 --- a/spec/requests/api/v1/harvest_request_spec.rb +++ b/spec/requests/api/v1/harvest_request_spec.rb @@ -8,15 +8,15 @@ RSpec.describe 'Harvests', type: :request do let(:headers) { { 'Accept' => 'application/vnd.api+json' } } let!(:harvest) { FactoryBot.create :harvest } let(:harvest_encoded_as_json_api) do - { "id" => harvest.id.to_s, - "type" => "harvests", - "links" => { "self" => resource_url }, - "attributes" => attributes, + { "id" => harvest.id.to_s, + "type" => "harvests", + "links" => { "self" => resource_url }, + "attributes" => attributes, "relationships" => { - "crop" => crop_as_json_api, + "crop" => crop_as_json_api, "planting" => planting_as_json_api, - "owner" => owner_as_json_api, - "photos" => photos_as_json_api + "owner" => owner_as_json_api, + "photos" => photos_as_json_api } } end @@ -24,38 +24,38 @@ RSpec.describe 'Harvests', type: :request do let(:crop_as_json_api) do { "links" => - { "self" => + { "self" => "#{resource_url}/relationships/crop", "related" => "#{resource_url}/crop" } } end let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", + { "self" => "#{resource_url}/relationships/owner", "related" => "#{resource_url}/owner" } } end let(:planting_as_json_api) do { "links" => - { "self" => + { "self" => "#{resource_url}/relationships/planting", "related" => "#{resource_url}/planting" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", + { "self" => "#{resource_url}/relationships/photos", "related" => "#{resource_url}/photos" } } end let(:attributes) do { - "harvested-at" => "2015-09-17", - "description" => harvest.description, - "unit" => harvest.unit, + "harvested-at" => "2015-09-17", + "description" => harvest.description, + "unit" => harvest.unit, "weight-quantity" => harvest.weight_quantity.to_s, - "weight-unit" => harvest.weight_unit, - "si-weight" => harvest.si_weight + "weight-unit" => harvest.weight_unit, + "si-weight" => harvest.si_weight } end diff --git a/spec/requests/api/v1/member_request_spec.rb b/spec/requests/api/v1/member_request_spec.rb index 38021af32..ae88f6c94 100644 --- a/spec/requests/api/v1/member_request_spec.rb +++ b/spec/requests/api/v1/member_request_spec.rb @@ -8,16 +8,16 @@ RSpec.describe 'Members', type: :request do let(:headers) { { 'Accept' => 'application/vnd.api+json' } } let!(:member) { FactoryBot.create :member } let(:member_encoded_as_json_api) do - { "id" => member.id.to_s, - "type" => "members", - "links" => { "self" => resource_url }, - "attributes" => attributes, + { "id" => member.id.to_s, + "type" => "members", + "links" => { "self" => resource_url }, + "attributes" => attributes, "relationships" => { - "gardens" => gardens_as_json_api, - "harvests" => harvests_as_json_api, - "photos" => photos_as_json_api, + "gardens" => gardens_as_json_api, + "harvests" => harvests_as_json_api, + "photos" => photos_as_json_api, "plantings" => plantings_as_json_api, - "seeds" => seeds_as_json_api + "seeds" => seeds_as_json_api } } end @@ -25,38 +25,38 @@ RSpec.describe 'Members', type: :request do let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", + { "self" => "#{resource_url}/relationships/harvests", "related" => "#{resource_url}/harvests" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", + { "self" => "#{resource_url}/relationships/photos", "related" => "#{resource_url}/photos" } } end let(:seeds_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/seeds", + { "self" => "#{resource_url}/relationships/seeds", "related" => "#{resource_url}/seeds" } } end let(:plantings_as_json_api) do { "links" => - { "self" => + { "self" => "#{resource_url}/relationships/plantings", "related" => "#{resource_url}/plantings" } } end let(:gardens_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/gardens", + { "self" => "#{resource_url}/relationships/gardens", "related" => "#{resource_url}/gardens" } } end let(:attributes) do { "login-name" => member.login_name, - "slug" => member.slug + "slug" => member.slug } end @@ -85,7 +85,7 @@ RSpec.describe 'Members', type: :request do it '#update' do expect do - post "/api/v1/members/#{member.id}", params: { + post "/api/v1/members/#{member.id}", params: { 'member' => { 'login_name' => 'can i modify this' } }, headers: headers diff --git a/spec/requests/api/v1/photos_request_spec.rb b/spec/requests/api/v1/photos_request_spec.rb index 1db6cede7..069521469 100644 --- a/spec/requests/api/v1/photos_request_spec.rb +++ b/spec/requests/api/v1/photos_request_spec.rb @@ -8,15 +8,15 @@ RSpec.describe 'Photos', type: :request do let(:headers) { { 'Accept' => 'application/vnd.api+json' } } let!(:photo) { FactoryBot.create :photo } let(:photo_encoded_as_json_api) do - { "id" => photo.id.to_s, - "type" => "photos", - "links" => { "self" => resource_url }, - "attributes" => attributes, + { "id" => photo.id.to_s, + "type" => "photos", + "links" => { "self" => resource_url }, + "attributes" => attributes, "relationships" => { - "owner" => owner_as_json_api, + "owner" => owner_as_json_api, "plantings" => plantings_as_json_api, - "harvests" => harvests_as_json_api, - "gardens" => gardens_as_json_api + "harvests" => harvests_as_json_api, + "gardens" => gardens_as_json_api } } end @@ -24,25 +24,25 @@ RSpec.describe 'Photos', type: :request do let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", + { "self" => "#{resource_url}/relationships/owner", "related" => "#{resource_url}/owner" } } end let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", + { "self" => "#{resource_url}/relationships/harvests", "related" => "#{resource_url}/harvests" } } end let(:gardens_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/gardens", + { "self" => "#{resource_url}/relationships/gardens", "related" => "#{resource_url}/gardens" } } end let(:plantings_as_json_api) do { "links" => - { "self" => + { "self" => "#{resource_url}/relationships/plantings", "related" => "#{resource_url}/plantings" } } end @@ -50,10 +50,10 @@ RSpec.describe 'Photos', type: :request do let(:attributes) do { "thumbnail-url" => photo.thumbnail_url, - "fullsize-url" => photo.fullsize_url, - "link-url" => photo.link_url, - "license-name" => photo.license_name, - "title" => photo.title + "fullsize-url" => photo.fullsize_url, + "link-url" => photo.link_url, + "license-name" => photo.license_name, + "title" => photo.title } end diff --git a/spec/requests/api/v1/plantings_request_spec.rb b/spec/requests/api/v1/plantings_request_spec.rb index 26781cc28..452776dfe 100644 --- a/spec/requests/api/v1/plantings_request_spec.rb +++ b/spec/requests/api/v1/plantings_request_spec.rb @@ -8,15 +8,15 @@ RSpec.describe 'Plantings', type: :request do let(:headers) { { 'Accept' => 'application/vnd.api+json' } } let!(:planting) { FactoryBot.create :planting } let(:planting_encoded_as_json_api) do - { "id" => planting.id.to_s, - "type" => "plantings", - "links" => { "self" => resource_url }, - "attributes" => attributes, + { "id" => planting.id.to_s, + "type" => "plantings", + "links" => { "self" => resource_url }, + "attributes" => attributes, "relationships" => { - "garden" => garden_as_json_api, - "crop" => crop_as_json_api, - "owner" => owner_as_json_api, - "photos" => photos_as_json_api, + "garden" => garden_as_json_api, + "crop" => crop_as_json_api, + "owner" => owner_as_json_api, + "photos" => photos_as_json_api, "harvests" => harvests_as_json_api } } end @@ -25,55 +25,55 @@ RSpec.describe 'Plantings', type: :request do let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", + { "self" => "#{resource_url}/relationships/harvests", "related" => "#{resource_url}/harvests" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", + { "self" => "#{resource_url}/relationships/photos", "related" => "#{resource_url}/photos" } } end let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", + { "self" => "#{resource_url}/relationships/owner", "related" => "#{resource_url}/owner" } } end let(:crop_as_json_api) do { "links" => - { "self" => + { "self" => "#{resource_url}/relationships/crop", "related" => "#{resource_url}/crop" } } end let(:garden_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/garden", + { "self" => "#{resource_url}/relationships/garden", "related" => "#{resource_url}/garden" } } end let(:attributes) do { - "slug" => planting.slug, - "planted-at" => "2014-07-30", - "finished-at" => nil, - "finished" => false, - "quantity" => 33, - "description" => planting.description, - "crop-name" => planting.crop.name, - "crop-slug" => planting.crop.slug, - "sunniness" => nil, - "planted-from" => nil, - "expected-lifespan" => nil, + "slug" => planting.slug, + "planted-at" => "2014-07-30", + "finished-at" => nil, + "finished" => false, + "quantity" => 33, + "description" => planting.description, + "crop-name" => planting.crop.name, + "crop-slug" => planting.crop.slug, + "sunniness" => nil, + "planted-from" => nil, + "expected-lifespan" => nil, "finish-predicted-at" => nil, - "percentage-grown" => nil, - "first-harvest-date" => nil, - "last-harvest-date" => nil, - "thumbnail" => nil, - "location" => planting.garden.location, - "longitude" => planting.garden.longitude, - "latitude" => planting.garden.latitude + "percentage-grown" => nil, + "first-harvest-date" => nil, + "last-harvest-date" => nil, + "thumbnail" => nil, + "location" => planting.garden.location, + "longitude" => planting.garden.longitude, + "latitude" => planting.garden.latitude } end diff --git a/spec/requests/api/v1/seeds_request_spec.rb b/spec/requests/api/v1/seeds_request_spec.rb index b0157fbfa..a9f093efc 100644 --- a/spec/requests/api/v1/seeds_request_spec.rb +++ b/spec/requests/api/v1/seeds_request_spec.rb @@ -8,13 +8,13 @@ RSpec.describe 'Photos', type: :request do let(:headers) { { 'Accept' => 'application/vnd.api+json' } } let!(:seed) { FactoryBot.create :seed } let(:seed_encoded_as_json_api) do - { "id" => seed.id.to_s, - "type" => "seeds", - "links" => { "self" => resource_url }, - "attributes" => attributes, + { "id" => seed.id.to_s, + "type" => "seeds", + "links" => { "self" => resource_url }, + "attributes" => attributes, "relationships" => { "owner" => owner_as_json_api, - "crop" => crop_as_json_api + "crop" => crop_as_json_api } } end @@ -22,27 +22,27 @@ RSpec.describe 'Photos', type: :request do let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", + { "self" => "#{resource_url}/relationships/owner", "related" => "#{resource_url}/owner" } } end let(:crop_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/crop", + { "self" => "#{resource_url}/relationships/crop", "related" => "#{resource_url}/crop" } } end let(:attributes) do { - "description" => seed.description, - "quantity" => seed.quantity, - "plant-before" => "2013-07-15", - "tradable-to" => seed.tradable_to, + "description" => seed.description, + "quantity" => seed.quantity, + "plant-before" => "2013-07-15", + "tradable-to" => seed.tradable_to, "days-until-maturity-min" => seed.days_until_maturity_min, "days-until-maturity-max" => seed.days_until_maturity_max, - "organic" => seed.organic, - "gmo" => seed.gmo, - "heirloom" => seed.heirloom + "organic" => seed.organic, + "gmo" => seed.gmo, + "heirloom" => seed.heirloom } end diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rb index 67a935fa8..c63bf5ff4 100644 --- a/spec/swagger_helper.rb +++ b/spec/swagger_helper.rb @@ -17,11 +17,11 @@ RSpec.configure do |config| config.swagger_docs = { 'v1/swagger.yaml' => { openapi: '3.0.1', - info: { - title: 'API V1', + info: { + title: 'API V1', version: 'v1' }, - paths: {} + paths: {} } } diff --git a/spec/views/admin/roles/edit.html.haml_spec.rb b/spec/views/admin/roles/edit.html.haml_spec.rb index d2ffc1146..65cf5e3db 100644 --- a/spec/views/admin/roles/edit.html.haml_spec.rb +++ b/spec/views/admin/roles/edit.html.haml_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe "admin/roles/edit" do before do @role = assign(:role, stub_model(Role, - name: "MyString", + name: "MyString", description: "MyText")) end diff --git a/spec/views/admin/roles/index.html.haml_spec.rb b/spec/views/admin/roles/index.html.haml_spec.rb index d8d0c7bc6..267cf78ba 100644 --- a/spec/views/admin/roles/index.html.haml_spec.rb +++ b/spec/views/admin/roles/index.html.haml_spec.rb @@ -7,10 +7,10 @@ describe "admin/roles/index" do controller.stub(:current_user) { nil } assign(:roles, [ stub_model(Role, - name: "Name", + name: "Name", description: "MyText"), stub_model(Role, - name: "Name", + name: "Name", description: "MyText") ]) end diff --git a/spec/views/admin/roles/new.html.haml_spec.rb b/spec/views/admin/roles/new.html.haml_spec.rb index b9b3dc7b7..3372f836b 100644 --- a/spec/views/admin/roles/new.html.haml_spec.rb +++ b/spec/views/admin/roles/new.html.haml_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe "admin/roles/new" do before do assign(:role, stub_model(Role, - name: "MyString", + name: "MyString", description: "MyText").as_new_record) end diff --git a/spec/views/crops/_grown_for.html.haml_spec.rb b/spec/views/crops/_grown_for.html.haml_spec.rb index 3cd68bfd8..d5445c5b5 100644 --- a/spec/views/crops/_grown_for.html.haml_spec.rb +++ b/spec/views/crops/_grown_for.html.haml_spec.rb @@ -7,7 +7,7 @@ describe "crops/_grown_for" do let(:plant_path) { FactoryBot.create(:plant_part) } let!(:harvest) do FactoryBot.create(:harvest, - crop: crop, + crop: crop, plant_part: plant_path) end diff --git a/spec/views/forums/edit.html.haml_spec.rb b/spec/views/forums/edit.html.haml_spec.rb index 08580e4e1..0ed49bd24 100644 --- a/spec/views/forums/edit.html.haml_spec.rb +++ b/spec/views/forums/edit.html.haml_spec.rb @@ -5,9 +5,9 @@ require 'rails_helper' describe "forums/edit" do before do @forum = assign(:forum, stub_model(Forum, - name: "MyString", + name: "MyString", description: "MyText", - owner_id: 1)) + owner_id: 1)) end it "renders the edit forum form" do diff --git a/spec/views/harvests/edit.html.haml_spec.rb b/spec/views/harvests/edit.html.haml_spec.rb index 2647f7961..36ab3286c 100644 --- a/spec/views/harvests/edit.html.haml_spec.rb +++ b/spec/views/harvests/edit.html.haml_spec.rb @@ -12,7 +12,7 @@ describe "harvests/edit" do assert_select "form", action: harvests_path, method: "post" do assert_select "input#crop", class: "ui-autocomplete-input" assert_select "input#harvest_crop_id", name: "harvest[crop_id]" - assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}", + assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}", name: "harvest[plant_part_id]" assert_select "input#harvest_quantity", name: "harvest[quantity]" assert_select "input#harvest_weight_quantity", name: "harvest[quantity]" diff --git a/spec/views/harvests/index.html.haml_spec.rb b/spec/views/harvests/index.html.haml_spec.rb index d018c9558..73c2a1fe2 100644 --- a/spec/views/harvests/index.html.haml_spec.rb +++ b/spec/views/harvests/index.html.haml_spec.rb @@ -15,12 +15,12 @@ describe "harvests/index" do harvests = WillPaginate::Collection.create(page, per_page, total_entries) do |pager| pager.replace([ FactoryBot.create(:harvest, - crop: @tomato, + crop: @tomato, owner: @member), FactoryBot.create(:harvest, - crop: @maize, + crop: @maize, plant_part: @pp, - owner: @member) + owner: @member) ]) end assign(:harvests, harvests) diff --git a/spec/views/harvests/new.html.haml_spec.rb b/spec/views/harvests/new.html.haml_spec.rb index 6c75a3853..e0b79973f 100644 --- a/spec/views/harvests/new.html.haml_spec.rb +++ b/spec/views/harvests/new.html.haml_spec.rb @@ -12,7 +12,7 @@ describe "harvests/new" do assert_select "form", action: harvests_path, method: "post" do assert_select "input#crop", class: "ui-autocomplete-input" assert_select "input#harvest_crop_id", name: "harvest[crop_id]" - assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}", + assert_select 'input', id: "harvest_plant_part_id_#{PlantPart.first.id}", name: "harvest[plant_part_id]" # some browsers interpret without a step as "integer" assert_select "input#harvest_quantity[step=any]", name: "harvest[quantity]" diff --git a/spec/views/photos/edit.html.haml_spec.rb b/spec/views/photos/edit.html.haml_spec.rb index 1e94fb7b3..a954b84c1 100644 --- a/spec/views/photos/edit.html.haml_spec.rb +++ b/spec/views/photos/edit.html.haml_spec.rb @@ -5,9 +5,9 @@ require 'rails_helper' describe "photos/edit" do before do @photo = assign(:photo, stub_model(Photo, - owner_id: 1, + owner_id: 1, flickr_photo_id: 1, - thumbnail_url: "MyString", - fullsize_url: "MyString")) + thumbnail_url: "MyString", + fullsize_url: "MyString")) end end diff --git a/spec/views/plantings/_form.html.haml_spec.rb b/spec/views/plantings/_form.html.haml_spec.rb index a4f110a2f..0dc7a5a1a 100644 --- a/spec/views/plantings/_form.html.haml_spec.rb +++ b/spec/views/plantings/_form.html.haml_spec.rb @@ -11,9 +11,9 @@ describe "plantings/_form" do @crop = @lowercase # needed to render the form @planting = FactoryBot.create(:planting, - garden: @garden, - crop: @crop, - owner: @member, + garden: @garden, + crop: @crop, + owner: @member, planted_at: Date.new(2013, 3, 1)) @gardens = @member.gardens diff --git a/spec/views/plantings/edit.html.haml_spec.rb b/spec/views/plantings/edit.html.haml_spec.rb index 3acb14223..68e1d0f97 100644 --- a/spec/views/plantings/edit.html.haml_spec.rb +++ b/spec/views/plantings/edit.html.haml_spec.rb @@ -6,7 +6,7 @@ describe "plantings/edit" do before do @member = FactoryBot.create(:member, login_name: 'right', - email: 'right@example.com') + email: 'right@example.com') # creating two crops to make sure that the correct one is selected # in the form. diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb index c6a0ae446..f2f29f556 100644 --- a/spec/views/plantings/index.html.haml_spec.rb +++ b/spec/views/plantings/index.html.haml_spec.rb @@ -17,21 +17,21 @@ describe "plantings/index" do pager.replace([ FactoryBot.create(:planting, garden: garden, - crop: tomato, - owner: member), + crop: tomato, + owner: member), FactoryBot.create(:planting, - garden: garden, - crop: maize, - owner: garden.owner, + garden: garden, + crop: maize, + owner: garden.owner, description: '', - planted_at: Time.zone.local(2013, 1, 13)), + planted_at: Time.zone.local(2013, 1, 13)), FactoryBot.create(:planting, - garden: garden, - owner: garden.owner, - crop: tomato, - planted_at: Time.zone.local(2013, 1, 13), + garden: garden, + owner: garden.owner, + crop: tomato, + planted_at: Time.zone.local(2013, 1, 13), finished_at: Time.zone.local(2013, 1, 20), - finished: true) + finished: true) ]) end assign(:plantings, plantings) diff --git a/spec/views/posts/edit.html.haml_spec.rb b/spec/views/posts/edit.html.haml_spec.rb index c664f2131..876ae3f0b 100644 --- a/spec/views/posts/edit.html.haml_spec.rb +++ b/spec/views/posts/edit.html.haml_spec.rb @@ -34,7 +34,7 @@ describe "posts/edit" do before do @forum = assign(:forum, FactoryBot.create(:forum)) assign(:post, FactoryBot.create(:post, - forum: @forum, + forum: @forum, author: @author)) render end From 3316e68eb69e511995f4ea0d71dc913dab80f8f6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2020 03:28:18 +0000 Subject: [PATCH 3/8] Bump cancancan from 3.0.1 to 3.0.2 Bumps [cancancan](https://github.com/CanCanCommunity/cancancan) from 3.0.1 to 3.0.2. - [Release notes](https://github.com/CanCanCommunity/cancancan/releases) - [Changelog](https://github.com/CanCanCommunity/cancancan/blob/develop/CHANGELOG.md) - [Commits](https://github.com/CanCanCommunity/cancancan/compare/3.0.1...3.0.2) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index f3250321e..2b97e069c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -90,7 +90,7 @@ GEM activesupport (>= 3.0.0) uniform_notifier (~> 1.11) byebug (11.1.0) - cancancan (3.0.1) + cancancan (3.0.2) capybara (3.30.0) addressable mini_mime (>= 0.1.3) From bad93ed40d803aad3dd5e327de159ecf3b2a2356 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 21 Jan 2020 03:49:30 +0000 Subject: [PATCH 4/8] Bump faraday_middleware from 0.13.1 to 0.14.0 Bumps [faraday_middleware](https://github.com/lostisland/faraday_middleware) from 0.13.1 to 0.14.0. - [Release notes](https://github.com/lostisland/faraday_middleware/releases) - [Commits](https://github.com/lostisland/faraday_middleware/compare/v0.13.1...v0.14.0) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2b97e069c..3897c64d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -187,7 +187,7 @@ GEM i18n (>= 1.6, < 2) faraday (0.17.3) multipart-post (>= 1.2, < 3) - faraday_middleware (0.13.1) + faraday_middleware (0.14.0) faraday (>= 0.7.4, < 1.0) ffi (1.11.3) figaro (1.1.1) From 5ffcb938072125b0ffe8afa16f139f7e580e5f3a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2020 07:38:11 +0000 Subject: [PATCH 5/8] Bump elasticsearch from 6.8.0 to 6.8.1 Bumps [elasticsearch](https://github.com/elasticsearch/elasticsearch-ruby) from 6.8.0 to 6.8.1. - [Release notes](https://github.com/elasticsearch/elasticsearch-ruby/releases) - [Changelog](https://github.com/elastic/elasticsearch-ruby/blob/v6.8.1/CHANGELOG.md) - [Commits](https://github.com/elasticsearch/elasticsearch-ruby/compare/v6.8.0...v6.8.1) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3897c64d9..ddc1c222c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -160,18 +160,18 @@ GEM discard (1.1.0) activerecord (>= 4.2, < 7) docile (1.1.5) - elasticsearch (6.8.0) - elasticsearch-api (= 6.8.0) - elasticsearch-transport (= 6.8.0) - elasticsearch-api (6.8.0) + elasticsearch (6.8.1) + elasticsearch-api (= 6.8.1) + elasticsearch-transport (= 6.8.1) + elasticsearch-api (6.8.1) multi_json elasticsearch-model (7.0.0) activesupport (> 3) elasticsearch (> 1) hashie elasticsearch-rails (6.0.0) - elasticsearch-transport (6.8.0) - faraday + elasticsearch-transport (6.8.1) + faraday (>= 0.14, < 1) multi_json equalizer (0.0.11) erubi (1.9.0) From 944ff39d955668aac5a257dee23de0882436208c Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2020 07:41:00 +0000 Subject: [PATCH 6/8] Bump byebug from 11.1.0 to 11.1.1 Bumps [byebug](https://github.com/deivid-rodriguez/byebug) from 11.1.0 to 11.1.1. - [Release notes](https://github.com/deivid-rodriguez/byebug/releases) - [Changelog](https://github.com/deivid-rodriguez/byebug/blob/master/CHANGELOG.md) - [Commits](https://github.com/deivid-rodriguez/byebug/compare/v11.1.0...v11.1.1) Signed-off-by: dependabot-preview[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index ddc1c222c..86eaa8f94 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -89,7 +89,7 @@ GEM bullet (6.1.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.11) - byebug (11.1.0) + byebug (11.1.1) cancancan (3.0.2) capybara (3.30.0) addressable From d2d2c5f6856fb6d0a72d5067791cd49a40e06660 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 25 Jan 2020 08:11:41 +1300 Subject: [PATCH 7/8] Fixed planting owner name on homepage --- app/views/home/_plantings.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/home/_plantings.html.haml b/app/views/home/_plantings.html.haml index a3bb79f75..797391927 100644 --- a/app/views/home/_plantings.html.haml +++ b/app/views/home/_plantings.html.haml @@ -8,4 +8,4 @@ %h5= planting['crop_name'] - if planting['planted_from'].present? %span.badge.badge-success= planting['planted_from'].pluralize - %small.text-muted planted by #{planting['owner_name']} + %small.text-muted planted by #{planting['owner_login_name']} From 793bc17692e5e44e90c52862fad79e90b6913b18 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sat, 25 Jan 2020 08:12:21 +1300 Subject: [PATCH 8/8] Fix owner name in harvests on homepage --- app/views/home/_harvests.html.haml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/home/_harvests.html.haml b/app/views/home/_harvests.html.haml index b8d23f9be..6e25c0a4c 100644 --- a/app/views/home/_harvests.html.haml +++ b/app/views/home/_harvests.html.haml @@ -7,6 +7,6 @@ %h5= harvest.crop_name %span.badge.badge-success=harvest.plant_part %small.text-muted - harvested by #{harvest.owner_name} + harvested by #{harvest.owner_login_name} %p.mb-2 - = image_tag harvest.thumbnail_url, width: 75, class: 'rounded shadow' \ No newline at end of file + = image_tag harvest.thumbnail_url, width: 75, class: 'rounded shadow'