i18nliner 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b0c858864e7452e710481ac27a31729269125d28
4
+ data.tar.gz: 5594ea378bb9cfbc3d625a5a3609fc88410a0544
5
+ SHA512:
6
+ metadata.gz: 5713557a04551c10965f53907108570aff48b126f34a62fd90348b8fda646eb08d3c353e2b68b9ea1ba88f4008ef9e6c5589aa0b02dcb04edb03339a31987b38
7
+ data.tar.gz: e6d1f3e1e6c3d1299a1a6f207676de109bbc92190f8fe04296f06a991e4861b61006abc3a273ffdee83f6a7f2dde5fd9196a78f7d955cf97f3e4aa9f1ada490b
@@ -13,10 +13,10 @@ describe I18nliner::Commands::Check do
13
13
  allow(I18nliner).to receive(:manual_translations).and_return({})
14
14
  checker = I18nliner::Commands::Check.new({:silent => true})
15
15
  checker.check_files
16
- checker.translations.values.should == ["welcome, %{name}", "Hello World", "*This* is a test, %{user}"]
17
- checker.errors.size.should == 2
16
+ expect(checker.translations.values).to eq ["welcome, %{name}", "Hello World", "*This* is a test, %{user}"]
17
+ expect(checker.errors.size).to eq 2
18
18
  checker.errors.each do |error|
19
- error.should =~ /\Ainvalid signature/
19
+ expect(error).to match /\Ainvalid signature/
20
20
  end
21
21
  end
22
22
  end
@@ -18,7 +18,7 @@ describe I18nliner::Commands::Dump do
18
18
  translations = I18nliner::Extractors::TranslationHash.new('i18n' => "Iñtërnâtiônàlizætiøn")
19
19
  dumper = I18nliner::Commands::Dump.new({:silent => true, :translations => translations})
20
20
  dumper.run
21
- File.read(dumper.yml_file).gsub(/\s+$/, '').should == <<-YML.strip_heredoc.strip
21
+ expect(File.read(dumper.yml_file).gsub(/\s+$/, '')).to eq <<-YML.strip_heredoc.strip
22
22
  ---
23
23
  #{I18n.default_locale}:
24
24
  i18n: Iñtërnâtiônàlizætiøn
@@ -22,8 +22,8 @@ describe I18nliner::Extensions::Controller do
22
22
 
23
23
  describe "#translate" do
24
24
  it "should inferpolate" do
25
- i18n.stub(:foo).and_return("FOO")
26
- I18nliner::CallHelpers.stub(:infer_key).and_return(:key)
25
+ allow(i18n).to receive(:foo).and_return("FOO")
26
+ allow(I18nliner::CallHelpers).to receive(:infer_key).and_return(:key)
27
27
 
28
28
  expect(I18n).to receive(:translate).with(:key, :default => "hello %{foo}", :foo => "FOO", :i18nliner_scope => i18n.i18nliner_scope)
29
29
  i18n.translate("hello %{foo}")
@@ -55,27 +55,27 @@ describe I18nliner::Extensions::Core do
55
55
  context "with wrappers" do
56
56
  it "should apply a single wrapper" do
57
57
  result = i18n.translate("Hello *bob*.", :wrapper => '<b>\1</b>')
58
- result.should == "Hello <b>bob</b>."
58
+ expect(result).to eq "Hello <b>bob</b>."
59
59
  end
60
60
 
61
61
  it "should be html-safe" do
62
62
  result = i18n.translate("Hello *bob*.", :wrapper => '<b>\1</b>')
63
- result.should be_html_safe
63
+ expect(result).to be_html_safe
64
64
  end
65
65
 
66
66
  it "should apply multiple wrappers" do
67
67
  result = i18n.translate("Hello *bob*. Click **here**", :wrappers => ['<b>\1</b>', '<a href="/">\1</a>'])
68
- result.should == "Hello <b>bob</b>. Click <a href=\"/\">here</a>"
68
+ expect(result).to eq "Hello <b>bob</b>. Click <a href=\"/\">here</a>"
69
69
  end
70
70
 
71
71
  it "should apply multiple wrappers with arbitrary delimiters" do
72
72
  result = i18n.translate("Hello !!!bob!!!. Click ???here???", :wrappers => {'!!!' => '<b>\1</b>', '???' => '<a href="/">\1</a>'})
73
- result.should == "Hello <b>bob</b>. Click <a href=\"/\">here</a>"
73
+ expect(result).to eq "Hello <b>bob</b>. Click <a href=\"/\">here</a>"
74
74
  end
75
75
 
