Sha256: 0d987fe6fb6f26f9fca07ad5ae8cb777cefa4ea79a29938df7933bfe8a9908a5

Contents?: true

Size: 1.56 KB

Versions: 21

Compression:

Stored size: 1.56 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)

module RR
  module WildcardMatchers
    describe IsA do
      include WildcardMatcherMatchers

      describe '#wildcard_match?' do
        subject { described_class.new(Symbol) }

        it "returns true when given IsA is a copy of this IsA" do
          matcher2 = described_class.new(Symbol)
          should wildcard_match(matcher2)
        end

        it "returns true when given an object that is is_a?(klass)" do
          should wildcard_match(:a_symbol)
        end

        it "returns false if not given an object that is is_a?(klass)" do
          should_not wildcard_match('a string')
        end
      end

      describe '#==' do
        subject { described_class.new(Symbol) }

        it "returns true when given IsA is a copy of this IsA" do
          matcher2 = described_class.new(Symbol)
          should equal_match(matcher2)
        end

        it "returns false when given IsA is not a copy of this IsA" do
          matcher2 = described_class.new(String)
          should_not equal_match(matcher2)
        end

        it "returns false even when given an object that wildcard matches this IsA" do
          should_not equal_match(:something_else)
        end

        it "returns false when not given an IsA whatsoever" do
          should_not equal_match([1, 2, 3])
        end
      end

      describe "#inspect" do
        it "returns the correct string" do
          matcher = described_class.new(Symbol)
          expect(matcher.inspect).to eq "is_a(Symbol)"
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rr-3.1.1 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.1.0 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.9 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.8 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.7 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.6 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.5 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.4 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.3 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.2 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.1 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-3.0.0 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.2.1 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.2.0 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.1.2 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.1.2.rc1 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.1.1.rc1 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.1.0 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.1.0.rc3 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb
rr-1.1.0.rc2 spec/suites/rspec_2/unit/wildcard_matchers/is_a_spec.rb