Sha256: bbea0a0dfd226122800cf3a86cac36dabbf77574c821826e0bfbbb09d4e4acfe

Contents?: true

Size: 948 Bytes

Versions: 5

Compression:

Stored size: 948 Bytes

Contents

require 'spec_helper'
require 'approvals/reporters/first_working_reporter'

describe Approvals::Reporters::FirstWorkingReporter do


  let(:no) { stub(:working_in_this_environment? => false) }
  let(:yes) { stub(:working_in_this_environment? => true) }
  let(:yes_too) { stub(:working_in_this_environment? => true) }

  context "when at least one reporter works" do
    subject { Approvals::Reporters::FirstWorkingReporter.new(no, yes) }
    its(:working_in_this_environment?) { should be_true }
  end

  context "when no reporters work" do
    subject { Approvals::Reporters::FirstWorkingReporter.new(no, no) }
    its(:working_in_this_environment?) { should be_false }
  end

  it "calls the first working reporter" do
    working = Approvals::Reporters::FirstWorkingReporter.new(no, yes, yes_too)

    no.should_not_receive(:report)
    yes.should_receive(:report)
    yes_too.should_not_receive(:report)

    working.report("r", "a")
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
approvals-0.0.9 spec/reporters/first_working_reporter_spec.rb
approvals-0.0.8 spec/reporters/first_working_reporter_spec.rb
approvals-0.0.7 spec/reporters/first_working_reporter_spec.rb
approvals-0.0.6 spec/reporters/first_working_reporter_spec.rb
approvals-0.0.5 spec/reporters/first_working_reporter_spec.rb