From e184503caab16a9f28dca4b9a7e77b46f4500301 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Thu, 16 Feb 2017 12:24:13 +1300 Subject: [PATCH 1/5] Fix up to match rubocop's MultilineMethodCallBraceLayout recommendation --- .rubocop_todo.yml | 48 ------------------- app/controllers/application_controller.rb | 6 +-- app/controllers/authentications_controller.rb | 3 +- app/controllers/seeds_controller.rb | 3 +- .../order_items_controller_spec.rb | 3 +- spec/helpers/gardens_helper_spec.rb | 12 ++--- spec/helpers/harvests_helper_spec.rb | 21 +++----- spec/helpers/plantings_helper_spec.rb | 33 +++++-------- spec/helpers/seeds_helper_spec.rb | 12 ++--- spec/models/ability_spec.rb | 11 ++--- spec/models/crop_spec.rb | 24 ++++------ spec/models/harvest_spec.rb | 21 +++----- spec/models/member_spec.rb | 3 +- spec/models/order_spec.rb | 12 ++--- spec/models/plant_part_spec.rb | 12 ++--- spec/models/planting_spec.rb | 3 +- spec/models/post_spec.rb | 6 +-- .../account_types/edit.html.haml_spec.rb | 3 +- .../views/account_types/new.html.haml_spec.rb | 3 +- .../account_types/show.html.haml_spec.rb | 3 +- spec/views/crops/_grown_for.html.haml_spec.rb | 3 +- .../crops/_planting_advice.html.haml_spec.rb | 3 +- spec/views/forums/edit.html.haml_spec.rb | 3 +- spec/views/harvests/index.html.haml_spec.rb | 6 +-- spec/views/orders/show.html.haml_spec.rb | 6 +-- spec/views/photos/edit.html.haml_spec.rb | 3 +- spec/views/plant_parts/edit.html.haml_spec.rb | 3 +- spec/views/plant_parts/new.html.haml_spec.rb | 3 +- spec/views/plantings/_form.html.haml_spec.rb | 3 +- spec/views/plantings/edit.html.haml_spec.rb | 6 +-- spec/views/plantings/index.html.haml_spec.rb | 9 ++-- spec/views/plantings/new.html.haml_spec.rb | 3 +- spec/views/plantings/show.html.haml_spec.rb | 6 +-- spec/views/posts/edit.html.haml_spec.rb | 3 +- spec/views/products/edit.html.haml_spec.rb | 3 +- spec/views/products/new.html.haml_spec.rb | 3 +- spec/views/roles/edit.html.haml_spec.rb | 3 +- spec/views/roles/index.html.haml_spec.rb | 6 +-- spec/views/roles/new.html.haml_spec.rb | 3 +- spec/views/roles/show.html.haml_spec.rb | 3 +- .../scientific_names/edit.html.haml_spec.rb | 3 +- .../scientific_names/show.html.haml_spec.rb | 3 +- 42 files changed, 95 insertions(+), 234 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f0e268852..8aa09404a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -277,54 +277,6 @@ Style/MultilineIfThen: - 'script/check_contributors_md' - 'script/gemfile_check' -# Offense count: 95 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: symmetrical, new_line, same_line -Style/MultilineMethodCallBraceLayout: - Exclude: - - 'app/controllers/application_controller.rb' - - 'app/controllers/authentications_controller.rb' - - 'app/controllers/seeds_controller.rb' - - 'spec/controllers/order_items_controller_spec.rb' - - 'spec/helpers/gardens_helper_spec.rb' - - 'spec/helpers/harvests_helper_spec.rb' - - 'spec/helpers/plantings_helper_spec.rb' - - 'spec/helpers/seeds_helper_spec.rb' - - 'spec/models/ability_spec.rb' - - 'spec/models/crop_spec.rb' - - 'spec/models/harvest_spec.rb' - - 'spec/models/member_spec.rb' - - 'spec/models/order_spec.rb' - - 'spec/models/plant_part_spec.rb' - - 'spec/models/planting_spec.rb' - - 'spec/models/post_spec.rb' - - 'spec/views/account_types/edit.html.haml_spec.rb' - - 'spec/views/account_types/new.html.haml_spec.rb' - - 'spec/views/account_types/show.html.haml_spec.rb' - - 'spec/views/crops/_grown_for.html.haml_spec.rb' - - 'spec/views/crops/_planting_advice.html.haml_spec.rb' - - 'spec/views/forums/edit.html.haml_spec.rb' - - 'spec/views/harvests/index.html.haml_spec.rb' - - 'spec/views/orders/show.html.haml_spec.rb' - - 'spec/views/photos/edit.html.haml_spec.rb' - - 'spec/views/plant_parts/edit.html.haml_spec.rb' - - 'spec/views/plant_parts/new.html.haml_spec.rb' - - 'spec/views/plantings/_form.html.haml_spec.rb' - - 'spec/views/plantings/edit.html.haml_spec.rb' - - 'spec/views/plantings/index.html.haml_spec.rb' - - 'spec/views/plantings/new.html.haml_spec.rb' - - 'spec/views/plantings/show.html.haml_spec.rb' - - 'spec/views/posts/edit.html.haml_spec.rb' - - 'spec/views/products/edit.html.haml_spec.rb' - - 'spec/views/products/new.html.haml_spec.rb' - - 'spec/views/roles/edit.html.haml_spec.rb' - - 'spec/views/roles/index.html.haml_spec.rb' - - 'spec/views/roles/new.html.haml_spec.rb' - - 'spec/views/roles/show.html.haml_spec.rb' - - 'spec/views/scientific_names/edit.html.haml_spec.rb' - - 'spec/views/scientific_names/show.html.haml_spec.rb' - # Offense count: 2 Style/MultilineTernaryOperator: Exclude: diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 3b76c87b8..69cf7a4e1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -59,8 +59,7 @@ class ApplicationController < ActionController::Base # profile stuff :bio, :location, :latitude, :longitude, # email settings - :show_email, :newsletter, :send_notification_email, :send_planting_reminder - ) + :show_email, :newsletter, :send_notification_email, :send_planting_reminder) end devise_parameter_sanitizer.permit(:account_update) do |member| @@ -73,8 +72,7 @@ class ApplicationController < ActionController::Base # email settings :show_email, :newsletter, :send_notification_email, :send_planting_reminder, # update password - :current_password - ) + :current_password) end end end diff --git a/app/controllers/authentications_controller.rb b/app/controllers/authentications_controller.rb index 62806da84..311cf7a9b 100644 --- a/app/controllers/authentications_controller.rb +++ b/app/controllers/authentications_controller.rb @@ -18,7 +18,8 @@ class AuthenticationsController < ApplicationController .find_or_create_by( provider: auth['provider'], uid: auth['uid'], - name: name) + name: name + ) flash[:notice] = "Authentication successful." else diff --git a/app/controllers/seeds_controller.rb b/app/controllers/seeds_controller.rb index eaed1e6c3..6cf5094f6 100644 --- a/app/controllers/seeds_controller.rb +++ b/app/controllers/seeds_controller.rb @@ -101,7 +101,8 @@ class SeedsController < ApplicationController params.require(:seed).permit( :owner_id, :crop_id, :description, :quantity, :plant_before, :days_until_maturity_min, :days_until_maturity_max, :organic, :gmo, - :heirloom, :tradable_to, :slug) + :heirloom, :tradable_to, :slug + ) end def seeds(owner: nil, crop: nil) diff --git a/spec/controllers/order_items_controller_spec.rb b/spec/controllers/order_items_controller_spec.rb index c8b59dfea..8c5581e92 100644 --- a/spec/controllers/order_items_controller_spec.rb +++ b/spec/controllers/order_items_controller_spec.rb @@ -23,8 +23,7 @@ describe OrderItemsController do @order_item = FactoryGirl.create(:order_item, order: @order, product: @product, - price: @product.min_price - ) + price: @product.min_price) end describe "POST create" do diff --git a/spec/helpers/gardens_helper_spec.rb b/spec/helpers/gardens_helper_spec.rb index 82a729774..01e62a793 100644 --- a/spec/helpers/gardens_helper_spec.rb +++ b/spec/helpers/gardens_helper_spec.rb @@ -4,32 +4,28 @@ describe GardensHelper do describe "garden description" do it "is missing" do garden = FactoryGirl.create(:garden, - description: nil - ) + description: nil) result = helper.display_garden_description(garden) expect(result).to eq "no description provided." end it "is less than 130 characters long" do garden = FactoryGirl.create(:garden, - description: 'a' * 20 - ) + description: 'a' * 20) result = helper.display_garden_description(garden) expect(result).to eq 'a' * 20 end it "is 130 characters long" do garden = FactoryGirl.create(:garden, - description: 'a' * 130 - ) + description: 'a' * 130) result = helper.display_garden_description(garden) expect(result).to eq 'a' * 130 end it "is more than 130 characters long" do garden = FactoryGirl.create(:garden, - description: 'a' * 140 - ) + description: 'a' * 140) result = helper.display_garden_description(garden) expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", garden_path(garden)) end diff --git a/spec/helpers/harvests_helper_spec.rb b/spec/helpers/harvests_helper_spec.rb index 15cafc9c5..04dcc9dd8 100644 --- a/spec/helpers/harvests_helper_spec.rb +++ b/spec/helpers/harvests_helper_spec.rb @@ -5,8 +5,7 @@ describe HarvestsHelper do it "blank" do harvest = FactoryGirl.create(:harvest, quantity: nil, - weight_quantity: nil - ) + weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq 'not specified' end @@ -15,8 +14,7 @@ describe HarvestsHelper do harvest = FactoryGirl.create(:harvest, quantity: 3, unit: 'individual', - weight_quantity: nil - ) + weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq '3' end @@ -25,8 +23,7 @@ describe HarvestsHelper do harvest = FactoryGirl.create(:harvest, quantity: 1, unit: 'bunch', - weight_quantity: nil - ) + weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq '1 bunch' end @@ -35,8 +32,7 @@ describe HarvestsHelper do harvest = FactoryGirl.create(:harvest, quantity: 3, unit: 'bunch', - weight_quantity: nil - ) + weight_quantity: nil) result = helper.display_quantity(harvest) result.should eq '3 bunches' end @@ -46,8 +42,7 @@ describe HarvestsHelper do quantity: nil, unit: nil, weight_quantity: 3, - weight_unit: 'kg' - ) + weight_unit: 'kg') result = helper.display_quantity(harvest) result.should eq '3 kg' end @@ -57,8 +52,7 @@ describe HarvestsHelper do 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 @@ -68,8 +62,7 @@ describe HarvestsHelper do 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 e776501b4..abbf74bd4 100644 --- a/spec/helpers/plantings_helper_spec.rb +++ b/spec/helpers/plantings_helper_spec.rb @@ -7,8 +7,7 @@ describe PlantingsHelper do quantity: 5, planted_at: nil, finished_at: nil, - days_before_maturity: 17 - ) + days_before_maturity: 17) result = helper.display_days_before_maturity(planting) expect(result).to eq "unknown" end @@ -18,8 +17,7 @@ describe PlantingsHelper do quantity: 5, planted_at: Date.current, finished_at: nil, - days_before_maturity: 17 - ) + days_before_maturity: 17) result = helper.display_days_before_maturity(planting) expect(result).to eq "17" end @@ -35,8 +33,7 @@ describe PlantingsHelper do quantity: 5, planted_at: Date.new(0, 1, 1), finished_at: nil, - days_before_maturity: "17" - ) + days_before_maturity: "17") result = helper.display_days_before_maturity(planting) expect(result).to eq "0" end @@ -46,8 +43,7 @@ describe PlantingsHelper do quantity: 5, planted_at: Date.new(2012, 5, 12), finished_at: nil, - days_before_maturity: nil - ) + days_before_maturity: nil) result = helper.display_days_before_maturity(planting) expect(result).to eq "unknown" end @@ -57,8 +53,7 @@ describe PlantingsHelper do quantity: 5, planted_at: Date.current, finished_at: Date.current + 5, - days_before_maturity: nil - ) + days_before_maturity: nil) result = helper.display_days_before_maturity(planting) expect(result).to eq "5" end @@ -71,8 +66,7 @@ describe PlantingsHelper do planting = FactoryGirl.build(:planting, quantity: nil, planted_from: '', - owner: member - ) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady." end @@ -81,8 +75,7 @@ describe PlantingsHelper do planting = FactoryGirl.build(:planting, quantity: nil, planted_from: 'seed', - owner: member - ) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted seeds." end @@ -92,8 +85,7 @@ describe PlantingsHelper do planting = FactoryGirl.build(:planting, quantity: 10, planted_from: '', - owner: member - ) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted 10 units." end @@ -102,8 +94,7 @@ describe PlantingsHelper do planting = FactoryGirl.build(:planting, quantity: 5, planted_from: 'seed', - owner: member - ) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted 5 seeds." end @@ -114,8 +105,7 @@ describe PlantingsHelper do planting = FactoryGirl.build(:planting, quantity: 1, planted_from: '', - owner: member - ) + owner: member) result = helper.display_planting(planting) expect(result).to eq "crop_lady planted 1 unit." end @@ -124,8 +114,7 @@ describe PlantingsHelper do planting = FactoryGirl.build(:planting, 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/helpers/seeds_helper_spec.rb b/spec/helpers/seeds_helper_spec.rb index a0eeb49f5..4b8330e10 100644 --- a/spec/helpers/seeds_helper_spec.rb +++ b/spec/helpers/seeds_helper_spec.rb @@ -4,32 +4,28 @@ describe SeedsHelper do describe "seed description" do it "is missing" do seed = FactoryGirl.create(:seed, - description: nil - ) + description: nil) result = helper.display_seed_description(seed) expect(result).to eq "no description provided." end it "is less than 130 characters long" do seed = FactoryGirl.create(:seed, - description: 'a' * 20 - ) + description: 'a' * 20) result = helper.display_seed_description(seed) expect(result).to eq 'a' * 20 end it "is 130 characters long" do seed = FactoryGirl.create(:seed, - description: 'a' * 130 - ) + description: 'a' * 130) result = helper.display_seed_description(seed) expect(result).to eq 'a' * 130 end it "is more than 130 characters long" do seed = FactoryGirl.create(:seed, - description: 'a' * 140 - ) + description: 'a' * 140) result = helper.display_seed_description(seed) expect(result).to eq 'a' * 126 + '...' + ' ' + link_to("Read more", seed_path(seed)) end diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 7a01114c0..b46908776 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -13,25 +13,20 @@ describe Ability do it "member can't view someone else's notifications" do notification = FactoryGirl.create(:notification, - recipient: FactoryGirl.create(:member) - ) + recipient: FactoryGirl.create(:member)) ability.should_not be_able_to(:read, notification) end it "member can't send messages to themself" do ability.should_not be_able_to(:create, FactoryGirl.create(:notification, recipient: member, - sender: member - ) - ) + sender: member)) end it "member can send messages to someone else" do ability.should be_able_to(:create, FactoryGirl.create(:notification, recipient: FactoryGirl.create(:member), - sender: member - ) - ) + sender: member)) end end diff --git a/spec/models/crop_spec.rb b/spec/models/crop_spec.rb index de924aeeb..f2f2e4507 100644 --- a/spec/models/crop_spec.rb +++ b/spec/models/crop_spec.rb @@ -253,20 +253,16 @@ describe Crop do @bulb = FactoryGirl.create(:plant_part, name: 'bulb') @harvest1 = FactoryGirl.create(:harvest, crop: crop, - plant_part: @fruit - ) + plant_part: @fruit) @harvest2 = FactoryGirl.create(:harvest, crop: crop, - plant_part: @fruit - ) + plant_part: @fruit) @harvest3 = FactoryGirl.create(:harvest, crop: crop, - plant_part: @seed - ) + plant_part: @seed) @harvest4 = FactoryGirl.create(:harvest, crop: crop, - plant_part: @root - ) + plant_part: @root) crop.popular_plant_parts.should == { [@fruit.id, @fruit.name] => 2, [@seed.id, @seed.name] => 1, [@root.id, @root.name] => 1 } @@ -363,12 +359,10 @@ describe Crop do @pp2 = FactoryGirl.create(:plant_part) @h1 = FactoryGirl.create(:harvest, crop: @maize, - plant_part: @pp1 - ) + plant_part: @pp1) @h2 = FactoryGirl.create(:harvest, crop: @maize, - plant_part: @pp2 - ) + plant_part: @pp2) @maize.plant_parts.should include @pp1 @maize.plant_parts.should include @pp2 end @@ -378,12 +372,10 @@ describe Crop do @pp1 = FactoryGirl.create(:plant_part) @h1 = FactoryGirl.create(:harvest, crop: @maize, - plant_part: @pp1 - ) + plant_part: @pp1) @h2 = FactoryGirl.create(:harvest, crop: @maize, - plant_part: @pp1 - ) + plant_part: @pp1) @maize.plant_parts.should eq [@pp1] end diff --git a/spec/models/harvest_spec.rb b/spec/models/harvest_spec.rb index a3aedddf2..d4e8405b6 100644 --- a/spec/models/harvest_spec.rb +++ b/spec/models/harvest_spec.rb @@ -154,8 +154,7 @@ describe Harvest do quantity: nil, unit: nil, weight_quantity: nil, - weight_unit: nil - ) + weight_unit: nil) @h.to_s.should eq "apricots" end @@ -164,8 +163,7 @@ describe Harvest do quantity: 1, unit: 'individual', weight_quantity: nil, - weight_unit: nil - ) + weight_unit: nil) @h.to_s.should eq "1 individual apricot" end @@ -174,8 +172,7 @@ describe Harvest do quantity: 10, unit: 'individual', weight_quantity: nil, - weight_unit: nil - ) + weight_unit: nil) @h.to_s.should eq "10 individual apricots" end @@ -184,8 +181,7 @@ describe Harvest do quantity: 1, unit: 'bushel', weight_quantity: nil, - weight_unit: nil - ) + weight_unit: nil) @h.to_s.should eq "1 bushel of apricots" end @@ -194,8 +190,7 @@ describe Harvest do quantity: 1.5, unit: 'bushel', weight_quantity: nil, - weight_unit: nil - ) + weight_unit: nil) @h.to_s.should eq "1.5 bushels of apricots" end @@ -204,8 +199,7 @@ describe Harvest do quantity: 10, unit: 'bushel', weight_quantity: nil, - weight_unit: nil - ) + weight_unit: nil) @h.to_s.should eq "10 bushels of apricots" end @@ -214,8 +208,7 @@ describe Harvest do quantity: nil, unit: nil, weight_quantity: 1.2, - weight_unit: 'kg' - ) + weight_unit: 'kg') @h.to_s.should eq "apricots weighing 1.2 kg" end diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index a16fa9e05..7a656caea 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -351,8 +351,7 @@ describe 'member' do context "update account" do let(:product) { FactoryGirl.create(:product, - paid_months: 3 - )} + paid_months: 3)} let(:member) { FactoryGirl.create(:member) } it "sets account_type" do diff --git a/spec/models/order_spec.rb b/spec/models/order_spec.rb index 1f8bf88bf..56895e834 100644 --- a/spec/models/order_spec.rb +++ b/spec/models/order_spec.rb @@ -36,8 +36,7 @@ describe Order do @account_type = FactoryGirl.create(:account_type, name: 'paid') @product = FactoryGirl.create(:product, account_type: @account_type, - paid_months: 3 - ) + paid_months: 3) @order_item = FactoryGirl.create(:order_item, order_id: @order.id, product_id: @product.id) @@ -53,8 +52,7 @@ describe Order do @member = FactoryGirl.create(:member) @order = FactoryGirl.create(:order, member: @member) @product = FactoryGirl.create(:product, - min_price: 1000 - ) + min_price: 1000) # we force an order to only have one item at present. Add more if wanted # later. @order_item1 = FactoryGirl.create(:order_item, @@ -67,8 +65,7 @@ describe Order do @member = FactoryGirl.create(:member) @order = FactoryGirl.create(:order, member: @member) @product = FactoryGirl.create(:product, - min_price: 1000 - ) + min_price: 1000) # we force an order to only have one item at present. Add more if wanted # later. @order_item1 = FactoryGirl.create(:order_item, @@ -82,8 +79,7 @@ describe Order do @order = FactoryGirl.create(:order, member: @member) @product = FactoryGirl.create(:product, name: 'foo', - min_price: 1000 - ) + min_price: 1000) # we force an order to only have one item at present. Add more if wanted # later. @order_item1 = FactoryGirl.create(:order_item, diff --git a/spec/models/plant_part_spec.rb b/spec/models/plant_part_spec.rb index 5d0cfb9b7..864a164cf 100644 --- a/spec/models/plant_part_spec.rb +++ b/spec/models/plant_part_spec.rb @@ -12,12 +12,10 @@ describe PlantPart do @pp1 = FactoryGirl.create(:plant_part) @h1 = FactoryGirl.create(:harvest, crop: @tomato, - plant_part: @pp1 - ) + plant_part: @pp1) @h2 = FactoryGirl.create(:harvest, crop: @maize, - plant_part: @pp1 - ) + plant_part: @pp1) @pp1.crops.should include @tomato @pp1.crops.should include @maize end @@ -27,12 +25,10 @@ describe PlantPart do @pp1 = FactoryGirl.create(:plant_part) @h1 = FactoryGirl.create(:harvest, crop: @maize, - plant_part: @pp1 - ) + plant_part: @pp1) @h2 = FactoryGirl.create(:harvest, crop: @maize, - plant_part: @pp1 - ) + plant_part: @pp1) @pp1.crops.should eq [@maize] end end diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb index e3bc1b66f..045cdeb18 100644 --- a/spec/models/planting_spec.rb +++ b/spec/models/planting_spec.rb @@ -251,8 +251,7 @@ describe Planting do # this one is newer, and has the same owner, through the garden @planting2 = FactoryGirl.create(:planting, created_at: 1.minute.ago, - owner_id: @planting1.owner.id - ) + owner_id: @planting1.owner.id) @planting2.photos << FactoryGirl.create(:photo) @planting2.save diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 0a879e061..0c169f7a6 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -9,13 +9,11 @@ describe Post do FactoryGirl.create(:post, subject: 'first entry', author: member, - created_at: 2.days.ago - ) + created_at: 2.days.ago) FactoryGirl.create(:post, subject: 'second entry', author: member, - created_at: 1.day.ago - ) + created_at: 1.day.ago) Post.first.subject.should == "second entry" end diff --git a/spec/views/account_types/edit.html.haml_spec.rb b/spec/views/account_types/edit.html.haml_spec.rb index c53272c0e..09bcc35ce 100644 --- a/spec/views/account_types/edit.html.haml_spec.rb +++ b/spec/views/account_types/edit.html.haml_spec.rb @@ -17,8 +17,7 @@ describe "account_types/edit" do @account_type = assign(:account_type, stub_model(AccountType, name: "MyString", is_paid: false, - is_permanent_paid: false - )) + is_permanent_paid: false)) end it "renders the edit account_type form" do diff --git a/spec/views/account_types/new.html.haml_spec.rb b/spec/views/account_types/new.html.haml_spec.rb index 01e1f025a..3efc39b05 100644 --- a/spec/views/account_types/new.html.haml_spec.rb +++ b/spec/views/account_types/new.html.haml_spec.rb @@ -17,8 +17,7 @@ describe "account_types/new" do assign(:account_type, stub_model(AccountType, name: "MyString", is_paid: false, - is_permanent_paid: false - ).as_new_record) + is_permanent_paid: false).as_new_record) end it "renders new account_type form" do diff --git a/spec/views/account_types/show.html.haml_spec.rb b/spec/views/account_types/show.html.haml_spec.rb index adad83ad8..828639f00 100644 --- a/spec/views/account_types/show.html.haml_spec.rb +++ b/spec/views/account_types/show.html.haml_spec.rb @@ -17,8 +17,7 @@ describe "account_types/show" do @account_type = assign(:account_type, stub_model(AccountType, name: "Name", is_paid: false, - is_permanent_paid: false - )) + is_permanent_paid: false)) end it "renders attributes in