76
76
  it "should html-escape the default when applying wrappers" do
77
- i18n.translate("*bacon* > narwhals", :wrappers => ['<b>\1</b>']).
78
- should == "<b>bacon</b> &gt; narwhals"
77
+ expect(i18n.translate("*bacon* > narwhals", :wrappers => ['<b>\1</b>'])).
78
+ to eq "<b>bacon</b> &gt; narwhals"
79
79
  end
80
80
  end
81
81
  end
@@ -90,28 +90,28 @@ describe I18nliner::Extensions::Core do
90
90
  describe ".interpolate_hash" do
91
91
  it "should not mark the result as html-safe if none of the components are html-safe" do
92
92
  result = i18n.interpolate_hash("hello %{name}", :name => "<script>")
93
- result.should == "hello <script>"
94
- result.should_not be_html_safe
93
+ expect(result).to eq "hello <script>"
94
+ expect(result).not_to be_html_safe
95
95
  end
96
96
 
97
97
  it "should html-escape values if the string is html-safe" do
98
98
  result = i18n.interpolate_hash("some markup: %{markup}".html_safe, :markup => "<html>")
99
- result.should == "some markup: &lt;html&gt;"
100
- result.should be_html_safe
99
+ expect(result).to eq "some markup: &lt;html&gt;"
100
+ expect(result).to be_html_safe
101
101
  end
102
102
 
103
103
  it "should html-escape the string and other values if any value is html-safe strings" do
104
104
  markup = "<input>"
105
105
  result = i18n.interpolate_hash("type %{input} & you get this: %{output}", :input => markup, :output => markup.html_safe)
106
- result.should == "type &lt;input&gt; &amp; you get this: <input>"
107
- result.should be_html_safe
106
+ expect(result).to eq "type &lt;input&gt; &amp; you get this: <input>"
107
+ expect(result).to be_html_safe
108
108
  end
109
109
 
110
110
  it "should not html-escape the string if the html-safe values are not strings" do
111
111
  markup = "<input>"
112
112
  result = i18n.interpolate_hash("my favorite number is %{number} & my favorite color is %{color}", :number => 1, :color => "red")
113
- result.should == "my favorite number is 1 & my favorite color is red"
114
- result.should_not be_html_safe
113
+ expect(result).to eq "my favorite number is 1 & my favorite color is red"
114
+ expect(result).not_to be_html_safe
115
115
  end
116
116
  end
117
117
  end
@@ -13,37 +13,37 @@ describe I18nliner::Extensions::Inferpolation do
13
13
 
14
14
  it "should inferpolate valid instance methods and chains" do
15
15
  options = {:default => "hello %{bar.baz} %{bar2}"}
16
- foo.inferpolate(options).should == {
16
+ expect(foo.inferpolate(options)).to eq({
17
17
  :default => "hello %{bar_baz} %{bar2}",
18
18
  :bar_baz => foo.bar.baz,
19
19
  :bar2 => foo.bar2
20
- }
20
+ })
21
21
  end
22
22
 
23
23
  it "should inferpolate valid instance variables and chains" do
24
24
  options = {:default => "hello %{@bar.baz} %{@bar2}"}
25
- foo.inferpolate(options).should == {
25
+ expect(foo.inferpolate(options)).to eq({
26
26
  :default => "hello %{bar_baz} %{bar2}",
27
27
  :bar_baz => foo.bar.baz,
28
28
  :bar2 => foo.bar2
29
- }
29
+ })
30
30
  end
31
31
 
32
32
  it "should not inferpolate invalid instance methods and chains" do
33
33
  options = {:default => "hello %{lol} %{bar.baz.lol}"}
34
- foo.inferpolate(options).should == options
34
+ expect(foo.inferpolate(options)).to eq options
35
35
  end
36
36
 
37
37
  it "should not inferpolate invalid instance variables and chains" do
38
38
  options = {:default => "hello %{@lol} %{@bar.baz.lol}"}
39
- foo.inferpolate(options).should == options
39
+ expect(foo.inferpolate(options)).to eq options
40
40
  end
41
41
 
42
42
  it "should work with pluralization hashes" do
43
43
  options = {:default => {:one => "%{bar2} has 1 item", :other => "%{bar2} has %{count} items"}}
44
- foo.inferpolate(options).should == {
44
+ expect(foo.inferpolate(options)).to eq({
45
45
  :default => {:one => "%{bar2} has 1 item", :other => "%{bar2} has %{count} items"},
46
46
  :bar2 => foo.bar2
47
- }
47
+ })
48
48
  end
49
49
  end
