Sha256: 7c06673e03328a9d176a286922c06b5ac717b1dd345777de451de0d0f5078c32

Contents?: true

Size: 937 Bytes

Versions: 5

Compression:

Stored size: 937 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe Article do
  it { should have_many :translations }

  it "should have empty translations for a new record" do
    Article.new.translations.should be_empty
  end
  
  it 'should destroy dependent locales' do
    article = Article.create!(:slug => '__hello__', :name => 'Hello', :content => 'World')
    expect do
      article.destroy
    end.to change(ArticleTranslation, :count).by(-1)
  end
  
  it 'should use I18n fallbacks' do
    article = Article.create!(:slug => '__hello__', :name => 'Hello', :content => 'World')
    article.update_attributes! :locale => :en, :name => 'Hello in English'
    I18n.locale = :en
    article.name.should == 'Hello in English'
    I18n.locale = :ru
    article.name.should == 'Hello'
    I18n.locale = :de
    article.name.should == 'Hello'
  end
end

describe ArticleTranslation do
  it { should belong_to :article }
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_model_translations-0.1.6 spec/simple_model_translations_spec.rb
simple_model_translations-0.1.4 spec/simple_model_translations_spec.rb
simple_model_translations-0.1.3 spec/simple_model_translations_spec.rb
simple_model_translations-0.1.1 spec/simple_model_translations_spec.rb
simple_model_translations-0.1.0 spec/simple_model_translations_spec.rb