Sha256: c7904f5fb4c6a08e53d2c5990c20730f394807e04f457de196524ed238eb0350

Contents?: true

Size: 967 Bytes

Versions: 23

Compression:

Stored size: 967 Bytes

Contents

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

module RR
  module Expectations
    describe TimesCalledExpectation do
      context "when using an AtLeastMatcher" do
        it_should_behave_like "RR::Expectations::TimesCalledExpectation"

        before do
          mock(subject).foobar.at_least(3)
        end

        describe "#verify!" do
          it "passes when times called > times" do
            4.times {subject.foobar}
            RR.verify
          end

          it "passes when times called == times" do
            3.times {subject.foobar}
            RR.verify
          end

          it "raises error when times called < times" do
            subject.foobar
            lambda do
              RR.verify
            end.should raise_error(
            RR::Errors::TimesCalledError,
            "foobar()\nCalled 1 time.\nExpected at least 3 times."
            )
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 19 versions & 5 rubygems

Version Path
rr-1.0.1 spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb
rr-1.0.0 spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb
rr-0.10.11 spec/rr/expectations/times_called_expectation/times_called_expectation_at_least_spec.rb