@@ -12,8 +12,8 @@ describe I18nliner::Extensions::Model do
12
12
 
13
13
  describe "#translate" do
14
14
  it "should inferpolate" do
15
- i18n.stub(:foo).and_return("FOO")
16
- I18nliner::CallHelpers.stub(:infer_key).and_return(:key)
15
+ allow(i18n).to receive(:foo).and_return("FOO")
16
+ allow(I18nliner::CallHelpers).to receive(:infer_key).and_return(:key)
17
17
 
18
18
  expect(I18n).to receive(:translate).with(:key, :default => "hello %{foo}", :foo => "FOO", :i18nliner_scope => i18n.i18nliner_scope, :i18nliner_inferred_key => true)
19
19
  i18n.translate("hello %{foo}")
@@ -18,8 +18,8 @@ describe I18nliner::Extensions::View do
18
18
 
19
19
  describe "#translate" do
20
20
  it "should inferpolate" do
21
- i18n.stub(:foo).and_return("FOO")
22
- I18nliner::CallHelpers.stub(:infer_key).and_return(:key)
21
+ allow(i18n).to receive(:foo).and_return("FOO")
22
+ allow(I18nliner::CallHelpers).to receive(:infer_key).and_return(:key)
23
23
 
24
24
  expect(I18n).to receive(:translate).with(:key, :default => "hello %{foo}", :foo => "FOO", :i18nliner_scope => i18n.i18nliner_scope)
25
25
  i18n.translate("hello %{foo}")
@@ -21,32 +21,32 @@ describe I18nliner::Extractors::RubyExtractor do
21
21
 
22
22
  describe "#each_translation" do
23
23
  it "should ignore non-t calls" do
24
- extract("foo 'Foo'").should == {}
24
+ expect(extract("foo 'Foo'")).to eq({})
25
25
  end
26
26
 
27
27
  it "should ignore t! calls" do
28
- extract("t! something").should == {}
28
+ expect(extract("t! something")).to eq({})
29
29
  end
30
30
 
31
31
  it "should not extract t calls with no default" do
32
- extract("t :foo").should == {}
32
+ expect(extract("t :foo")).to eq({})
33
33
  end
34
34
 
35
35
  it "should extract valid t calls" do
36
- extract("t 'Foo'").should ==
37
- {"foo_f44ad75d" => "Foo"}
38
- extract("t :bar, 'Baz'").should ==
39
- {"bar" => "Baz"}
40
- extract("t 'lol', 'wut'").should ==
41
- {"lol" => "wut"}
42
- extract("translate 'one', {:one => '1', :other => '2'}, :count => 1").should ==
43
- {"one.one" => "1", "one.other" => "2"}
44
- extract("t({:one => 'just one', :other => 'zomg lots'}, :count => 1)").should ==
45
- {"zomg_lots_a54248c9.one" => "just one", "zomg_lots_a54248c9.other" => "zomg lots"}
46
- extract("t 'foo2', <<-STR\nFoo\nSTR").should ==
47
- {'foo2' => "Foo"}
48
- extract("t 'foo', 'F' + 'o' + 'o'").should ==
49
- {'foo' => "Foo"}
36
+ expect(extract("t 'Foo'")).to eq(
37
+ {"foo_f44ad75d" => "Foo"})
38
+ expect(extract("t :bar, 'Baz'")).to eq(
39
+ {"bar" => "Baz"})
40
+ expect(extract("t 'lol', 'wut'")).to eq(
41
+ {"lol" => "wut"})
42
+ expect(extract("translate 'one', {:one => '1', :other => '2'}, :count => 1")).to eq(
43
+ {"one.one" => "1", "one.other" => "2"})
44
+ expect(extract("t({:one => 'just one', :other => 'zomg lots'}, :count => 1)")).to eq(
45
+ {"zomg_lots_a54248c9.one" => "just one", "zomg_lots_a54248c9.other" => "zomg lots"})
46
+ expect(extract("t 'foo2', <<-STR\nFoo\nSTR")).to eq(
47
+ {'foo2' => "Foo"})
48
+ expect(extract("t 'foo', 'F' + 'o' + 'o'")).to eq(
49
+ {'foo' => "Foo"})
50
50
  end
51
51
 
52
52
  it "should bail on invalid t calls" do
@@ -48,17 +48,17 @@ describe I18nliner::Extractors::TranslateCall do
48
48
  # for legacy calls, e.g. t :key, :default => "foo"
49
49
  it "should allow the default to be specified in the options hash" do
50
50
  call = call(no_scope, :key, :default => "foo")
