Skip to content

Commit 45966fb

Browse files
committed
Add a test for bevhavior of returning Rack response by after callback
1 parent 7f49c40 commit 45966fb

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/grape/middleware/base_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@
3838
end
3939
end
4040

41+
context 'after callback' do
42+
before do
43+
allow(subject).to receive(:after).and_return([200, {}, 'Hello from after callback'])
44+
end
45+
46+
it 'overwrites application response' do
47+
expect(subject.call!({}).last).to eq('Hello from after callback')
48+
end
49+
end
50+
4151
it 'is able to access the response' do
4252
subject.call({})
4353
expect(subject.response).to be_kind_of(Rack::Response)

0 commit comments

Comments
 (0)