This repository has been archived by the owner on Oct 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #916 from dmann/DDS-809-fix_request_timeout-develop
DDS-809 fix request timeout develop
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
require 'rails_helper' | ||
|
||
describe DDS::V1::Base do | ||
let(:path) {"/api_base_test"} | ||
let(:dummy) do | ||
dummy_path = path | ||
Class.new(Grape::API) do | ||
helpers do | ||
def override_helper; end | ||
end | ||
get dummy_path do | ||
override_helper | ||
end | ||
end | ||
end | ||
before do | ||
described_class.mount dummy | ||
DDS::Base.change! | ||
end | ||
|
||
let(:url) {"/api/v1" + path } | ||
subject { get(url) } | ||
|
||
context 'when Rack::Timeout raises Rack::Timeout::RequestTimeoutError' do | ||
before do | ||
Grape::Endpoint.before_each do |endpoint| | ||
expect(endpoint).to receive(:override_helper).and_raise(Rack::Timeout::RequestTimeoutError, ENV) | ||
end | ||
end | ||
after { Grape::Endpoint.before_each nil } | ||
it 'should return a 503' do | ||
is_expected.to eq 503 | ||
expect(response.body).to include('Request Timeout') | ||
end | ||
end | ||
end |