Created
February 9, 2017 15:15
-
-
Save edgar/fcac002d741ae2fb80be861f9ed05237 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe 'My API' do | |
let(:request) do | |
lambda do | |
get '/my_api/value-cannot-be-routed-due-to-route-constraints' | |
end | |
end | |
context 'when action_dispatch.show_exceptions is false (default behavior on test env)' do | |
it 'raise a routing error' do | |
expect { request.call }.to raise_error(ActionController::RoutingError) | |
end | |
end | |
context 'when action_dispatch.show_exceptions is true' do | |
before do | |
Rails.application.config.action_dispatch.show_exceptions = true | |
end | |
it 'return a 404' do | |
request.call | |
expect(response.status).to eq(404) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment