optic14n 2.0.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/spec/c14n_spec.rb CHANGED
@@ -1,195 +1,207 @@
1
- # encoding: utf-8
2
-
3
- require 'spec_helper'
1
+ require "spec_helper"
4
2
 
5
3
  describe "Paul's tests, translated from Perl" do
6
- it 'lowercases URLs' do
7
- BLURI('http://www.EXAMPLE.COM/Foo/Bar/BAZ').canonicalize!.to_s.should == 'http://www.example.com/foo/bar/baz'
4
+ it "lowercases URLs" do
5
+ expect(BLURI("http://www.EXAMPLE.COM/Foo/Bar/BAZ").canonicalize!.to_s).to eq("http://www.example.com/foo/bar/baz")
8
6
  end
9
7
 
10
- describe 'protocol' do
11
- it 'translates protocol to http', reason: 'Reduces our input space, everything public anyway' do
12
- BLURI('https://www.example.com').canonicalize!.to_s.should == 'http://www.example.com'
8
+ describe "protocol" do
9
+ it "translates protocol to http", reason: "Reduces our input space, everything public anyway" do
10
+ expect(BLURI("https://www.example.com").canonicalize!.to_s).to eq("http://www.example.com")
13
11
  end
14
12
  end
15
13
 
16
- describe 'slashes' do
17
- it 'drops single trailing slashes' do
18
- BLURI('http://www.example.com/').canonicalize!.to_s.should == 'http://www.example.com'
14
+ describe "slashes" do
15
+ it "drops single trailing slashes" do
16
+ expect(BLURI("http://www.example.com/").canonicalize!.to_s).to eq("http://www.example.com")
19
17
  end
20
18
 
21
- it 'drops multiple trailing slashes' do
22
- BLURI('http://www.example.com////').canonicalize!.to_s.should == 'http://www.example.com'
19
+ it "drops multiple trailing slashes" do
20
+ expect(BLURI("http://www.example.com////").canonicalize!.to_s).to eq("http://www.example.com")
23
21
  end
24
22
 
25
- it 'drops multiple trailing slashes on the path' do
26
- BLURI('http://www.example.com/foo///').canonicalize!.to_s.should == 'http://www.example.com/foo'
23
+ it "drops multiple trailing slashes on the path" do
24
+ expect(BLURI("http://www.example.com/foo///").canonicalize!.to_s).to eq("http://www.example.com/foo")
27
25
  end
28
26
  end
29
27
 
30
- describe 'fragments' do
31
- it 'drops fragment identifier', reason: 'They won''t be mapped, so are redundant' do
32
- BLURI('http://www.example.com#foo').canonicalize!.to_s.should == 'http://www.example.com'
28
+ describe "fragments" do
29
+ it "drops fragment identifier", reason: "They won't be mapped, so are redundant" do
30
+ expect(BLURI("http://www.example.com#foo").canonicalize!.to_s).to eq("http://www.example.com")
33
31
  end
34
- it 'drops fragment identifier and slashes' do
35
- BLURI('http://www.example.com/#foo').canonicalize!.to_s.should == 'http://www.example.com'
32
+ it "drops fragment identifier and slashes" do
33
+ expect(BLURI("http://www.example.com/#foo").canonicalize!.to_s).to eq("http://www.example.com")
36
34
  end
37
35
  end
38
36
 
39
- describe 'Things to keep verbatim or encode', reason: 'http://tools.ietf.org/html/rfc3986' do
40
- it 'retains colons' do
41
- BLURI('http://www.example.com/:colon:').canonicalize!.to_s.should == 'http://www.example.com/:colon:'
37
+ describe "Things to keep verbatim or encode", reason: "http://tools.ietf.org/html/rfc3986" do
38
+ it "retains colons" do
39
+ expect(BLURI("http://www.example.com/:colon:").canonicalize!.to_s).to eq("http://www.example.com/:colon:")
42
40
  end
43
- it 'retains tilde' do
44
- BLURI('http://www.example.com/~tilde').canonicalize!.to_s.should == 'http://www.example.com/~tilde'
41
+ it "retains tilde" do
42
+ expect(BLURI("http://www.example.com/~tilde").canonicalize!.to_s).to eq("http://www.example.com/~tilde")
45
43
  end
46
- it 'retains underscores' do
47
- BLURI('http://www.example.com/_underscore_').canonicalize!.to_s.should == 'http://www.example.com/_underscore_'
44
+ it "retains underscores" do
45
+ expect(BLURI("http://www.example.com/_underscore_").canonicalize!.to_s).to eq("http://www.example.com/_underscore_")
48
46
  end
49
- it 'retains asterisks' do
50
- BLURI('http://www.example.com/*asterisk*').canonicalize!.to_s.should == 'http://www.example.com/*asterisk*'
47
+ it "retains asterisks" do
48
+ expect(BLURI("http://www.example.com/*asterisk*").canonicalize!.to_s).to eq("http://www.example.com/*asterisk*")
51
49
  end
52
- it 'retains parens' do
53
- BLURI('http://www.example.com/(parens)').canonicalize!.to_s.should == 'http://www.example.com/(parens)'
50
+ it "retains parens" do
51
+ expect(BLURI("http://www.example.com/(parens)").canonicalize!.to_s).to eq("http://www.example.com/(parens)")
54
52
  end
55
- it 'escapes square brackets' do
56
- BLURI('http://www.example.com/[square-brackets]').canonicalize!.to_s.should == 'http://www.example.com/%5bsquare-brackets%5d'
53
+ it "escapes square brackets" do
54
+ expect(BLURI("http://www.example.com/[square-brackets]").canonicalize!.to_s).to eq("http://www.example.com/%5bsquare-brackets%5d")
57
55
  end
58
- it 'encodes commas and quotes', reason: 'They make csv harder to awk' do
59
- BLURI("http://www.example.com/commas,and-\"quotes\"-make-CSV-harder-to-'awk'").canonicalize!.to_s.should ==
60
- 'http://www.example.com/commas%2cand-%22quotes%22-make-csv-harder-to-%27awk%27'
56
+ it "encodes commas and quotes", reason: "They make csv harder to awk" do
57
+ expect(BLURI("http://www.example.com/commas,and-\"quotes\"-make-CSV-harder-to-'awk'").canonicalize!.to_s).to eq(
58
+ "http://www.example.com/commas%2cand-%22quotes%22-make-csv-harder-to-%27awk%27",
59
+ )
61
60
  end
62
- it 'encodes square brackets and pipes', reason: "It's problematic in curl and regexes" do
63
- BLURI('http://www.example.com/problematic-in-curl[]||[and-regexes]').canonicalize!.to_s.should ==
64
- 'http://www.example.com/problematic-in-curl%5b%5d%7c%7c%5band-regexes%5d'
61
+ it "encodes square brackets and pipes", reason: "It's problematic in curl and regexes" do
62
+ expect(BLURI("http://www.example.com/problematic-in-curl[]||[and-regexes]").canonicalize!.to_s).to eq(
63
+ "http://www.example.com/problematic-in-curl%5b%5d%7c%7c%5band-regexes%5d",
64
+ )
65
65
  end
66
- it 'decodes non-reserved characters (! and ~)' do
66
+ it "decodes non-reserved characters (! and ~)" do
67
67
  # My god, it's full of stars
68
- BLURI('http://www.example.com/%7eyes%20I%20have%20now%20read%20%5brfc%203986%5d%2C%20%26%20I%27m%20a%20%3Dlot%3D%20more%20reassured%21%21').
69
- canonicalize!.to_s.should == 'http://www.example.com/~yes%20i%20have%20now%20read%20%5brfc%203986%5d%2c%20%26%20i%27m%20a%20%3dlot%3d%20more%20reassured!!'
68
+ expect(BLURI("http://www.example.com/%7eyes%20I%20have%20now%20read%20%5brfc%203986%5d%2C%20%26%20I%27m%20a%20%3Dlot%3D%20more%20reassured%21%21")
69
+ .canonicalize!.to_s).to eq("http://www.example.com/~yes%20i%20have%20now%20read%20%5brfc%203986%5d%2c%20%26%20i%27m%20a%20%3dlot%3d%20more%20reassured!!")
70
70
  end
71
- it 'encodes pound signs' do
72
- BLURI('https://www.example.com/pound-sign-£').canonicalize!.to_s.should == 'http://www.example.com/pound-sign-%c2%a3'
71
+ it "encodes pound signs" do
72
+ expect(BLURI("https://www.example.com/pound-sign-£").canonicalize!.to_s).to eq("http://www.example.com/pound-sign-%c2%a3")
73
73
  end
74
74
  end
75
75
 
76
- describe 'query strings' do
77
- it 'disallows all query string params by default' do
78
- BLURI('http://www.example.com?q=foo').canonicalize!.to_s.should == 'http://www.example.com'
76
+ describe "query strings" do
77
+ it "disallows all query string params by default" do
78
+ expect(BLURI("http://www.example.com?q=foo").canonicalize!.to_s).to eq("http://www.example.com")
79
79
  end
80
- it 'disallows all params when there''s a slash' do
81
- BLURI('http://www.example.com/?q=foo').canonicalize!.to_s.should == 'http://www.example.com'
80
+ it "disallows all params when there's a slash" do
81
+ expect(BLURI("http://www.example.com/?q=foo").canonicalize!.to_s).to eq("http://www.example.com")
82
82
  end
83
- it 'disallows all params after a slash with fragid' do
84
- BLURI('http://www.example.com/?q=foo#bar').canonicalize!.to_s.should == 'http://www.example.com'
83
+ it "disallows all params after a slash with fragid" do
84
+ expect(BLURI("http://www.example.com/?q=foo#bar").canonicalize!.to_s).to eq("http://www.example.com")
85
85
  end
86
86
 
87
- describe 'allowing some or all query string values' do
88
- it 'allows named query_string parameters' do
89
- BLURI('http://www.example.com/?q=foo&r=bar').canonicalize!(allow_query: 'q').to_s.should ==
90
- 'http://www.example.com?q=foo'
87
+ describe "allowing some or all query string values" do
88
+ it "allows named query_string parameters" do
89
+ expect(BLURI("http://www.example.com/?q=foo&r=bar").canonicalize!(allow_query: "q").to_s).to eq(
90
+ "http://www.example.com?q=foo",
91
+ )
91
92
  end
92
- it 'sorts query string values' do
93
- BLURI('http://www.example.com?c=23&d=1&b=909&e=33&a=1').
94
- canonicalize!(allow_query: [:b,:e,:c,:d,:a]).to_s.should == 'http://www.example.com?a=1&b=909&c=23&d=1&e=33'
93
+ it "sorts query string values" do
94
+ expect(BLURI("http://www.example.com?c=23&d=1&b=909&e=33&a=1")
95
+ .canonicalize!(allow_query: %i[b e c d a]).to_s).to eq("http://www.example.com?a=1&b=909&c=23&d=1&e=33")
95
96
  end
96
- it 'encodes querystring values' do
97
- BLURI("http://www.example.com?a=you're_dangerous").canonicalize!(allow_query: :all).to_s.should ==
98
- 'http://www.example.com?a=you%27re_dangerous'
97
+ it "encodes querystring values" do
98
+ expect(BLURI("http://www.example.com?a=you're_dangerous").canonicalize!(allow_query: :all).to_s).to eq(
99
+ "http://www.example.com?a=you%27re_dangerous",
100
+ )
99
101
  end
100
- it 'whitelists and sorts query strings' do
101
- BLURI('http://www.example.com?a=1&c=3&b=2').canonicalize!(allow_query: :all).to_s.should ==
102
- 'http://www.example.com?a=1&b=2&c=3'
102
+ it "whitelists and sorts query strings" do
103
+ expect(BLURI("http://www.example.com?a=1&c=3&b=2").canonicalize!(allow_query: :all).to_s).to eq(
104
+ "http://www.example.com?a=1&b=2&c=3",
105
+ )
103
106
  end
104
- it 'converts matrix URI to query_string' do
105
- BLURI('http://www.example.com?c=23;d=1;b=909;e=33;a=1').
106
- canonicalize!(allow_query: [:b,:e,:c,:d,:a]).to_s.should == 'http://www.example.com?a=1&b=909&c=23&d=1&e=33'
107
+ it "converts matrix URI to query_string" do
108
+ expect(BLURI("http://www.example.com?c=23;d=1;b=909;e=33;a=1")
109
+ .canonicalize!(allow_query: %i[b e c d a]).to_s).to eq("http://www.example.com?a=1&b=909&c=23&d=1&e=33")
107
110
  end
108
- it 'sorts cherry-picked query string arguments' do
109
- BLURI('http://www.example.com?a=2322sdfsf&topic=334499&q=909&item=23444').
110
- canonicalize!(allow_query: [:topic, :item]).to_s.should == 'http://www.example.com?item=23444&topic=334499'
111
+ it "sorts cherry-picked query string arguments" do
112
+ expect(BLURI("http://www.example.com?a=2322sdfsf&topic=334499&q=909&item=23444")
113
+ .canonicalize!(allow_query: %i[topic item]).to_s).to eq("http://www.example.com?item=23444&topic=334499")
111
114
  end
112
- it 'ignores empty querystring values' do
113
- BLURI('http://www.example.com?a=2322sdfsf&topic=334499&q=909&item=23444').
114
- canonicalize!(allow_query: %w(foo bar baz)).to_s.should == 'http://www.example.com'
115
+ it "ignores empty querystring values" do
116
+ expect(BLURI("http://www.example.com?a=2322sdfsf&topic=334499&q=909&item=23444")
117
+ .canonicalize!(allow_query: %w[foo bar baz]).to_s).to eq("http://www.example.com")
115
118
  end
116
119
 
117
- describe 'querystrings that are not an HTML-encoded thing' do
120
+ describe "querystrings that are not an HTML-encoded thing" do
118
121
  before do
119
- @bluri = BLURI('http://some.com/a/path?foo&bar').canonicalize!(allow_query: :all)
122
+ @bluri = BLURI("http://some.com/a/path?foo&bar").canonicalize!(allow_query: :all)
120
123
  end
121
124
 
122
- it 'retains the query string' do
123
- @bluri.query.should == 'bar&foo'
125
+ it "retains the query string" do
126
+ expect(@bluri.query).to eq("bar&foo")
124
127
  end
125
128
 
126
- it 'has a query hash with empty elements' do
127
- @bluri.query_hash['foo'].should == nil
128
- @bluri.query_hash['bar'].should == nil
129
+ it "has a query hash with empty elements" do
130
+ expect(@bluri.query_hash["foo"]).to eq(nil)
131
+ expect(@bluri.query_hash["bar"]).to eq(nil)
129
132
  end
130
133
 
131
- it 'renders the string properly' do
132
- @bluri.query_hash.to_s.should == 'bar&foo'
134
+ it "renders the string properly" do
135
+ expect(@bluri.query_hash.to_s).to eq("bar&foo")
133
136
  end
134
137
  end
135
138
 
136
- describe 'casing of allowed query params' do
137
- context 'when the query param contains upper-case letters' do
138
- it 'does not preserve the query string, even when it appeared identically in the URL' do
139
- BLURI('http://www.example.com/?Foo=bar').canonicalize!(allow_query: 'Foo').to_s.should ==
140
- 'http://www.example.com'
139
+ describe "casing of allowed query params" do
140
+ context "when the query param contains upper-case letters" do
141
+ it "does not preserve the query string, even when it appeared identically in the URL" do
142
+ expect(BLURI("http://www.example.com/?Foo=bar").canonicalize!(allow_query: "Foo").to_s).to eq(
143
+ "http://www.example.com",
144
+ )
141
145
  end
142
146
  end
143
147
 
144
- context 'when the query param is lower-cased' do
145
- it 'preserves the query string and lower-cases it' do
146
- BLURI('http://www.example.com/?Foo=bar').canonicalize!(allow_query: 'foo').to_s.should ==
147
- 'http://www.example.com?foo=bar'
148
+ context "when the query param is lower-cased" do
149
+ it "preserves the query string and lower-cases it" do
150
+ expect(BLURI("http://www.example.com/?Foo=bar").canonicalize!(allow_query: "foo").to_s).to eq(
151
+ "http://www.example.com?foo=bar",
152
+ )
148
153
  end
149
154
  end
150
155
  end
151
156
 
152
- describe 'indifferent specfication of allowed query params' do
153
- context 'specifying the allowed query param using either a symbol or a string' do
154
- it 'should behave the same' do
155
- url = 'http://example.com/some?significant=1&query_params=2'
157
+ describe "indifferent specfication of allowed query params" do
158
+ context "specifying the allowed query param using either a symbol or a string" do
159
+ it "should behave the same" do
160
+ url = "http://example.com/some?significant=1&query_params=2"
156
161
 
157
162
  using_symbol = BLURI(url).canonicalize!(allow_query: :significant)
158
- using_string = BLURI(url).canonicalize!(allow_query: 'significant')
163
+ using_string = BLURI(url).canonicalize!(allow_query: "significant")
159
164
 
160
- using_symbol.should == using_string
165
+ expect(using_symbol).to eq(using_string)
161
166
  end
162
167
  end
163
168
  end
164
169
  end
165
170
 
166
- describe 'degenerate cases' do
167
- describe 'the treatment of query strings when there are query string octets that unescape to '\
168
- 'invalid UTF-8 sequences (we no longer treat these as failures)' do
169
- it 'no longer raises exceptions when there are bad things in query values' do
170
- BLURI('http://example.com/path?view=%ED').
171
- canonicalize!(allow_query: :all).
172
- to_s.should eql('http://example.com/path?view=%ED')
171
+ describe "degenerate cases" do
172
+ describe "the treatment of query strings when there are query string octets that unescape to "\
173
+ "invalid UTF-8 sequences (we no longer treat these as failures)" do
174
+ it "no longer raises exceptions when there are bad things in query values" do
175
+ expect(BLURI("http://example.com/path?view=%ED")
176
+ .canonicalize!(allow_query: :all)
177
+ .to_s).to eql("http://example.com/path?view=%ED")
173
178
  end
174
179
 
175
- it 're-encodes correctly when there are bad things in query keys' do
176
- BLURI('http://example.com/path?%ED=view').
177
- canonicalize!(allow_query: :all).
178
- to_s.should eql('http://example.com/path?%ED=view')
180
+ it "re-encodes correctly when there are bad things in query keys" do
181
+ expect(BLURI("http://example.com/path?%ED=view")
182
+ .canonicalize!(allow_query: :all)
183
+ .to_s).to eql("http://example.com/path?%ED=view")
179
184
  end
180
185
 
181
- it 'does not error when there are bad things in query keys when allow_query isn\'t :all' do
182
- expect { BLURI('http://some.com/a/path?%E2').canonicalize! }.not_to raise_error
186
+ it "does not error when there are bad things in query keys when allow_query isn't :all" do
187
+ expect { BLURI("http://some.com/a/path?%E2").canonicalize! }.not_to raise_error
183
188
  end
184
189
  end
185
190
 
186
- describe 'failure to canonicalize paths correctly' do
191
+ describe "failure to canonicalize paths correctly" do
187
192
  # see https://www.pivotaltracker.com/s/projects/860575/stories/54502932
188
193
 
189
- subject { BLURI('http://www.voa.gov.uk/stuff/?query=thing').canonicalize!(allow_query: :all) }
194
+ subject { BLURI("http://www.voa.gov.uk/stuff/?query=thing").canonicalize!(allow_query: :all) }
195
+
196
+ describe "#path" do
197
+ subject { super().path }
198
+ it { is_expected.to eql("/stuff") }
199
+ end
190
200
 
191
- its(:path) { should eql('/stuff') }
192
- its(:query) { should eql('query=thing') }
201
+ describe "#query" do
202
+ subject { super().query }
203
+ it { is_expected.to eql("query=thing") }
204
+ end
193
205
  end
194
206
  end
195
207
  end
@@ -1,57 +1,66 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Optic14n::CanonicalizedUrls do
4
- describe 'c14nize' do
4
+ describe "c14nize" do
5
5
  let(:test_urls) do
6
- %w(
6
+ %w[
7
7
  http://www.qhm.mod.uk/portsmouth/leisure/fuel
8
8
  http://www.qhm.mod.uk/portsmouth/leisure/lntm?
9
9
  http://www.qhm.mod.uk/portsmouth/leisure/lntm?action=view
10
10
  http://www.qhm.mod.uk/portsmouth/leisure/lntm?action=view&id=199
11
11
  http://unistats.direct.gov.uk/searchResults.do?pname=institutesearchresults&level3Subjects=L3.90%AC10007761%ACFIRSTDEGREE%ACFulltime%AC430%ACNo%AC60%ACYes%AC83%ACNo%ACYes
12
12
  1234://123
13
- )
13
+ ]
14
14
  end
15
15
 
16
- context 'options[:allow_query] is false' do
16
+ context "options[:allow_query] is false" do
17
17
  subject(:c14nizer) { Optic14n::CanonicalizedUrls.from_urls(test_urls, allow_query: false) }
18
18
 
19
- it { should be_a(Optic14n::CanonicalizedUrls) }
19
+ it { is_expected.to be_a(Optic14n::CanonicalizedUrls) }
20
20
 
21
- its(:seen) { should eql(6) }
21
+ describe "#seen" do
22
+ subject { super().seen }
23
+ it { is_expected.to eql(6) }
24
+ end
22
25
 
23
- describe 'the output set' do
26
+ describe "the output set" do
24
27
  subject(:output_set) { c14nizer.output_set }
25
28
 
26
- its(:size) { should eql(3) }
29
+ describe "#size" do
30
+ subject { super().size }
31
+ it { is_expected.to eql(3) }
32
+ end
27
33
 
28
- describe 'the items' do
34
+ describe "the items" do
29
35
  subject { output_set.map(&:to_s) }
30
36
 
31
- it { should include('http://www.qhm.mod.uk/portsmouth/leisure/fuel') }
32
- it { should include('http://www.qhm.mod.uk/portsmouth/leisure/lntm') }
33
- it { should include('http://unistats.direct.gov.uk/searchresults.do') }
37
+ it { is_expected.to include("http://www.qhm.mod.uk/portsmouth/leisure/fuel") }
38
+ it { is_expected.to include("http://www.qhm.mod.uk/portsmouth/leisure/lntm") }
39
+ it { is_expected.to include("http://unistats.direct.gov.uk/searchresults.do") }
34
40
  end
35
41
  end
36
42
  end
37
43
 
38
- context 'options[:allow_query] is :all' do
44
+ context "options[:allow_query] is :all" do
39
45
  subject(:c14nizer) { Optic14n::CanonicalizedUrls.from_urls(test_urls, allow_query: :all) }
40
46
 
41
- describe 'the output set' do
47
+ describe "the output set" do
42
48
  subject(:output_set) { c14nizer.output_set }
43
49
 
44
- its(:size) { should eql(5) }
50
+ describe "#size" do
51
+ subject { super().size }
52
+ it { is_expected.to eql(5) }
53
+ end
45
54
  end
46
55
 
47
- describe 'failures' do
56
+ describe "failures" do
48
57
  subject(:failures) { c14nizer.failures }
49
58
 
50
- it { should be_a(Hash) }
59
+ it { is_expected.to be_a(Hash) }
51
60
 
52
- it 'has our last URL and an error' do
61
+ it "has our last URL and an error" do
53
62
  e = failures[test_urls.last]
54
- e.should be_an(Addressable::URI::InvalidURIError)
63
+ expect(e).to be_an(Addressable::URI::InvalidURIError)
55
64
  end
56
65
  end
57
66
  end
@@ -1,15 +1,29 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe URI::QueryHash do
4
4
  subject(:hash) { {}.extend URI::QueryHash }
5
5
 
6
- its(:to_s) { should eql('') }
6
+ describe "#to_s" do
7
+ subject { super().to_s }
8
+ it { is_expected.to eql("") }
9
+ end
10
+
11
+ describe "setting a value by symbol" do
12
+ before { hash["x"] = "1" }
13
+
14
+ describe "[:x]" do
15
+ subject { super()[:x] }
16
+ it { is_expected.to eql("1") }
17
+ end
7
18
 
8
- describe 'setting a value by symbol' do
9
- before { hash['x'] = '1' }
19
+ describe "['x']" do
20
+ subject { super()["x"] }
21
+ it { is_expected.to eql("1") }
22
+ end
10
23
 
11
- its([:x]) { should eql('1') }
12
- its(['x']) { should eql('1') }
13
- its(:to_s) { should eql('x=1') }
24
+ describe "#to_s" do
25
+ subject { super().to_s }
26
+ it { is_expected.to eql("x=1") }
27
+ end
14
28
  end
