Sha256: 8495948dfd6e6f6d2650312a2a220d6ca70afcff46309dedde5fab8ad4c2582a

Contents?: true

Size: 847 Bytes

Versions: 14

Compression:

Stored size: 847 Bytes

Contents

require 'spec_helper'

describe "Translation" do
  it "should translate add mongo_mapper translations" do
    I18n.translate("mongo_mapper.errors.messages.taken").should == "has already been taken"
  end

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

  it "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

  it "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

14 entries across 14 versions & 1 rubygems

Version Path
mongo_mapper-0.16.0 spec/unit/translation_spec.rb
mongo_mapper-0.15.6 spec/unit/translation_spec.rb
mongo_mapper-0.15.5 spec/unit/translation_spec.rb
mongo_mapper-0.15.4 spec/unit/translation_spec.rb
mongo_mapper-0.15.3 spec/unit/translation_spec.rb
mongo_mapper-0.15.2 spec/unit/translation_spec.rb
mongo_mapper-0.15.1 spec/unit/translation_spec.rb
mongo_mapper-0.15.0 spec/unit/translation_spec.rb
mongo_mapper-0.14.0 spec/unit/translation_spec.rb
mongo_mapper-0.14.0.rc1 spec/unit/translation_spec.rb
mongo_mapper-0.13.1 spec/unit/translation_spec.rb
mongo_mapper-0.13.0 spec/unit/translation_spec.rb
mongo_mapper-0.13.0.beta2 spec/unit/translation_spec.rb
mongo_mapper-0.13.0.beta1 spec/unit/translation_spec.rb