Sha256: b17865bdb3e4f1496f437f09f93b4b414f150d523d28ef8d8a752ab7aff8ff6d

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

#encoding=utf-8
require 'spec_helper'

describe Transmating::I18n do
  let(:user) { User.new :name => 'John Doe', :organization => 'SNU' }

  it "embeds translation model in the target class" do
    user.translations.should == []
  end

  describe "#translated" do
    it "returns nil if no translation is found" do
      user.translated("ko").should == nil
    end
  end

  describe "#translate" do
    it "adds a translation object to model" do
      user.translate("ko", :name => '홍길동', :organization => '서울대학교')
      user.translations.to_a.count.should == 1
      user.translated("ko").name.should == '홍길동'
      user.translated("ko").organization.should == '서울대학교'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transmating-0.1.0 spec/unit/i18n_spec.rb