Update rubocop config

This commit is contained in:
Brenda Wallace
2020-11-11 14:49:17 +13:00
committed by Brenda Wallace
parent 26f1991d16
commit 43a577fa50
4 changed files with 55 additions and 155 deletions

View File

@@ -1,6 +1,7 @@
inherit_from: .rubocop_todo.yml
require: rubocop-rails
AllCops:
NewCops: enable
Exclude:
- 'db/schema.rb'
- 'vendor/**/*'
@@ -60,103 +61,3 @@ Rails/SkipsModelValidations:
Exclude:
- 'db/migrate/20190317023129_finished_boolean.rb'
- 'db/seeds.rb'
Layout/EmptyLinesAroundAttributeAccessor:
Enabled: true
Layout/SpaceAroundMethodCallOperator:
Enabled: true
Lint/DeprecatedOpenSSLConstant:
Enabled: true
Lint/DuplicateElsifCondition:
Enabled: true
Lint/MixedRegexpCaptureTypes:
Enabled: true
Lint/RaiseException:
Enabled: true
Lint/StructNewOverride:
Enabled: true
Style/AccessorGrouping:
Enabled: true
Style/ArrayCoercion:
Enabled: true
Style/BisectedAttrAccessor:
Enabled: false
Style/CaseLikeIf:
Enabled: true
Style/ExponentialNotation:
Enabled: true
Style/HashAsLastArrayItem:
Enabled: true
Style/HashEachMethods:
Enabled: true
Style/HashLikeCase:
Enabled: true
Style/HashTransformKeys:
Enabled: true
Style/HashTransformValues:
Enabled: true
Style/RedundantAssignment:
Enabled: true
Style/RedundantFetchBlock:
Enabled: true
Style/RedundantFileExtensionInRequire:
Enabled: true
Style/RedundantRegexpCharacterClass:
Enabled: true
Style/RedundantRegexpEscape:
Enabled: true
Style/SlicingWithRange:
Enabled: true
Rails/ActiveRecordCallbacksOrder:
Enabled: true
Rails/FindById:
Enabled: true
Rails/Inquiry:
Enabled: true
Rails/MailerName:
Enabled: true
Rails/MatchRoute:
Enabled: true
Rails/NegateInclude:
Enabled: true
Rails/Pluck:
Enabled: true
Rails/PluckInWhere:
Enabled: true
Rails/RenderInline:
Enabled: true
Rails/RenderPlainText:
Enabled: true
Rails/ShortI18n:
Enabled: true
Rails/WhereExists:
Enabled: true
Lint/BinaryOperatorWithIdenticalOperands:
Enabled: true
Lint/DuplicateRescueException:
Enabled: true
Lint/EmptyConditionalBody:
Enabled: true
Lint/FloatComparison:
Enabled: true
Lint/MissingSuper:
Enabled: true
Lint/OutOfRangeRegexpRef:
Enabled: true
Lint/SelfAssignment:
Enabled: true
Lint/TopLevelReturnWithArgument:
Enabled: true
Lint/UnreachableLoop:
Enabled: true
Style/ExplicitBlockArgument:
Enabled: true
Style/GlobalStdStream:
Enabled: true
Style/OptionalBooleanParameter:
Enabled: true
Style/SingleArgumentDig:
Enabled: true
Style/StringConcatenation:
Enabled: true

View File

@@ -73,12 +73,12 @@ describe CropsController do
describe 'CREATE' do
let(:crop_params) do
{
crop: {
name: 'aubergine',
crop: {
name: 'aubergine',
en_wikipedia_url: "https://en.wikipedia.org/wiki/Eggplant"
},
alt_name: {"1": "egg plant", "2": "purple apple"},
sci_name: {"1": "fancy sci name", "2": ""}
alt_name: { "1": "egg plant", "2": "purple apple" },
sci_name: { "1": "fancy sci name", "2": "" }
}
end
subject { put :create, params: crop_params }

View File

@@ -4,7 +4,7 @@ require 'rails_helper'
require 'capybara/email/rspec'
describe "Planting reminder email", :js do
let(:member) { create :member }
let(:member) { create :member }
let(:mail) { NotifierMailer.planting_reminder(member) }
# Unfortunately, we can't use the default url options for ActionMailer as configured in

View File

@@ -1,50 +1,49 @@
# frozen_string_literal: true
require 'rails_helper'
describe "crops/show" do
before do
@crop = FactoryBot.create(:maize)
@posts = []
assign(:crop, @crop)
@member = FactoryBot.create(:crop_wrangling_member)
sign_in @member
@current_member = @member
@harvest = FactoryBot.create :harvest, owner: @member
controller.stub(:current_user) { @member }
end
it "hides sunniness block if no sunniness" do
render
expect(rendered).not_to have_content "Sunniness"
end
it "has sunniness block if sunny planting" do
FactoryBot.create(:sunny_planting, crop: @crop)
render
expect(rendered).to have_content "Sunniness"
end
it "hides planted from block if no planted_from" do
render
expect(rendered).not_to have_content "Planted from"
end
it "has planted from block if seed planting" do
FactoryBot.create(:seed_planting, crop: @crop)
render
expect(rendered).to have_content "Planted from"
end
it "hides harvested block if no harvests" do
render
expect(rendered).not_to have_content "Harvested for"
end
it "has harvested block if harvest" do
@crop.harvests << @harvest
render
expect(rendered).to have_content "Harvested for"
end
end
# frozen_string_literal: true
require 'rails_helper'
describe "crops/show" do
before do
@crop = FactoryBot.create(:maize)
@posts = []
assign(:crop, @crop)
@member = FactoryBot.create(:crop_wrangling_member)
sign_in @member
@current_member = @member
@harvest = FactoryBot.create :harvest, owner: @member
controller.stub(:current_user) { @member }
end
it "hides sunniness block if no sunniness" do
render
expect(rendered).not_to have_content "Sunniness"
end
it "has sunniness block if sunny planting" do
FactoryBot.create(:sunny_planting, crop: @crop)
render
expect(rendered).to have_content "Sunniness"
end
it "hides planted from block if no planted_from" do
render
expect(rendered).not_to have_content "Planted from"
end
it "has planted from block if seed planting" do
FactoryBot.create(:seed_planting, crop: @crop)
render
expect(rendered).to have_content "Planted from"
end
it "hides harvested block if no harvests" do
render
expect(rendered).not_to have_content "Harvested for"
end
it "has harvested block if harvest" do
@crop.harvests << @harvest
render
expect(rendered).to have_content "Harvested for"
end
end