Rspec-i18n
Description
The Rspec-i18n gem provide a easy way to write specs in any language you prefer. 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 code/specs in English =)
But if you don’t prefer that, you’ll like the Rspec-i18n.
Synopsis
Rspec-i18n will supports any language you want (See github.com/tomas-stefano/rspec-i18n/blob/master/lib/spec-i18n/languages.yml file). This is Portuguese(Brazil):
require 'spec'
require 'spec-i18n'
Spec::Runner.configure do |config|
config.spec_language :pt
...
end
# In spec/pessoa_spec.rb
require 'spec_helper'
descreva Pessoa do
antes(:de_cada) do
@nome = "Tomas"
@pessoa = Pessoa.new(@nome)
end
exemplo "retornar o seu nome" do
@pessoa.nome.deve == @nome
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 rspec-i18n –language es
Adding a new language or completing a existing one(based on Cucumber implementation)
1. Make a fork of Rspec-i18n and pull it down
2. Add your language keywords to languages.yml
3. Commit and push your changes - then send a pull request at Github
** OBS: Hints for better words in languages.yml are Welcome =D.
Install
[sudo] gem install rspec-i18n
TODO
See the TODO.txt file and see more details