Sha256: fa80ca04d37d7b48ceb62bb8c7d4d7e38ff33efc6d4bfd46f4e4e6121b74d140
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe "Juicy::Build::Callback" do it "should call #process! on each of it's callbacks" do def mock_callback mock(:payload= => nil).tap do |callback| callback.expects(:process!).once end end callbacks = ["rawr", "test"] callbacks.each do |callback| Juici::Callback.stubs(:new).with(callback). returns(mock_callback) end build = Juici::Build.new(:callbacks => callbacks) build.start! build.success! build.destroy end # TODO DRY This right up it "should have status success on success" do cb = Juici::Callback.new("test") cb.stubs(:process!) Juici::Callback.stubs(:new).with("test").returns(cb) build = Juici::Build.new(:callbacks => ["test"]) build.start! build.success! JSON.load(cb.payload)["status"].should == Juici::BuildStatus::PASS build.destroy end it "should have status failed on failure" do cb = Juici::Callback.new("test") cb.stubs(:process!) Juici::Callback.stubs(:new).with("test").returns(cb) build = Juici::Build.new(:callbacks => ["test"]) build.start! build.failure! JSON.load(cb.payload)["status"].should == Juici::BuildStatus::FAIL build.destroy end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
juici-0.0.1.alpha1 | spec/build_callback_spec.rb |
juici-0.0.0.alpha1 | spec/build_callback_spec.rb |