Sha256: 28a9b0e48ce331003e2169fd7ec0f86001e940cee20727e9cd7fc344c580e143

Contents?: true

Size: 1.04 KB

Versions: 21

Compression:

Stored size: 1.04 KB

Contents

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

describe Regexp do
  include WildcardMatcherMatchers

  describe '#wildcard_match?' do
    subject { /foo/ }

    it "returns true when given Regexp is exactly equal to this Regexp" do
      should wildcard_match(/foo/)
    end

    it "returns true if given string matches the regexp" do
      should wildcard_match('foobarbaz')
    end

    it "returns false if given string does not match the regexp" do
      should_not wildcard_match('aslkj')
    end
  end

  describe '#==' do
    subject { /foo/ }

    it "returns true when given Regexp is exactly equal to this Regexp" do
      should equal_match(/foo/)
    end

    it "returns false when given Regexp is not exactly equal to this Regexp" do
      should_not equal_match(/alkj/)
    end

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

    it "returns false when not even given a Regexp" do
      should_not equal_match(:something_else)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

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