Sha256: 00cbe5439fea5179cd63f03a71194c9f9c41e199375356f5d0f95415ed093719

Contents?: true

Size: 1.57 KB

Versions: 11

Compression:

Stored size: 1.57 KB

Contents

require "spec/spec_helper"

module RR
  module Expectations
    describe ArgumentEqualityExpectation, "with is_a string matcher" do
      attr_reader :expectation

      before do
        @expectation = ArgumentEqualityExpectation.new(is_a(String))
      end
      
      describe "#exact_match?" do
        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 "#wildcard_match?" do
        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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rr-0.4.3 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.10 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.6 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.8 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.2 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.4 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.0 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.9 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.7 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.1 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb
rr-0.4.5 spec/rr/expectations/is_a_argument_equality_expectation_spec.rb