Sha256: 44c041c65ea1a0e1e73b3cc17f3e3137c20f44e41b20a59c29a760b1b37744d5
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
# coding: utf-8 require 'spec_helper' describe 'UsedKeys' do let!(:task) { I18n::Tasks::BaseTask.new } around do |ex| task.config[:search] = {paths: ['a.html.slim']} TestCodebase.setup('a.html.slim' => <<-SLIM) div = t 'a' p = t 'a' h1 = t 'b' SLIM TestCodebase.in_test_app_dir { ex.run } TestCodebase.teardown end it '#used_keys(source_locations: true)' do used = task.used_tree(source_locations: true) leaves = used.leaves.to_a expect(leaves.size).to eq 2 expect_node_key_data( leaves[0], 'a', source_locations: [{pos: 6, line_num: 1, line_pos: 7, line: "div = t 'a'", path: 'a.html.slim'}, {pos: 18, line_num: 2, line_pos: 7, line: " p = t 'a'", path: 'a.html.slim'}] ) expect_node_key_data( leaves[1], 'b', source_locations: [{pos: 29, line_num: 3, line_pos: 6, line: "h1 = t 'b'", path: 'a.html.slim'}] ) end it '#used_keys(source_locations: true, key_filter: "b*")' do used_keys = task.used_tree(key_filter: 'b*', source_locations: true) expect(used_keys.size).to eq 1 expect_node_key_data( used_keys.leaves.first, 'b', source_locations: [{pos: 29, line_num: 3, line_pos: 6, line: "h1 = t 'b'", path: 'a.html.slim'}] ) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
i18n-tasks-0.5.0 | spec/used_keys_spec.rb |