Skip to content

Commit 5c3f44c

Browse files
committed
added spec for expected headers when error raised
When we set headers using `before`, `after` or just before `error!` raised, we expect them to transferred with error response together. * First spec will be `success` due to there is no error. * Second test will fail at the moment because when an error raised, all headers will be ignored. They shouldn't be.
1 parent 70b1f64 commit 5c3f44c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spec/grape/headers_on_error_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'spec_helper'
22

3-
describe Grape::API do
4-
let(:error_header) do
3+
describe Grape::API do
4+
let(:error_header) do
55
Class.new(Grape::API) do
66
before do
77
header 'X-Grape-Before-Header', '1'
@@ -14,7 +14,7 @@
1414
end
1515
get '/error' do
1616
header 'X-Grape-Returns-Error', '1'
17-
error!({ success: false })
17+
error!(success: false)
1818
end
1919
end
2020
end
@@ -37,7 +37,7 @@ def app
3737
expect(last_response.headers['X-Grape-Before-Header']).to eq('1')
3838
expect(last_response.headers['X-Grape-After-Header']).to eq('1')
3939
end
40-
40+
4141
it 'should returns all headers on error' do
4242
get '/error'
4343
expect(last_response.headers['X-Grape-Returns-Error']).to eq('1')

0 commit comments

Comments
 (0)