Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/open_graph_cache_spec.rb')
-rw-r--r--spec/models/open_graph_cache_spec.rb21
1 files changed, 19 insertions, 2 deletions
diff --git a/spec/models/open_graph_cache_spec.rb b/spec/models/open_graph_cache_spec.rb
index 40d7eebd8..7bd0c81a4 100644
--- a/spec/models/open_graph_cache_spec.rb
+++ b/spec/models/open_graph_cache_spec.rb
@@ -8,7 +8,7 @@ describe OpenGraphCache, type: :model do
describe "fetch_and_save_opengraph_data!" do
context "with an unsecure video url" do
it "doesn't save the video url" do
- expect(OpenGraphReader).to receive(:fetch!).with("https://example.com/article/123").and_return(
+ expect(OpenGraphReader).to receive(:fetch!).with(URI.parse("https://example.com/article/123")).and_return(
double(
og: double(
description: "This is the article lead",
@@ -34,7 +34,7 @@ describe OpenGraphCache, type: :model do
context "with a secure video url" do
it "saves the video url" do
- expect(OpenGraphReader).to receive(:fetch!).with("https://example.com/article/123").and_return(
+ expect(OpenGraphReader).to receive(:fetch!).with(URI.parse("https://example.com/article/123")).and_return(
double(
og: double(
description: "This is the article lead",
@@ -57,5 +57,22 @@ describe OpenGraphCache, type: :model do
expect(ogc.video_url).to eq("https://bandcamp.com/EmbeddedPlayer/v=2/track=12/size=small")
end
end
+
+ context "a mixed case hostname" do
+ it "downcases the hostname" do
+ stub_request(:head, "http:///wetter.com")
+ .with(headers: {
+ "Accept" => "text/html",
+ "User-Agent" => "OpenGraphReader/0.6.2 (+https://github.com/jhass/open_graph_reader)"
+ })
+ .to_return(status: 200, body: "", headers:
+ {"Set-Cookie" => "Dabgroup=A;path=/;Expires=Thu, 23 May 2019 16:12:01 GMT;httpOnly"})
+
+ ogc = OpenGraphCache.new(url: "Wetter.com")
+ expect {
+ ogc.fetch_and_save_opengraph_data!
+ }.to_not raise_error
+ end
+ end
end
end