spec/lib/onebox/engine/amazon_onebox_spec.rb in onebox-1.5.38 vs spec/lib/onebox/engine/amazon_onebox_spec.rb in onebox-1.5.39
- old
+ new
@@ -16,12 +16,11 @@
expect(onebox_cls).to_not be(nil)
expect(onebox_cls.new(link).url).to include("http://www.amazon.#{tdl}")
end
it "matches canadian domains" do
- resp = check_link("ca", "http://www.amazon.ca/Too-Much-Happiness-Alice-Munro-ebook/dp/B0031TZ98K/")
-
+ check_link("ca", "http://www.amazon.ca/Too-Much-Happiness-Alice-Munro-ebook/dp/B0031TZ98K/")
end
it "matches german domains" do
check_link("de", "http://www.amazon.de/Buddenbrooks-Verfall-einer-Familie-Roman/dp/3596294312/")
end
@@ -58,10 +57,20 @@
check_link("in", "http://www.amazon.in/Fireflies-Rabindranath-Tagore/dp/9381523169/")
end
end
+ describe "#url" do
+ it "maintains the same http/https scheme as the requested URL" do
+ expect(described_class.new("https://www.amazon.fr/gp/product/B01BYD0TZM").url)
+ .to eq("https://www.amazon.fr/gp/aw/d/B01BYD0TZM")
+
+ expect(described_class.new("http://www.amazon.fr/gp/product/B01BYD0TZM").url)
+ .to eq("http://www.amazon.fr/gp/aw/d/B01BYD0TZM")
+ end
+ end
+
describe "#to_html" do
it "includes image" do
expect(html).to include("http://ecx.images-amazon.com/images/I/51opYcR6kVL._SY400_.jpg")
end
@@ -74,8 +83,8 @@
end
it "includes title" do
expect(html).to include("Seven Languages in Seven Weeks: A Pragmatic Guide to Learning Programming Languages (Pragmatic Programmers)")
end
-
end
+
end