Sha256: 7464027b90d7ad752cd19b41f212b947090cb500e0478f308812a8fa2c1ba76b

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require "examples/example_helper"

module RR
module Expectations
describe TimesCalledExpectation, " with failure", :shared => true do
  it_should_behave_like "RR::Expectations::TimesCalledExpectation"

  before do
    @times = 0
    @matcher = TimesCalledMatchers::IntegerMatcher.new(@times)
    @expectation = TimesCalledExpectation.new(@scenario, @matcher)
  end
end

describe TimesCalledExpectation, "#attempt! with failure" do
  it_should_behave_like "RR::Expectations::TimesCalledExpectation with failure"
  
  it "raises error that includes the scenario" do
    proc do
      @expectation.attempt!
    end.should raise_error(
      Errors::TimesCalledError,
      "#{@scenario.formatted_name}\n#{@matcher.error_message(1)}"
    )
  end
end

describe TimesCalledExpectation, "#verify! with failure" do
  it_should_behave_like "RR::Expectations::TimesCalledExpectation with failure"
  
  it "raises error with passed in message prepended" do
    @expectation.instance_variable_set(:@times_called, 1)
    proc do
      @expectation.verify!
    end.should raise_error(
      Errors::TimesCalledError,
      "#{@scenario.formatted_name}\n#{@matcher.error_message(1)}"
    )
  end
end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rr-0.3.11 examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb
rr-0.3.10 examples/rr/expectations/times_called_expectation/times_called_expectation_example.rb