Sha256: 079b1aabb031c31233cef54c1468463c0b846d7d5a8b884a8f2a1b8719c738a5

Contents?: true

Size: 1.54 KB

Versions: 25

Compression:

Stored size: 1.54 KB

Contents

require "examples/example_helper"

module RR
module Expectations
  describe ArgumentEqualityExpectation, "#exact_match? with is_a argument" do
    before do
      @expectation = ArgumentEqualityExpectation.new(is_a(String))
    end
    
    it "returns true when passed in an IsA module" do
      @expectation.should be_exact_match(WildcardMatchers::IsA.new(String))
    end

    it "returns false when passed in an IsA object with a different module" do
      @expectation.should_not be_exact_match(WildcardMatchers::IsA.new(Integer))
    end

    it "returns false otherwise" do
      @expectation.should_not be_exact_match("hello")
      @expectation.should_not be_exact_match(:hello)
      @expectation.should_not be_exact_match(1)
      @expectation.should_not be_exact_match(nil)
      @expectation.should_not be_exact_match()
    end
  end

  describe ArgumentEqualityExpectation, "#wildcard_match? with is_a String argument" do
    before do
      @expectation = ArgumentEqualityExpectation.new(is_a(String))
    end

    it "returns true when passed a String" do
      @expectation.should be_wildcard_match("Hello")
    end

    it "returns false when not passed a String" do
      @expectation.should_not be_wildcard_match(:not_a_string)
    end

    it "returns true when an exact match" do
      @expectation.should be_wildcard_match(is_a(String))
    end

    it "returns false when not passed correct number of arguments" do
      @expectation.should_not be_wildcard_match()
      @expectation.should_not be_wildcard_match("one", "two")
    end
  end
end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
rr-0.1.11 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.14 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.10 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.13 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.12 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.8 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.15 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.3.4 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.2.1 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.3.11 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.3.2 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.3.3 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.2.3 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.2.4 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.9 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.2.2 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.3.10 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.2.5 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.3.1 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.3.0 examples/rr/expectations/is_a_argument_equality_expectation_example.rb