Merge pull request #1217 from Br3nda/MultilineMethodCallBraceLayout

Fix up to match rubocop's MultilineMethodCallBraceLayout recommendation
This commit is contained in:
pozorvlak
2017-02-20 12:46:17 +00:00
committed by GitHub
48 changed files with 129 additions and 293 deletions

View File

@@ -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:
@@ -247,23 +241,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:
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:
@@ -277,54 +254,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:
@@ -395,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.

View File

@@ -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
@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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)

View File

@@ -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."

View File

@@ -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

View File

@@ -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

View File

@@ -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'

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
@@ -116,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

View File

@@ -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

View File

@@ -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

View File

@@ -350,9 +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

View File

@@ -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,

View File

@@ -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

View File

@@ -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
@@ -251,8 +252,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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <p>" do

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -25,14 +25,13 @@ describe "plantings/new" do
assign(:planting, FactoryGirl.create(:planting,
garden: @garden_a,
crop: @crop2
))
crop: @crop2))
end
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

View File

@@ -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

View File

@@ -13,7 +13,7 @@
require 'rails_helper'
describe "posts/_single" do
def render_post()
def render_post
render partial: "single", locals: { post: @post }
end

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <p>" do

View File

@@ -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

View File

@@ -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 <p>" do