Skip to content

Commit

Permalink
Fixes tests where NotFound exceptions now return 404 status
Browse files Browse the repository at this point in the history
  • Loading branch information
MacTwister committed Jan 16, 2024
1 parent c9a6611 commit 363c8a6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
5 changes: 2 additions & 3 deletions spec/controllers/oauth/applications_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@


session[:user_id] = @anotherUser.id
expect {
get :show, params: { id: @app.id }
}.to raise_error(ActiveRecord::RecordNotFound)
get :show, params: { id: @app.id }
expect(response).to have_http_status :not_found
#unauthorized
end

Expand Down
10 changes: 4 additions & 6 deletions spec/controllers/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
it 'not published without current_user' do
page = FactoryBot.create(:page, published: false)

expect {
get :show, params: { id: page.slug }
}.to raise_error(ActiveRecord::RecordNotFound)
get :show, params: { id: page.slug }
expect(response).to have_http_status :not_found
end

it 'published' do
Expand All @@ -24,9 +23,8 @@

page = FactoryBot.create(:page, published: false)

expect {
get :show, params: { id: page.slug }
}.to raise_error(ActiveRecord::RecordNotFound)
get :show, params: { id: page.slug }
expect(response).to have_http_status :not_found
end

it 'not published with superadmin current_user' do
Expand Down
3 changes: 2 additions & 1 deletion spec/features/employees/managing_employees_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
superadmin.add_role :superadmin
lab.remove(superadmin)
sign_in_superadmin
expect{visit lab_employees_path(lab)}.to raise_error ActiveRecord::RecordNotFound
visit lab_employees_path(lab)
expect(page).to have_http_status :not_found
end

scenario "as a superadmin" do
Expand Down
3 changes: 2 additions & 1 deletion spec/features/recoveries/resetting_your_password_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
end

scenario "with an invalid url" do
expect{visit recovery_url('invalidkey')}.to raise_error(ActiveRecord::RecordNotFound)
visit recovery_url('invalidkey')
expect(page).to have_http_status :not_found
end

scenario "with an empty password" do
Expand Down

0 comments on commit 363c8a6

Please sign in to comment.