translatr 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/translatr/merger.rb +1 -1
- data/lib/translatr/version.rb +1 -1
- data/spec/translatr/merger_spec.rb +10 -0
- metadata +1 -1
data/lib/translatr/merger.rb
CHANGED
data/lib/translatr/version.rb
CHANGED
@@ -112,6 +112,12 @@ module Translatr
|
|
112
112
|
merger.merge.should == { :foo => "target", :bar => "source %{baz}" }
|
113
113
|
end
|
114
114
|
|
115
|
+
it "works with entries where variables match but their numbers differ" do
|
116
|
+
merger.target = { :foo => "target %{bar}", :bar => "target %{baz} %{baz}" }
|
117
|
+
merger.source = { :foo => "source %{bar} %{bar}", :bar => "source %{baz}"}
|
118
|
+
merger.merge.should == { :foo => "source %{bar} %{bar}", :bar => "source %{baz}" }
|
119
|
+
end
|
120
|
+
|
115
121
|
it "ignores entries with markup when target has none and key doesn't end with '_html'"
|
116
122
|
end
|
117
123
|
|
@@ -127,6 +133,10 @@ module Translatr
|
|
127
133
|
it "gives a list of variables in a string" do
|
128
134
|
merger.variables_in("foo %{bar}, %{baz}").should == ["%{bar}", "%{baz}"]
|
129
135
|
end
|
136
|
+
|
137
|
+
it "gives duplicate variables only once" do
|
138
|
+
merger.variables_in("foo %{bar}, %{bar}").should == ["%{bar}"]
|
139
|
+
end
|
130
140
|
end
|
131
141
|
|
132
142
|
describe "#store" do
|