Check response body instead of assigns in settings imports controller spec

This commit is contained in:
Matt Jankowski 2024-04-30 12:51:25 -04:00
parent 25fa2226ec
commit f741c1308c
2 changed files with 6 additions and 4 deletions

View File

@ -46,7 +46,7 @@
%th= t('imports.failures')
%tbody
- @recent_imports.each do |import|
%tr
%tr{ id: dom_id(import) }
%td= t("imports.types.#{import.type}")
%td
- if import.state_unconfirmed?

View File

@ -21,9 +21,10 @@ RSpec.describe Settings::ImportsController do
it 'assigns the expected imports', :aggregate_failures do
expect(response).to have_http_status(200)
expect(assigns(:recent_imports)).to eq [import]
expect(assigns(:recent_imports)).to_not include(other_import)
expect(response.headers['Cache-Control']).to include('private, no-store')
expect(response.body)
.to include("bulk_import_#{import.id}")
.and not_include("bulk_import_#{other_import.id}")
end
end
@ -261,7 +262,8 @@ RSpec.describe Settings::ImportsController do
it 'does not creates an unconfirmed bulk_import', :aggregate_failures do
expect { subject }.to_not(change { user.account.bulk_imports.count })
expect(assigns(:import).errors).to_not be_empty
expect(response.body)
.to include('field_with_errors')
end
end