Skip to content

Commit

Permalink
fix errors pages tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienMLD committed Oct 26, 2023
1 parent ff53879 commit 3a1cbe9
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions spec/features/shared_controller_feature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,26 @@
describe 'render_error' do
login_admin

# TODO : à mettre à jour
before do
ENV['TEST_ERROR_RENDERING'] = 'true'
# allow_any_instance_of(User).to receive(:received_needs).and_raise(raised_error)
# # Je comprend pas pourquoi ce test visite une url de diagnoses et si on rien ne passe
allow_any_instance_of(User).to receive(:received_needs).and_raise(raised_error)
visit quo_active_needs_path
end

after do
ENV['TEST_ERROR_RENDERING'] = 'false'
end

describe '404 error' do
it do
# visit edit_user_path
expect(page.html).to include I18n.t('shared.errors.404.message')
end
let(:raised_error) { ActiveRecord::RecordNotFound }

it { expect(page.html).to include(I18n.t('shared.errors.404.message')) }
end

describe '500 error' do
let(:raised_error) { ArgumentError }

it do
visit need_path(id: 'wrong_id')
expect(page.html).to include I18n.t('shared.errors.500.message')
end
it { expect(page.html).to include I18n.t('shared.errors.500.message') }
end
end
end

0 comments on commit 3a1cbe9

Please sign in to comment.