Sha256: c0760b1a725a2892c488691f2b4b24e4c4ff1ce32ac9b51b210346589ec52cd9

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 boolean match" do
      attr_reader :expectation
      
      before do
        @expectation = ArgumentEqualityExpectation.new(boolean)
      end

      describe "#exact_match?" do
        it "returns true when passed in an IsA module" do
          expectation.should be_exact_match(WildcardMatchers::Boolean.new)
        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(true)
          expectation.should_not be_exact_match()
        end
      end

      describe "#wildcard_match?" do
        before do
          expectation = ArgumentEqualityExpectation.new(boolean)
        end

        it "returns true when passed a Boolean" do
          expectation.should be_wildcard_match(true)
          expectation.should be_wildcard_match(false)
        end

        it "returns false when not passed a Boolean" do
          expectation.should_not be_wildcard_match(:not_a_boolean)
        end

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

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

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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