Skip to content

Commit eaed8f4

Browse files
committed
rubocop
1 parent 156c2b2 commit eaed8f4

3 files changed

Lines changed: 20 additions & 12 deletions

File tree

app/controllers/admin/urns_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def index
88
end
99

1010
def download
11-
send_data urn_csv,
11+
send_data urn_csv,
1212
type: 'text/csv',
1313
disposition: 'attachment',
1414
filename: "customer_urns_#{Time.zone.today}.csv"
@@ -25,4 +25,4 @@ def urn_csv
2525
end
2626
end
2727
end
28-
end
28+
end

spec/features/admin_can_search_urns_spec.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
RSpec.feature 'Admin can search for URNs' do
44
before do
5-
@customer1 = FactoryBot.create(:customer, urn: '123', name: 'Customer One', postcode: 'AB1 2CD', sector: :central_government)
6-
@customer2 = FactoryBot.create(:customer, urn: '456', name: 'Customer Two', postcode: 'EF3 4GH', sector: :wider_public_sector)
7-
@customer3 = FactoryBot.create(:customer, urn: '789', name: 'Customer Three', postcode: 'IJ5 6KL', sector: :wider_public_sector)
5+
@customer1 = FactoryBot.create(:customer, urn: '123', name: 'Customer One', postcode: 'AB1 2CD',
6+
sector: :central_government)
7+
@customer2 = FactoryBot.create(:customer, urn: '456', name: 'Customer Two', postcode: 'EF3 4GH',
8+
sector: :wider_public_sector)
9+
@customer3 = FactoryBot.create(:customer, urn: '789', name: 'Customer Three', postcode: 'IJ5 6KL',
10+
sector: :wider_public_sector)
811
sign_in_as_admin
912
end
1013

@@ -41,4 +44,4 @@
4144
expect(page).to_not have_content '456'
4245
expect(page).to have_content '789'
4346
end
44-
end
47+
end

spec/requests/admin/urns_spec.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
mock_sso_with(email: 'admin@example.com')
1010
get '/auth/google_oauth2/callback'
1111
end
12-
13-
describe 'GET /admin/urns' do
12+
13+
describe 'GET /admin/urns' do
1414
it 'renders the URN search page' do
1515
get admin_urns_path
1616

@@ -22,15 +22,20 @@
2222
end
2323

2424
describe 'GET /admin/urns/download' do
25-
let!(:active_customer) { create(:customer, urn: '123', name: 'Active Customer One', postcode: 'AB1 2CD', sector: :central_government) }
26-
let!(:deleted_customer) { create(:customer, urn: '456', name: 'Deleted Customer', postcode: 'IJ5 6KL', sector: :wider_public_sector, deleted: true) }
25+
let!(:active_customer) do
26+
create(:customer, urn: '123', name: 'Active Customer One', postcode: 'AB1 2CD', sector: :central_government)
27+
end
28+
let!(:deleted_customer) do
29+
create(:customer, urn: '456', name: 'Deleted Customer', postcode: 'IJ5 6KL', sector: :wider_public_sector,
30+
deleted: true)
31+
end
2732

2833
it 'returns a CSV file with active customers' do
2934
get download_admin_urns_path
3035

3136
expect(response).to have_http_status(:ok)
3237
expect(response.headers['Content-Type']).to include('text/csv')
33-
expect(response.headers['Content-Disposition']).to include("attachment; filename=\"customer_urns_#{Time.zone.today}.csv\"")
38+
expect(response.headers['Content-Disposition']).to include("filename=\"customer_urns_#{Time.zone.today}.csv\"")
3439

3540
csv = CSV.parse(response.body, headers: true)
3641
expect(csv.headers).to eq(['URN', 'CustomerName', 'PostCode', 'Sector', 'Published'])
@@ -49,4 +54,4 @@
4954
end
5055
end
5156
end
52-
end
57+
end

0 commit comments

Comments
 (0)