mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-05-18 21:56:55 -04:00
Rubocop upgrade (and some style fixes)
This commit is contained in:
@@ -7,12 +7,14 @@ AllCops:
|
||||
Exclude:
|
||||
- 'db/schema.rb'
|
||||
- 'vendor/**/*'
|
||||
TargetRailsVersion: 4.0
|
||||
|
||||
Rails:
|
||||
Enabled: true
|
||||
|
||||
Style/FileName:
|
||||
Exclude:
|
||||
- 'Guardfile'
|
||||
- 'Gemfile'
|
||||
- 'Gemfile.lock'
|
||||
|
||||
|
||||
5
Gemfile
5
Gemfile
@@ -1,4 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ruby '2.4.1'
|
||||
@@ -46,8 +47,8 @@ gem 'comfortable_mexican_sofa' # content management system
|
||||
gem 'bootstrap-kaminari-views' # bootstrap views for kaminari
|
||||
gem 'kaminari' # pagination
|
||||
|
||||
gem 'activemerchant'
|
||||
gem 'active_utils'
|
||||
gem 'activemerchant'
|
||||
gem 'sidekiq'
|
||||
|
||||
# Markdown formatting for updates etc
|
||||
@@ -144,7 +145,7 @@ group :development, :test do
|
||||
gem 'rainbow', '< 2.2.0' # See https://github.com/sickill/rainbow/issues/44
|
||||
gem 'rspec-activemodel-mocks'
|
||||
gem 'rspec-rails' # unit testing framework
|
||||
gem 'rubocop', '<= 0.47.1', require: false # Pin to rubocop (0.47.1) as 0.48.0 is buggy
|
||||
gem 'rubocop'
|
||||
gem 'selenium-webdriver'
|
||||
gem 'webrat' # provides HTML matchers for view tests
|
||||
end
|
||||
|
||||
@@ -366,6 +366,7 @@ GEM
|
||||
cocaine (~> 0.5.5)
|
||||
mime-types
|
||||
mimemagic (~> 0.3.0)
|
||||
parallel (1.12.0)
|
||||
parser (2.4.0.2)
|
||||
ast (~> 2.3)
|
||||
pg (0.21.0)
|
||||
@@ -461,7 +462,8 @@ GEM
|
||||
rspec-mocks (~> 3.7.0)
|
||||
rspec-support (~> 3.7.0)
|
||||
rspec-support (3.7.0)
|
||||
rubocop (0.47.1)
|
||||
rubocop (0.49.1)
|
||||
parallel (~> 1.10)
|
||||
parser (>= 2.3.3.1, < 3.0)
|
||||
powerpack (~> 0.1)
|
||||
rainbow (>= 1.99.1, < 3.0)
|
||||
@@ -623,7 +625,7 @@ DEPENDENCIES
|
||||
responders
|
||||
rspec-activemodel-mocks
|
||||
rspec-rails
|
||||
rubocop (<= 0.47.1)
|
||||
rubocop
|
||||
ruby-units
|
||||
sass-rails
|
||||
selenium-webdriver
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
guard :rspec,
|
||||
cmd: 'bundle exec rspec --format documentation',
|
||||
failed_mode: :keep do
|
||||
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" }
|
||||
watch('spec/spec_helper.rb') { "spec" }
|
||||
watch('spec/spec_helper.rb') { "spec" }
|
||||
|
||||
# Rails example
|
||||
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
||||
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
||||
watch('config/routes.rb') { "spec/routing" }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class AlternateNamesController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :show]
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :json
|
||||
responders :flash
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CommentsController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :show]
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :json
|
||||
respond_to :rss, only: :index
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
require 'will_paginate/array'
|
||||
|
||||
class CropsController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :hierarchy, :search, :show]
|
||||
before_action :authenticate_member!, except: %i(index hierarchy search show)
|
||||
load_and_authorize_resource
|
||||
skip_authorize_resource only: [:hierarchy, :search]
|
||||
skip_authorize_resource only: %i(hierarchy search)
|
||||
respond_to :html, :json, :rss, :csv
|
||||
responders :flash
|
||||
|
||||
@@ -134,7 +134,7 @@ class CropsController < ApplicationController
|
||||
end
|
||||
|
||||
def recreate_names(param_name, name_type)
|
||||
return unless params[param_name].present?
|
||||
return if params[param_name].blank?
|
||||
destroy_names(name_type)
|
||||
params[param_name].each do |_i, value|
|
||||
create_name!(name_type, value) unless value.empty?
|
||||
@@ -159,9 +159,9 @@ class CropsController < ApplicationController
|
||||
:request_notes,
|
||||
:reason_for_rejection,
|
||||
:rejection_notes,
|
||||
scientific_names_attributes: [:scientific_name,
|
||||
:_destroy,
|
||||
:id])
|
||||
scientific_names_attributes: %i(scientific_name
|
||||
_destroy
|
||||
id))
|
||||
end
|
||||
|
||||
def filename
|
||||
@@ -173,7 +173,7 @@ class CropsController < ApplicationController
|
||||
include: {
|
||||
plantings: {
|
||||
include: {
|
||||
owner: { only: [:id, :login_name, :location, :latitude, :longitude] }
|
||||
owner: { only: %i(id login_name location latitude longitude) }
|
||||
}
|
||||
},
|
||||
scientific_names: { only: [:name] },
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class GardensController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :show]
|
||||
after_action :expire_homepage, only: [:create, :delete]
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
after_action :expire_homepage, only: %i(create delete)
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :json
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class MembersController < ApplicationController
|
||||
load_and_authorize_resource except: [:finish_signup, :unsubscribe, :view_follows, :view_followers, :show]
|
||||
skip_authorize_resource only: [:nearby, :unsubscribe, :finish_signup]
|
||||
load_and_authorize_resource except: %i(finish_signup unsubscribe view_follows view_followers show)
|
||||
skip_authorize_resource only: %i(nearby unsubscribe finish_signup)
|
||||
respond_to :html, :json, :rss
|
||||
after_action :expire_homepage, only: :create
|
||||
|
||||
@@ -62,7 +62,6 @@ class MembersController < ApplicationController
|
||||
@member.update(@type => false)
|
||||
|
||||
flash.now[:notice] = I18n.t('members.unsubscribed', email_type: EMAIL_TYPE_STRING[@type])
|
||||
|
||||
rescue ActiveSupport::MessageVerifier::InvalidSignature
|
||||
flash.now[:alert] = I18n.t('members.unsubscribe.error')
|
||||
end
|
||||
@@ -88,11 +87,11 @@ class MembersController < ApplicationController
|
||||
end
|
||||
|
||||
def member_json_fields
|
||||
[
|
||||
:id, :login_name,
|
||||
:slug, :bio, :created_at,
|
||||
:location, :latitude, :longitude
|
||||
]
|
||||
%i(
|
||||
id login_name
|
||||
slug bio created_at
|
||||
location latitude longitude
|
||||
)
|
||||
end
|
||||
|
||||
def members
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class PhotosController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :show]
|
||||
after_action :expire_homepage, only: [:create, :delete]
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
after_action :expire_homepage, only: %i(create delete)
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :json
|
||||
responders :flash
|
||||
|
||||
@@ -7,9 +7,9 @@ class PlacesController < ApplicationController
|
||||
format.html
|
||||
# json response is whatever we want to map here
|
||||
format.json do
|
||||
render json: Member.located.to_json(only: [
|
||||
:id, :login_name, :slug, :location, :latitude, :longitude
|
||||
])
|
||||
render json: Member.located.to_json(only: %i(
|
||||
id login_name slug location latitude longitude
|
||||
))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -22,9 +22,9 @@ class PlacesController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html # show.html.haml
|
||||
format.json do
|
||||
render json: @nearby_members.to_json(only: [
|
||||
:id, :login_name, :slug, :location, :latitude, :longitude
|
||||
])
|
||||
render json: @nearby_members.to_json(only: %i(
|
||||
id login_name slug location latitude longitude
|
||||
))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
class PostsController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :show]
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :json
|
||||
respond_to :rss, only: [:index, :show]
|
||||
respond_to :rss, only: %i(index show)
|
||||
|
||||
# GET /posts
|
||||
# GET /posts.json
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class ScientificNamesController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :show]
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :json
|
||||
responders :flash
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class SeedsController < ApplicationController
|
||||
before_action :authenticate_member!, except: [:index, :show]
|
||||
before_action :authenticate_member!, except: %i(index show)
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :json
|
||||
respond_to :csv, only: :index
|
||||
|
||||
@@ -8,7 +8,7 @@ module CropsHelper
|
||||
total_quantity += seed.quantity if seed.quantity
|
||||
end
|
||||
|
||||
if !seeds.any?
|
||||
if seeds.none?
|
||||
return "You don't have any seeds of this crop."
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ module HarvestsHelper
|
||||
|
||||
if harvest.unit == 'individual' # just the number
|
||||
number_to_human(harvest.quantity, strip_insignificant_zeros: true)
|
||||
elsif !harvest.unit.blank? # pluralize anything else
|
||||
elsif harvest.unit.present? # pluralize anything else
|
||||
pluralize(number_to_human(harvest.quantity, strip_insignificant_zeros: true), harvest.unit)
|
||||
else
|
||||
"#{number_to_human(harvest.quantity, strip_insignificant_zeros: true)} #{harvest.unit}"
|
||||
|
||||
@@ -10,11 +10,11 @@ module PlantingsHelper
|
||||
end
|
||||
|
||||
def display_planted_from(planting)
|
||||
!planting.planted_from.blank? ? planting.planted_from : "not specified"
|
||||
planting.planted_from.present? ? planting.planted_from : "not specified"
|
||||
end
|
||||
|
||||
def display_planting_quantity(planting)
|
||||
!planting.quantity.blank? ? planting.quantity : "not specified"
|
||||
planting.quantity.present? ? planting.quantity : "not specified"
|
||||
end
|
||||
|
||||
def display_planting(planting)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Crop < ActiveRecord::Base
|
||||
extend FriendlyId
|
||||
friendly_id :name, use: [:slugged, :finders]
|
||||
friendly_id :name, use: %i(slugged finders)
|
||||
|
||||
##
|
||||
## Triggers
|
||||
|
||||
@@ -34,7 +34,7 @@ class CsvImporter
|
||||
|
||||
def add_scientific_names(scientific_names)
|
||||
names_to_add = []
|
||||
if !scientific_names.blank? # i.e. we actually passed something in, which isn't a given
|
||||
if scientific_names.present? # i.e. we actually passed something in, which isn't a given
|
||||
names_to_add = scientific_names.split(/,\s*/)
|
||||
elsif @crop.parent && !@crop.parent.scientific_names.empty? # pick up from parent
|
||||
names_to_add = @crop.parent.scientific_names.map(&:name)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Seed < ActiveRecord::Base
|
||||
extend FriendlyId
|
||||
include PhotoCapable
|
||||
friendly_id :seed_slug, use: [:slugged, :finders]
|
||||
friendly_id :seed_slug, use: %i(slugged finders)
|
||||
|
||||
TRADABLE_TO_VALUES = %w(nowhere locally nationally internationally).freeze
|
||||
ORGANIC_VALUES = ['certified organic', 'non-certified organic', 'conventional/non-organic', 'unknown'].freeze
|
||||
|
||||
@@ -43,7 +43,7 @@ Devise.setup do |config|
|
||||
# Configure which authentication keys should have whitespace stripped.
|
||||
# These keys will have whitespace before and after removed upon creating or
|
||||
# modifying a user and when used to authenticate or find a user. Default is :email.
|
||||
config.strip_whitespace_keys = [:email, :login_name]
|
||||
config.strip_whitespace_keys = %i(email login_name)
|
||||
|
||||
# Tell if authentication through request.params is enabled. True by default.
|
||||
# It can be set to an array that will enable params authentication only for the
|
||||
|
||||
@@ -12,14 +12,14 @@ Growstuff::Application.routes.draw do
|
||||
devise_scope :member do
|
||||
get '/members/unsubscribe/:message' => 'members#unsubscribe', :as => 'unsubscribe_member'
|
||||
end
|
||||
match '/members/:id/finish_signup' => 'members#finish_signup', via: [:get, :patch], :as => :finish_signup
|
||||
match '/members/:id/finish_signup' => 'members#finish_signup', via: %i(get patch), :as => :finish_signup
|
||||
|
||||
resources :members
|
||||
|
||||
resources :photos
|
||||
delete 'photo_associations' => 'photo_associations#destroy'
|
||||
|
||||
resources :authentications, only: [:create, :destroy]
|
||||
resources :authentications, only: %i(create destroy)
|
||||
|
||||
resources :plantings do
|
||||
resources :harvests
|
||||
@@ -59,7 +59,7 @@ Growstuff::Application.routes.draw do
|
||||
get 'reply', on: :member
|
||||
end
|
||||
|
||||
resources :follows, only: [:create, :destroy]
|
||||
resources :follows, only: %i(create destroy)
|
||||
get '/members/:login_name/follows' => 'members#view_follows', :as => 'member_follows'
|
||||
get '/members/:login_name/followers' => 'members#view_followers', :as => 'member_followers'
|
||||
|
||||
@@ -78,7 +78,7 @@ Growstuff::Application.routes.draw do
|
||||
resources :order_items
|
||||
resources :products
|
||||
|
||||
resources :likes, only: [:create, :destroy]
|
||||
resources :likes, only: %i(create destroy)
|
||||
|
||||
get "home/index"
|
||||
root to: 'home#index'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class AddCreationIndexToUpdates < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :updates, [:created_at, :user_id]
|
||||
add_index :updates, %i(created_at user_id)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class RenameNotificationFields < ActiveRecord::Migration
|
||||
def change
|
||||
change_table :notifications do |t| # rubocop:disable Rails/ReversibleMigration
|
||||
change_table :notifications do |t|
|
||||
t.rename :to_id, :recipient_id
|
||||
t.rename :from_id, :sender_id
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ class AddCropsPostsTable < ActiveRecord::Migration
|
||||
t.integer :crop_id
|
||||
t.integer :post_id
|
||||
end
|
||||
add_index :crops_posts, [:crop_id, :post_id]
|
||||
add_index :crops_posts, %i(crop_id post_id)
|
||||
add_index :crops_posts, :crop_id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class CreateIndexHarvestPhotos < ActiveRecord::Migration
|
||||
def change
|
||||
add_index(:harvests_photos, [:harvest_id, :photo_id])
|
||||
add_index(:harvests_photos, %i(harvest_id photo_id))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,6 +4,6 @@ class AddGardensPhotosTable < ActiveRecord::Migration
|
||||
t.integer :photo_id
|
||||
t.integer :garden_id
|
||||
end
|
||||
add_index(:gardens_photos, [:garden_id, :photo_id])
|
||||
add_index(:gardens_photos, %i(garden_id photo_id))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -33,8 +33,8 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_layouts, [:parent_id, :position]
|
||||
add_index :comfy_cms_layouts, [:site_id, :identifier], unique: true
|
||||
add_index :comfy_cms_layouts, %i(parent_id position)
|
||||
add_index :comfy_cms_layouts, %i(site_id identifier), unique: true
|
||||
|
||||
# -- Pages --------------------------------------------------------------
|
||||
create_table :comfy_cms_pages do |t|
|
||||
@@ -52,8 +52,8 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_pages, [:site_id, :full_path]
|
||||
add_index :comfy_cms_pages, [:parent_id, :position]
|
||||
add_index :comfy_cms_pages, %i(site_id full_path)
|
||||
add_index :comfy_cms_pages, %i(parent_id position)
|
||||
|
||||
# -- Page Blocks --------------------------------------------------------
|
||||
create_table :comfy_cms_blocks do |t|
|
||||
@@ -63,7 +63,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_blocks, [:identifier]
|
||||
add_index :comfy_cms_blocks, [:blockable_id, :blockable_type]
|
||||
add_index :comfy_cms_blocks, %i(blockable_id blockable_type)
|
||||
|
||||
# -- Snippets -----------------------------------------------------------
|
||||
create_table :comfy_cms_snippets do |t|
|
||||
@@ -75,8 +75,8 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.boolean :is_shared, null: false, default: false
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_snippets, [:site_id, :identifier], unique: true
|
||||
add_index :comfy_cms_snippets, [:site_id, :position]
|
||||
add_index :comfy_cms_snippets, %i(site_id identifier), unique: true
|
||||
add_index :comfy_cms_snippets, %i(site_id position)
|
||||
|
||||
# -- Files --------------------------------------------------------------
|
||||
create_table :comfy_cms_files do |t|
|
||||
@@ -90,10 +90,10 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.integer :position, null: false, default: 0
|
||||
t.timestamps null: true
|
||||
end
|
||||
add_index :comfy_cms_files, [:site_id, :label]
|
||||
add_index :comfy_cms_files, [:site_id, :file_file_name]
|
||||
add_index :comfy_cms_files, [:site_id, :position]
|
||||
add_index :comfy_cms_files, [:site_id, :block_id]
|
||||
add_index :comfy_cms_files, %i(site_id label)
|
||||
add_index :comfy_cms_files, %i(site_id file_file_name)
|
||||
add_index :comfy_cms_files, %i(site_id position)
|
||||
add_index :comfy_cms_files, %i(site_id block_id)
|
||||
|
||||
# -- Revisions -----------------------------------------------------------
|
||||
create_table :comfy_cms_revisions, force: true do |t|
|
||||
@@ -102,7 +102,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.text :data, text_limit
|
||||
t.datetime :created_at
|
||||
end
|
||||
add_index :comfy_cms_revisions, [:record_type, :record_id, :created_at],
|
||||
add_index :comfy_cms_revisions, %i(record_type record_id created_at),
|
||||
name: 'index_cms_revisions_on_rtype_and_rid_and_created_at'
|
||||
|
||||
# -- Categories ---------------------------------------------------------
|
||||
@@ -111,7 +111,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.string :label, null: false
|
||||
t.string :categorized_type, null: false
|
||||
end
|
||||
add_index :comfy_cms_categories, [:site_id, :categorized_type, :label],
|
||||
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'
|
||||
|
||||
@@ -120,7 +120,7 @@ class CreateCms < ActiveRecord::Migration
|
||||
t.string :categorized_type, null: false
|
||||
t.integer :categorized_id, null: false
|
||||
end
|
||||
add_index :comfy_cms_categorizations, [:category_id, :categorized_type, :categorized_id],
|
||||
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'
|
||||
end
|
||||
|
||||
@@ -4,6 +4,6 @@ class AddPhotosSeedsTable < ActiveRecord::Migration
|
||||
t.integer :photo_id
|
||||
t.integer :seed_id
|
||||
end
|
||||
add_index(:photos_seeds, [:seed_id, :photo_id])
|
||||
add_index(:photos_seeds, %i(seed_id photo_id))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ module Geocodable
|
||||
private
|
||||
|
||||
def empty_unwanted_geocodes
|
||||
return unless location.blank?
|
||||
return if location.present?
|
||||
self.latitude = nil
|
||||
self.longitude = nil
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ FactoryBot.define do
|
||||
sequence(:email) { |n| "member#{n}@example.com" }
|
||||
sequence(:login_name) { |n| "member#{n}" }
|
||||
|
||||
factory :member, aliases: [:author, :owner, :sender, :recipient, :creator] do
|
||||
factory :member, aliases: %i(author owner sender recipient creator) do
|
||||
login_name { generate(:login_name) }
|
||||
password 'password1'
|
||||
email { generate(:email) }
|
||||
|
||||
@@ -112,7 +112,7 @@ describe Seed do
|
||||
end
|
||||
|
||||
it 'should refuse invalid organic/GMO/heirloom values' do
|
||||
[:organic, :gmo, :heirloom].each do |field|
|
||||
%i(organic gmo heirloom).each do |field|
|
||||
@seed = FactoryBot.build(:seed, field => 'not valid')
|
||||
@seed.should_not be_valid
|
||||
@seed.errors[field].should_not be_empty
|
||||
@@ -120,7 +120,7 @@ describe Seed do
|
||||
end
|
||||
|
||||
it 'should not allow nil or blank values' do
|
||||
[:organic, :gmo, :heirloom].each do |field|
|
||||
%i(organic gmo heirloom).each do |field|
|
||||
@seed = FactoryBot.build(:seed, field => nil)
|
||||
@seed.should_not be_valid
|
||||
@seed = FactoryBot.build(:seed, field => '')
|
||||
|
||||
@@ -28,7 +28,7 @@ RSpec.configure do |config|
|
||||
# # => "be bigger than 2 and smaller than 4"
|
||||
# ...rather than:
|
||||
# # => "be bigger than 2"
|
||||
expectations.syntax = [:should, :expect]
|
||||
expectations.syntax = %i(should expect)
|
||||
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ RSpec.configure do |config|
|
||||
# a real object. This is generally recommended, and will default to
|
||||
# `true` in RSpec 4.
|
||||
mocks.verify_partial_doubles = false
|
||||
mocks.syntax = [:should, :expect]
|
||||
mocks.syntax = %i(should expect)
|
||||
end
|
||||
|
||||
# The settings below are suggested to provide a good initial experience
|
||||
|
||||
Reference in New Issue
Block a user