embiggen 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,8 +40,8 @@ module Embiggen
40
40
  end
41
41
 
42
42
  it 'can be overridden' do
43
- expect { described_class.shorteners << 'foo.bar' }.
44
- to change { described_class.shorteners.size }.by(1)
43
+ expect { described_class.shorteners << 'foo.bar' }
44
+ .to change { described_class.shorteners.size }.by(1)
45
45
  end
46
46
 
47
47
  after do
@@ -9,7 +9,7 @@ RSpec.describe Embiggen::ShortenerList do
9
9
  end
10
10
 
11
11
  it 'converts a given enumerable to a set' do
12
- list = described_class.new(%w(a.com a.com))
12
+ list = described_class.new(%w[a.com a.com])
13
13
 
14
14
  expect(list.size).to eq(1)
15
15
  end
@@ -17,19 +17,19 @@ RSpec.describe Embiggen::ShortenerList do
17
17
 
18
18
  describe '#include?' do
19
19
  it 'returns true if a URL host is on the whitelist' do
20
- list = described_class.new(%w(bit.ly))
20
+ list = described_class.new(%w[bit.ly])
21
21
 
22
22
  expect(list).to include(URI('http://bit.ly/foo'))
23
23
  end
24
24
 
25
25
  it 'returns false if a URL host is not on the whitelist' do
26
- list = described_class.new(%w(bit.ly))
26
+ list = described_class.new(%w[bit.ly])
27
27
 
28
28
  expect(list).to_not include(URI('http://www.altmetric.com'))
29
29
  end
30
30
 
31
31
  it 'returns true if a URL host without a subdomain is on the whitelist' do
32
- list = described_class.new(%w(bit.ly))
32
+ list = described_class.new(%w[bit.ly])
33
33
 
34
34
  expect(list).to include(URI('http://www.bit.ly/foo'))
35
35
  end
@@ -53,7 +53,7 @@ RSpec.describe Embiggen::ShortenerList do
53
53
 
54
54
  describe '#size' do
55
55
  it 'returns the number of domains in the list' do
56
- list = described_class.new(%w(bit.ly ow.ly))
56
+ list = described_class.new(%w[bit.ly ow.ly])
57
57
 
58
58
  expect(list.size).to eq(2)
59
59
  end
@@ -61,7 +61,7 @@ RSpec.describe Embiggen::ShortenerList do
61
61
 
62
62
  describe '#delete' do
63
63
  it 'removes domains from the list' do
64
- list = described_class.new(%w(bit.ly))
64
+ list = described_class.new(%w[bit.ly])
65
65
  list.delete('bit.ly')
66
66
 
67
67
  expect(list).to be_empty
@@ -70,15 +70,15 @@ RSpec.describe Embiggen::ShortenerList do
70
70
 
71
71
  describe '#+' do
72
72
  it 'appends a list of domains to the existing one' do
73
- list = described_class.new(%w(bit.ly))
74
- list += %w(a.com)
73
+ list = described_class.new(%w[bit.ly])
74
+ list += %w[a.com]
75
75
 
76
76
  expect(list).to include(URI('http://a.com/foo'))
77
77
  end
78
78
 
79
79
  it 'can combine two lists' do
80
- list = described_class.new(%w(bit.ly))
81
- list += described_class.new(%w(a.com))
80
+ list = described_class.new(%w[bit.ly])
81
+ list += described_class.new(%w[a.com])
82
82
 
83
83
  expect(list).to include(URI('http://a.com/foo'))
84
84
  end
@@ -67,8 +67,8 @@ module Embiggen
67
67
  stub_redirect('http://bit.ly/3', 'http://bit.ly/4')
68
68
  uri = described_class.new('http://bit.ly/1')
69
69
 
70
- expect { uri.expand(:redirects => 2) }.
71
- to raise_error(TooManyRedirects)
70
+ expect { uri.expand(redirects: 2) }
71
+ .to raise_error(TooManyRedirects)
72
72
  end
