spec/cfoundry/v2/app_spec.rb in cfoundry-2.4.1.rc1 vs spec/cfoundry/v2/app_spec.rb in cfoundry-3.0.0
- old
+ new
@@ -76,66 +76,68 @@
client.base.stub(:put).with("v2", "apps", subject.guid, anything) do
response
end
end
- context "when asynchronous is true" do
- it "sends the PUT request with &stage_async=true" do
- client.base.should_receive(:put).with(
- "v2", "apps", subject.guid,
- hash_including(
- :params => {:stage_async => true},
- :return_response => true)) do
- response
+ it "sends the PUT request" do
+ client.base.should_receive(:put).with(
+ "v2", "apps", subject.guid,
+ hash_including(
+ :return_response => true)) do
+ response
+ end
+
+ update
+ end
+
+ context "and a block is given" do
+ let(:response) do
+ { :headers => { "x-app-staging-log" => "http://app/staging/log" },
+ :body => "{}"
+ }
+ end
+
+ it "yields the URL for the logs" do
+ yielded_url = nil
+ update do |url|
+ yielded_url = url
end
- update(true)
+ expect(yielded_url).to eq "http://app/staging/log"
end
- context "and a block is given" do
+ context "and no staging header is returned" do
let(:response) do
- {:headers => {"x-app-staging-log" => "http://app/staging/log"},
+ { :headers => {},
:body => "{}"
}
end
- it "yields the URL for the logs" do
- yielded_url = nil
- update(true) do |url|
+ it "yields nil" do
+ yielded_url = :something
+ update do |url|
yielded_url = url
end
- expect(yielded_url).to eq "http://app/staging/log"
+ expect(yielded_url).to be_nil
end
end
end
-
- context "when asynchronous is false" do
- it "sends the PUT request with &stage_async=false" do
- client.base.should_receive(:put).with(
- "v2", "apps", subject.guid,
- hash_including(:params => {:stage_async => false})) do
- response
- end
-
- update(false)
- end
- end
end
describe "#start!" do
it_should_behave_like "something may stage the app" do
- def update(async, &blk)
- subject.start!(async, &blk)
+ def update(&blk)
+ subject.start!(&blk)
end
end
end
describe "#restart!" do
it_should_behave_like "something may stage the app" do
- def update(async, &blk)
- subject.restart!(async, &blk)
+ def update(&blk)
+ subject.restart!(&blk)
end
end
end
describe "#update!" do
@@ -155,11 +157,11 @@
}.to change { subject.manifest }.to(:foo => "bar")
end
end
it_should_behave_like "something may stage the app" do
- def update(async, &blk)
- subject.update!(async, &blk)
+ def update(&blk)
+ subject.update!(&blk)
end
end
end
describe "#stream_update_log" do