Sha256: 9f86d340112f8da6fff66a70f58164fa4689b7c2253a7bfff6723e9aaa474b90

Contents?: true

Size: 1.25 KB

Versions: 10

Compression:

Stored size: 1.25 KB

Contents

require "spec_helper"

describe AwesomeTranslations::ErbInspector::TranslationInspector do
  let(:erb_inspector) do
    AwesomeTranslations::ErbInspector.new(
      dirs: [Rails.root.to_s]
    )
  end

  let(:files) { erb_inspector.files.to_a }
  let(:file_paths) { files.map { |file| file.file_path } }
  let(:user_index_inspector) { files.select { |file_inspector| file_inspector.file_path == "app/views/users/index.html.haml" }.first }
  let(:user_index_translations) { user_index_inspector.translations.to_a }
  let(:hello_world_translation) { user_index_translations.select { |translation| translation.key == ".hello_world" }.first }
  let(:user_was_created_translation) do
    files
      .select { |file_inspector| file_inspector.file_path == "app/controllers/users_controller.rb" }
      .first
      .translations
      .select { |translation| translation.key == ".user_was_created" }
      .first
  end

  it "#full_key" do
    hello_world_translation.full_key.should eq "users.index.hello_world"
  end

  it "#full_path" do
    hello_world_translation.full_path.should eq "#{Rails.root}/app/views/users/index.html.haml"
  end

  it '#dir' do
    user_was_created_translation.dir.should end_with 'spec/dummy/config/locales/awesome_translations/app/controllers'
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
awesome_translations-0.0.19 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.18 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.17 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.16 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.15 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.14 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.13 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.12 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.10 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.9 spec/lib/erb_inspector/translation_inspector_spec.rb