Sha256: 415c4df6261d3ed2a19caeb6ebf91f9e220afd871c9b1b4dbd8fd607c1abe122

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

require 'i18n_flow/repository'

describe I18nFlow::Repository do
  include_examples :create_repository

  describe '#file_paths' do
    it 'should return an array of matched file paths' do
      expect(repository.file_paths).to match_array([
        '/fixtures/models/user.en.yml',
        '/fixtures/models/user.ja.yml',
        '/fixtures/views/profiles/show.en.yml',
        '/fixtures/views/profiles/show.ja.yml',
        '/fixtures/views/profiles/show.fr.yml',
      ])
    end
  end

  describe '#asts_by_path' do
    it 'should return a hash of tree indexed by (relative) file paths' do
      expect(repository.asts_by_path.keys).to match_array([
        'models/user.en.yml',
        'models/user.ja.yml',
        'views/profiles/show.en.yml',
        'views/profiles/show.ja.yml',
        'views/profiles/show.fr.yml',
      ])
    end
  end

  describe '#asts_by_scope' do
    it 'should return a hash of tree indexed by scopes' do
      expect(repository.asts_by_scope.keys).to match_array([
        'models.user',
        'views.profiles.show',
      ])
      expect(repository.asts_by_scope['models.user'].keys).to match_array(['en', 'ja'])
      expect(repository.asts_by_scope['views.profiles.show'].keys).to match_array(['en', 'ja', 'fr'])
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
i18n_flow-0.2.3 spec/lib/i18n_flow/repository_spec.rb
i18n_flow-0.2.2 spec/lib/i18n_flow/repository_spec.rb
i18n_flow-0.2.1 spec/lib/i18n_flow/repository_spec.rb
i18n_flow-0.2.0 spec/lib/i18n_flow/repository_spec.rb
i18n_flow-0.1.0 spec/lib/i18n_flow/repository_spec.rb