Sha256: 6dff9afdf69c25e363d979fdec9bbb63a51ff226568ee8f9fdbe13fa3b1e19f8

Contents?: true

Size: 1007 Bytes

Versions: 2

Compression:

Stored size: 1007 Bytes

Contents

require 'spec_helper'

describe "should match(expected)" do
  before(:each) do
    @expected_matcher = {'matchers' => { 'match' => 'corresponder|corresponde'} }
    stub_language!("pt", @expected_matcher)
    Spec::Matchers.register_all_matchers
  end
  
  it "should translated the include matcher" do
    [:corresponder, :corresponde].each do |translated_matcher|
      methods.to_symbols.should include(translated_matcher)
    end
  end
  
  it "should pass when target (String) matches expected (Regexp)" do
    "string".should corresponder(/tri/)
  end

  it "should pass when target (String) matches expected (String)" do
    "string".should corresponder("tri")
  end

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

  it "should fail when target (String) does not match expected (String)" do
    lambda {
      "string".should corresponder("rings")
    }.should raise_error
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-i18n-1.2.1 spec/spec-i18n/matchers/match_spec.rb
rspec-i18n-1.2.0 spec/spec-i18n/matchers/match_spec.rb