Sha256: da24e8ed3a829837499401332cc1bcca3732c8f76e9880e9ae3771e356f57542

Contents?: true

Size: 1.69 KB

Versions: 21

Compression:

Stored size: 1.69 KB

Contents

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

module RR
  module WildcardMatchers
    describe Satisfy do
      include WildcardMatcherMatchers

      describe '#wildcard_match?' do
        let(:expectation_proc) { lambda {|v| v == 'x' } }
        subject { described_class.new(expectation_proc) }

        it "returns true if given Satisfy is a copy of this Satisfy" do
          matcher2 = described_class.new(expectation_proc)
          should wildcard_match(matcher2)
        end

        it "returns true if the given object matches the block" do
          should wildcard_match('x')
        end

        it "returns false otherwise" do
          should_not wildcard_match('y')
        end
      end

      describe '#==' do
        let(:expectation_proc) { lambda {|v| v == 'x' } }
        subject { described_class.new(expectation_proc) }

        it "returns true if given Satisfy is a copy of this Satisfy" do
          matcher2 = described_class.new(expectation_proc)
          should equal_match(matcher2)
        end

        it "returns false if given Satisfy is not a copy of this Satisfy" do
          matcher2 = described_class.new(lambda {|v| })
          should_not equal_match(matcher2)
        end

        it "returns false even when given an object that wildcard matches this Satisfy" do
          should_not equal_match('x')
        end

        it "returns false when given object isn't even a Satisfy" do
          should_not equal_match(:something_else)
        end
      end

      describe '#inspect' do
        it "returns the correct string" do
          matcher = Satisfy.new(lambda {})
          expect(matcher.inspect).to eq "satisfy { ... }"
        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/satisfy_spec.rb
rr-3.1.0 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.9 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.8 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.7 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.6 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.5 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.4 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.3 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.2 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.1 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-3.0.0 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.2.1 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.2.0 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.1.2 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.1.2.rc1 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.1.1.rc1 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.1.0 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.1.0.rc3 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb
rr-1.1.0.rc2 spec/suites/rspec_2/unit/wildcard_matchers/satisfy_spec.rb