Sha256: eb52704a313f860de4a2b62fe3e70986f1a9a6705f16e416fd0eff54de78dde8

Contents?: true

Size: 1.11 KB

Versions: 23

Compression:

Stored size: 1.11 KB

Contents

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

module RR
  module Expectations
    describe TimesCalledExpectation do
      context "when using a RangeMatcher" do
        it_should_behave_like "RR::Expectations::TimesCalledExpectation"

        before do
          stub(subject).foobar.times(1..2)
        end

        describe "#verify" do
          it "passes after attempt! called 1 time" do
            subject.foobar
            RR.verify
          end

          it "passes after attempt! called 2 times" do
            subject.foobar
            subject.foobar
            RR.verify
          end

          it "can't be called when attempt! is called 3 times" do
            subject.foobar
            subject.foobar
            lambda do
              subject.foobar
            end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 3 times.\nExpected 1..2 times.")
            lambda do
              RR.verify
            end.should raise_error(RR::Errors::TimesCalledError, "foobar()\nCalled 3 times.\nExpected 1..2 times.")
          end
        end
      end
    end
  end
end

Version data entries

23 entries across 19 versions & 5 rubygems

Version Path
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.3/vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
bitclust-core-0.5.3 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/bitclust-core-0.5.1/vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
bitclust-core-0.5.2 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
bitclust-core-0.5.1 vendor/bundle/ruby/1.9.1/gems/rr-1.0.4/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
mcmire-rr-1.0.5.rc1 spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
messagebus_ruby_api-0.4.7 spec/ruby/1.9.1/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
messagebus_ruby_api-0.4.4 spec/ruby/1.9.1/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
rr-1.0.4 spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
rr-1.0.3 spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
vim-jar-0.1.2.0001 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
vim-jar-0.1.2 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
vim-jar-0.1.1 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
vim-jar-0.1.0 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
vim-jar-0.0.3 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
vim-jar-0.0.2 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
vim-jar-0.0.1 bundler/ruby/1.8/gems/rr-1.0.2/spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb
rr-1.0.2 spec/rr/expectations/times_called_expectation/times_called_expectation_range_spec.rb