require 'spec_helper' describe Aigu::EmberPodImporter do describe :build_blob do let(:importer) { Aigu::EmberPodImporter.new } let(:blob) { importer.send(:build_blob, content) } let(:content) do { 'app/locales/__LOCALE__/translations.general.json|hello' => 'Hello from general.hello', 'app/pods/component-a/nested-component-a/translations.__LOCALE__.json|labels.first_name' => 'Nested A) First Name', 'app/pods/component-a/nested-component-a/translations.__LOCALE__.json|labels.last_name' => 'Nested A) Last Name', 'app/pods/component-a/nested-component-a/translations.__LOCALE__.json|errors.general' => 'Nested A) An error occured.', 'app/pods/component-a/nested-component-a/translations.__LOCALE__.json|errors.network' => 'Nested A) A network error occured.', 'app/pods/component-a/translations.__LOCALE__.json|labels.first_name' => 'A) First Name', 'app/pods/component-a/translations.__LOCALE__.json|labels.last_name' => 'A) Last Name', 'app/pods/component-a/translations.__LOCALE__.json|errors.general' => 'A) An error occured.', 'app/pods/component-a/translations.__LOCALE__.json|errors.network' => 'A) A network error occured.', 'app/pods/component-b/translations.__LOCALE__.json|labels.first_name' => 'B) First Name', 'app/pods/component-b/translations.__LOCALE__.json|labels.last_name' => 'B) Last Name', 'app/pods/component-b/translations.__LOCALE__.json|errors.general' => 'B) An error occured.', 'app/pods/component-b/translations.__LOCALE__.json|errors.network' => 'B) A network error occured.' } end let(:expected_blob) do { 'app/locales/__LOCALE__/translations.general.json' => { 'hello' => 'Hello from general.hello' }, 'app/pods/component-a/nested-component-a/translations.__LOCALE__.json' => { 'errors' => { 'general' => 'Nested A) An error occured.', 'network' => 'Nested A) A network error occured.' }, 'labels' => { 'first_name' => 'Nested A) First Name', 'last_name' => 'Nested A) Last Name' } }, 'app/pods/component-a/translations.__LOCALE__.json' => { 'errors' => { 'general' => 'A) An error occured.', 'network' => 'A) A network error occured.' }, 'labels' => { 'first_name' => 'A) First Name', 'last_name' => 'A) Last Name' } }, 'app/pods/component-b/translations.__LOCALE__.json' => { 'errors' => { 'general' => 'B) An error occured.', 'network' => 'B) A network error occured.' }, 'labels' => { 'first_name' => 'B) First Name', 'last_name' => 'B) Last Name' } } } end it { expect(blob).to eql expected_blob } end end