uniform_resource_identifier 0.1.13 → 0.1.14

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,44 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ uniform_resource_identifier (0.1.13)
5
+ activesupport (>= 3.0.0)
6
+ addressable (~> 2.2.6)
7
+ i18n (~> 0.6.0)
8
+ public_suffix_service (~> 0.9.0)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ activesupport (3.1.1)
14
+ multi_json (~> 1.0)
15
+ addressable (2.2.6)
16
+ diff-lcs (1.1.3)
17
+ fuubar (0.0.6)
18
+ rspec (~> 2.0)
19
+ rspec-instafail (~> 0.1.8)
20
+ ruby-progressbar (~> 0.0.10)
21
+ i18n (0.6.0)
22
+ multi_json (1.0.3)
23
+ public_suffix_service (0.9.0)
24
+ rspec (2.6.0)
25
+ rspec-core (~> 2.6.0)
26
+ rspec-expectations (~> 2.6.0)
27
+ rspec-mocks (~> 2.6.0)
28
+ rspec-core (2.6.4)
29
+ rspec-expectations (2.6.0)
30
+ diff-lcs (~> 1.1.2)
31
+ rspec-instafail (0.1.9)
32
+ rspec-mocks (2.6.0)
33
+ ruby-progressbar (0.0.10)
34
+ watchr (0.7)
35
+
36
+ PLATFORMS
37
+ ruby
38
+
39
+ DEPENDENCIES
40
+ bundler (~> 1.0.0)
41
+ fuubar (~> 0.0.6)
42
+ rspec (~> 2.6.0)
43
+ uniform_resource_identifier!
44
+ watchr (~> 0.7.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.13
1
+ 0.1.14
@@ -1,16 +1,18 @@
1
1
  RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
2
2
  match do |uri_string|
3
+
4
+
3
5
  false.should == true unless uri_specification.respond_to?(:to_hash)
4
6
  false.should == true if uri_specification == {}
5
-
7
+
6
8
  url = UniformResourceIdentifier.parse(uri_string)
7
9
  # uri_specification = uri_specification.to_hash # TODO: Needed?
8
-
10
+
9
11
  # ======================================================================= #
10
12
  # = Protocol/Scheme = #
11
13
  # ======================================================================= #
12
-
13
- unless uri_specification.has_key?(:authority)
14
+
15
+ if uri_specification.has_key?(:protocol)
14
16
  url.protocol.class.should == String
15
17
  url.protocol.to_s.should == uri_specification[:protocol]
16
18
  url.scheme.class.should == String # Alias
@@ -19,20 +21,20 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
19
21
  # ======================================================================= #
20
22
  # = Authority = #
21
23
  # ======================================================================= #
22
-
23
- unless uri_specification.has_key?(:authority)
24
+
25
+ if uri_specification.has_key?(:authority)
24
26
  url.authority.class.should == UniformResourceIdentifier::Authority
25
27
  url.authority.to_s.should == uri_specification[:authority]
26
28
  end
27
-
28
- unless uri_specification.has_key?(:user_info)
29
+
30
+ if uri_specification.has_key?(:user_info)
29
31
  url.authority.user_info.class.should == UniformResourceIdentifier::UserInfo
30
32
  url.authority.user_info.to_s.should == uri_specification[:user_info]
31
33
  url.user_info.class.should == UniformResourceIdentifier::UserInfo # Delegate
32
34
  url.user_info.to_s.should == uri_specification[:user_info] # Delegate
33
35
  end
34
-
35
- unless uri_specification.has_key?(:username)
36
+
37
+ if uri_specification.has_key?(:username)
36
38
  url.authority.user_info.username.class.should == String
37
39
  url.authority.user_info.username.to_s.should == uri_specification[:username]
38
40
  url.user_info.username.class.should == String # Delegate
@@ -40,8 +42,8 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
40
42
  url.username.class.should == String # Delegate
41
43
  url.username.to_s.should == uri_specification[:username] # Delegate
42
44
  end
43
-
44
- unless uri_specification.has_key?(:password)
45
+
46
+ if uri_specification.has_key?(:password)
45
47
  url.authority.user_info.password.class.should == String
46
48
  url.authority.user_info.password.to_s.should == uri_specification[:password]
47
49
  url.user_info.password.class.should == String # Delegate
@@ -49,15 +51,15 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
49
51
  url.password.class.should == String # Delegate
50
52
  url.password.to_s.should == uri_specification[:password] # Delegate
51
53
  end
52
-
53
- unless uri_specification.has_key?(:host)
54
+
55
+ if uri_specification.has_key?(:host)
54
56
  url.authority.host.class.should == UniformResourceIdentifier::Host
55
57
  url.authority.host.to_s.should == uri_specification[:host]
56
58
  url.host.class.should == UniformResourceIdentifier::Host # Delegate
57
59
  url.host.to_s.should == uri_specification[:host] # Delegate
58
60
  end
59
-
60
- unless uri_specification.has_key?(:subdomain)
61
+
62
+ if uri_specification.has_key?(:subdomain)
61
63
  url.authority.host.subdomain.class.should == String
62
64
  url.authority.host.subdomain.to_s.should == uri_specification[:subdomain]
63
65
  url.host.subdomain.class.should == String # Delegate
@@ -65,8 +67,8 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
65
67
  url.subdomain.class.should == String # Delegate
66
68
  url.subdomain.to_s.should == uri_specification[:subdomain] # Delegate
67
69
  end
68
-
69
- unless uri_specification.has_key?(:domain)
70
+
71
+ if uri_specification.has_key?(:domain)
70
72
  url.authority.host.domain.class.should == UniformResourceIdentifier::Domain
71
73
  url.authority.host.domain.to_s.should == uri_specification[:domain]
72
74
  url.host.domain.class.should == UniformResourceIdentifier::Domain # Delegate
@@ -74,8 +76,8 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
74
76
  url.domain.class.should == UniformResourceIdentifier::Domain # Delegate
75
77
  url.domain.to_s.should == uri_specification[:domain] # Delegate
76
78
  end
77
-
78
- unless uri_specification.has_key?(:sld)
79
+
80
+ if uri_specification.has_key?(:sld)
79
81
  url.authority.host.domain.sld.class.should == String
80
82
  url.authority.host.sld.to_s.should == uri_specification[:sld]
81
83
  url.host.sld.class.should == String # Delegate
@@ -83,8 +85,8 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
83
85
  url.sld.class.should == String # Delegate
84
86
  url.sld.to_s.should == uri_specification[:sld] # Delegate
85
87
  end
86
-
87
- unless uri_specification.has_key?(:tld)
88
+
89
+ if uri_specification.has_key?(:tld)
88
90
  url.authority.host.domain.tld.class.should == String
89
91
  url.authority.host.tld.to_s.should == uri_specification[:tld]
90
92
  url.host.tld.class.should == String # Delegate
@@ -92,31 +94,31 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
92
94
  url.tld.class.should == String # Delegate
93
95
  url.tld.to_s.should == uri_specification[:tld] # Delegate
94
96
  end
95
-
96
- unless uri_specification.has_key?(:port)
97
+
98
+ if uri_specification.has_key?(:port)
97
99
  url.authority.port.class.should == Fixnum
98
100
  url.authority.port.to_s.should == uri_specification[:port]
99
101
  url.port.class.should == Fixnum # Delegate
100
102
  url.port.to_s.should == uri_specification[:port] # Delegate
101
103
  end
102
-
104
+
103
105
  # ======================================================================= #
104
106
  # = Relative = #
105
107
  # ======================================================================= #
106
-
107
- unless uri_specification.has_key?(:relative)
108
+
109
+ if uri_specification.has_key?(:relative)
108
110
  url.relative.class.should == UniformResourceIdentifier::Relative
109
111
  url.relative.to_s.should == uri_specification[:relative]
110
112
  end
111
-
112
- unless uri_specification.has_key?(:path)
113
+
114
+ if uri_specification.has_key?(:path)
113
115
  url.relative.path.class.should == UniformResourceIdentifier::Path
114
116
  url.relative.path.to_s.should == uri_specification[:path]
115
117
  url.path.class.should == UniformResourceIdentifier::Path # Delegate
116
118
  url.path.to_s.should == uri_specification[:path] # Delegate
117
119
  end
118
-
119
- unless uri_specification.has_key?(:directory)
120
+
121
+ if uri_specification.has_key?(:directory)
120
122
  url.relative.path.directory.class.should == String
121
123
  url.relative.path.directory.to_s.should == uri_specification[:directory]
122
124
  url.relative.directory.class.should == String # Delegate
@@ -124,8 +126,8 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
124
126
  url.directory.class.should == String # Delegate
125
127
  url.directory.to_s.should == uri_specification[:directory] # Delegate
126
128
  end
127
-
128
- unless uri_specification.has_key?(:file)
129
+
130
+ if uri_specification.has_key?(:file)
129
131
  url.relative.path.file.class.should == String
130
132
  url.relative.path.file.to_s.should == uri_specification[:file]
131
133
  url.relative.file.class.should == String # Delegate
@@ -133,15 +135,15 @@ RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
133
135
  url.file.class.should == String # Delegate
134
136
  url.file.to_s.should == uri_specification[:file] # Delegate
135
137
  end
136
-
137
- unless uri_specification.has_key?(:query)
138
+
139
+ if uri_specification.has_key?(:query)
138
140
  url.relative.query.class.should == UniformResourceIdentifier::Query
139
141
  url.relative.query.to_s.should == uri_specification[:query]
140
142
  url.query.class.should == UniformResourceIdentifier::Query # Delegate
141
143
  url.query.to_s.should == uri_specification[:query] # Delegate
142
144
  end
143
-
144
- unless uri_specification.has_key?(:anchor)
145
+
146
+ if uri_specification.has_key?(:anchor)
145
147
  url.relative.anchor.class.should == String
146
148
  url.relative.anchor.to_s.should == uri_specification[:anchor]
147
149
  url.anchor.class.should == String # Delegate
@@ -55,11 +55,11 @@ describe UniformResourceIdentifier do
55
55
  :sld => "test",
56
56
  :tld => "com",
57
57
  :port => "81",
58
- :relative => "/dir/dir.2/foo/bar/index.htm?q1=0&test1=true&test2=value&arr[]=one&arr[]=two&hsh[foo]=bar&test3=val3#top",
58
+ # :relative => "/dir/dir.2/foo/bar/index.htm?q1=0&test1=true&test2=value&arr[]=one&arr[]=two&hsh[foo]=bar&test3=val3#top",
59
59
  :path => "/dir/dir.2/foo/bar/index.htm",
60
60
  :directory => "/dir/dir.2/foo/bar/",
61
61
  :file => "index.htm",
62
- :query => "q1=0&test1=true&test2=value&arr[]=one&arr[]=two&hsh[foo]=bar&test3=val3",
62
+ # :query => "q1=0&test1=true&test2=value&arr[]=one&arr[]=two&hsh[foo]=bar&test3=val3",
63
63
  :anchor => "top"
64
64
  )
