You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
494 B
24 lines
494 B
2 years ago
|
require "rails_helper"
|
||
|
|
||
|
RSpec.describe ApplicationController do
|
||
|
describe "when Pundit::NotAuthorizedError raised" do
|
||
|
render_views
|
||
|
|
||
|
controller do
|
||
|
def index
|
||
|
raise Pundit::NotAuthorizedError, "error goes here"
|
||
|
end
|
||
|
end
|
||
|
|
||
|
it "returns status 401 unauthorized" do
|
||
|
get :index
|
||
|
expect(response).to be_unauthorized
|
||
|
end
|
||
|
|
||
|
it "renders page not found" do
|
||
|
get :index
|
||
|
expect(response.body).to have_content("Page not found")
|
||
|
end
|
||
|
end
|
||
|
end
|