mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Run transpec
This commit is contained in:
@@ -24,15 +24,15 @@ describe "i18n" do
|
||||
end
|
||||
|
||||
it "translates within the spree scope" do
|
||||
Spree.normal_t(:foo).should eql("bar")
|
||||
Spree.translate(:foo).should eql("bar")
|
||||
expect(Spree.normal_t(:foo)).to eql("bar")
|
||||
expect(Spree.translate(:foo)).to eql("bar")
|
||||
end
|
||||
|
||||
it "translates within the spree scope using a path" do
|
||||
Spree.stub(:virtual_path).and_return('bar')
|
||||
allow(Spree).to receive(:virtual_path).and_return('bar')
|
||||
|
||||
Spree.normal_t('.legacy_translation').should eql("back in the day...")
|
||||
Spree.translate('.legacy_translation').should eql("back in the day...")
|
||||
expect(Spree.normal_t('.legacy_translation')).to eql("back in the day...")
|
||||
expect(Spree.translate('.legacy_translation')).to eql("back in the day...")
|
||||
end
|
||||
|
||||
it "raise error without any context when using a path" do
|
||||
@@ -46,19 +46,19 @@ describe "i18n" do
|
||||
end
|
||||
|
||||
it "prepends a string scope" do
|
||||
Spree.normal_t(:foo, scope: "bar").should eql("bar within bar scope")
|
||||
expect(Spree.normal_t(:foo, scope: "bar")).to eql("bar within bar scope")
|
||||
end
|
||||
|
||||
it "prepends to an array scope" do
|
||||
Spree.normal_t(:foo, scope: ["bar"]).should eql("bar within bar scope")
|
||||
expect(Spree.normal_t(:foo, scope: ["bar"])).to eql("bar within bar scope")
|
||||
end
|
||||
|
||||
it "returns two translations" do
|
||||
Spree.normal_t([:foo, 'bar.foo']).should eql(["bar", "bar within bar scope"])
|
||||
expect(Spree.normal_t([:foo, 'bar.foo'])).to eql(["bar", "bar within bar scope"])
|
||||
end
|
||||
|
||||
it "returns reasonable string for missing translations" do
|
||||
Spree.t(:missing_entry).should include("<span")
|
||||
expect(Spree.t(:missing_entry)).to include("<span")
|
||||
end
|
||||
|
||||
context "missed + unused translations" do
|
||||
@@ -74,7 +74,7 @@ describe "i18n" do
|
||||
def assert_missing_translation(key)
|
||||
key = key_with_locale(key)
|
||||
message = Spree.missing_translation_messages.detect { |m| m == key }
|
||||
message.should_not(be_nil, "expected '#{key}' to be missing, but it wasn't.")
|
||||
expect(message).not_to(be_nil, "expected '#{key}' to be missing, but it wasn't.")
|
||||
end
|
||||
|
||||
it "logs missing translations" do
|
||||
@@ -88,13 +88,13 @@ describe "i18n" do
|
||||
it "does not log present translations" do
|
||||
Spree.t(:foo)
|
||||
Spree.check_missing_translations
|
||||
Spree.missing_translation_messages.should be_empty
|
||||
expect(Spree.missing_translation_messages).to be_empty
|
||||
end
|
||||
|
||||
it "does not break when asked for multiple translations" do
|
||||
Spree.t [:foo, 'bar.foo']
|
||||
Spree.check_missing_translations
|
||||
Spree.missing_translation_messages.should be_empty
|
||||
expect(Spree.missing_translation_messages).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
@@ -102,13 +102,13 @@ describe "i18n" do
|
||||
def assert_unused_translation(key)
|
||||
key = key_with_locale(key)
|
||||
message = Spree.unused_translation_messages.detect { |m| m == key }
|
||||
message.should_not(be_nil, "expected '#{key}' to be unused, but it was used.")
|
||||
expect(message).not_to(be_nil, "expected '#{key}' to be unused, but it was used.")
|
||||
end
|
||||
|
||||
def assert_used_translation(key)
|
||||
key = key_with_locale(key)
|
||||
message = Spree.unused_translation_messages.detect { |m| m == key }
|
||||
message.should(be_nil, "expected '#{key}' to be used, but it wasn't.")
|
||||
expect(message).to(be_nil, "expected '#{key}' to be used, but it wasn't.")
|
||||
end
|
||||
|
||||
it "logs translations that aren't used" do
|
||||
|
||||
Reference in New Issue
Block a user