Enable RSpec/LetBeforeExamples cop & fix issues

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/LetBeforeExamples
This commit is contained in:
Bertocq
2018-01-07 02:28:06 +01:00
parent 4bb75c3a11
commit 3e5b13ae4d
5 changed files with 15 additions and 11 deletions

View File

@@ -115,3 +115,6 @@ RSpec/IteratedExpectation:
RSpec/LeadingSubject: RSpec/LeadingSubject:
Enabled: true Enabled: true
RSpec/LetBeforeExamples:
Enabled: true

View File

@@ -3,9 +3,6 @@ require 'sessions_helper'
feature 'Budget Investments' do feature 'Budget Investments' do
context "Concerns" do
it_behaves_like 'notifiable in-app', Budget::Investment
end
let(:author) { create(:user, :level_two, username: 'Isabel') } let(:author) { create(:user, :level_two, username: 'Isabel') }
let(:budget) { create(:budget, name: "Big Budget") } let(:budget) { create(:budget, name: "Big Budget") }
@@ -21,6 +18,10 @@ feature 'Budget Investments' do
Setting['feature.allow_images'] = nil Setting['feature.allow_images'] = nil
end end
context "Concerns" do
it_behaves_like 'notifiable in-app', Budget::Investment
end
scenario 'Index' do scenario 'Index' do
investments = [create(:budget_investment, heading: heading), investments = [create(:budget_investment, heading: heading),
create(:budget_investment, heading: heading), create(:budget_investment, heading: heading),

View File

@@ -3,14 +3,14 @@ include ActionView::Helpers::DateHelper
feature 'Commenting legislation questions' do feature 'Commenting legislation questions' do
context "Concerns" do
it_behaves_like 'notifiable in-app', Legislation::Question
end
let(:user) { create :user, :level_two } let(:user) { create :user, :level_two }
let(:process) { create :legislation_process, :in_debate_phase } let(:process) { create :legislation_process, :in_debate_phase }
let(:legislation_question) { create :legislation_question, process: process } let(:legislation_question) { create :legislation_question, process: process }
context "Concerns" do
it_behaves_like 'notifiable in-app', Legislation::Question
end
scenario 'Index' do scenario 'Index' do
3.times { create(:comment, commentable: legislation_question) } 3.times { create(:comment, commentable: legislation_question) }

View File

@@ -2,10 +2,10 @@ require 'rails_helper'
describe Budget::Group do describe Budget::Group do
it_behaves_like "sluggable"
let(:budget) { create(:budget) } let(:budget) { create(:budget) }
it_behaves_like "sluggable"
describe "name" do describe "name" do
before do before do
create(:budget_group, budget: budget, name: 'object name') create(:budget_group, budget: budget, name: 'object name')

View File

@@ -2,11 +2,11 @@ require 'rails_helper'
describe Budget::Heading do describe Budget::Heading do
it_behaves_like "sluggable"
let(:budget) { create(:budget) } let(:budget) { create(:budget) }
let(:group) { create(:budget_group, budget: budget) } let(:group) { create(:budget_group, budget: budget) }
it_behaves_like "sluggable"
describe "name" do describe "name" do
before do before do
create(:budget_heading, group: group, name: 'object name') create(:budget_heading, group: group, name: 'object name')