[ruby/json] Appease ruby/ruby CI
[ruby.git] / spec / ruby / library / uri / merge_spec.rb
blobe9644a7fd0d1cf0eb461ce7c40e76dd7830125b2
1 require_relative '../../spec_helper'
2 require 'uri'
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"
9   end
11   it "accepts URI objects as argument" do
12     URI("http://localhost/").merge(URI("main.rbx")).should == URI.parse("http://localhost/main.rbx")
13   end
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")
19   end
20 end