create error in v3.rb
This commit is contained in:
parent
ab1bfe0aeb
commit
0448427136
|
@ -35,6 +35,7 @@ module Travis
|
|||
NotImplemented = ServerError .create('request not (yet) implemented', status: 501)
|
||||
RequestLimitReached = ClientError .create('request limit reached for resource', status: 429)
|
||||
AlreadySyncing = ClientError .create('sync already in progress', status: 409)
|
||||
MethodNotAllowed = ClientError .create('method not allowed', status: 405)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,10 +35,4 @@ module Travis::API::V3
|
|||
super(message)
|
||||
end
|
||||
end
|
||||
|
||||
class MethodNotAllowed < Error
|
||||
def self.status
|
||||
405
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
15
spec/v3/error_handling_spec.rb
Normal file
15
spec/v3/error_handling_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Travis::API::V3::ServiceIndex do
|
||||
let(:headers) {{ }}
|
||||
let(:path) { "/v3/repo/1/enable" }
|
||||
let(:json) { JSON.load(response.body) }
|
||||
let(:response) { get(path, {}, headers) }
|
||||
let(:resources) { json.fetch('resources') }
|
||||
|
||||
it "handles wrong HTTP method with 405 status" do
|
||||
|
||||
response.status.should == 405
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue
Block a user