Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
ripan committed Jun 25, 2024
1 parent 9b614ab commit f661e87
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions app/models/crime_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ def employments
end

def applicant_employments
@applicant_employments ||= employments.select{|e| e.ownership_type == 'applicant'}
@applicant_employments ||= employments.select { |e| e.ownership_type == 'applicant' }
end

def partner_employments
@partner_employments ||= employments.select{|e| e.ownership_type == 'partner'}
@partner_employments ||= employments.select { |e| e.ownership_type == 'partner' }
end

def income_benefits
Expand Down
16 changes: 12 additions & 4 deletions app/presenters/income_payments_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,27 @@ def formatted_income_payments(ownership_type)
end

def applicant_employment_income
@income_payments&.detect { |income_payment| income_payment.payment_type == 'employment' && income_payment.ownership_type == 'applicant' }
@income_payments&.detect do |income_payment|
income_payment.payment_type == 'employment' && income_payment.ownership_type == 'applicant'
end
end

def partner_employment_income
@income_payments&.detect { |income_payment| income_payment.payment_type == 'employment' && income_payment.ownership_type == 'partner' }
@income_payments&.detect do |income_payment|
income_payment.payment_type == 'employment' && income_payment.ownership_type == 'partner'
end
end

def applicant_other_work_benefits
@income_payments&.detect { |income_payment| income_payment.payment_type == 'work_benefits' && income_payment.ownership_type == 'applicant' }
@income_payments&.detect do |income_payment|
income_payment.payment_type == 'work_benefits' && income_payment.ownership_type == 'applicant'
end
end

def partner_other_work_benefits
@income_payments&.detect { |income_payment| income_payment.payment_type == 'work_benefits' && income_payment.ownership_type == 'partner' }
@income_payments&.detect do |income_payment|
income_payment.payment_type == 'work_benefits' && income_payment.ownership_type == 'partner'
end
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
visit crime_application_path(application_id)
end

context 'when client has employments' do
context 'when client/partner has employments' do
let(:means_details) { JSON.parse(LaaCrimeSchemas.fixture(1.0, name: 'means').read) }

let(:application_data) do
Expand All @@ -22,14 +22,15 @@
expect(page).to have_css('h2.govuk-summary-card__title', text: 'Job')
end

# rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength, RSpec/NestedGroups
describe 'a jobs card' do
context 'with deductions' do
context 'job_card 1' do
context 'with job_card 1' do
subject(:applicant_job_card) do
page.all('h2.govuk-summary-card__title', text: 'Job 1')[0].ancestor('div.govuk-summary-card')
end

it 'shows jobs details with deductions' do # rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength
it 'shows jobs details with deductions' do
within(applicant_job_card) do |card|
expect(card).to have_summary_row "Employer's name", 'Joe Goodwin'
expect(card).to have_summary_row 'Address',
Expand All @@ -43,12 +44,12 @@
end
end

context 'job_card 2' do
context 'with job_card 2' do
subject(:partner_job_card) do
page.all('h2.govuk-summary-card__title', text: 'Job 1')[1].ancestor('div.govuk-summary-card')
end

it 'shows jobs details with deductions' do # rubocop:disable RSpec/MultipleExpectations, RSpec/ExampleLength
it 'shows jobs details with deductions' do
within(partner_job_card) do |card|
expect(card).to have_summary_row "Employer's name", 'Andy Murray'
expect(card).to have_summary_row 'Address',
Expand All @@ -64,12 +65,12 @@
end

context 'without deductions' do
context 'job_card 1' do
context 'with job_card 1' do
subject(:applicant_job_card) do
page.all('h2.govuk-summary-card__title', text: 'Job 2')[0].ancestor('div.govuk-summary-card')
end

it 'shows jobs details without deductions' do # rubocop:disable RSpec/MultipleExpectations
it 'shows jobs details without deductions' do
within(applicant_job_card) do |card|
expect(card).to have_summary_row "Employer's name", 'Teegan Ayala'
expect(card).to have_summary_row 'Address',
Expand All @@ -80,12 +81,13 @@
end
end
end
context 'job_card 2' do

context 'with job_card 2' do
subject(:partner_job_card) do
page.all('h2.govuk-summary-card__title', text: 'Job 2')[1].ancestor('div.govuk-summary-card')
end

it 'shows jobs details without deductions' do # rubocop:disable RSpec/MultipleExpectations
it 'shows jobs details without deductions' do
within(partner_job_card) do |card|
expect(card).to have_summary_row "Employer's name", 'Joe Goodwin'
expect(card).to have_summary_row 'Address',
Expand All @@ -98,5 +100,6 @@
end
end
end
# rubocop:enable RSpec/MultipleExpectations, RSpec/ExampleLength, RSpec/NestedGroups
end
end

0 comments on commit f661e87

Please sign in to comment.