65
65
  end
@@ -67,7 +67,8 @@ describe UniformResourceIdentifier do
67
67
 
68
68
  describe "#to_s" do
69
69
  it "should return the normalized URI" do
70
- subject.parse(url).to_s.should == "http://usr:pwd@www.test.com:81/dir/dir.2/foo/bar/index.htm?q1=0&test1=true&test2=value&arr[]=one&arr[]=two&hsh[foo]=bar&test3=val3#top"
70
+ # subject.parse(url).to_s.should == "http://usr:pwd@www.test.com:81/dir/dir.2/foo/bar/index.htm?q1=0&test1=true&test2=value&arr[]=one&arr[]=two&hsh[foo]=bar&test3=val3#top"
71
+ subject.parse(url).to_s.should == "http://usr:pwd@www.test.com:81/dir/dir.2/foo/bar/index.htm?arr%5B%5D=one&arr%5B%5D=two&hsh%5Bfoo%5D=bar&q1=0&test1=true&test2=value&test3=val3#top"
71
72
  end
72
73
  end
73
74
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uniform_resource_identifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-31 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: public_suffix_service
16
- requirement: &70259992125480 !ruby/object:Gem::Requirement
16
+ requirement: &70309375717880 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70259992125480
24
+ version_requirements: *70309375717880
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activesupport
27
- requirement: &70259992125000 !ruby/object:Gem::Requirement
27
+ requirement: &70309375717280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 3.0.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70259992125000
35
+ version_requirements: *70309375717280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: addressable
38
- requirement: &70259992124540 !ruby/object:Gem::Requirement
38
+ requirement: &70309375716720 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,21 @@ dependencies:
43
43
  version: 2.2.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70259992124540