" do diff --git a/spec/views/crops/_grown_for.html.haml_spec.rb b/spec/views/crops/_grown_for.html.haml_spec.rb index 776d3bdf3..59b2d97af 100644 --- a/spec/views/crops/_grown_for.html.haml_spec.rb +++ b/spec/views/crops/_grown_for.html.haml_spec.rb @@ -18,8 +18,7 @@ describe "crops/_grown_for" do @pp = FactoryGirl.create(:plant_part) @harvest = FactoryGirl.create(:harvest, crop: @crop, - plant_part: @pp - ) + plant_part: @pp) end it 'shows plant parts' do diff --git a/spec/views/crops/_planting_advice.html.haml_spec.rb b/spec/views/crops/_planting_advice.html.haml_spec.rb index 62d85bcfa..d87b935d5 100644 --- a/spec/views/crops/_planting_advice.html.haml_spec.rb +++ b/spec/views/crops/_planting_advice.html.haml_spec.rb @@ -19,8 +19,7 @@ describe "crops/_planting_advice" do @garden = FactoryGirl.create(:garden, owner: @owner) @planting = FactoryGirl.create(:planting, garden: @garden, - crop: @crop - ) + crop: @crop) end context "sunniness" do diff --git a/spec/views/forums/edit.html.haml_spec.rb b/spec/views/forums/edit.html.haml_spec.rb index 002a52f3e..d7d426a8e 100644 --- a/spec/views/forums/edit.html.haml_spec.rb +++ b/spec/views/forums/edit.html.haml_spec.rb @@ -17,8 +17,7 @@ describe "forums/edit" do @forum = assign(:forum, stub_model(Forum, 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 32baadc1a..0b08da8be 100644 --- a/spec/views/harvests/index.html.haml_spec.rb +++ b/spec/views/harvests/index.html.haml_spec.rb @@ -26,13 +26,11 @@ describe "harvests/index" do pager.replace([ FactoryGirl.create(:harvest, crop: @tomato, - owner: @member - ), + owner: @member), FactoryGirl.create(:harvest, crop: @maize, plant_part: @pp, - owner: @member - ) + owner: @member) ]) end assign(:harvests, harvests) diff --git a/spec/views/orders/show.html.haml_spec.rb b/spec/views/orders/show.html.haml_spec.rb index b6c3da53b..80624b180 100644 --- a/spec/views/orders/show.html.haml_spec.rb +++ b/spec/views/orders/show.html.haml_spec.rb @@ -25,8 +25,7 @@ describe "orders/show" do @order_item = FactoryGirl.create(:order_item, order: @order, quantity: 2, - price: 9900 - ) + price: 9900) render end @@ -67,8 +66,7 @@ describe "orders/show" do @order_item = FactoryGirl.create(:order_item, order: @order, quantity: 2, - price: 9900 - ) + price: 9900) render end diff --git a/spec/views/photos/edit.html.haml_spec.rb b/spec/views/photos/edit.html.haml_spec.rb index 5ff07030b..f1f2eacc5 100644 --- a/spec/views/photos/edit.html.haml_spec.rb +++ b/spec/views/photos/edit.html.haml_spec.rb @@ -18,7 +18,6 @@ describe "photos/edit" do owner_id: 1, flickr_photo_id: 1, thumbnail_url: "MyString", - fullsize_url: "MyString" - )) + fullsize_url: "MyString")) end end diff --git a/spec/views/plant_parts/edit.html.haml_spec.rb b/spec/views/plant_parts/edit.html.haml_spec.rb index 2eeb4e535..e871b49d3 100644 --- a/spec/views/plant_parts/edit.html.haml_spec.rb +++ b/spec/views/plant_parts/edit.html.haml_spec.rb @@ -15,8 +15,7 @@ require 'rails_helper' describe "plant_parts/edit" do before(:each) do @plant_part = assign(:plant_part, stub_model(PlantPart, - name: "MyString" - )) + name: "MyString")) end it "renders the edit plant_part form" do diff --git a/spec/views/plant_parts/new.html.haml_spec.rb b/spec/views/plant_parts/new.html.haml_spec.rb index e25ba2da1..31218ee71 100644 --- a/spec/views/plant_parts/new.html.haml_spec.rb +++ b/spec/views/plant_parts/new.html.haml_spec.rb @@ -15,8 +15,7 @@ require 'rails_helper' describe "plant_parts/new" do before(:each) do assign(:plant_part, stub_model(PlantPart, - name: "MyString" - ).as_new_record) + name: "MyString").as_new_record) end it "renders new plant_part form" do diff --git a/spec/views/plantings/_form.html.haml_spec.rb b/spec/views/plantings/_form.html.haml_spec.rb index 1ba3be93e..937a95eea 100644 --- a/spec/views/plantings/_form.html.haml_spec.rb +++ b/spec/views/plantings/_form.html.haml_spec.rb @@ -24,8 +24,7 @@ describe "plantings/_form" do @planting = FactoryGirl.create(:planting, garden: @garden, crop: @crop, - planted_at: Date.new(2013, 03, 01) - ) + planted_at: Date.new(2013, 03, 01)) render end diff --git a/spec/views/plantings/edit.html.haml_spec.rb b/spec/views/plantings/edit.html.haml_spec.rb index 1ea5fc586..eb544ec36 100644 --- a/spec/views/plantings/edit.html.haml_spec.rb +++ b/spec/views/plantings/edit.html.haml_spec.rb @@ -16,8 +16,7 @@ describe "plantings/edit" do before(:each) do @member = FactoryGirl.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. @@ -29,8 +28,7 @@ describe "plantings/edit" do @garden2 = FactoryGirl.create(:garden_a, owner: @member) @planting = assign(:planting, - FactoryGirl.create(:planting, garden: @garden, crop: @tomato) - ) + FactoryGirl.create(:planting, garden: @garden, crop: @tomato)) end context "logged in" do diff --git a/spec/views/plantings/index.html.haml_spec.rb b/spec/views/plantings/index.html.haml_spec.rb index 54f2bb63a..5b0b38000 100644 --- a/spec/views/plantings/index.html.haml_spec.rb +++ b/spec/views/plantings/index.html.haml_spec.rb @@ -27,21 +27,18 @@ describe "plantings/index" do FactoryGirl.create(:planting, garden: @garden, crop: @tomato, - owner: @member - ), + owner: @member), FactoryGirl.create(:planting, garden: @garden, crop: @maize, description: '', - planted_at: Time.local(2013, 1, 13) - ), + planted_at: Time.local(2013, 1, 13)), FactoryGirl.create(:planting, garden: @garden, crop: @tomato, planted_at: Time.local(2013, 1, 13), finished_at: Time.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 2fadcf38b..c2f2dd80b 100644 --- a/spec/views/plantings/new.html.haml_spec.rb +++ b/spec/views/plantings/new.html.haml_spec.rb @@ -25,8 +25,7 @@ describe "plantings/new" do assign(:planting, FactoryGirl.create(:planting, garden: @garden_a, - crop: @crop2 - )) + crop: @crop2)) end context "logged in" do diff --git a/spec/views/plantings/show.html.haml_spec.rb b/spec/views/plantings/show.html.haml_spec.rb index f6136f8f6..f14003320 100644 --- a/spec/views/plantings/show.html.haml_spec.rb +++ b/spec/views/plantings/show.html.haml_spec.rb @@ -18,8 +18,7 @@ describe "plantings/show" do @crop = FactoryGirl.create(:tomato) @planting = assign(:planting, FactoryGirl.create(:planting, garden: @garden, crop: @crop, - planted_from: 'cutting') - ) + planted_from: 'cutting')) end before(:each) do @@ -31,8 +30,7 @@ describe "plantings/show" do context 'sunniness' do before(:each) do @p = assign(:planting, - FactoryGirl.create(:sunny_planting) - ) + FactoryGirl.create(:sunny_planting)) end it "shows the sunniness" do diff --git a/spec/views/posts/edit.html.haml_spec.rb b/spec/views/posts/edit.html.haml_spec.rb index d3342f5b9..490cb6f83 100644 --- a/spec/views/posts/edit.html.haml_spec.rb +++ b/spec/views/posts/edit.html.haml_spec.rb @@ -45,8 +45,7 @@ describe "posts/edit" do @forum = assign(:forum, FactoryGirl.create(:forum)) assign(:post, FactoryGirl.create(:post, forum: @forum, - author: @author - )) + author: @author)) render end diff --git a/spec/views/products/edit.html.haml_spec.rb b/spec/views/products/edit.html.haml_spec.rb index cb8269d9c..e0d8ebbda 100644 --- a/spec/views/products/edit.html.haml_spec.rb +++ b/spec/views/products/edit.html.haml_spec.rb @@ -17,8 +17,7 @@ describe "products/edit" do @product = assign(:product, stub_model(Product, name: "MyString", description: "MyString", - min_price: "9.99" - )) + min_price: "9.99")) end it "renders the edit product form" do diff --git a/spec/views/products/new.html.haml_spec.rb b/spec/views/products/new.html.haml_spec.rb index 172cdf2ee..d75741775 100644 --- a/spec/views/products/new.html.haml_spec.rb +++ b/spec/views/products/new.html.haml_spec.rb @@ -17,8 +17,7 @@ describe "products/new" do assign(:product, stub_model(Product, name: "MyString", description: "MyString", - min_price: "9.99" - ).as_new_record) + min_price: "9.99").as_new_record) end it "renders new product form" do diff --git a/spec/views/roles/edit.html.haml_spec.rb b/spec/views/roles/edit.html.haml_spec.rb index 44e32b306..9135b8639 100644 --- a/spec/views/roles/edit.html.haml_spec.rb +++ b/spec/views/roles/edit.html.haml_spec.rb @@ -16,8 +16,7 @@ describe "roles/edit" do before(:each) do @role = assign(:role, stub_model(Role, name: "MyString", - description: "MyText" - )) + description: "MyText")) end it "renders the edit role form" do diff --git a/spec/views/roles/index.html.haml_spec.rb b/spec/views/roles/index.html.haml_spec.rb index 00aca2be7..54fe35337 100644 --- a/spec/views/roles/index.html.haml_spec.rb +++ b/spec/views/roles/index.html.haml_spec.rb @@ -18,12 +18,10 @@ describe "roles/index" do assign(:roles, [ stub_model(Role, name: "Name", - description: "MyText" - ), + description: "MyText"), stub_model(Role, name: "Name", - description: "MyText" - ) + description: "MyText") ]) end diff --git a/spec/views/roles/new.html.haml_spec.rb b/spec/views/roles/new.html.haml_spec.rb index e884d6e64..a56fce052 100644 --- a/spec/views/roles/new.html.haml_spec.rb +++ b/spec/views/roles/new.html.haml_spec.rb @@ -16,8 +16,7 @@ describe "roles/new" do before(:each) do assign(:role, stub_model(Role, name: "MyString", - description: "MyText" - ).as_new_record) + description: "MyText").as_new_record) end it "renders new role form" do diff --git a/spec/views/roles/show.html.haml_spec.rb b/spec/views/roles/show.html.haml_spec.rb index cb208b487..03df232ec 100644 --- a/spec/views/roles/show.html.haml_spec.rb +++ b/spec/views/roles/show.html.haml_spec.rb @@ -16,8 +16,7 @@ describe "roles/show" do before(:each) do @role = assign(:role, stub_model(Role, name: "Name", - description: "MyText" - )) + description: "MyText")) end it "renders attributes in

