Skip to content

Commit 75928b4

Browse files
author
Michael Bleigh
committed
Add pending spec for error objects.
1 parent 4884b18 commit 75928b4

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/grape/middleware/error.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ def error_response(error = {})
1818
end
1919
end
2020
end
21-
end
21+
end

spec/grape/endpoint_spec.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ def app; subject end
7171
last_response.status.should == 401
7272
last_response.body.should == "Unauthorized."
7373
end
74+
75+
it 'should accept an object and render it in format' do
76+
pending
77+
78+
subject.get '/hey' do
79+
error!({'dude' => 'rad'}, 403)
80+
end
81+
82+
get '/hey.json'
83+
last_response.status.should == 403
84+
last_response.body.should == '{"dude":"rad"}'
85+
end
7486
end
7587

7688
it 'should not persist params between calls' do
@@ -101,4 +113,4 @@ def memoized
101113
get '/hello?howdy=yo'
102114
last_response.body.should == 'yo'
103115
end
104-
end
116+
end

0 commit comments

Comments
 (0)