Sha256: c508e755d6b830bbc5d65e93ac0e1003dbf6366d51f92b174672440ae67411e5
Contents?: true
Size: 1.34 KB
Versions: 1
Compression:
Stored size: 1.34 KB
Contents
# encoding: utf-8 require File.dirname(__FILE__) + '/spec_helper' describe 'HasTranslations' do it "should switch locales" do g = Group.create!(:name => "Sport") c = Category.create!(:name => "Golf", :groups => [g]) z = News.create!(:title => "Tiger Woods sucks", :body => Faker::Lorem::paragraphs(10).join, :category_id => c.id) # translate g.translations.create!(:locale => 'lv', :name => "Sports") c.translations.create!(:locale => 'lv', :name => "Golfs") z.translations.create!(:locale => 'lv', :title => "Taigers Vuds nekam neder") g.name.should == "Sport" c.name.should == "Golf" z.title.should == "Tiger Woods sucks" I18n.locale = :lv g.name.should == "Sports" c.name.should == "Golfs" z.title.should == "Taigers Vuds nekam neder" z.category.name.should == "Golfs" z.category.groups.first.name.should == "Sports" z.destroy c.destroy g.destroy #-------------------------------- I18n.locale = I18n.default_locale end it "should load requested locale with 'in' method" do g = Group.create!(:name => "Sport") g.translations.create!(:locale => 'lv', :name => "Sports") g = Group.find_by_name "Sport" g.name.should == "Sport" g.name.in(:lv).should == "Sports" g.name.should == "Sport" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lolita-translation-0.0.4 | spec/has_translations_spec.rb |