51
- call.default.should == "foo"
51
+ expect(call.default).to eq "foo"
52
52
  end
53
53
 
54
54
  it "should not extract symbol defaults" do
55
55
  call = call(no_scope, :key, :default => :bar_key)
56
- call.default.should be_nil
56
+ expect(call.default).to be_nil
57
57
  end
58
58
 
59
59
  it "should extract the first string default" do
60
60
  call = call(no_scope, :key, :default => [:foo_key, :bar_key, "baz"])
61
- call.default.should == "baz"
61
+ expect(call.default).to eq "baz"
62
62
  end
63
63
 
64
64
  it "should ensure options is a hash, if provided" do
@@ -71,15 +71,15 @@ describe I18nliner::Extractors::TranslateCall do
71
71
  describe "key inference" do
72
72
  it "should generate literal keys" do
73
73
  I18nliner.inferred_key_format :literal do
74
- call(no_scope, "zomg key").translations.should ==
75
- [["zomg key", "zomg key"]]
74
+ expect(call(no_scope, "zomg key").translations).to eq(
75
+ [["zomg key", "zomg key"]])
76
76
  end
77
77
  end
78
78
 
79
79
  it "should generate underscored keys" do
80
80
  I18nliner.inferred_key_format :underscored do
81
- call(no_scope, "zOmg key!!").translations.should ==
82
- [["zomg_key", "zOmg key!!"]]
81
+ expect(call(no_scope, "zOmg key!!").translations).to eq(
82
+ [["zomg_key", "zOmg key!!"]])
83
83
  end
84
84
  end
85
85
 
@@ -97,33 +97,33 @@ describe I18nliner::Extractors::TranslateCall do
97
97
 
98
98
  I18nliner.inferred_key_format :underscored do
99
99
  I18n.default_locale = :en
100
- call(no_scope, "Jürgen").translations[0][0].should == "jurgen"
100
+ expect(call(no_scope, "Jürgen").translations[0][0]).to eq "jurgen"
101
101
  I18n.default_locale = :de
102
- call(no_scope, "Jürgen").translations[0][0].should == "juergen"
102
+ expect(call(no_scope, "Jürgen").translations[0][0]).to eq "juergen"
103
103
  end
104
104
  I18n.default_locale = orig_locale
105
105
  end
106
106
 
107
107
  it "should generate underscored + crc32 keys" do
108
108
  I18nliner.inferred_key_format :underscored_crc32 do
109
- call(no_scope, "zOmg key!!").translations.should ==
110
- [["zomg_key_90a85b0b", "zOmg key!!"]]
109
+ expect(call(no_scope, "zOmg key!!").translations).to eq(
110
+ [["zomg_key_90a85b0b", "zOmg key!!"]])
111
111
  end
112
112
  end
113
113
  end
114
114
 
115
115
  describe "normalization" do
116
116
  it "should make keys absolute if scoped" do
117
- call(scope, '.key', "value").translations[0][0].should =~ /\Afoo\.key/
118
- call(scope, ['.key1', '.key2'], "value").translations.map(&:first).should == ['foo.key1', 'foo.key2']
117
+ expect(call(scope, '.key', "value").translations[0][0]).to match /\Afoo\.key/
118
+ expect(call(scope, ['.key1', '.key2'], "value").translations.map(&:first)).to eq ['foo.key1', 'foo.key2']
119
119
  end
120
120
 
121
121
  it "should strip leading whitespace from defaults" do
122
- call(no_scope, "\t white space \n\t ").translations[0][1].should == "white space \n\t "
122
+ expect(call(no_scope, "\t white space \n\t ").translations[0][1]).to eq "white space \n\t "
123
123
  end
124
124
 
125
125
  it "should strip all whitespace from defaults if the scope requests it" do
126
- call(erb_scope, "\t white space \n\t ").translations[0][1].should == "white space"
126
+ expect(call(erb_scope, "\t white space \n\t ").translations[0][1]).to eq "white space"
127
127
  end
128
128
  end
129
129
 
@@ -131,32 +131,32 @@ describe I18nliner::Extractors::TranslateCall do
131
131
  describe "keys" do
132
132
  it "should be inferred from a word" do
133
133
  translations = call(no_scope, "person", {:count => Object.new}).translations
134
- translations.map(&:first).sort.should == ["count_people_489946e7.one", "count_people_489946e7.other"]
134
+ expect(translations.map(&:first).sort).to eq ["count_people_489946e7.one", "count_people_489946e7.other"]
135
135
  end
136
136
 
137
137
  it "should be inferred from a hash" do