" do diff --git a/spec/views/scientific_names/edit.html.haml_spec.rb b/spec/views/scientific_names/edit.html.haml_spec.rb index 446740f2d..131861a79 100644 --- a/spec/views/scientific_names/edit.html.haml_spec.rb +++ b/spec/views/scientific_names/edit.html.haml_spec.rb @@ -19,8 +19,7 @@ describe "scientific_names/edit" do sign_in @member controller.stub(:current_user) { @member } @scientific_name = assign(:scientific_name, - FactoryGirl.create(:zea_mays) - ) + FactoryGirl.create(:zea_mays)) render end diff --git a/spec/views/scientific_names/show.html.haml_spec.rb b/spec/views/scientific_names/show.html.haml_spec.rb index d044bfbcc..00ca59823 100644 --- a/spec/views/scientific_names/show.html.haml_spec.rb +++ b/spec/views/scientific_names/show.html.haml_spec.rb @@ -16,8 +16,7 @@ describe "scientific_names/show" do before(:each) do controller.stub(:current_user) { nil } @scientific_name = assign(:scientific_name, - FactoryGirl.create(:zea_mays) - ) + FactoryGirl.create(:zea_mays)) end it "renders attributes in

" do From 818466a142452ec7f960b5e1bd62acbf3dadea4f Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 19 Feb 2017 16:14:52 +1300 Subject: [PATCH 2/5] MethodCallWithoutArgsParentheses fixup --- .rubocop_todo.yml | 7 ------- spec/helpers/application_helper_spec.rb | 2 +- spec/views/plantings/new.html.haml_spec.rb | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8aa09404a..c7ed6a687 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -247,13 +247,6 @@ Style/Lambda: - 'spec/controllers/member_controller_spec.rb' - 'spec/models/photo_spec.rb' -# Offense count: 2 -# Cop supports --auto-correct. -Style/MethodCallWithoutArgsParentheses: - Exclude: - - 'spec/helpers/application_helper_spec.rb' - - 'spec/views/plantings/new.html.haml_spec.rb' - # Offense count: 8 # Cop supports --auto-correct. Style/MultilineBlockLayout: diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 7f623caef..346cf722a 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -125,7 +125,7 @@ describe ApplicationHelper do expect(build_alert_classes(:info)).to include 'alert-info' end it 'works when blank' do - expect(build_alert_classes()).to include 'alert-info' + expect(build_alert_classes).to include 'alert-info' end it 'includes base classes' do expect(build_alert_classes(:info)).to include 'alert alert-dismissable' diff --git a/spec/views/plantings/new.html.haml_spec.rb b/spec/views/plantings/new.html.haml_spec.rb index c2f2dd80b..57cb605d6 100644 --- a/spec/views/plantings/new.html.haml_spec.rb +++ b/spec/views/plantings/new.html.haml_spec.rb @@ -31,7 +31,7 @@ describe "plantings/new" do context "logged in" do before(:each) do sign_in @member - assign(:planting, Planting.new()) + assign(:planting, Planting.new) assign(:crop, @crop2) assign(:garden, @garden_z) render From 50624fb2cbf04ad67f358d418806b4652fd4c714 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 19 Feb 2017 16:16:35 +1300 Subject: [PATCH 3/5] Style/MultilineBlockLayout fix --- .rubocop_todo.yml | 10 ---------- app/controllers/members_controller.rb | 9 +++++---- spec/models/ability_spec.rb | 20 ++++++++++++-------- spec/models/member_spec.rb | 5 +++-- spec/models/planting_spec.rb | 5 +++-- 5 files changed, 23 insertions(+), 26 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index c7ed6a687..f1873051d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -247,16 +247,6 @@ Style/Lambda: - 'spec/controllers/member_controller_spec.rb' - 'spec/models/photo_spec.rb' -# Offense count: 8 -# Cop supports --auto-correct. -Style/MultilineBlockLayout: - Exclude: - - 'app/controllers/members_controller.rb' - - 'app/controllers/posts_controller.rb' - - 'spec/models/ability_spec.rb' - - 'spec/models/member_spec.rb' - - 'spec/models/planting_spec.rb' - # Offense count: 1 # Cop supports --auto-correct. Style/MultilineIfModifier: diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb index b522e0eea..1d56d0e8d 100644 --- a/app/controllers/members_controller.rb +++ b/app/controllers/members_controller.rb @@ -45,10 +45,11 @@ class MembersController < ApplicationController :latitude, :longitude ]) } - format.rss { render( - layout: false, - locals: { member: @member } - )} + format.rss { + render( + layout: false, + locals: { member: @member } + )} end end diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index b46908776..aed568fde 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -111,15 +111,19 @@ describe Ability do context "orders" do let(:order) { FactoryGirl.create(:order, member: member) } - let(:strangers_order) { FactoryGirl.create(:order, - member: FactoryGirl.create(:member)) } - let(:completed_order) { FactoryGirl.create(:completed_order, - member: member) } + let(:strangers_order) { + FactoryGirl.create(:order, + member: FactoryGirl.create(:member)) } + let(:completed_order) { + FactoryGirl.create(:completed_order, + member: member) } let(:order_item) { FactoryGirl.create(:order_item, order: order) } - let(:strangers_order_item) { FactoryGirl.create(:order_item, - order: strangers_order) } - let(:completed_order_item) { FactoryGirl.create(:order_item, - order: completed_order) } + let(:strangers_order_item) { + FactoryGirl.create(:order_item, + order: strangers_order) } + let(:completed_order_item) { + FactoryGirl.create(:order_item, + order: completed_order) } context "standard member" do it "can read their own orders" do diff --git a/spec/models/member_spec.rb b/spec/models/member_spec.rb index 7a656caea..c6f2ab071 100644 --- a/spec/models/member_spec.rb +++ b/spec/models/member_spec.rb @@ -350,8 +350,9 @@ describe 'member' do end context "update account" do - let(:product) { FactoryGirl.create(:product, - paid_months: 3)} + let(:product) { + FactoryGirl.create(:product, + paid_months: 3)} let(:member) { FactoryGirl.create(:member) } it "sets account_type" do diff --git a/spec/models/planting_spec.rb b/spec/models/planting_spec.rb index 045cdeb18..8b8f10690 100644 --- a/spec/models/planting_spec.rb +++ b/spec/models/planting_spec.rb @@ -4,8 +4,9 @@ describe Planting do let(:crop) { FactoryGirl.create(:tomato) } let(:garden_owner) { FactoryGirl.create(:member) } let(:garden) { FactoryGirl.create(:garden, owner: garden_owner) } - let(:planting) { FactoryGirl.create(:planting, - crop: crop, garden: garden)} + let(:planting) { + FactoryGirl.create(:planting, + crop: crop, garden: garden)} it 'has an owner' do planting.owner.should be_an_instance_of Member From ae3752e021ec98c63f113682c0914e5275c945e5 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 19 Feb 2017 16:19:16 +1300 Subject: [PATCH 4/5] DefWithParentheses fixup --- .rubocop_todo.yml | 6 ------ spec/views/posts/_single.html.haml_spec.rb | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f1873051d..a8942264f 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -183,12 +183,6 @@ Style/CommentAnnotation: Exclude: - 'app/controllers/crops_controller.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Style/DefWithParentheses: - Exclude: - - 'spec/views/posts/_single.html.haml_spec.rb' - # Offense count: 10 # Cop supports --auto-correct. Style/EachForSimpleLoop: diff --git a/spec/views/posts/_single.html.haml_spec.rb b/spec/views/posts/_single.html.haml_spec.rb index 656a4194b..b23d61af0 100644 --- a/spec/views/posts/_single.html.haml_spec.rb +++ b/spec/views/posts/_single.html.haml_spec.rb @@ -13,7 +13,7 @@ require 'rails_helper' describe "posts/_single" do - def render_post() + def render_post render partial: "single", locals: { post: @post } end From 550848a513db677514ea4ec1f7f14a7b333e4608 Mon Sep 17 00:00:00 2001 From: Brenda Wallace Date: Sun, 19 Feb 2017 16:20:45 +1300 Subject: [PATCH 5/5] ParenthesesAroundCondition fixup --- .rubocop_todo.yml | 9 --------- app/controllers/application_controller.rb | 12 ++++++------ app/controllers/orders_controller.rb | 2 +- app/helpers/crops_helper.rb | 2 +- config/factory_girl.rb | 2 +- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a8942264f..15f9036d2 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -324,15 +324,6 @@ Style/ParallelAssignment: Exclude: - 'app/mailers/notifier.rb' -# Offense count: 4 -# Cop supports --auto-correct. -# Configuration parameters: AllowSafeAssignment. -Style/ParenthesesAroundCondition: - Exclude: - - 'app/controllers/application_controller.rb' - - 'app/controllers/orders_controller.rb' - - 'app/helpers/crops_helper.rb' - - 'config/factory_girl.rb' # Offense count: 5 # Cop supports --auto-correct. diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 69cf7a4e1..adab37357 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,12 +7,12 @@ class ApplicationController < ActionController::Base before_action :set_locale def store_location - unless (request.path.in?(["/members/sign_in", - "/members/sign_up", - "/members/password/new", - "/members/password/edit", - "/members/confirmation", - "/members/sign_out"]) || request.xhr?) + unless request.path.in?(["/members/sign_in", + "/members/sign_up", + "/members/password/new", + "/members/password/edit", + "/members/confirmation", + "/members/sign_out"]) || request.xhr? store_location_for(:member, request.fullpath) end end diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index def0a018a..3bc9fe45c 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -48,7 +48,7 @@ class OrdersController < ApplicationController end def complete - if (params[:token] && params['PayerID']) + if params[:token] && params['PayerID'] purchase = EXPRESS_GATEWAY.purchase( @order.total, currency: Growstuff::Application.config.currency, diff --git a/app/helpers/crops_helper.rb b/app/helpers/crops_helper.rb index 079d56598..2b1c08ad7 100644 --- a/app/helpers/crops_helper.rb +++ b/app/helpers/crops_helper.rb @@ -12,7 +12,7 @@ module CropsHelper return "You don't have any seeds of this crop." end - if (total_quantity != 0) + if total_quantity != 0 "You have #{total_quantity} #{Seed.model_name.human(count: total_quantity)} of this crop." else "You have an unknown quantity of seeds of this crop." diff --git a/config/factory_girl.rb b/config/factory_girl.rb index f9e9b5bfb..dc0ab40b4 100644 --- a/config/factory_girl.rb +++ b/config/factory_girl.rb @@ -1,6 +1,6 @@ ActionDispatch::Callbacks.after do # Reload the factories - return unless (Rails.env.development? || Rails.env.test?) + return unless Rails.env.development? || Rails.env.test? unless FactoryGirl.factories.blank? # first init will load factories, this should only run on subsequent reloads FactoryGirl.factories.clear