Sha256: b63de27c66dc37030129e4ab831727dbeb14bd43ef022e50c6620dbdd122bca0
Contents?: true
Size: 1.67 KB
Versions: 2
Compression:
Stored size: 1.67 KB
Contents
require File.join(File.dirname(__FILE__), '/../generators/i18n_locale/i18n_locale_command') describe I18nGenerator::Generator::Commands::Create do before do (@command = Object.new).extend I18nGenerator::Generator::Commands::Create @command.stub!(:locale_name).and_return('ja') end describe 'add_locale_config' do describe 'when i18n.default_locale is configured in environment.rb' do before do @config = " Rails::Initializer.run do |config| config.i18n.default_locale = :de end" end it 'rewrites the existing default_locale to locale_name value' do @command.send(:add_locale_config, @config).should == " Rails::Initializer.run do |config| config.i18n.default_locale = 'ja' end" end end describe 'when i18n.default_locale config is commented in environment.rb' do before do @config = " Rails::Initializer.run do |config| # config.i18n.default_locale = :de end" end it 'uncomments the existing commented i18n config and sets locale_name value' do @command.send(:add_locale_config, @config).should == " Rails::Initializer.run do |config| config.i18n.default_locale = 'ja' end" end end describe 'when i18n.default_locale is not written in environment.rb' do before do @config = " Rails::Initializer.run do |config| something goes here. bla bla bla... end" end it 'adds the default_locale config inside the config block and sets locale_name value' do @command.send(:add_locale_config, @config).should == " Rails::Initializer.run do |config| something goes here. bla bla bla... config.i18n.default_locale = 'ja' end" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
amatsuda-i18n_generators-0.3.0 | spec/i18n_locale_command_spec.rb |
amatsuda-i18n_generators-0.3.1 | spec/i18n_locale_command_spec.rb |