Sha256: 8e66f35c3946901e0cc932ef96c2591415b522251082cd600cb00fbbc6452651

Contents?: true

Size: 1.05 KB

Versions: 10

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'

describe ExvoGlobalize do

  let(:backend) { I18n.backend.globalize_store }

  it "should not change a normal hash" do
    hash = { :hello => "Hello", :world => "World" }
    backend.nest_translations(hash).should eq(hash)
  end

  it "should not change a nested hash" do
    nested_hash = { :en => { :hello => "Hello World!", :world => "World!" } }
    backend.nest_translations(nested_hash).should eq(nested_hash)
  end

  it "should nest a simple flatten hash" do
    hash = { "hello.world" => "Hello World!" }
    nested_hash = { :hello => { :world => "Hello World!" } }
    backend.nest_translations(hash).should eq(nested_hash)
  end

  it "should nest a complicated flatten hash with symbol key" do
    hash = {
      :en => {
        "hello.world" => "Hello World!",
        "hello.earth" => "Hello Earth!"
      }
    }

    nested_hash = {
      :en => {
        :hello => {
          :world => "Hello World!",
          :earth => "Hello Earth!"
        }
      }
    }

    backend.nest_translations(hash).should eq(nested_hash)
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
exvo_globalize-0.6.0 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.5.6 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.5.5 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.5.4 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.5.3 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.5.2 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.5.1 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.5.0 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.4.0 spec/exvo_globalize/flatten_spec.rb
exvo_globalize-0.3.2 spec/exvo_globalize/flatten_spec.rb