Sha256: dc7a15dd0814a6809ee7dbc26eb26c01e3c5fb8cd801b523c898b5dc26557776

Contents?: true

Size: 1.18 KB

Versions: 31

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../../../spec_helper")

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

        before do
          @times = 0
          double.definition.times(0)
          @matcher = double.definition.times_matcher
          @expectation = TimesCalledExpectation.new(double)
        end

        describe "#attempt!" do
          it "raises error that includes the double" do
            lambda {expectation.attempt}.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)
            lambda {expectation.verify!}.should raise_error(
              Errors::TimesCalledError,
              "#{double.formatted_name}\n#{matcher.error_message(1)}"
            )
          end
        end
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 5 rubygems

Version Path
adva-0.3.2 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.3.1 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.3.0 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.2.4 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.2.3 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.2.2 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.2.1 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.2.0 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.1.4 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.1.3 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.1.2 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.1.1 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.1.0 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
adva-0.0.1 test/rr/spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
jferris-rr-0.7.1.0.1239654108 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
redinger-redinger-rr-0.10.3 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
redinger-rr-0.10.4 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.10.9 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.10.8 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb
rr-0.10.7 spec/rr/expectations/times_called_expectation/times_called_expectation_spec.rb