138
138
  translations = call(no_scope, {:one => "just you", :other => "lotsa peeps"}, {:count => Object.new}).translations
139
- translations.map(&:first).sort.should == ["lotsa_peeps_41499c40.one", "lotsa_peeps_41499c40.other"]
139
+ expect(translations.map(&:first).sort).to eq ["lotsa_peeps_41499c40.one", "lotsa_peeps_41499c40.other"]
140
140
  end
141
141
  end
142
142
 
143
143
  describe "defaults" do
144
144
  it "should be inferred" do
145
145
  translations = call(no_scope, "person", {:count => Object.new}).translations
146
- translations.map(&:last).sort.should == ["%{count} people", "1 person"]
146
+ expect(translations.map(&:last).sort).to eq ["%{count} people", "1 person"]
147
147
  end
148
148
 
149
149
  it "should not be inferred if given multiple words" do
150
150
  translations = call(no_scope, "happy person", {:count => Object.new}).translations
151
- translations.map(&:last).should == ["happy person"]
151
+ expect(translations.map(&:last)).to eq ["happy person"]
152
152
  end
153
153
  end
154
154
 
155
155
  it "should accept valid hashes" do
156
- call(no_scope, {:one => "asdf", :other => "qwerty"}, :count => 1).translations.sort.should ==
157
- [["qwerty_98185351.one", "asdf"], ["qwerty_98185351.other", "qwerty"]]
158
- call(no_scope, :some_stuff, {:one => "asdf", :other => "qwerty"}, :count => 1).translations.sort.should ==
159
- [["some_stuff.one", "asdf"], ["some_stuff.other", "qwerty"]]
156
+ expect(call(no_scope, {:one => "asdf", :other => "qwerty"}, :count => 1).translations.sort).to eq(
157
+ [["qwerty_98185351.one", "asdf"], ["qwerty_98185351.other", "qwerty"]])
158
+ expect(call(no_scope, :some_stuff, {:one => "asdf", :other => "qwerty"}, :count => 1).translations.sort).to eq(
159
+ [["some_stuff.one", "asdf"], ["some_stuff.other", "qwerty"]])
160
160
  end
161
161
 
162
162
  it "should reject invalid keys" do
@@ -11,7 +11,7 @@ describe I18nliner::Extractors::TranslationHash do
11
11
  hash["foo"] = "Foo"
12
12
  hash["foo"] = "Foo"
13
13
  }.to_not raise_error
14
- hash.should == {"foo" => "Foo"}
14
+ expect(hash).to eq({"foo" => "Foo"})
15
15
  end
16
16
 
17
17
  it "should reject mismatched values" do
@@ -5,7 +5,7 @@ require 'active_support/core_ext/string/strip.rb'
5
5
 
6
6
  describe I18nliner::PreProcessors::ErbPreProcessor do
7
7
  before do
8
- I18nliner::PreProcessors::ErbPreProcessor::TBlock.any_instance.stub(:infer_key).and_return(:key)
8
+ allow_any_instance_of(I18nliner::PreProcessors::ErbPreProcessor::TBlock).to receive(:infer_key).and_return(:key)
9
9
  end
10
10
 
11
11
  describe ".process" do
@@ -16,13 +16,13 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
16
16
  end
17
17
 
18
18
  it "should transform t block expressions" do
19
- process("<%= t do %>hello world!<% end %>").should ==
20
- '<%= t :key, "hello world!", :i18nliner_inferred_key => (true) %>'
19
+ expect(process("<%= t do %>hello world!<% end %>")).to eq(
20
+ '<%= t :key, "hello world!", :i18nliner_inferred_key => (true) %>')
21
21
  end
22
22
 
23
23
  it "should remove extraneous whitespace from the default" do
24
- process("<%= t do %> ohai! lulz\t <% end %>").should ==
25
- '<%= t :key, "ohai! lulz", :i18nliner_inferred_key => (true) %>'
24
+ expect(process("<%= t do %> ohai! lulz\t <% end %>")).to eq(
25
+ '<%= t :key, "ohai! lulz", :i18nliner_inferred_key => (true) %>')
26
26
  end
27
27
 
28
28
  # so that line numbers are close-ish when you get an error in a
@@ -30,7 +30,7 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
30
30
  # match up perfectly, but it will at least point to the start of the
31
31
  # t-block
32
32
  it "should preserve all newlines in the generated erb" do
33
- process(<<-SOURCE.strip_heredoc, false).
33
+ expect(process(<<-SOURCE.strip_heredoc, false)).
34
34
  <%= t do
