Sha256: 1d981b5e43ab9a31f874367c8768e513e43b53739b80a92139d3e1c598b0cd86

Contents?: true

Size: 1.1 KB

Versions: 22

Compression:

Stored size: 1.1 KB

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

describe "should match(expected)" do
  it "should pass when target (String) matches expected (Regexp)" do
    "string".should match(/tri/)
  end

  it "should fail when target (String) matches expected (Regexp)" do
    lambda {
      "string".should match(/rings/)
    }.should fail
  end

  it "should provide message, expected and actual on failure" do
    matcher = match(/rings/)
    matcher.matches?("string")
    matcher.failure_message.should == ["expected \"string\" to match /rings/", /rings/, "string"]
  end
end

describe "should_not match(expected)" do
  it "should pass when target (String) matches expected (Regexp)" do
    "string".should_not match(/rings/)
  end

  it "should fail when target (String) matches expected (Regexp)" do
    lambda {
      "string".should_not match(/tri/)
    }.should fail
  end

  it "should provide message, expected and actual on failure" do
    matcher = match(/tri/)
    matcher.matches?("string")
    matcher.negative_failure_message.should == ["expected \"string\" not to match /tri/", /tri/, "string"]
  end
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
deckshuffler-0.0.2 vendor/plugins/rspec/spec/spec/matchers/match_spec.rb
has_finder-0.1.1 spec/rails/vendor/plugins/rspec/spec/spec/matchers/match_spec.rb
has_finder-0.1.2 spec/rails/vendor/plugins/rspec/spec/spec/matchers/match_spec.rb
has_finder-0.1.3 spec/rails/vendor/plugins/rspec/spec/spec/matchers/match_spec.rb
rspec-1.0.3 spec/spec/matchers/match_spec.rb
rspec-0.9.3 spec/spec/matchers/match_spec.rb
rspec-0.9.4 spec/spec/matchers/match_spec.rb
rspec-1.0.0 spec/spec/matchers/match_spec.rb
rspec-1.0.1 spec/spec/matchers/match_spec.rb
rspec-1.0.2 spec/spec/matchers/match_spec.rb
rspec-1.0.4 spec/spec/matchers/match_spec.rb
rspec-1.0.5 spec/spec/matchers/match_spec.rb
rspec-0.9.1 spec/spec/matchers/match_spec.rb
rspec-0.9.0 spec/spec/matchers/match_spec.rb
rspec-0.9.2 spec/spec/matchers/match_spec.rb
rspec-1.1.1 spec/spec/matchers/match_spec.rb
rspec-1.0.8 spec/spec/matchers/match_spec.rb
rspec-1.0.7 spec/spec/matchers/match_spec.rb
rspec-1.0.6 spec/spec/matchers/match_spec.rb
rspec-1.1.0 spec/spec/matchers/match_spec.rb