create error in v3.rb

This commit is contained in:
Lisa P 2016-02-25 15:06:45 +01:00
parent ab1bfe0aeb
commit 0448427136
3 changed files with 16 additions and 6 deletions

View File

@ -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

View File

@ -35,10 +35,4 @@ module Travis::API::V3
super(message)
end
end
class MethodNotAllowed < Error
def self.status
405
end
end
end

View 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