gh 0.12.2 → 0.12.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 17c62259f2ff6776d135b5079091dee7976a24e5
4
- data.tar.gz: 7cd1b53054db693b769fa6e82efd4503125a8ea1
3
+ metadata.gz: 6111e2fa8dbc01a5d52b267e44617e5096a152c7
4
+ data.tar.gz: fbd8a0a0658ba302b5901e35d37f07c20463b6fd
5
5
  SHA512:
6
- metadata.gz: c051a03e105602daee90fef644b4e9a88a9ba71f5482676670615530c553b4f4706da8fbe89975d07fa8b3219d1aeb21772089e69c5ea5d056781847e6361d06
7
- data.tar.gz: 27d56e64807726a167d68985709d4b880b9a9adfe44b608f1e9ec33b1dc55f6f41b71d9881565d83b679c4e2a98f344a1ea26718b816706c96f9d8704c345149
6
+ metadata.gz: bcc5eb0e275f4e0c268459167d400edb9959f7a5163eeacbd937f381979b7d3ca3672d96ebb70fd5ea7fb9cb2b5ca3e73e4643bb07f86df8704e6824734ebde1
7
+ data.tar.gz: 3d1088dfd9ce6c426f6821f50edfd847f8b21bb5d8a71f82e7d17a42744107950889c1436f75944e4bec460e90bc87df467adb38e453e6b769d3a403a1892429
@@ -79,7 +79,7 @@ module GH
79
79
  when "blog"
80
80
  set_link(hash, key, value)
81
81
  when "url"
82
- type = Addressable::URI.parse(value).host == api_host.host ? "self" : "html"
82
+ type = value.to_s.start_with?(api_host.to_s) ? "self" : "html"
83
83
  set_link(hash, type, value)
84
84
  when /^(.+)_url$/
85
85
  set_link(hash, $1, value)
@@ -1,4 +1,4 @@
1
1
  module GH
2
2
  # Public: Library version.
3
- VERSION = "0.12.2"
3
+ VERSION = "0.12.3"
4
4
  end
@@ -4,16 +4,16 @@ describe GH::Normalizer do
4
4
  before { subject.backend = GH::MockBackend.new }
5
5
 
6
6
  def normalize(payload)
7
- data['/payload'] = payload
7
+ data[subject.path_for('/payload')] = payload
8
8
  end
9
9
 
10
10
  def with_headers(headers = {})
11
11
  response = GH::Response.new("{}", headers)
12
- data['/payload'], response.data = response, data['/payload']
12
+ data[subject.path_for('/payload')], response.data = response, data[subject.path_for('/payload')]
13
13
  end
14
14
 
15
15
  def normalized
16
- subject['/payload']
16
+ subject[subject.path_for('/payload')]
17
17
  end
18
18
 
19
19
  it 'is set up properly' do
@@ -285,17 +285,35 @@ describe GH::Normalizer do
285
285
  end
286
286
 
287
287
  it 'detects self urls in url field' do
288
- normalize 'url' => 'http://api.github.com/foo'
288
+ normalize 'url' => 'https://api.github.com/foo'
289
289
  normalized.should_not include('url')
290
290
  normalized.should include('_links')
291
291
  normalized['_links'].should include('self')
292
292
  normalized['_links'].should_not include('html')
293
- normalized['_links']['self']['href'].should be == 'http://api.github.com/foo'
293
+ normalized['_links']['self']['href'].should be == 'https://api.github.com/foo'
294
294
  end
295
295
 
296
296
  it 'passes through true' do
297
297
  normalize 'foo' => true
298
298
  normalized['foo'].should be == true
299
299
  end
300
+
301
+ it 'properly detects html links when api is served from same host' do
302
+ subject.backend.setup("http://localhost/api/v3", {})
303
+ normalize 'url' => 'http://localhost/foo'
304
+ normalized.should_not include('url')
305
+ normalized.should include('_links')
306
+ normalized['_links'].should include('html')
307
+ normalized['_links']['html']['href'].should be == 'http://localhost/foo'
308
+ end
309
+
310
+ it 'properly detects self links when api is served from same host' do
311
+ subject.backend.setup("http://localhost/api/v3", {})
312
+ normalize 'url' => 'http://localhost/api/v3/foo'
313
+ normalized.should_not include('url')
314
+ normalized.should include('_links')
315
+ normalized['_links'].should include('self')
316
+ normalized['_links']['self']['href'].should be == 'http://localhost/api/v3/foo'
317
+ end
300
318
  end
301
319
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.2
4
+ version: 0.12.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase