Sha256: f314efbbaf90c9ca53f2e2a85ce669b0b6c44c7ca385b9fa2590a98486e213a9

Contents?: true

Size: 1.58 KB

Versions: 19

Compression:

Stored size: 1.58 KB

Contents

require "examples/example_helper"

module RR
module TimesCalledMatchers
  describe AnyTimesMatcher, :shared => true do
    before do
      @matcher = AnyTimesMatcher.new
    end
  end

  describe TimesCalledMatcher, ".create when passed a AnyTimesMatcher" do
    it "returns the passed in argument" do
      matcher = AnyTimesMatcher.new
      TimesCalledMatcher.create(matcher).should === matcher
    end
  end

  describe AnyTimesMatcher, "#possible_match?" do
    it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"

    it "always returns true" do
      @matcher.should be_possible_match(0)
      @matcher.should be_possible_match(99999)
    end
  end

  describe AnyTimesMatcher, "#matches?" do
    it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"

    it "always returns true" do
      @matcher.should be_matches(0)
      @matcher.should be_matches(99999)
    end
  end

  describe AnyTimesMatcher, "#attempt?" do
    it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"

    it "always returns true" do
      @matcher.should be_attempt(0)
      @matcher.should be_attempt(99999)
    end
  end

  describe AnyTimesMatcher, "#terminal?" do
    it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"

    it "returns false" do
      @matcher.should_not be_terminal
    end
  end

  describe AnyTimesMatcher, "#error_message" do
    it_should_behave_like "RR::TimesCalledMatchers::AnyTimesMatcher"

    it "has an error message" do
      @matcher.error_message(2).should == (
        "Called 2 times.\nExpected any number of times."
      )
    end
  end
end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rr-0.1.15 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.1.14 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.11 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.2 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.3 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.0 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.2.5 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.1 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.2.2 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.2.3 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.10 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.4 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.2.4 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.2.1 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.9 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.7 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.6 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.8 examples/rr/times_called_matchers/any_times_matcher_example.rb
rr-0.3.5 examples/rr/times_called_matchers/any_times_matcher_example.rb