1 require_relative '../../spec_helper'
4 describe "URI#merge" do
5 it "returns the receiver and the argument, joined as per URI.join" do
6 URI("http://localhost/").merge("main.rbx").should == URI.parse("http://localhost/main.rbx")
7 URI("http://localhost/a/b/c/d").merge("http://ruby-lang.com/foo").should == URI.parse("http://ruby-lang.com/foo")
8 URI("http://localhost/a/b/c/d").merge("../../e/f").to_s.should == "http://localhost/a/e/f"
11 it "accepts URI objects as argument" do
12 URI("http://localhost/").merge(URI("main.rbx")).should == URI.parse("http://localhost/main.rbx")
15 it "accepts a string-like argument" do
16 str = mock('string-like')
17 str.should_receive(:to_str).and_return("foo/bar")
18 URI("http://localhost/").merge(str).should == URI.parse("http://localhost/foo/bar")