73
73
 
74
74
  it 'retains the last URI when redirecting too many times' do
@@ -80,7 +80,7 @@ module Embiggen
80
80
  last_uri = nil
81
81
 
82
82
  begin
83
- uri.expand(:redirects => 2)
83
+ uri.expand(redirects: 2)
84
84
  rescue TooManyRedirects => ex
85
85
  last_uri = ex.uri
86
86
  end
@@ -89,7 +89,7 @@ module Embiggen
89
89
  end
90
90
 
91
91
  it 'raises an error if a shortened URI does not redirect' do
92
- stub_request(:get, 'http://bit.ly/bad').to_return(:status => 500)
92
+ stub_request(:get, 'http://bit.ly/bad').to_return(status: 500)
93
93
  uri = described_class.new('http://bit.ly/bad')
94
94
 
95
95
  expect { uri.expand }.to raise_error(BadShortenedURI)
@@ -111,7 +111,7 @@ module Embiggen
111
111
 
112
112
  it 'retains the last URI if a shortened URI does not redirect' do
113
113
  stub_redirect('http://bit.ly/bad', 'http://bit.ly/bad2')
114
- stub_request(:get, 'http://bit.ly/bad2').to_return(:status => 500)
114
+ stub_request(:get, 'http://bit.ly/bad2').to_return(status: 500)
115
115
  uri = described_class.new('http://bit.ly/bad')
116
116
 
117
117
  last_uri = nil
@@ -188,7 +188,7 @@ module Embiggen
188
188
  stub_redirect('http://bit.ly/3', 'http://bit.ly/4')
189
189
  uri = described_class.new(URI('http://bit.ly/1'))
190
190
 
191
- expect { uri.expand(:redirects => 2) }.to raise_error(TooManyRedirects)
191
+ expect { uri.expand(redirects: 2) }.to raise_error(TooManyRedirects)
192
192
  end
193
193
 
194
194
  it 'uses the threshold from the configuration' do
@@ -282,8 +282,8 @@ module Embiggen
282
282
  end
283
283
 
284
284
  def stub_redirect(short_url, expanded_url, status = 301)
285
- stub_request(:get, short_url).
286
- to_return(:status => status, :headers => { 'Location' => expanded_url })
285
+ stub_request(:get, short_url)
286
+ .to_return(status: status, headers: { 'Location' => expanded_url })
287
287
  end
288
288
  end
289
289
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: embiggen
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Mucur
8
8
  - Jonathan Hernandez
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-23 00:00:00.000000000 Z
12
+ date: 2024-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable
@@ -29,30 +29,58 @@ dependencies:
29
29
  name: rspec
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '3.2'
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '3.2'
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: webmock
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '1.21'
48
+ version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
54
68
  - !ruby/object:Gem::Version
55
- version: '1.21'
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: house_style
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
56
84
  description: |2
57
85
  A library to expand shortened URIs, respecting timeouts, following
58
86
  multiple redirects and leaving unshortened URIs intact.
@@ -79,7 +107,7 @@ homepage: https://github.com/altmetric/embiggen
79
107
  licenses:
80
108
  - MIT
81
109
  metadata: {}
82
- post_install_message:
110
+ post_install_message:
83
111
  rdoc_options: []
84
112
  require_paths:
85
113
  - lib
@@ -94,14 +122,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
122
  - !ruby/object:Gem::Version
95
123
  version: '0'
96
124
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.7.3
99
- signing_key:
125
+ rubygems_version: 3.5.21
126
+ signing_key:
100
127
  specification_version: 4
101
128
  summary: A library to expand shortened URLs
102
129
  test_files:
103
- - spec/spec_helper.rb
104
- - spec/embiggen_spec.rb
105
130
  - spec/embiggen/configuration_spec.rb
106
131
  - spec/embiggen/shortener_list_spec.rb
107
132
  - spec/embiggen/uri_spec.rb
133
+ - spec/embiggen_spec.rb
134
+ - spec/spec_helper.rb