From 7b01fcbd4b73745fa859d862b1e53bfc206171de Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 30 Dec 2018 15:22:29 +1300 Subject: [PATCH] Align all the hashes --- Guardfile | 2 +- app/controllers/authentications_controller.rb | 8 +-- app/controllers/crops_controller.rb | 4 +- app/controllers/likes_controller.rb | 8 +-- app/controllers/members_controller.rb | 2 +- app/helpers/application_helper.rb | 2 +- app/mailers/notifier.rb | 2 +- app/models/comment.rb | 8 +-- app/models/crop.rb | 20 +++--- app/models/csv_importer.rb | 2 +- app/models/follow.rb | 6 +- app/models/garden.rb | 16 ++--- app/models/harvest.rb | 18 +++--- app/models/member.rb | 22 +++---- app/models/photo.rb | 16 ++--- app/models/planting.rb | 12 ++-- app/models/post.rb | 6 +- app/models/seed.rb | 6 +- app/services/crop_search_service.rb | 2 +- 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 +-- lib/tasks/growstuff.rake | 2 +- .../authentications_controller_spec.rb | 6 +- spec/controllers/crops_controller_spec.rb | 4 +- spec/controllers/forums_controller_spec.rb | 4 +- spec/controllers/harvests_controller_spec.rb | 8 +-- .../notifications_controller_spec.rb | 8 +-- .../photo_associations_controller_spec.rb | 4 +- spec/controllers/photos_controller_spec.rb | 22 +++---- spec/controllers/plantings_controller_spec.rb | 2 +- spec/features/crops/crop_detail_page_spec.rb | 4 +- spec/features/crops/crop_photos_spec.rb | 24 +++---- spec/features/gardens/gardens_index_spec.rb | 14 ++-- spec/features/notifications_spec.rb | 6 +- 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/planting_spec.rb | 8 +-- spec/models/post_spec.rb | 2 +- spec/requests/api/v1/crop_request_spec.rb | 42 ++++++------ spec/requests/api/v1/gardens_request_spec.rb | 32 +++++----- spec/requests/api/v1/harvest_request_spec.rb | 44 ++++++------- spec/requests/api/v1/member_request_spec.rb | 40 ++++++------ spec/requests/api/v1/photos_request_spec.rb | 40 ++++++------ .../requests/api/v1/plantings_request_spec.rb | 60 ++++++++--------- spec/requests/api/v1/seeds_request_spec.rb | 32 +++++----- spec/views/crops/_grown_for.html.haml_spec.rb | 2 +- spec/views/forums/edit.html.haml_spec.rb | 4 +- spec/views/harvests/index.html.haml_spec.rb | 6 +- spec/views/harvests/index.rss.haml_spec.rb | 8 +-- .../notifications/index.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/plantings/new.html.haml_spec.rb | 4 +- spec/views/posts/edit.html.haml_spec.rb | 2 +- spec/views/roles/edit.html.haml_spec.rb | 2 +- spec/views/roles/index.html.haml_spec.rb | 4 +- spec/views/roles/new.html.haml_spec.rb | 2 +- spec/views/roles/show.html.haml_spec.rb | 2 +- 68 files changed, 445 insertions(+), 445 deletions(-) diff --git a/Guardfile b/Guardfile index 4b5f3ccb5..0d6759dbf 100644 --- a/Guardfile +++ b/Guardfile @@ -1,5 +1,5 @@ guard :rspec, - cmd: 'bundle exec rspec --format documentation', + cmd: 'bundle exec rspec --format documentation', failed_mode: :keep do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/libs/#{m[1]}_spec.rb" } diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb index fc18ff4d7..f6bf1bb21 100644 --- a/app/controllers/authentications_controller.rb +++ b/app/controllers/authentications_controller.rb @@ -12,14 +12,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/crops_controller.rb b/app/controllers/crops_controller.rb index c5b268f8b..abfb47a0e 100644 --- a/app/controllers/crops_controller.rb +++ b/app/controllers/crops_controller.rb @@ -173,13 +173,13 @@ class CropsController < ApplicationController def crop_json_fields { include: { - plantings: { + plantings: { include: { owner: { only: %i(id login_name location latitude longitude) } } }, scientific_names: { only: [:name] }, - alternate_names: { only: [:name] } + alternate_names: { only: [:name] } } } end diff --git a/app/controllers/likes_controller.rb b/app/controllers/likes_controller.rb index 0fdc2f407..e942d5b1f 100644 --- a/app/controllers/likes_controller.rb +++ b/app/controllers/likes_controller.rb @@ -24,10 +24,10 @@ class LikesController < ApplicationController def render_json(like, liked_by_member: true) { - id: like.likeable.id, + id: like.likeable.id, liked_by_member: liked_by_member, - description: ActionController::Base.helpers.pluralize(like.likeable.likes.count, "like"), - url: like_path(like, format: :json) + description: ActionController::Base.helpers.pluralize(like.likeable.likes.count, "like"), + url: like_path(like, format: :json) } end @@ -35,7 +35,7 @@ class LikesController < ApplicationController respond_to do |format| format.html { redirect_to like.likeable } format.json do - render(json: render_json(like, liked_by_member: liked_by_member), + render(json: render_json(like, liked_by_member: liked_by_member), status: status_code) end end diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index ae720e57b..9576d6750 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -51,7 +51,7 @@ class MembersController < ApplicationController EMAIL_TYPE_STRING = { send_notification_email: "direct message notifications", - send_planting_reminder: "planting reminders" + send_planting_reminder: "planting reminders" }.freeze def unsubscribe diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 97ff16b76..9e65fc303 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -53,7 +53,7 @@ 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) end diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index 6b7420cba..0d4ea407e 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -19,7 +19,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 3c9f3ce42..182e1e61f 100644 --- a/app/models/comment.rb +++ b/app/models/comment.rb @@ -11,10 +11,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 525e3fb8d..2846b8a5f 100644 --- a/app/models/crop.rb +++ b/app/models/crop.rb @@ -44,10 +44,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? #################################### # Elastic search configuration @@ -57,22 +57,22 @@ class Crop < ApplicationRecord # In order to avoid clashing between different environments, # use Rails.env as a part of index name (eg. development_growstuff) index_name [Rails.env, "growstuff"].join('_') - settings index: { number_of_shards: 1 }, + settings index: { number_of_shards: 1 }, analysis: { tokenizer: { gs_edgeNGram_tokenizer: { - type: "edgeNGram", # edgeNGram: NGram match from the start of a token - min_gram: 3, - max_gram: 10, + type: "edgeNGram", # edgeNGram: NGram match from the start of a token + min_gram: 3, + max_gram: 10, # token_chars: Elasticsearch will split on characters # that don't belong to any of these classes token_chars: %w(letter digit) } }, - analyzer: { + analyzer: { gs_edgeNGram_analyzer: { tokenizer: "gs_edgeNGram_tokenizer", - filter: ["lowercase"] + filter: ["lowercase"] } } } do @@ -82,11 +82,11 @@ class Crop < ApplicationRecord indexes :approval_status, type: 'text' indexes :scientific_names do indexes :name, - type: 'text', + type: 'text', analyzer: 'gs_edgeNGram_analyzer', # Disabling field-length norm (norm). If the norm option is turned on(by default), # higher weigh would be given for shorter fields, which in our case is irrelevant. - norms: { enabled: false } + norms: { enabled: false } end indexes :alternate_names do indexes :name, type: 'text', analyzer: 'gs_edgeNGram_analyzer' diff --git a/app/models/csv_importer.rb b/app/models/csv_importer.rb index d3b992aba..d228bb3e1 100644 --- a/app/models/csv_importer.rb +++ b/app/models/csv_importer.rb @@ -11,7 +11,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 a70fd15f6..6562ca92c 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -6,9 +6,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 01466120f..880dda91e 100644 --- a/app/models/garden.rb +++ b/app/models/garden.rb @@ -29,20 +29,20 @@ class Garden < ApplicationRecord validates :area, numericality: { - only_integer: false, + only_integer: false, greater_than_or_equal_to: 0 }, - allow_nil: true + allow_nil: true 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" }, - allow_nil: true, + validates :area_unit, inclusion: { in: AREA_UNITS_VALUES.values, + message: "%s is not a valid area unit" }, + allow_nil: true, allow_blank: true after_validation :cleanup_area diff --git a/app/models/harvest.rb b/app/models/harvest.rb index 987c83d0b..94b71d7b4 100644 --- a/app/models/harvest.rb +++ b/app/models/harvest.rb @@ -9,15 +9,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 3a997840d..2247bd038 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -69,13 +69,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: { @@ -136,13 +136,13 @@ class Member < ApplicationRecord result = if set flickr.photosets.getPhotos( photoset_id: set, - page: page_num, - per_page: 30 + page: page_num, + per_page: 30 ) else flickr.people.getPhotos( - user_id: 'me', - page: page_num, + user_id: 'me', + page: page_num, per_page: 30 ) end @@ -199,9 +199,9 @@ class Member < ApplicationRecord return true if Rails.env.test? && !testing gibbon.lists.subscribe( - id: Rails.application.config.newsletter_list_id, - email: { email: email }, - merge_vars: { login_name: login_name }, + id: Rails.application.config.newsletter_list_id, + email: { email: email }, + merge_vars: { login_name: login_name }, double_optin: false # they already confirmed their email with us ) end @@ -209,7 +209,7 @@ class Member < ApplicationRecord def newsletter_unsubscribe(gibbon = Gibbon::API.new, testing = false) return true if Rails.env.test? && !testing - gibbon.lists.unsubscribe(id: Rails.application.config.newsletter_list_id, + gibbon.lists.unsubscribe(id: Rails.application.config.newsletter_list_id, email: { email: email }) end diff --git a/app/models/photo.rb b/app/models/photo.rb index f3636760c..87e9f9f4c 100644 --- a/app/models/photo.rb +++ b/app/models/photo.rb @@ -8,8 +8,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: :photographings, - source: :photographable, + through: :photographings, + source: :photographable, source_type: type end @@ -23,13 +23,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 27f99870b..984b55c03 100644 --- a/app/models/planting.rb +++ b/app/models/planting.rb @@ -21,14 +21,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', - required: false, - inverse_of: :child_plantings - has_many :child_seeds, class_name: 'Seed', # children + required: false, + 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 9e570b845..46efa2e45 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -80,9 +80,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 d9a2261d2..2075afba2 100644 --- a/app/models/seed.rb +++ b/app/models/seed.rb @@ -23,11 +23,11 @@ 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_nil: false, allow_blank: false, inclusion: { in: TRADABLE_TO_VALUES, message: "You may only trade seed nowhere, "\ diff --git a/app/services/crop_search_service.rb b/app/services/crop_search_service.rb index fb7716019..8fce60b2d 100644 --- a/app/services/crop_search_service.rb +++ b/app/services/crop_search_service.rb @@ -9,7 +9,7 @@ class CropSearchService filter: { term: { "approval_status" => "approved" } }, - must: { + must: { query_string: { query: "*#{search_str}*" } diff --git a/db/migrate/20150201052245_create_cms.rb b/db/migrate/20150201052245_create_cms.rb index 91fea54e8..71ba20b11 100644 --- a/db/migrate/20150201052245_create_cms.rb +++ b/db/migrate/20150201052245_create_cms.rb @@ -113,7 +113,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 @@ -122,7 +122,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 0a94cb71a..0e1332ab3 100644 --- a/db/migrate/20180213005731_seed_usage.rb +++ b/db/migrate/20180213005731_seed_usage.rb @@ -7,16 +7,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 4781bc80f..378b98875 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -57,9 +57,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! @@ -79,11 +79,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 @@ -94,9 +94,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! @@ -104,9 +104,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! @@ -116,9 +116,9 @@ end def create_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 de274dc35..3d80cee25 100644 --- a/lib/actions/oauth_signup_action.rb +++ b/lib/actions/oauth_signup_action.rb @@ -41,14 +41,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/lib/tasks/growstuff.rake b/lib/tasks/growstuff.rake index 4a6234c4b..4f22214ea 100644 --- a/lib/tasks/growstuff.rake +++ b/lib/tasks/growstuff.rake @@ -225,7 +225,7 @@ namespace :growstuff do if crop alternate_names.split(/,\s*/).each do |an| AlternateName.where( - name: an, + name: an, crop_id: crop.id ).first_or_create do |x| x.creator = cropbot diff --git a/spec/controllers/authentications_controller_spec.rb b/spec/controllers/authentications_controller_spec.rb index 8b61bbddc..db4bec89a 100644 --- a/spec/controllers/authentications_controller_spec.rb +++ b/spec/controllers/authentications_controller_spec.rb @@ -7,9 +7,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/crops_controller_spec.rb b/spec/controllers/crops_controller_spec.rb index afdea715c..ad011da74 100644 --- a/spec/controllers/crops_controller_spec.rb +++ b/spec/controllers/crops_controller_spec.rb @@ -5,9 +5,9 @@ describe CropsController do def valid_attributes { - name: "Tomato", + name: "Tomato", en_wikipedia_url: 'http://en.wikipedia.org/wiki/Tomato', - approval_status: 'approved' + approval_status: 'approved' } end diff --git a/spec/controllers/forums_controller_spec.rb b/spec/controllers/forums_controller_spec.rb index 5c59473cb..aeca681c1 100644 --- a/spec/controllers/forums_controller_spec.rb +++ b/spec/controllers/forums_controller_spec.rb @@ -5,9 +5,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/harvests_controller_spec.rb b/spec/controllers/harvests_controller_spec.rb index 186782e88..aad371da5 100644 --- a/spec/controllers/harvests_controller_spec.rb +++ b/spec/controllers/harvests_controller_spec.rb @@ -5,10 +5,10 @@ describe HarvestsController do def valid_attributes { - owner_id: subject.current_member.id, - crop_id: FactoryBot.create(:crop).id, + owner_id: subject.current_member.id, + crop_id: FactoryBot.create(:crop).id, plant_part_id: FactoryBot.create(:plant_part).id, - harvested_at: '2017-01-01' + harvested_at: '2017-01-01' } end @@ -176,7 +176,7 @@ describe HarvestsController do describe "does not save planting_id" do before do - put :update, params: { id: harvest.to_param, + put :update, params: { id: harvest.to_param, harvest: valid_attributes.merge(planting_id: not_my_planting.id) } end diff --git a/spec/controllers/notifications_controller_spec.rb b/spec/controllers/notifications_controller_spec.rb index 30cf37ddd..55ba4b947 100644 --- a/spec/controllers/notifications_controller_spec.rb +++ b/spec/controllers/notifications_controller_spec.rb @@ -6,8 +6,8 @@ describe NotificationsController do def valid_attributes { "recipient_id" => subject.current_member.id, - "sender_id" => FactoryBot.create(:member).id, - "subject" => 'test' + "sender_id" => FactoryBot.create(:member).id, + "subject" => 'test' } end @@ -18,9 +18,9 @@ describe NotificationsController do # attributes. def valid_attributes_for_sender { - "sender_id" => subject.current_member.id, + "sender_id" => subject.current_member.id, "recipient_id" => FactoryBot.create(:member).id, - "subject" => 'test' + "subject" => 'test' } end diff --git a/spec/controllers/photo_associations_controller_spec.rb b/spec/controllers/photo_associations_controller_spec.rb index 5ed022218..a7c05f029 100644 --- a/spec/controllers/photo_associations_controller_spec.rb +++ b/spec/controllers/photo_associations_controller_spec.rb @@ -6,8 +6,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 88ed6599b..e49d3b194 100644 --- a/spec/controllers/photos_controller_spec.rb +++ b/spec/controllers/photos_controller_spec.rb @@ -8,13 +8,13 @@ describe PhotosController do def valid_attributes member = FactoryBot.create(:member) { - "owner_id" => member.id, + "owner_id" => member.id, "flickr_photo_id" => 1, - "title" => "Photo", - "license_name" => "CC-BY", - "thumbnail_url" => 'http://example.com/thumb.jpg', - "fullsize_url" => 'http://example.com/full.jpg', - "link_url" => 'http://example.com' + "title" => "Photo", + "license_name" => "CC-BY", + "thumbnail_url" => 'http://example.com/thumb.jpg', + "fullsize_url" => 'http://example.com/full.jpg', + "link_url" => 'http://example.com' } end @@ -60,12 +60,12 @@ describe PhotosController do describe "POST create" do before(:each) 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 7f100d76b..e2c6522be 100644 --- a/spec/controllers/plantings_controller_spec.rb +++ b/spec/controllers/plantings_controller_spec.rb @@ -6,7 +6,7 @@ describe PlantingsController 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 a194e8f1e..cbc73cf9c 100644 --- a/spec/features/crops/crop_detail_page_spec.rb +++ b/spec/features/crops/crop_detail_page_spec.rb @@ -200,8 +200,8 @@ feature "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/crops/crop_photos_spec.rb b/spec/features/crops/crop_photos_spec.rb index efefc6a36..36138fed6 100644 --- a/spec/features/crops/crop_photos_spec.rb +++ b/spec/features/crops/crop_photos_spec.rb @@ -10,27 +10,27 @@ feature "crop detail page", js: true do let(:harvest) { create :harvest, owner: member } let(:valid_server) { 'https://farm5.staticflickr.com/' } let(:photo1) do - create(:photo, owner: member, - title: 'photo 1', - fullsize_url: "#{valid_server}photo1.jpg", + create(:photo, owner: member, + title: 'photo 1', + fullsize_url: "#{valid_server}photo1.jpg", thumbnail_url: "#{valid_server}thumb1.jpg") end let(:photo2) do - create(:photo, owner: member, - title: 'photo 2', - fullsize_url: "#{valid_server}photo2.jpg", + create(:photo, owner: member, + title: 'photo 2', + fullsize_url: "#{valid_server}photo2.jpg", thumbnail_url: "#{valid_server}thumb2.jpg") end let(:photo3) do - create(:photo, owner: member, - title: 'photo 3', - fullsize_url: "#{valid_server}photo3.jpg", + create(:photo, owner: member, + title: 'photo 3', + fullsize_url: "#{valid_server}photo3.jpg", thumbnail_url: "#{valid_server}thumb3.jpg") end let(:photo4) do - create(:photo, owner: member, - title: 'photo 4', - fullsize_url: "#{valid_server}photo4.jpg", + create(:photo, owner: member, + title: 'photo 4', + fullsize_url: "#{valid_server}photo4.jpg", thumbnail_url: "#{valid_server}thumb4.jpg") end diff --git a/spec/features/gardens/gardens_index_spec.rb b/spec/features/gardens/gardens_index_spec.rb index 03fc28447..ebe5f5547 100644 --- a/spec/features/gardens/gardens_index_spec.rb +++ b/spec/features/gardens/gardens_index_spec.rb @@ -79,10 +79,10 @@ feature "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, + 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 @@ -96,9 +96,9 @@ feature "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/notifications_spec.rb b/spec/features/notifications_spec.rb index a3049a0c2..05e6e2b9a 100644 --- a/spec/features/notifications_spec.rb +++ b/spec/features/notifications_spec.rb @@ -7,10 +7,10 @@ feature "Notifications", :js do context "On existing notification" do let!(:notification) do create :notification, - sender: sender, + sender: sender, recipient: recipient, - body: "Notification body", - post_id: nil + body: "Notification body", + post_id: nil end background do diff --git a/spec/helpers/harvests_helper_spec.rb b/spec/helpers/harvests_helper_spec.rb index 1ba63810d..d720f1318 100644 --- a/spec/helpers/harvests_helper_spec.rb +++ b/spec/helpers/harvests_helper_spec.rb @@ -4,7 +4,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' @@ -12,8 +12,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' @@ -21,8 +21,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' @@ -30,8 +30,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' @@ -39,30 +39,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 3af084d5a..f71fc6ef4 100644 --- a/spec/helpers/plantings_helper_spec.rb +++ b/spec/helpers/plantings_helper_spec.rb @@ -6,18 +6,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." 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 @@ -25,18 +25,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 @@ -45,18 +45,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 1710428a4..3fc37c00e 100644 --- a/spec/lib/actions/oauth_signup_action_spec.rb +++ b/spec/lib/actions/oauth_signup_action_spec.rb @@ -8,16 +8,16 @@ describe 'Growstuff::OauthSignupAction' do context 'with a valid authentication' do before :each 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 @@ -74,8 +74,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) @@ -118,13 +118,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 e95dfbdc6..7891135c9 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -20,13 +20,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 a76749130..42b8aa9aa 100644 --- a/spec/models/alternate_name_spec.rb +++ b/spec/models/alternate_name_spec.rb @@ -10,8 +10,8 @@ describe AlternateName do it 'should be 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 a52e6c583..1b8de81ed 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -259,20 +259,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 @@ -564,15 +564,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 455afeb9b..9711d2a59 100644 --- a/spec/models/harvest_spec.rb +++ b/spec/models/harvest_spec.rb @@ -150,74 +150,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 a6ec189dd..66612e5ad 100644 --- a/spec/models/plant_part_spec.rb +++ b/spec/models/plant_part_spec.rb @@ -11,10 +11,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 @@ -24,10 +24,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/planting_spec.rb b/spec/models/planting_spec.rb index 6647655ca..29241db3f 100644 --- a/spec/models/planting_spec.rb +++ b/spec/models/planting_spec.rb @@ -180,8 +180,8 @@ describe Planting do before do FactoryBot.create(:harvest, - planting: planting, - crop: planting.crop, + planting: planting, + crop: planting.crop, harvested_at: 10.days.ago) planting.update_harvest_days! planting.crop.update_harvest_medians @@ -402,8 +402,8 @@ describe Planting do # this one is newer, and has the same owner, through the garden @planting2 = FactoryBot.create(:planting, created_at: 1.minute.ago, - garden: @planting1.garden, - owner: @planting1.owner) + garden: @planting1.garden, + owner: @planting1.owner) @planting2.photos << FactoryBot.create(:photo, owner: @planting2.owner) @planting2.save diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 6c2d9b32e..eeda089d2 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -70,7 +70,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 d0f1948fa..31212ab2c 100644 --- a/spec/requests/api/v1/crop_request_spec.rb +++ b/spec/requests/api/v1/crop_request_spec.rb @@ -6,15 +6,15 @@ RSpec.describe 'Plantings', 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, - "photos" => photos_as_json_api, - "harvests" => harvests_as_json_api + "parent" => parent_as_json_api, + "photos" => photos_as_json_api, + "harvests" => harvests_as_json_api } } end @@ -22,37 +22,37 @@ RSpec.describe 'Plantings', type: :request do let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", - "related" => "#{resource_url}/harvests" } } + { "self" => "#{resource_url}/relationships/harvests", + "related" => "#{resource_url}/harvests" } } end let(:parent_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/parent", - "related" => "#{resource_url}/parent" } } + { "self" => "#{resource_url}/relationships/parent", + "related" => "#{resource_url}/parent" } } end let(:plantings_as_json_api) do { "links" => - { "self" => - "#{resource_url}/relationships/plantings", - "related" => "#{resource_url}/plantings" } } + { "self" => + "#{resource_url}/relationships/plantings", + "related" => "#{resource_url}/plantings" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", - "related" => "#{resource_url}/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 60283f7b7..8426dfcb2 100644 --- a/spec/requests/api/v1/gardens_request_spec.rb +++ b/spec/requests/api/v1/gardens_request_spec.rb @@ -6,36 +6,36 @@ 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, - "plantings" => plantings_as_json_api, - "photos" => photos_as_json_api - } } + { + "owner" => owner_as_json_api, + "plantings" => plantings_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" => - "#{resource_url}/relationships/plantings", - "related" => "#{resource_url}/plantings" } } + { "self" => + "#{resource_url}/relationships/plantings", + "related" => "#{resource_url}/plantings" } } end let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", - "related" => "#{resource_url}/owner" } } + { "self" => "#{resource_url}/relationships/owner", + "related" => "#{resource_url}/owner" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", - "related" => "#{resource_url}/photos" } } + { "self" => "#{resource_url}/relationships/photos", + "related" => "#{resource_url}/photos" } } end scenario '#index' do diff --git a/spec/requests/api/v1/harvest_request_spec.rb b/spec/requests/api/v1/harvest_request_spec.rb index 595774694..c4fddd350 100644 --- a/spec/requests/api/v1/harvest_request_spec.rb +++ b/spec/requests/api/v1/harvest_request_spec.rb @@ -6,15 +6,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 @@ -22,38 +22,38 @@ RSpec.describe 'Harvests', type: :request do let(:crop_as_json_api) do { "links" => - { "self" => - "#{resource_url}/relationships/crop", - "related" => "#{resource_url}/crop" } } + { "self" => + "#{resource_url}/relationships/crop", + "related" => "#{resource_url}/crop" } } end let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", - "related" => "#{resource_url}/owner" } } + { "self" => "#{resource_url}/relationships/owner", + "related" => "#{resource_url}/owner" } } end let(:planting_as_json_api) do { "links" => - { "self" => - "#{resource_url}/relationships/planting", - "related" => "#{resource_url}/planting" } } + { "self" => + "#{resource_url}/relationships/planting", + "related" => "#{resource_url}/planting" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", - "related" => "#{resource_url}/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 334a18fd9..f44b2a4ae 100644 --- a/spec/requests/api/v1/member_request_spec.rb +++ b/spec/requests/api/v1/member_request_spec.rb @@ -6,16 +6,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 @@ -23,32 +23,32 @@ RSpec.describe 'Members', type: :request do let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", - "related" => "#{resource_url}/harvests" } } + { "self" => "#{resource_url}/relationships/harvests", + "related" => "#{resource_url}/harvests" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", - "related" => "#{resource_url}/photos" } } + { "self" => "#{resource_url}/relationships/photos", + "related" => "#{resource_url}/photos" } } end let(:seeds_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/seeds", - "related" => "#{resource_url}/seeds" } } + { "self" => "#{resource_url}/relationships/seeds", + "related" => "#{resource_url}/seeds" } } end let(:plantings_as_json_api) do { "links" => - { "self" => - "#{resource_url}/relationships/plantings", - "related" => "#{resource_url}/plantings" } } + { "self" => + "#{resource_url}/relationships/plantings", + "related" => "#{resource_url}/plantings" } } end let(:gardens_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/gardens", - "related" => "#{resource_url}/gardens" } } + { "self" => "#{resource_url}/relationships/gardens", + "related" => "#{resource_url}/gardens" } } end let(:attributes) do @@ -80,7 +80,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 7ae939562..15fb8cd19 100644 --- a/spec/requests/api/v1/photos_request_spec.rb +++ b/spec/requests/api/v1/photos_request_spec.rb @@ -6,15 +6,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 @@ -22,36 +22,36 @@ RSpec.describe 'Photos', type: :request do let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", - "related" => "#{resource_url}/owner" } } + { "self" => "#{resource_url}/relationships/owner", + "related" => "#{resource_url}/owner" } } end let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", - "related" => "#{resource_url}/harvests" } } + { "self" => "#{resource_url}/relationships/harvests", + "related" => "#{resource_url}/harvests" } } end let(:gardens_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/gardens", - "related" => "#{resource_url}/gardens" } } + { "self" => "#{resource_url}/relationships/gardens", + "related" => "#{resource_url}/gardens" } } end let(:plantings_as_json_api) do { "links" => - { "self" => - "#{resource_url}/relationships/plantings", - "related" => "#{resource_url}/plantings" } } + { "self" => + "#{resource_url}/relationships/plantings", + "related" => "#{resource_url}/plantings" } } end 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 24085b00c..0291af4b2 100644 --- a/spec/requests/api/v1/plantings_request_spec.rb +++ b/spec/requests/api/v1/plantings_request_spec.rb @@ -6,15 +6,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 @@ -23,48 +23,48 @@ RSpec.describe 'Plantings', type: :request do let(:harvests_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/harvests", - "related" => "#{resource_url}/harvests" } } + { "self" => "#{resource_url}/relationships/harvests", + "related" => "#{resource_url}/harvests" } } end let(:photos_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/photos", - "related" => "#{resource_url}/photos" } } + { "self" => "#{resource_url}/relationships/photos", + "related" => "#{resource_url}/photos" } } end let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", - "related" => "#{resource_url}/owner" } } + { "self" => "#{resource_url}/relationships/owner", + "related" => "#{resource_url}/owner" } } end let(:crop_as_json_api) do { "links" => - { "self" => - "#{resource_url}/relationships/crop", - "related" => "#{resource_url}/crop" } } + { "self" => + "#{resource_url}/relationships/crop", + "related" => "#{resource_url}/crop" } } end let(:garden_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/garden", - "related" => "#{resource_url}/garden" } } + { "self" => "#{resource_url}/relationships/garden", + "related" => "#{resource_url}/garden" } } end let(:attributes) do { - "planted-at" => "2014-07-30", - "finished-at" => nil, - "finished" => false, - "quantity" => 33, - "description" => planting.description, - "sunniness" => nil, - "planted-from" => nil, - "expected-lifespan" => nil, + "planted-at" => "2014-07-30", + "finished-at" => nil, + "finished" => false, + "quantity" => 33, + "description" => planting.description, + "sunniness" => nil, + "planted-from" => nil, + "expected-lifespan" => nil, "finish-predicted-at" => nil, - "percentage-grown" => nil, - "first-harvest-date" => nil, - "last-harvest-date" => nil + "percentage-grown" => nil, + "first-harvest-date" => nil, + "last-harvest-date" => nil } end diff --git a/spec/requests/api/v1/seeds_request_spec.rb b/spec/requests/api/v1/seeds_request_spec.rb index 92cafc0a4..909d08864 100644 --- a/spec/requests/api/v1/seeds_request_spec.rb +++ b/spec/requests/api/v1/seeds_request_spec.rb @@ -6,13 +6,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 @@ -20,27 +20,27 @@ RSpec.describe 'Photos', type: :request do let(:owner_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/owner", - "related" => "#{resource_url}/owner" } } + { "self" => "#{resource_url}/relationships/owner", + "related" => "#{resource_url}/owner" } } end let(:crop_as_json_api) do { "links" => - { "self" => "#{resource_url}/relationships/crop", - "related" => "#{resource_url}/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/views/crops/_grown_for.html.haml_spec.rb b/spec/views/crops/_grown_for.html.haml_spec.rb index c378c296c..ccb04b28d 100644 --- a/spec/views/crops/_grown_for.html.haml_spec.rb +++ b/spec/views/crops/_grown_for.html.haml_spec.rb @@ -5,7 +5,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 44151170a..77f5cff31 100644 --- a/spec/views/forums/edit.html.haml_spec.rb +++ b/spec/views/forums/edit.html.haml_spec.rb @@ -3,9 +3,9 @@ require 'rails_helper' describe "forums/edit" do before(:each) 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/index.html.haml_spec.rb b/spec/views/harvests/index.html.haml_spec.rb index fe205cda6..b5ebcfb67 100644 --- a/spec/views/harvests/index.html.haml_spec.rb +++ b/spec/views/harvests/index.html.haml_spec.rb @@ -13,12 +13,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/index.rss.haml_spec.rb b/spec/views/harvests/index.rss.haml_spec.rb index aea1f7bc5..b0898cf78 100644 --- a/spec/views/harvests/index.rss.haml_spec.rb +++ b/spec/views/harvests/index.rss.haml_spec.rb @@ -13,13 +13,13 @@ describe 'harvests/index.rss.haml' 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, - quantity: 2) + owner: @member, + quantity: 2) ]) end assign(:harvests, harvests) diff --git a/spec/views/notifications/index.html.haml_spec.rb b/spec/views/notifications/index.html.haml_spec.rb index 2c8195069..0bb4257fa 100644 --- a/spec/views/notifications/index.html.haml_spec.rb +++ b/spec/views/notifications/index.html.haml_spec.rb @@ -8,7 +8,7 @@ describe "notifications/index" do context "ordinary notifications" do before(:each) do - @notification = FactoryBot.create(:notification, sender: @member, + @notification = FactoryBot.create(:notification, sender: @member, recipient: @member) assign(:notifications, Kaminari.paginate_array([@notification, @notification]).page(1)) render diff --git a/spec/views/photos/edit.html.haml_spec.rb b/spec/views/photos/edit.html.haml_spec.rb index a52b51a79..d83a1a911 100644 --- a/spec/views/photos/edit.html.haml_spec.rb +++ b/spec/views/photos/edit.html.haml_spec.rb @@ -3,9 +3,9 @@ require 'rails_helper' describe "photos/edit" do before(:each) 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 6371311ae..8da8f1bfe 100644 --- a/spec/views/plantings/_form.html.haml_spec.rb +++ b/spec/views/plantings/_form.html.haml_spec.rb @@ -9,9 +9,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)) sign_in @member diff --git a/spec/views/plantings/edit.html.haml_spec.rb b/spec/views/plantings/edit.html.haml_spec.rb index b83af0028..0afa1e829 100644 --- a/spec/views/plantings/edit.html.haml_spec.rb +++ b/spec/views/plantings/edit.html.haml_spec.rb @@ -4,7 +4,7 @@ describe "plantings/edit" do before(:each) 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 a3a713100..3df5b20ff 100644 --- a/spec/views/plantings/index.html.haml_spec.rb +++ b/spec/views/plantings/index.html.haml_spec.rb @@ -15,21 +15,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/plantings/new.html.haml_spec.rb b/spec/views/plantings/new.html.haml_spec.rb index 6667a05ee..6b6b11f57 100644 --- a/spec/views/plantings/new.html.haml_spec.rb +++ b/spec/views/plantings/new.html.haml_spec.rb @@ -13,8 +13,8 @@ describe "plantings/new" do assign(:planting, FactoryBot.create(:planting, garden: @garden_a, - crop: @crop2, - owner: @member)) + crop: @crop2, + owner: @member)) end context "logged in" do diff --git a/spec/views/posts/edit.html.haml_spec.rb b/spec/views/posts/edit.html.haml_spec.rb index 48d64a267..8ec056aff 100644 --- a/spec/views/posts/edit.html.haml_spec.rb +++ b/spec/views/posts/edit.html.haml_spec.rb @@ -32,7 +32,7 @@ describe "posts/edit" do before(:each) do @forum = assign(:forum, FactoryBot.create(:forum)) assign(:post, FactoryBot.create(:post, - forum: @forum, + forum: @forum, author: @author)) render end diff --git a/spec/views/roles/edit.html.haml_spec.rb b/spec/views/roles/edit.html.haml_spec.rb index a86f67ceb..01def5033 100644 --- a/spec/views/roles/edit.html.haml_spec.rb +++ b/spec/views/roles/edit.html.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe "roles/edit" do before(:each) do @role = assign(:role, stub_model(Role, - name: "MyString", + name: "MyString", description: "MyText")) end diff --git a/spec/views/roles/index.html.haml_spec.rb b/spec/views/roles/index.html.haml_spec.rb index e4b28e9ba..8338f3cd9 100644 --- a/spec/views/roles/index.html.haml_spec.rb +++ b/spec/views/roles/index.html.haml_spec.rb @@ -5,10 +5,10 @@ describe "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/roles/new.html.haml_spec.rb b/spec/views/roles/new.html.haml_spec.rb index 1cdce8c41..eab80fa36 100644 --- a/spec/views/roles/new.html.haml_spec.rb +++ b/spec/views/roles/new.html.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe "roles/new" do before(:each) do assign(:role, stub_model(Role, - name: "MyString", + name: "MyString", description: "MyText").as_new_record) end diff --git a/spec/views/roles/show.html.haml_spec.rb b/spec/views/roles/show.html.haml_spec.rb index 56f1cc4fb..f6d0b10b3 100644 --- a/spec/views/roles/show.html.haml_spec.rb +++ b/spec/views/roles/show.html.haml_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe "roles/show" do before(:each) do @role = assign(:role, stub_model(Role, - name: "Name", + name: "Name", description: "MyText")) end