spec/bamboo-client/rest_spec.rb in bamboo-client-0.1.7 vs spec/bamboo-client/rest_spec.rb in bamboo-client-0.1.8

- old
+ new

@@ -108,25 +108,22 @@ it "has a URL" do plan.url.should == "http://xserve.openqa.org:8085/rest/api/latest/plan/S2RB-REMWIN" end it "can be queued" do - http.should_receive(:cookies).and_return("some" => "cookie") - http.should_receive(:post).with("/rest/api/latest/queue/S2RB-REMWIN", {}, {"some" => "cookie"}) + http.should_receive(:post).with("/rest/api/latest/queue/S2RB-REMWIN", {}) plan.queue end it "can be queued with parameters" do - http.should_receive(:cookies).and_return("some" => "cookie") - http.should_receive(:post_with_query).with("/rest/api/latest/queue/S2RB-REMWIN", {:customRevision => 'test123'}, {"some" => "cookie"}) + http.should_receive(:post_with_query).with("/rest/api/latest/queue/S2RB-REMWIN", {:customRevision => 'test123'}) plan.queue(:customRevision => 'test123') end it 'can fetch results' do document.should_receive(:auto_expand).with(Rest::Result, http) - http.should_receive(:cookies).and_return("some" => "cookie") - http.should_receive(:get).with("/rest/api/latest/result/S2RB-REMWIN", {}, {"some" => "cookie"}).and_return(document) + http.should_receive(:get).with("/rest/api/latest/result/S2RB-REMWIN", {}).and_return(document) plan.results end end # Plan @@ -146,12 +143,11 @@ project.url.should == "http://xserve.openqa.org:8085/rest/api/latest/project/S2J" end it 'can fetch plans' do document.should_receive(:data).and_return('plans' => {'plan' => []}) - http.should_receive(:cookies).and_return("some" => "cookie") - http.should_receive(:get).with(URI.parse(project.url), {:expand => 'plans'}, {"some" => "cookie"}).and_return(document) + http.should_receive(:get).with(URI.parse(project.url), {:expand => 'plans'}).and_return(document) project.plans.should == [] end end @@ -193,10 +189,11 @@ end context "with details" do before do # TODO: arg/uri expectation? + http.stub(:cookies => {"some" => "cookie"}) http.should_receive(:get).and_return Http::Json::Doc.new(json_fixture("result_with_changes")) end it "has a list of changes" do result.changes.first.should be_kind_of(Rest::Change) @@ -256,10 +253,13 @@ it "has a comment" do change.comment.should == "Fixed the config thing." end + it "has a commit url" do + change.commit_url.should == "https://crucible/changelog/SVN?cs=1101" + end it "has a list of files" do change.files.first.should == {:name => "/trunk/server/src/main/resources/some-config.ini", :revision => "131"} end end @@ -271,22 +271,19 @@ queue.size.should == 1 end it "has a list of queued builds when there are queued builds" do http.should_receive(:get).and_return Http::Json::Doc.new(json_fixture("queue_with_queued_builds")) - http.should_receive(:cookies).and_return("some" => "cookie") queue.queued_builds.first.should be_kind_of(Rest::QueuedBuild) end it "has an empty list when there are no queued builds" do http.should_receive(:get).and_return Http::Json::Doc.new(json_fixture("queue_with_no_queued_builds")) - http.should_receive(:cookies).and_return("some" => "cookie") queue.queued_builds.should be_empty end it "can add plan to queue" do - http.should_receive(:cookies).and_return("some" => "cookie") - http.should_receive(:post).with("/rest/api/latest/queue/DEMOPROJECT-CANARY", {}, {"some" => "cookie"}).and_return Http::Json::Doc.new(json_fixture("queued_build")) + http.should_receive(:post).with("/rest/api/latest/queue/DEMOPROJECT-CANARY", {}).and_return Http::Json::Doc.new(json_fixture("queued_build")) queue.add("DEMOPROJECT-CANARY").should be_kind_of(Rest::QueuedBuild) end end describe Rest::QueuedBuild do