Sha256: 05a80a07109c7b3c6c2f19c3957f51c8617a8a07fa43d160f7cad7fe669cba26

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 KB

Contents

dir = File.dirname(__FILE__)
require "#{dir}/../../example_helper"

module RR
module Expectations
  describe ArgumentEqualityError, "#exact_match? with is_a argument" do
    before do
      @expectation = ArgumentEqualityError.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 ArgumentEqualityError, "#wildcard_match? with is_a String argument" do
    before do
      @expectation = ArgumentEqualityError.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

6 entries across 6 versions & 1 rubygems

Version Path
rr-0.1.6 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.3 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.5 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.2 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.1 examples/rr/expectations/is_a_argument_equality_expectation_example.rb
rr-0.1.4 examples/rr/expectations/is_a_argument_equality_expectation_example.rb