Sha256: ba893a1806ca8084287e584aaa62a23081fca57de923957a96fef8b748a02ec1

Contents?: true

Size: 647 Bytes

Versions: 9

Compression:

Stored size: 647 Bytes

Contents

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

describe Post do
  it 'should be valid with both :ru and :en translations' do
    post = Post.new(:locale => :ru, :name => 'Privet')
    post.attributes = { :locale => :en, :name => 'Hello' }
    post.should be_valid
  end
  
  it 'should be invalid with only :ru translation' do
    post = Post.new(:locale => :ru, :name => 'Privet')
    post.should_not be_valid
  end
end

describe Book do
  it 'should validate presence of name' do
    book = Book.new(:locale => :ru, :name => '')
    book.should_not be_valid
    book.errors['translations.name'].should_not be_empty
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
simple_model_translations-0.2.8 spec/validations_spec.rb
simple_model_translations-0.2.7 spec/validations_spec.rb
simple_model_translations-0.2.6 spec/validations_spec.rb
simple_model_translations-0.2.5 spec/validations_spec.rb
simple_model_translations-0.2.4 spec/validations_spec.rb
simple_model_translations-0.2.3 spec/validations_spec.rb
simple_model_translations-0.2.2 spec/validations_spec.rb
simple_model_translations-0.2.1 spec/validations_spec.rb
simple_model_translations-0.2.0 spec/validations_spec.rb