Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ValidationErrorInJson < Goliath::API
- use Goliath::Rack::Formatters::JSON
- def response(env)
- raise Goliath::Validation::Error.new(420, 'You Must Chill')
- end
- end
- describe ValidationErrorInEndpoint do
- let(:err) { Proc.new { fail "API request failed" } }
- it 'handles Goliath::Validation::Error with the correct format response' do
- with_api(ValidationErrorInEndpoint) do
- get_request({}, err) do |c|
- c.response.should == '{"error":"You Must Chill"}'
- c.response_header.status.should == 420
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment