Sha256: b92d58dc737b3b6deb464420777350c30a8df658faf98cbc5b68ce1f4346e03d

Contents?: true

Size: 867 Bytes

Versions: 7

Compression:

Stored size: 867 Bytes

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 }

  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
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
awesome_translations-0.0.8 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.7 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.6 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.5 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.4 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.3 spec/lib/erb_inspector/translation_inspector_spec.rb
awesome_translations-0.0.2 spec/lib/erb_inspector/translation_inspector_spec.rb