35
35
  %>
36
36
  ohai!
@@ -38,7 +38,7 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
38
38
  lulz
39
39
  <% end %>
40
40
  SOURCE
41
- should == <<-EXPECTED.strip_heredoc
41
+ to eq <<-EXPECTED.strip_heredoc
42
42
  <%= t :key, "ohai! %{test} lulz", :test => (test), :i18nliner_inferred_key => (true)
43
43
 
44
44
 
@@ -49,13 +49,13 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
49
49
  end
50
50
 
51
51
  it "should not translate other block expressions" do
52
- process(<<-SOURCE).
52
+ expect(process(<<-SOURCE)).
53
53
  <%= form_for do %>
54
54
  <%= t do %>Your Name<% end %>
55
55
  <input>
56
56
  <% end %>
57
57
  SOURCE
58
- should == <<-EXPECTED
58
+ to eq <<-EXPECTED
59
59
  <%= form_for do %>
60
60
  <%= t :key, "Your Name", :i18nliner_inferred_key => (true) %>
61
61
  <input>
@@ -81,12 +81,12 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
81
81
  end
82
82
 
83
83
  it "should create wrappers for markup" do
84
- process(<<-SOURCE).
84
+ expect(process(<<-SOURCE)).
85
85
  <%= t do %>
86
86
  <b>bold</b>, or even <a href="#"><i><img>combos</i></a> get wrapper'd
87
87
  <% end %>
88
88
  SOURCE
89
- should == <<-EXPECTED
89
+ to eq <<-EXPECTED
90
90
  <%= t :key, "*bold*, or even **combos** get wrapper'd", :i18nliner_inferred_key => (true), :wrappers => ["<b>\\\\1</b>", "<a href=\\\"#\\\"><i><img>\\\\1</i></a>"] %>
91
91
  EXPECTED
92
92
  end
@@ -97,30 +97,30 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
97
97
  end
98
98
 
99
99
  it "should create wrappers for link_to calls with string content" do
100
- process(<<-SOURCE).
100
+ expect(process(<<-SOURCE)).
101
101
  <%= t do %>
102
102
  You should <%= link_to("create a profile", "/profile") %>.
103
103
  idk why <%= link_to "this " + "link", "/zomg" %> has concatention
104
104
  <% end %>
105
105
  SOURCE
106
- should == <<-EXPECTED
106
+ to eq <<-EXPECTED
107
107
  <%= t :key, "You should *create a profile*. idk why **this link** has concatention", :i18nliner_inferred_key => (true), :wrappers => [link_to("\\\\1", "/profile"), link_to("\\\\1", "/zomg")] %>
108
108
  EXPECTED
109
109
  end
110
110
 
111
111
  it "should create wrappers for link_to calls with other content" do
112
- process(<<-SOURCE).
112
+ expect(process(<<-SOURCE)).
113
113
  <%= t do %>
114
114
  Your account rep is <%= link_to(@user.name, "/user/\#{@user.id}") %>
115
115
  <% end %>
116
116
  SOURCE
117
- should == <<-EXPECTED
117
+ to eq <<-EXPECTED
118
118
  <%= t :key, "Your account rep is *%{user_name}*", :user_name => (@user.name), :i18nliner_inferred_key => (true), :wrappers => [link_to("\\\\1", "/user/\#{@user.id}")] %>
119
119
  EXPECTED
120
120
  end
121
121
 
122
122
  it "should reuse identical wrappers" do
123
- process(<<-SOURCE).
123
+ expect(process(<<-SOURCE)).
124
124
  <%= t do %>
125
125
  the wrappers for
126
126
  <%= link_to "these", url %> <%= link_to "links", url %> are the same,
@@ -128,29 +128,29 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
128
128
  <b>these</b> <b>tags</b>
129
129
  <% end %>
130
130
  SOURCE
131
- should == <<-EXPECTED
131
+ to eq <<-EXPECTED
132
132
  <%= t :key, "the wrappers for **these** **links** are the same, as are the ones for *these* *tags*", :i18nliner_inferred_key => (true), :wrappers => ["<b>\\\\1</b>", link_to("\\\\1", url)] %>
133
133
  EXPECTED
134
134
  end
135
135
 
136
136
  it "should generate placeholders for inline expressions" do
137
- process(<<-SOURCE).
137
+ expect(process(<<-SOURCE)).
138
138
  <%= t do %>
139
139
  Hello, <%= name %>
140
140
  <% end %>
141
141
  SOURCE
