~ubuntu-branches/ubuntu/vivid/ruby-i18n/vivid

« back to all changes in this revision

Viewing changes to test/backend/chain_test.rb

  • Committer: Package Import Robot
  • Author(s): Jonas Genannt
  • Date: 2013-11-27 19:26:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: package-import@ubuntu.com-20131127192654-ihh1sn3y680fvh29
Tags: upstream-0.6.5
ImportĀ upstreamĀ versionĀ 0.6.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
class I18nBackendChainTest < Test::Unit::TestCase
4
4
  def setup
5
5
    @first  = backend(:en => {
6
 
      :foo => 'Foo', :formats => { :short => 'short' }, :plural_1 => { :one => '%{count}' }
 
6
      :foo => 'Foo', :formats => { :short => 'short' }, :plural_1 => { :one => '%{count}' }, :dates => {:a => "A"}
7
7
    })
8
8
    @second = backend(:en => {
9
 
      :bar => 'Bar', :formats => { :long => 'long' }, :plural_2 => { :one => 'one' }
 
9
      :bar => 'Bar', :formats => { :long => 'long' }, :plural_2 => { :one => 'one' }, :dates => {:a => "B", :b => "B"}
10
10
    })
11
11
    @chain  = I18n.backend = I18n::Backend::Chain.new(@first, @second)
12
12
  end
42
42
    assert_equal({ :short => 'short', :long => 'long' }, I18n.t(:formats))
43
43
  end
44
44
 
 
45
  test "namespace lookup collects results from all backends and does not overwrite" do
 
46
    assert_equal({ :a => "A", :b => "B" }, I18n.t(:dates))
 
47
  end
 
48
 
45
49
  test "namespace lookup with only the first backend returning a result" do
46
50
    assert_equal({ :one => '%{count}' }, I18n.t(:plural_1))
47
51
  end