Browse Source

Check template is shown (#191)

pull/194/head
baarkerlounger 3 years ago committed by GitHub
parent
commit
2dd1dbab62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/controllers/organisations_controller.rb
  2. 2
      app/controllers/users_controller.rb
  3. 4
      spec/requests/organisations_controller_spec.rb
  4. 4
      spec/requests/user_controller_spec.rb

2
app/controllers/organisations_controller.rb

@ -45,7 +45,7 @@ private
end end
def authenticate_scope! def authenticate_scope!
head :not_found if current_user.organisation != @organisation render_not_found if current_user.organisation != @organisation
end end
def find_resource def find_resource

2
app/controllers/users_controller.rb

@ -74,6 +74,6 @@ private
end end
def authenticate_scope! def authenticate_scope!
head :not_found if current_user != @user render_not_found if current_user != @user
end end
end end

4
spec/requests/organisations_controller_spec.rb

@ -50,6 +50,10 @@ RSpec.describe OrganisationsController, type: :request do
it "returns not found 404 from org route" do it "returns not found 404 from org route" do
expect(response).to have_http_status(:not_found) expect(response).to have_http_status(:not_found)
end end
it "shows the 404 view" do
expect(page).to have_content("Page not found")
end
end end
end end

4
spec/requests/user_controller_spec.rb

@ -87,6 +87,10 @@ RSpec.describe UsersController, type: :request do
it "returns not found 404" do it "returns not found 404" do
expect(response).to have_http_status(:not_found) expect(response).to have_http_status(:not_found)
end end
it "shows the 404 view" do
expect(page).to have_content("Page not found")
end
end end
end end

Loading…
Cancel
Save