From b43568a0f988f91bf58b3e55f8eb6970442bcb02 Mon Sep 17 00:00:00 2001
From: Hiro Asari <asari.ruby@gmail.com>
Date: Wed, 29 Jan 2014 14:30:23 -0500
Subject: [PATCH] Fix Annoation-related specs

Annotations are now blocked by features, so stub the service to
return true for the cases we expect to get data back from POST
requests
---
 spec/integration/v2/jobs_spec.rb | 2 ++
 spec/unit/endpoint/jobs_spec.rb  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/spec/integration/v2/jobs_spec.rb b/spec/integration/v2/jobs_spec.rb
index 6e092e00..b865ed59 100644
--- a/spec/integration/v2/jobs_spec.rb
+++ b/spec/integration/v2/jobs_spec.rb
@@ -86,6 +86,8 @@ describe 'Jobs' do
   describe "POST /jobs/:id/annotations" do
     context "with valid credentials" do
       it "responds with a 204" do
+        Travis::Services::UpdateAnnotation.any_instance.stubs(:annotations_enabled?).returns(true)
+
         annotation_provider = Factory(:annotation_provider)
         response = post "/jobs/#{job.id}/annotations", { username: annotation_provider.api_username, key: annotation_provider.api_key, status: "passed", description: "Foobar" }, headers
         response.status.should eq(204)
diff --git a/spec/unit/endpoint/jobs_spec.rb b/spec/unit/endpoint/jobs_spec.rb
index 23dc5636..ca9e143c 100644
--- a/spec/unit/endpoint/jobs_spec.rb
+++ b/spec/unit/endpoint/jobs_spec.rb
@@ -9,6 +9,8 @@ describe Travis::Api::App::Endpoint::Jobs do
   end
 
   it "POST /jobs/:id/annotations" do
+    Travis::Services::UpdateAnnotation.any_instance.stubs(:annotations_enabled?).returns(true)
+
     response = post("/jobs/#{job.id}/annotations", { "username" => provider.api_username, "key" => provider.api_key, "status" => "passed", "description" => "Foobar" }, "HTTP_ACCEPT" => "application/vnd.travis-ci.2+json, */*; q=0.01").should be_successful
   end
 end