Sha256: 312e4cf7277ccf32a2470f3eaf614ba845db67f9d9b620ee727a0cbbdd4593c2

Contents?: true

Size: 1.01 KB

Versions: 2

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

# The same class in rspec specs file
class Substance
  def initialize exists, description
    @exists = exists
    @description = description
  end
  def exist?(arg=nil)
    @exists
  end
end

module Spec
  module Matchers
    
    describe "exist matcher" do
      
      before(:each) do
        @keywords = {'matchers' => {'exist' => 'existir|existe'}}
        stub_language!("pt", @keywords)
        Spec::Matchers.register_all_matchers
        @real = Substance.new true, 'something real'
        @imaginary = Substance.new false, 'something imaginary'
      end
      
      it 'should register the exist method translated' do
        [:existir, :existe].each do |translated_matcher|
          methods.to_symbols.should include(translated_matcher)
        end
      end
      
      it "passes if target exists" do
        @real.should existir
      end
      
      it "fails if target does not exist" do
        lambda { @imaginary.should exist }.should raise_error
      end
      
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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