Sha256: a36e514c04623b38cc84c8764229d4069e2936a4fd59611fd0d4f7b5635e0b6c

Contents?: true

Size: 1.08 KB

Versions: 6

Compression:

Stored size: 1.08 KB

Contents

require "spec/spec_helper"

module RR
  module Expectations
    describe TimesCalledExpectation, " with failure" do
      it_should_behave_like "RR::Expectations::TimesCalledExpectation"
      attr_reader :times, :matcher

      before do
        @times = 0
        @matcher = TimesCalledMatchers::IntegerMatcher.new(times)
        @expectation = TimesCalledExpectation.new(double, matcher)
      end
      
      describe "#attempt!" do
        it "raises error that includes the double" do
          proc do
            expectation.attempt!
          end.should raise_error(
          Errors::TimesCalledError,
          "#{double.formatted_name}\n#{matcher.error_message(1)}"
          )
        end
      end

      describe "#verify!" do
        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,
          "#{double.formatted_name}\n#{matcher.error_message(1)}"
          )
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rr-0.4.3 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.4.7 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.4.5 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.4.4 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.4.8 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.4.6 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb