uniform_resource_identifier 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/uniform_resource_identifier/rspec_matcher.rb +132 -95
- metadata +15 -15
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|
@@ -1,114 +1,151 @@
|
|
1
1
|
RSpec::Matchers.define(:have_uri_specification) do |uri_specification|
|
2
2
|
match do |uri_string|
|
3
|
+
false.should == true unless uri_specification.respond_to?(:to_hash)
|
4
|
+
false.should == true if uri_specification == {}
|
5
|
+
|
3
6
|
url = UniformResourceIdentifier.parse(uri_string)
|
7
|
+
uri_specification = uri_specification.to_hash
|
4
8
|
|
5
9
|
# ======================================================================= #
|
6
10
|
# = Protocol/Scheme = #
|
7
11
|
# ======================================================================= #
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
unless uri_specification.has_key?(:authority)
|
14
|
+
url.protocol.class.should == String
|
15
|
+
url.protocol.to_s.should == uri_specification[:protocol]
|
16
|
+
url.scheme.class.should == String # Alias
|
17
|
+
url.scheme.to_s.should == uri_specification[:protocol] # Alias
|
18
|
+
end
|
14
19
|
# ======================================================================= #
|
15
20
|
# = Authority = #
|
16
21
|
# ======================================================================= #
|
17
22
|
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
23
|
+
unless uri_specification.has_key?(:authority)
|
24
|
+
url.authority.class.should == UniformResourceIdentifier::Authority
|
25
|
+
url.authority.to_s.should == uri_specification[:authority]
|
26
|
+
end
|
27
|
+
|
28
|
+
unless uri_specification.has_key?(:user_info)
|
29
|
+
url.authority.user_info.class.should == UniformResourceIdentifier::UserInfo
|
30
|
+
url.authority.user_info.to_s.should == uri_specification[:user_info]
|
31
|
+
url.user_info.class.should == UniformResourceIdentifier::UserInfo # Delegate
|
32
|
+
url.user_info.to_s.should == uri_specification[:user_info] # Delegate
|
33
|
+
end
|
34
|
+
|
35
|
+
unless uri_specification.has_key?(:username)
|
36
|
+
url.authority.user_info.username.class.should == String
|
37
|
+
url.authority.user_info.username.to_s.should == uri_specification[:username]
|
38
|
+
url.user_info.username.class.should == String # Delegate
|
39
|
+
url.user_info.username.to_s.should == uri_specification[:username] # Delegate
|
40
|
+
url.username.class.should == String # Delegate
|
41
|
+
url.username.to_s.should == uri_specification[:username] # Delegate
|
42
|
+
end
|
43
|
+
|
44
|
+
unless uri_specification.has_key?(:password)
|
45
|
+
url.authority.user_info.password.class.should == String
|
46
|
+
url.authority.user_info.password.to_s.should == uri_specification[:password]
|
47
|
+
url.user_info.password.class.should == String # Delegate
|
48
|
+
url.user_info.password.to_s.should == uri_specification[:password] # Delegate
|
49
|
+
url.password.class.should == String # Delegate
|
50
|
+
url.password.to_s.should == uri_specification[:password] # Delegate
|
51
|
+
end
|
52
|
+
|
53
|
+
unless uri_specification.has_key?(:host)
|
54
|
+
url.authority.host.class.should == UniformResourceIdentifier::Host
|
55
|
+
url.authority.host.to_s.should == uri_specification[:host]
|
56
|
+
url.host.class.should == UniformResourceIdentifier::Host # Delegate
|
57
|
+
url.host.to_s.should == uri_specification[:host] # Delegate
|
58
|
+
end
|
59
|
+
|
60
|
+
unless uri_specification.has_key?(:subdomain)
|
61
|
+
url.authority.host.subdomain.class.should == String
|
62
|
+
url.authority.host.subdomain.to_s.should == uri_specification[:subdomain]
|
63
|
+
url.host.subdomain.class.should == String # Delegate
|
64
|
+
url.host.subdomain.to_s.should == uri_specification[:subdomain] # Delegate
|
65
|
+
url.subdomain.class.should == String # Delegate
|
66
|
+
url.subdomain.to_s.should == uri_specification[:subdomain] # Delegate
|
67
|
+
end
|
68
|
+
|
69
|
+
unless uri_specification.has_key?(:domain)
|
70
|
+
url.authority.host.domain.class.should == UniformResourceIdentifier::Domain
|
71
|
+
url.authority.host.domain.to_s.should == uri_specification[:domain]
|
72
|
+
url.host.domain.class.should == UniformResourceIdentifier::Domain # Delegate
|
73
|
+
url.host.domain.to_s.should == uri_specification[:domain] # Delegate
|
74
|
+
url.domain.class.should == UniformResourceIdentifier::Domain # Delegate
|
75
|
+
url.domain.to_s.should == uri_specification[:domain] # Delegate
|
76
|
+
end
|
77
|
+
|
78
|
+
unless uri_specification.has_key?(:sld)
|
79
|
+
url.authority.host.domain.sld.class.should == String
|
80
|
+
url.authority.host.sld.to_s.should == uri_specification[:sld]
|
81
|
+
url.host.sld.class.should == String # Delegate
|
82
|
+
url.host.sld.to_s.should == uri_specification[:sld] # Delegate
|
83
|
+
url.sld.class.should == String # Delegate
|
84
|
+
url.sld.to_s.should == uri_specification[:sld] # Delegate
|
85
|
+
end
|
86
|
+
|
87
|
+
unless uri_specification.has_key?(:tld)
|
88
|
+
url.authority.host.domain.tld.class.should == String
|
89
|
+
url.authority.host.tld.to_s.should == uri_specification[:tld]
|
90
|
+
url.host.tld.class.should == String # Delegate
|
91
|
+
url.host.tld.to_s.should == uri_specification[:tld] # Delegate
|
92
|
+
url.tld.class.should == String # Delegate
|
93
|
+
url.tld.to_s.should == uri_specification[:tld] # Delegate
|
94
|
+
end
|
95
|
+
|
96
|
+
unless uri_specification.has_key?(:port)
|
97
|
+
url.authority.port.class.should == Fixnum
|
98
|
+
url.authority.port.to_s.should == uri_specification[:port]
|
99
|
+
url.port.class.should == Fixnum # Delegate
|
100
|
+
url.port.to_s.should == uri_specification[:port] # Delegate
|
101
|
+
end
|
77
102
|
|
78
103
|
# ======================================================================= #
|
79
104
|
# = Relative = #
|
80
105
|
# ======================================================================= #
|
81
106
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
107
|
+
unless uri_specification.has_key?(:relative)
|
108
|
+
url.relative.class.should == UniformResourceIdentifier::Relative
|
109
|
+
url.relative.to_s.should == uri_specification[:relative]
|
110
|
+
end
|
111
|
+
|
112
|
+
unless uri_specification.has_key?(:path)
|
113
|
+
url.relative.path.class.should == UniformResourceIdentifier::Path
|
114
|
+
url.relative.path.to_s.should == uri_specification[:path]
|
115
|
+
url.path.class.should == UniformResourceIdentifier::Path # Delegate
|
116
|
+
url.path.to_s.should == uri_specification[:path] # Delegate
|
117
|
+
end
|
118
|
+
|
119
|
+
unless uri_specification.has_key?(:directory)
|
120
|
+
url.relative.path.directory.class.should == String
|
121
|
+
url.relative.path.directory.to_s.should == uri_specification[:directory]
|
122
|
+
url.relative.directory.class.should == String # Delegate
|
123
|
+
url.relative.directory.to_s.should == uri_specification[:directory] # Delegate
|
124
|
+
url.directory.class.should == String # Delegate
|
125
|
+
url.directory.to_s.should == uri_specification[:directory] # Delegate
|
126
|
+
end
|
127
|
+
|
128
|
+
unless uri_specification.has_key?(:file)
|
129
|
+
url.relative.path.file.class.should == String
|
130
|
+
url.relative.path.file.to_s.should == uri_specification[:file]
|
131
|
+
url.relative.file.class.should == String # Delegate
|
132
|
+
url.relative.file.to_s.should == uri_specification[:file] # Delegate
|
133
|
+
url.file.class.should == String # Delegate
|
134
|
+
url.file.to_s.should == uri_specification[:file] # Delegate
|
135
|
+
end
|
136
|
+
|
137
|
+
unless uri_specification.has_key?(:query)
|
138
|
+
url.relative.query.class.should == UniformResourceIdentifier::Query
|
139
|
+
url.relative.query.to_s.should == uri_specification[:query]
|
140
|
+
url.query.class.should == UniformResourceIdentifier::Query # Delegate
|
141
|
+
url.query.to_s.should == uri_specification[:query] # Delegate
|
142
|
+
end
|
143
|
+
|
144
|
+
unless uri_specification.has_key?(:anchor)
|
145
|
+
url.relative.anchor.class.should == String
|
146
|
+
url.relative.anchor.to_s.should == uri_specification[:anchor]
|
147
|
+
url.anchor.class.should == String # Delegate
|
148
|
+
url.anchor.to_s.should == uri_specification[:anchor] # Delegate
|
149
|
+
end
|
113
150
|
end
|
114
151
|
end
|
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.
|
4
|
+
version: 0.1.11
|
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: &
|
16
|
+
requirement: &70282682928420 !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: *
|
24
|
+
version_requirements: *70282682928420
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70282682927940 !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: *
|
35
|
+
version_requirements: *70282682927940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: addressable
|
38
|
-
requirement: &
|
38
|
+
requirement: &70282682927480 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.2.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70282682927480
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bundler
|
49
|
-
requirement: &
|
49
|
+
requirement: &70282682927020 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.0.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70282682927020
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &70282668884040 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 2.6.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70282668884040
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: fuubar
|
71
|
-
requirement: &
|
71
|
+
requirement: &70282681551760 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.0.6
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70282681551760
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: watchr
|
82
|
-
requirement: &
|
82
|
+
requirement: &70282681793760 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: 0.7.0
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70282681793760
|
91
91
|
description: ! '`uniform_resource_identifier` splits URIs according to RFC 3986 using
|
92
92
|
regexp, attempts to check the public suffix using `public_suffix_service`, and serializes
|
93
93
|
the query string using `active_support` and `addressable`'
|