Sha256: 34731a266da24f62977965585bfb9cf163c4545f7f04c20fe5d220bb00e3098a
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
require 'spec_helper' require 'bait/integrator' def expect_event(*args) Bait.should_receive(:broadcast).with(:build, *args) end describe Bait::Integrator do let(:build) { Bait::Build.create(name: "bait", clone_url:repo_path) } let(:worker) { Bait::Integrator.new } describe "#perform" do subject { build.reload } before { build.clone! } describe "real-time events" do before do write_script_with_status build.script("test.sh"), 0 write_script_with_status build.script("coffeelint.rb"), 0 end it "push updates directly to the browser" do expect_event(:status, build.id, 'phase: test.sh') expect_event(:status, build.id, 'phase: coffeelint.rb') expect_event(:output, build.id, kind_of(String)).exactly(2).times expect_event(:status, build.id, 'passed').exactly(2).times worker.perform build.id end end context "a script is missing" do before do FileUtils.rm build.script("test.sh") FileUtils.rm build.script("coffeelint.rb") worker.perform build.id end it "has errors in output" do build.reload.output.should match /was expected but is missing/ end end context "has a test script" do before do write_script_with_status build.script("coffeelint.rb"), status write_script_with_status build.script('test.sh'), status worker.perform build.id end shared_examples_for "a test run" do it "saves output into the build" do build.reload.output.should match "this is a test script" end end context "successful" do let(:status) { 0 } it { should be_passed } it_behaves_like "a test run" end context 'failure' do let(:status) { 1 } it { should_not be_passed } it_behaves_like "a test run" end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bait-0.5.11 | spec/lib/bait/integrator_spec.rb |
bait-0.5.10 | spec/lib/bait/integrator_spec.rb |
bait-0.5.9 | spec/lib/bait/integrator_spec.rb |