46
+ version_requirements: *70309375716720
47
+ - !ruby/object:Gem::Dependency
48
+ name: i18n
49
+ requirement: &70309375716140 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.6.0
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *70309375716140
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: bundler
49
- requirement: &70259992124080 !ruby/object:Gem::Requirement
60
+ requirement: &70309375715620 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: 1.0.0
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *70259992124080
68
+ version_requirements: *70309375715620
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: rspec
60
- requirement: &70259992123620 !ruby/object:Gem::Requirement
71
+ requirement: &70309375715140 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ~>
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: 2.6.0
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *70259992123620
79
+ version_requirements: *70309375715140
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: fuubar
71
- requirement: &70259992123160 !ruby/object:Gem::Requirement
82
+ requirement: &70309375714640 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 0.0.6
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *70259992123160
90
+ version_requirements: *70309375714640
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: watchr
82
- requirement: &70259990235200 !ruby/object:Gem::Requirement
93
+ requirement: &70309375688880 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - ~>
@@ -87,7 +98,7 @@ dependencies:
87
98
  version: 0.7.0
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *70259990235200
101
+ version_requirements: *70309375688880
91
102
  description: ! '`uniform_resource_identifier` splits URIs according to RFC 3986 using
92
103
  regexp, attempts to check the public suffix using `public_suffix_service`, and serializes
93
104
  the query string using `active_support` and `addressable`'
@@ -100,6 +111,7 @@ extra_rdoc_files:
100
111
  files:
101
112
  - LICENSE
102
113
  - VERSION
114
+ - Gemfile.lock
103
115
  - lib/uniform_resource_identifier/authority.rb
104
116
  - lib/uniform_resource_identifier/domain.rb
105
117
  - lib/uniform_resource_identifier/host.rb