embiggen 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,14 @@
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.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Mucur
8
8
  - Jonathan Hernandez
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2018-01-23 00:00:00.000000000 Z
11
+ date: 2025-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: addressable
@@ -29,30 +28,58 @@ dependencies:
29
28
  name: rspec
30
29
  requirement: !ruby/object:Gem::Requirement
31
30
  requirements:
32
- - - "~>"
31
+ - - ">="
33
32
  - !ruby/object:Gem::Version
34
- version: '3.2'
33
+ version: '0'
35
34
  type: :development
36
35
  prerelease: false
37
36
  version_requirements: !ruby/object:Gem::Requirement
38
37
  requirements:
39
- - - "~>"
38
+ - - ">="
40
39
  - !ruby/object:Gem::Version
41
- version: '3.2'
40
+ version: '0'
42
41
  - !ruby/object:Gem::Dependency
43
42
  name: webmock
44
43
  requirement: !ruby/object:Gem::Requirement
45
44
  requirements:
46
- - - "~>"
45
+ - - ">="
47
46
  - !ruby/object:Gem::Version
48
- version: '1.21'
47
+ version: '0'
49
48
  type: :development
50
49
  prerelease: false
51
50
  version_requirements: !ruby/object:Gem::Requirement
52
51
  requirements:
53
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
54
67
  - !ruby/object:Gem::Version
55
- version: '1.21'
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: house_style
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
56
83
  description: |2
57
84
  A library to expand shortened URIs, respecting timeouts, following
58
85
  multiple redirects and leaving unshortened URIs intact.
@@ -79,7 +106,6 @@ homepage: https://github.com/altmetric/embiggen
79
106
  licenses:
80
107
  - MIT
81
108
  metadata: {}
82
- post_install_message:
83
109
  rdoc_options: []
84
110
  require_paths:
85
111
  - lib
@@ -94,14 +120,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
120
  - !ruby/object:Gem::Version
95
121
  version: '0'
96
122
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.7.3
99
- signing_key:
123
+ rubygems_version: 3.6.2
100
124
  specification_version: 4
101
125
  summary: A library to expand shortened URLs
102
126
  test_files:
103
- - spec/spec_helper.rb
104
- - spec/embiggen_spec.rb
105
127
  - spec/embiggen/configuration_spec.rb
106
128
  - spec/embiggen/shortener_list_spec.rb
107
129
  - spec/embiggen/uri_spec.rb
130
+ - spec/embiggen_spec.rb
131
+ - spec/spec_helper.rb