15
- end
29
+ end
data/spec/spec_helper.rb CHANGED
@@ -1 +1 @@
1
- require 'optic14n'
1
+ require "optic14n"
@@ -1,11 +1,22 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe URI::QueryHash do
4
- describe 'non-HTML encoded query strings' do
5
- subject { { 'foo' => nil, 'bar' => nil }.extend URI::QueryHash }
4
+ describe "non-HTML encoded query strings" do
5
+ subject { { "foo" => nil, "bar" => nil }.extend URI::QueryHash }
6
6
 
7
- its(['foo']) { should be_nil }
8
- its(['bar']) { should be_nil }
9
- its(:to_s) { should eql('foo&bar') }
7
+ describe "['foo']" do
8
+ subject { super()["foo"] }
9
+ it { is_expected.to be_nil }
10
+ end
11
+
12
+ describe "['bar']" do
13
+ subject { super()["bar"] }
14
+ it { is_expected.to be_nil }
15
+ end
16
+
17
+ describe "#to_s" do
18
+ subject { super().to_s }
19
+ it { is_expected.to eql("foo&bar") }
20
+ end
10
21
  end
11
- end
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: optic14n
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
- - Russell Garner
7
+ - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-27 00:00:00.000000000 Z
11
+ date: 2024-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.3'
19
+ version: '2.7'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.3'
26
+ version: '2.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,33 +39,53 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: gem_publisher
42
+ name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-govuk
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 5.0.2
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
53
67
  - !ruby/object:Gem::Version
54
- version: 1.3.0
68
+ version: 5.0.2
55
69
  description: Canonicalises URLs.
56
70
  email:
57
- - rgarner@zephyros-systems.co.uk
71
+ - govuk-dev@digital.cabinet-office.gov.uk
58
72
  executables: []
59
73
  extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
76
+ - ".github/dependabot.yml"
77
+ - ".github/pull_request_template.md"
78
+ - ".github/workflows/autorelease.yml"
79
+ - ".github/workflows/ci.yml"
62
80
  - ".gitignore"
81
+ - ".govuk_dependabot_merger.yml"
82
+ - ".rubocop.yml"
63
83
  - ".ruby-version"
84
+ - CHANGELOG.md
64
85
  - Gemfile
65
- - LICENSE.txt
86
+ - LICENCE
66
87
  - README.md
67
88
  - Rakefile
68
- - jenkins.sh
69
89
  - lib/optic14n.rb
70
90
  - lib/optic14n/canonicalized_urls.rb
71
91
  - lib/optic14n/version.rb
@@ -80,7 +100,7 @@ files:
80
100
  - spec/query_hash_spec.rb
81
101
  - spec/spec_helper.rb
82
102
  - spec/uri/query_hash_spec.rb
83
- homepage: ''
103
+ homepage: https://github.com/alphagov/optic14n
84
104
  licenses:
85
105
  - MIT
86
106
  metadata: {}
@@ -92,15 +112,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
92
112
  requirements:
93
113
  - - ">="
94
114
  - !ruby/object:Gem::Version
95
- version: '0'
115
+ version: 3.1.4
96
116
  required_rubygems_version: !ruby/object:Gem::Requirement
97
117
  requirements:
98
118
  - - ">="
99
119
  - !ruby/object:Gem::Version
100
120
  version: '0'
101
121
  requirements: []
102
- rubyforge_project:
103
- rubygems_version: 2.5.1
122
+ rubygems_version: 3.5.21
104
123
  signing_key:
105
124
  specification_version: 4
106
125
  summary: Specifically, HTTP URLs, for a limited purpose
data/jenkins.sh DELETED
@@ -1,10 +0,0 @@
1
- #!/bin/bash -x
2
- export RAILS_ENV=test
3
- export DISPLAY=":99"
4
-
5
- set -e
6
- rm -f Gemfile.lock
7
- bundle install --path "${HOME}/bundles/${JOB_NAME}"
8
- export GOVUK_APP_DOMAIN=dev.gov.uk
9
- bundle exec rake
10
- bundle exec rake publish_gem
File without changes