142
- should == <<-EXPECTED
142
+ to eq <<-EXPECTED
143
143
  <%= t :key, "Hello, %{name}", :name => (name), :i18nliner_inferred_key => (true) %>
144
144
  EXPECTED
145
145
  end
146
146
 
147
147
  it "should generate placeholders for inline expressions in wrappers" do
148
- process(<<-SOURCE).
148
+ expect(process(<<-SOURCE)).
149
149
  <%= t do %>
150
150
  Go to <a href="/asdf" title="<%= name %>">your account</a>
151
151
  <% end %>
152
152
  SOURCE
153
- should == <<-EXPECTED
153
+ to eq <<-EXPECTED
154
154
  <%= t :key, "Go to *your account*", :i18nliner_inferred_key => (true), :wrappers => ["<a href=\\"/asdf\\" title=\\"\#{name}\\">\\\\1</a>"] %>
155
155
  EXPECTED
156
156
  end
@@ -159,34 +159,34 @@ describe I18nliner::PreProcessors::ErbPreProcessor do
159
159
  # spec for this in case the underlying implementation changes
160
160
  # dramatically
161
161
  it "should transform nested t block expressions in wrappers" do
162
- process(<<-SOURCE).
162
+ expect(process(<<-SOURCE)).
163
163
  <%= t do %>
164
164
  Go to <a href="/asdf" title="<%= t do %>manage account stuffs, <%= name %><% end %>">your account</a>
165
165
  <% end %>
166
166
  SOURCE
167
- should == <<-EXPECTED
167
+ to eq <<-EXPECTED
168
168
  <%= t :key, "Go to *your account*", :i18nliner_inferred_key => (true), :wrappers => ["<a href=\\"/asdf\\" title=\\"\#{t :key, \"manage account stuffs, %{name}\", :name => (name), :i18nliner_inferred_key => (true)}\\">\\\\1</a>"] %>
169
169
  EXPECTED
170
170
  end
171
171
 
172
172
  it "should generate placeholders for empty markup" do
173
- process(<<-SOURCE).
173
+ expect(process(<<-SOURCE)).
174
174
  <%= t do %>
175
175
  Create <input name="count"> groups
176
176
  <% end %>
177
177
  SOURCE
178
- should == <<-EXPECTED
178
+ to eq <<-EXPECTED
179
179
  <%= t :key, "Create %{input_name_count} groups", :input_name_count => ("<input name=\\"count\\">".html_safe), :i18nliner_inferred_key => (true) %>
180
180
  EXPECTED
181
181
  end
182
182
 
183
183
  it "should unescape entities" do
184
- process(<<-SOURCE).
184
+ expect(process(<<-SOURCE)).
185
185
  <%= t do %>
186
186
  &copy; <%= year %> ACME Corp. All Rights Reserved. Our lawyers &gt; your lawyers
187
187
  <% end %>
188
188
  SOURCE
189
- should == <<-EXPECTED
189
+ to eq <<-EXPECTED
190
190
  <%= t :key, "© %{year} ACME Corp. All Rights Reserved. Our lawyers > your lawyers", :year => (year), :i18nliner_inferred_key => (true) %>
191
191
  EXPECTED
192
192
  end
@@ -35,7 +35,7 @@ describe I18nliner::Processors::ErbProcessor do
35
35
  >with nesting</a>!!!
36
36
  <% end %>
37
37
  SOURCE
38
- @translations.values.sort.should == [
38
+ expect(@translations.values.sort).to eq [
39
39
  "Inline!",
40
40
  "Zomg a block *with nesting*!!!",
41
41
  "what is this?"
metadata CHANGED
@@ -1,116 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18nliner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
5
- prerelease:
4
+ version: 0.0.14
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jon Jensen
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2015-11-21 00:00:00.000000000 Z
11
+ date: 2017-10-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activesupport
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3.0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: ruby_parser
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ~>
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '3.2'
33
+ version: '3.10'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ~>
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: '3.2'
40
+ version: '3.10'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: sexp_processor
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ~>
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: 4.4.0
47
+ version: '4.10'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ~>
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: 4.4.0
54
+ version: '4.10'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: ruby2ruby
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
- version: '2.0'
61
+ version: '2.4'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
- version: '2.0'
68
+ version: '2.4'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: globby
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: 0.1.1
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: 0.1.1
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: erubis
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ~>
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
89
  version: 2.7.0
102
90
  type: :runtime
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ~>
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
96
  version: 2.7.0
110
97
  - !ruby/object:Gem::Dependency
111
98
  name: ya2yaml
112
99
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
100
  requirements:
115
101
  - - '='
116
102
  - !ruby/object:Gem::Version
@@ -118,7 +104,6 @@ dependencies:
118
104
  type: :runtime
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
107
  requirements:
123
108
  - - '='
124
109
  - !ruby/object:Gem::Version
@@ -126,51 +111,45 @@ dependencies:
126
111
  - !ruby/object:Gem::Dependency
127
112
  name: nokogiri
128
113
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
114
  requirements:
131
- - - ! '>='
115
+ - - ">="
132
116
  - !ruby/object:Gem::Version
133
117
  version: 1.5.0
134
118
  type: :runtime
135
119
  prerelease: false
136
120
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
121
  requirements:
139
- - - ! '>='
122
+ - - ">="
140
123
  - !ruby/object:Gem::Version
141
124
  version: 1.5.0
142
125
  - !ruby/object:Gem::Dependency
143
126
  name: rspec
144
127
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
128
  requirements:
147
- - - ~>
129
+ - - "~>"
148
130
  - !ruby/object:Gem::Version
149
- version: 2.14.0
131
+ version: 3.6.0
150
132
  type: :development
151
133
  prerelease: false
152
134
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
135
  requirements:
155
- - - ~>
136
+ - - "~>"
156
137
  - !ruby/object:Gem::Version
157
- version: 2.14.0
138
+ version: 3.6.0
158
139
  - !ruby/object:Gem::Dependency
159
140
  name: rspec-mocks
160
141
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
142
  requirements:
163
- - - ~>
143
+ - - "~>"
164
144
  - !ruby/object:Gem::Version
165
- version: 2.14.0
145
+ version: 3.6.0
166
146
  type: :development
167
147
  prerelease: false
168
148
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
149
  requirements:
171
- - - ~>
150
+ - - "~>"
172
151
  - !ruby/object:Gem::Version
173
- version: 2.14.0
152
+ version: 3.6.0
174
153
  description: No .yml files. Inline defaults. Optional keys. Inferred interpolation
175
154
  values. Wrappers and blocks, so your templates look template-y and your translations
176
155
  stay HTML-free.
@@ -180,8 +159,9 @@ extensions: []
180
159
  extra_rdoc_files: []
181
160
  files:
182
161
  - LICENSE.txt
183
- - Rakefile
184
162
  - README.md
163
+ - Rakefile
164
+ - lib/i18nliner.rb
185
165
  - lib/i18nliner/base.rb
186
166
  - lib/i18nliner/call_helpers.rb
187
167
  - lib/i18nliner/commands/basic_formatter.rb
@@ -203,13 +183,12 @@ files:
203
183
  - lib/i18nliner/extractors/translate_call.rb
204
184
  - lib/i18nliner/extractors/translation_hash.rb
205
185
  - lib/i18nliner/pre_processors/erb_pre_processor.rb
186
+ - lib/i18nliner/processors.rb
206
187
  - lib/i18nliner/processors/abstract_processor.rb
207
188
  - lib/i18nliner/processors/erb_processor.rb
208
189
  - lib/i18nliner/processors/ruby_processor.rb
209
- - lib/i18nliner/processors.rb
210
190
  - lib/i18nliner/railtie.rb
211
191
  - lib/i18nliner/scope.rb
212
- - lib/i18nliner.rb
213
192
  - lib/tasks/i18nliner.rake
214
193
  - spec/commands/check_spec.rb
215
194
  - spec/commands/dump_spec.rb
@@ -228,27 +207,25 @@ files:
228
207
  - spec/processors/ruby_processor_spec.rb
229
208
  homepage: http://github.com/jenseng/i18nliner
230
209
  licenses: []
210
+ metadata: {}
231
211
  post_install_message:
232
212
  rdoc_options: []
233
213
  require_paths:
234
214
  - lib
235
215
  required_ruby_version: !ruby/object:Gem::Requirement
236
- none: false
237
216
  requirements:
238
- - - ! '>='
217
+ - - ">="
239
218
  - !ruby/object:Gem::Version
240
219
  version: 1.9.3
241
220
  required_rubygems_version: !ruby/object:Gem::Requirement
242
- none: false
243
221
  requirements:
244
- - - ! '>='
222
+ - - ">="
245
223
  - !ruby/object:Gem::Version
246
224
  version: 1.3.5
247
225
  requirements: []
248
226
  rubyforge_project:
249
- rubygems_version: 1.8.23.2
227
+ rubygems_version: 2.6.13
250
228
  signing_key:
251
- specification_version: 3
229
+ specification_version: 4
252
230
  summary: I18n made simple
253
231
  test_files: []
254
- has_rdoc: