File: uri_spec.rb

package info (click to toggle)
libdataobjects-ruby 0.10.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 336 kB
  • ctags: 200
  • sloc: ruby: 2,729; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,050 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))

describe DataObjects::URI do
  before do
    @uri = DataObjects::URI.parse('mock://username:password@localhost:12345/path?encoding=utf8#fragment')
  end

  it "should parse the scheme part" do
    @uri.scheme.should == "mock"
  end

  it "should parse the user part" do
    @uri.user.should == "username"
  end

  it "should parse the password part" do
    @uri.password.should == "password"
  end

  it "should parse the host part" do
    @uri.host.should == "localhost"
  end

  it "should parse the port part" do
    @uri.port.should == 12345
  end

  it "should parse the path part" do
    @uri.path.should == "/path"
  end

  it "should parse the query part" do
    @uri.query.should == { "encoding" => "utf8" }
  end

  it "should parse the fragment part" do
    @uri.fragment.should == "fragment"
  end

  it "should provide a correct string representation" do
    @uri.to_s.should == 'mock://username:password@localhost:12345/path?encoding=utf8#fragment'
  end

end