Sha256: b8691d44b33874781bef69a18ade48c965f21f7adf60b385592df93596b0edb2
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
require "spec_helper" describe AwesomeTranslations::ErbInspector::FileInspector 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_path) } let(:user_index_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/index.html.haml" } } let(:user_edit_inspector) { files.find { |file_inspector| file_inspector.file_path == "app/views/users/edit.html.liquid" } } let(:user_index_translations) { user_index_inspector.translations.to_a } let(:hello_world_translation) { user_index_translations.find { |translation| translation.key == ".hello_world" } } describe "#translations" do it "finds the right number of translations" do expect(user_index_translations.length).to eq 3 end it "finds liquid translations" do translation_keys = user_edit_inspector.translations.map(&:key) expect(translation_keys).to include ".edit_user" expect(translation_keys).to include ".test_for_liquid_templates" expect(translation_keys).to include ".test_for_liquid_templates_with_var_double_quotes" expect(translation_keys).to include ".test_for_liquid_templates_with_var_single_quotes" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
awesome_translations-0.0.48 | spec/lib/erb_inspector/file_inspector_spec.rb |
awesome_translations-0.0.47 | spec/lib/erb_inspector/file_inspector_spec.rb |