cucumber-attic / gherkin2

A fast Gherkin parser in Ragel (The parser behind Cucumber)
MIT License
382 stars 221 forks source link

When I18n.get receives an invalid iso_code it doesn't raises error accordingly #309

Open abinoam opened 10 years ago

abinoam commented 10 years ago
Gherkin::I18n.get('non-valid-iso_code')

doesn't raises an error.

I'm working on specs and fix. PR soon.

abinoam commented 10 years ago

When trying to do

$ cucumber --i18n pt-BR

I got

undefined method `[]' for nil:NilClass (NoMethodError)
/Users/abinoam/.rvm/gems/ruby-2.1.0/gems/gherkin-2.12.2/lib/gherkin/i18n.rb:93:in `initialize'
/Users/abinoam/.rvm/gems/ruby-2.1.0/gems/gherkin-2.12.2/lib/gherkin/i18n.rb:25:in `new'
/Users/abinoam/.rvm/gems/ruby-2.1.0/gems/gherkin-2.12.2/lib/gherkin/i18n.rb:25:in `get'
/Users/abinoam/.rvm/gems/ruby-2.1.0/gems/cucumber-1.3.15/lib/cucumber/cli/options.rb:412:in `list_keywords_and_exit'
/Users/abinoam/.rvm/gems/ruby-2.1.0/gems/cucumber-1.3.15/lib/cucumber/cli/options.rb:159:in `block (2 levels) in parse!'
abinoam commented 10 years ago

After the fix I will get:

$ cucumber --i18n pt-BR
Language not supported: "pt-BR" (RuntimeError)
/Users/abinoam/src/gherkin/lib/gherkin/i18n.rb:92:in `initialize'
/Users/abinoam/src/gherkin/lib/gherkin/i18n.rb:25:in `new'
/Users/abinoam/src/gherkin/lib/gherkin/i18n.rb:25:in `get'
/Users/abinoam/.rvm/gems/ruby-2.0.0-p247@cucumber/gems/cucumber-1.3.15/lib/cucumber/cli/options.rb:412:in `list_keywords_and_exit'
/Users/abinoam/.rvm/gems/ruby-2.0.0-p247@cucumber/gems/cucumber-1.3.15/lib/cucumber/cli/options.rb:159:in `block (2 levels) in parse!'