spec/lib/roadie/url_generator_spec.rb in roadie-3.0.1 vs spec/lib/roadie/url_generator_spec.rb in roadie-3.0.2
- old
+ new
@@ -80,10 +80,17 @@
expect(url("bar", host: "example.com", path: "/foo")).to eq("http://example.com/foo/bar")
expect(url("bar", host: "example.com", path: "/foo/")).to eq("http://example.com/foo/bar")
end
it "does not touch data: URIs" do
- expect(url("data:deadbeef", host: "example.com")).to eq("data:deadbeef")
+ # We've had failures with longer data URIs, but I have not been able to
+ # pinpoint where the problem is. I suspect a specific version of Ruby.
+ # This test might not actually catch the real issues since I couldn't
+ # get it red for the reported cases.
+ # It was solved by being more relaxed when determining if a URI is
+ # absolute or not.
+ data_uri = "data:image/png;dead/beef+/=="
+ expect(url(data_uri, host: "example.com")).to eq(data_uri)
end
it "does not touch absolute URLs without schemes" do
expect(url("//assets.myapp.com/foo.jpg", host: "example.com")).to eq("//assets.myapp.com/foo.jpg")
end