Add GET /jobs/:job_id/metadata endpoint

This commit is contained in:
Henrik Hodne 2013-07-09 18:15:32 -07:00
parent 5236e6d4e7
commit b103a7ccb1
3 changed files with 16 additions and 1 deletions

View File

@ -28,6 +28,10 @@ class Travis::Api::App
end
end
get "/:job_id/metadata" do
respond_with service(:find_metadata, params)
end
def archive_url(path)
"https://s3.amazonaws.com/#{hostname('archive')}#{path}"
end

View File

@ -75,4 +75,11 @@ describe 'Jobs' do
end
end
end
it "/jobs/:id/metadata" do
metadata_provider = Factory(:metadata_provider)
metadata = metadata_provider.metadata.create(job_id: job.id, description: "Foobar")
response = get "/jobs/#{job.id}/metadata", {}, headers
response.should deliver_json_for(Metadata.where(id: metadata.id), version: 'v2')
end
end

View File

@ -1,5 +1,9 @@
require 'spec_helper'
describe Travis::Api::App::Endpoint::Jobs do
it 'has to be tested'
let(:job) { Factory(:test) }
it "GET /jobs/:id/metadata" do
get("/jobs/#{job.id}/metadata", {}, "HTTP_ACCEPT" => "application/vnd.travis-ci.2+json, */*; q=0.01").should be_ok
end
end