Rspec-i18n

Install

[sudo] gem install rspec-i18n

Description

The Rspec-i18n gem provide a easy way to write specs in any speaking language you prefer - If don’t have your speaking language, please make a fork =) The Rspec-i18n was created for the purpose of teaching people who are starting to developing applications but also serves to Production use. I know that many people prefer to write Specs in English. But if you don’t prefer that or in some cases DON’T NEED THAT, you’ll like the Rspec-i18n. =)

Synopsis

Rspec-i18n Will support various languages(If don’t have your speaking language, please make a fork and send pull requests!) (See github.com/tomas-stefano/rspec-i18n/blob/master/lib/spec-i18n/languages.yml file). Here is a simple example of Portuguese(Brazil):

First your spec_helper:

# In spec/spec_helper

require 'spec-i18n'

Spec::Runner.configure do |config|

  config.spec_language :pt

  # ...
end

Then you have Translated -> Matchers, Before Hooks, After Hooks …(etc) in Portuguese Language. Start with a very very simple example in Portuguese:

# In spec/personagem_spec.rb

require 'spec_helper'

  descreva Personagem do

    antes(:de_cada) do
      @homer = Personagem.new("Homer Simpson", :desenho => :simpson)
      @meggie = Personagem.new("Meggie Simpson", :desenho => :simpson)
    end

    isto "deve retornar o desenho ao qual o personagem pertence" do             
      @homer.desenho.deve ser_igual_a(:simpson)                                 
    end                                                                         

    isto "deve ser personagem principal" do                                     
      @homer.deve ser_personagem_principal # look personagem_principal? method  
    end                                                                         

    isto "deve beber cerveja Duffy" do                                          
      @homer.bebe_cerveja_duffy?.deve ser_verdadeiro                            
    end                                                                         

    isto "não deve beber cerveja Duffy" do                                          
      @meggie.bebe_cerveja_duffy?.nao_deve ser_verdadeiro
    end

    isto "deve ser menor de idade" do
      @meggie.maior_de_idade?.deve ser_falso
    end

    isto "deve ser nulo" do
      @margie.deve ser_nulo
    end

end

Examples

See more examples in github.com/tomas-stefano/rspec-i18n/blob/master/examples/i18n

Listing the available languages

rspec-i18n --language help

Listing the available keywords for the language

rspec-i18n –language pt

Collaborating with Rspec-I18n

  • See http://wiki.github.com/tomas-stefano/rspec-i18n/collaborating-with-rspec-i18n

Supported Versions

Ruby 1.8.7, 1.9.1 and 1.9.2

Rspec-i18n >= 1.0.0 supports ONLY Rspec 1.3

The older versions supports this versions: Rspec: 1.2.7, 1.2.8, 1.2.9

Support for Rspec 2.0

TODO

See the TODO.txt file and see more details