Sha256: 7ee49d25c43d6daa9cfd0dd3a0c050bccaec4686ac45ea873dd3f55ecf63d0ec

Contents?: true

Size: 854 Bytes

Versions: 11

Compression:

Stored size: 854 Bytes

Contents

require 'test_helper'

class TranslationTest < Test::Unit::TestCase
  should "translate add mongo_mapper translations" do
    I18n.translate("mongo_mapper.errors.messages.taken").should == "has already been taken"
  end

  should "set i18n_scope" do
    Doc().i18n_scope.should == :mongo_mapper
  end

  should "translate document attributes" do
    I18n.config.backend.store_translations(:en, :mongo_mapper => {:attributes => {:thing => {:foo => 'Bar'}}})
    doc = Doc('Thing') do
      key :foo, String
    end
    doc.human_attribute_name(:foo).should == 'Bar'
  end

  should "translate embedded document attributes" do
    I18n.config.backend.store_translations(:en, :mongo_mapper => {:attributes => {:thing => {:foo => 'Bar'}}})
    doc = EDoc('Thing') do
      key :foo, String
    end
    doc.human_attribute_name(:foo).should == 'Bar'
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
mongo_mapper-0.12.0 test/unit/test_translation.rb
lookout-mongo_mapper-0.11.3 test/unit/test_translation.rb
mongo_mapper-0.11.2 test/unit/test_translation.rb
jamieorc-mongo_mapper-0.11.1.1 test/unit/test_translation.rb
mongo_mapper-0.11.1 test/unit/test_translation.rb
mongo_mapper-0.11.0 test/unit/test_translation.rb
mongo_mapper-0.10.1 test/unit/test_translation.rb
mongo_mapper-0.10.0 test/unit/test_translation.rb
mongo_mapper-0.9.2 test/unit/test_translation.rb
mongo_mapper-0.9.1 test/unit/test_translation.rb
mongo_mapper-0.9.0 test/unit/test_translation.rb