Sha256: 752421c092ba835158ec3fb112260819a808985fb6177f2e39506f3f48acbe46
Contents?: true
Size: 1.98 KB
Versions: 4
Compression:
Stored size: 1.98 KB
Contents
require 'spec_helper' describe Aigu::Exporter do describe :flattenize_content_values do let(:exporter) { described_class.new } let(:flattenized_content) { exporter.send(:flattenize_content_values, content) } let(:content) do { 'users.fr|fr.users.index.title' => 'Foo', 'users.fr|fr.users.index.actions' => [ 'Bar', true, 'LOL' ], 'users.fr|fr.users.index.footer' => 'Bla', 'users.fr|fr.users.index.shown' => false, 'users.fr|fr.users.index.hidden' => true, 'users.fr|fr.users.index.what' => nil } end let(:expected_content) do { 'users.fr|fr.users.index.title' => 'Foo', 'users.fr|fr.users.index.actions___KEY___0' => 'Bar', 'users.fr|fr.users.index.actions___KEY___1' => '___TRUE___', 'users.fr|fr.users.index.actions___KEY___2' => 'LOL', 'users.fr|fr.users.index.footer' => 'Bla', 'users.fr|fr.users.index.shown' => '___FALSE___', 'users.fr|fr.users.index.hidden' => '___TRUE___', 'users.fr|fr.users.index.what' => '___NULL___' } end it { expect(flattenized_content).to eql expected_content } end describe :globalize_content_keys do let(:exporter) { described_class.new } let(:globalized_keys) { exporter.send(:globalize_content_keys, content).keys } before { exporter.instance_variable_set(:@locale, 'fr') } let(:content) do { 'users.fr|fr.users.index.title' => 'Foo', 'users.fr|fr.users.index.footer' => 'Bla', 'users.fr|fr.users.index.fr.shown' => false, 'users.fr|fr.users.index.hidden' => true, 'users.fr|fr.users.index.what' => nil } end let(:expected_keys) do [ 'users|users.index.title', 'users|users.index.footer', 'users|users.index.fr.shown', 'users|users.index.hidden', 'users|users.index.what' ] end it { expect(globalized_keys).to eql expected_keys } end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
aigu-0.3.1 | spec/aigu/exporter_spec.rb |
aigu-0.3 | spec/aigu/exporter_spec.rb |
aigu-0.2.1 | spec/aigu/exporter_spec.rb |
aigu-0.2 | spec/aigu/exporter_spec.rb |