hyperclient 0.9.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.github/dependabot.yml +18 -0
  4. data/.github/workflows/coverage.yml +24 -0
  5. data/.github/workflows/danger.yml +22 -0
  6. data/.github/workflows/lint.yml +16 -0
  7. data/.github/workflows/test.yml +23 -0
  8. data/.rubocop.yml +8 -3
  9. data/.rubocop_todo.yml +32 -41
  10. data/CHANGELOG.md +18 -0
  11. data/CONTRIBUTING.md +1 -1
  12. data/Gemfile +4 -4
  13. data/README.md +16 -9
  14. data/RELEASING.md +1 -1
  15. data/Rakefile +0 -8
  16. data/features/api_navigation.feature +5 -0
  17. data/features/steps/api_navigation.rb +19 -6
  18. data/features/steps/default_config.rb +2 -2
  19. data/features/support/api.rb +22 -5
  20. data/features/support/env.rb +14 -1
  21. data/features/support/fixtures.rb +96 -2
  22. data/hyperclient.gemspec +4 -6
  23. data/lib/hyperclient/entry_point.rb +4 -5
  24. data/lib/hyperclient/link.rb +21 -0
  25. data/lib/hyperclient/resource.rb +1 -3
  26. data/lib/hyperclient/resource_collection.rb +1 -3
  27. data/lib/hyperclient/version.rb +1 -1
  28. data/test/hyperclient/attributes_test.rb +9 -9
  29. data/test/hyperclient/collection_test.rb +15 -15
  30. data/test/hyperclient/curie_test.rb +4 -4
  31. data/test/hyperclient/entry_point_test.rb +46 -56
  32. data/test/hyperclient/link_collection_test.rb +14 -14
  33. data/test/hyperclient/link_test.rb +43 -43
  34. data/test/hyperclient/resource_collection_test.rb +6 -6
  35. data/test/hyperclient/resource_test.rb +28 -27
  36. data/test/hyperclient_test.rb +10 -11
  37. data/test/test_helper.rb +26 -3
  38. metadata +21 -66
  39. data/.travis.yml +0 -25
  40. data/lib/faraday/connection.rb +0 -17
  41. data/test/faraday/connection_test.rb +0 -29
data/hyperclient.gemspec CHANGED
@@ -8,15 +8,13 @@ Gem::Specification.new do |gem|
8
8
  gem.homepage = 'https://github.com/codegram/hyperclient/'
9
9
  gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
10
10
  gem.files = `git ls-files`.split("\n")
11
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
12
11
  gem.name = 'hyperclient'
13
12
  gem.require_paths = ['lib']
14
13
  gem.version = Hyperclient::VERSION
15
14
 
16
15
  gem.add_dependency 'addressable'
17
- gem.add_dependency 'faraday', '>= 0.9.0'
18
- gem.add_dependency 'faraday-digestauth', '>= 0.3.0'
19
- gem.add_dependency 'faraday_hal_middleware'
20
- gem.add_dependency 'faraday_middleware'
21
- gem.add_dependency 'net-http-digest_auth'
16
+ gem.add_dependency 'faraday', '>= 2'
17
+ gem.add_dependency 'faraday-follow_redirects'
18
+ gem.add_dependency 'faraday_hal_middleware', '>= 0.2'
19
+ gem.metadata['rubygems_mfa_required'] = 'true'
22
20
  end
@@ -1,6 +1,5 @@
1
- require 'faraday_middleware'
1
+ require 'faraday/follow_redirects'
2
2
  require 'faraday_hal_middleware'
3
- require_relative '../faraday/connection'
4
3
 
5
4
  module Hyperclient
6
5
  # Public: Exception that is raised when trying to modify an
@@ -21,7 +20,7 @@ module Hyperclient
21
20
  #
22
21
  # client = Hyperclient::EntryPoint.new('http://my.api.org') do |entry_point|
23
22
  # entry_point.connection do |conn|
24
- # conn.use Faraday::Request::OAuth
23
+ # conn.use Faraday::Request::Instrumentation
25
24
  # end
26
25
  # entry_point.headers['Access-Token'] = 'token'
27
26
  # end
@@ -30,7 +29,7 @@ module Hyperclient
30
29
  extend Forwardable
31
30
 
32
31
  # Public: Delegates common methods to be used with the Faraday connection.
33
- def_delegators :connection, :basic_auth, :digest_auth, :token_auth, :params, :params=
32
+ def_delegators :connection, :params, :params=
34
33
 
35
34
  # Public: Initializes an EntryPoint.
36
35
  #
@@ -139,7 +138,7 @@ module Hyperclient
139
138
  def default_faraday_block
140
139
  lambda do |connection, &block|
141
140
  connection.use Faraday::Response::RaiseError
142
- connection.use FaradayMiddleware::FollowRedirects
141
+ connection.use Faraday::FollowRedirects::Middleware
143
142
  connection.request :hal_json
144
143
  connection.response :hal_json, content_type: /\bjson$/
145
144
 
@@ -4,6 +4,8 @@ module Hyperclient
4
4
  # Internal: The Link is used to let a Resource interact with the API.
5
5
  #
6
6
  class Link
7
+ include Enumerable
8
+
7
9
  # Public: Initializes a new Link.
8
10
  #
9
11
  # key - The key or name of the link.
@@ -19,6 +21,25 @@ module Hyperclient
19
21
  @resource = nil
20
22
  end
21
23
 
24
+ # Public: Each implementation to allow the class to use the Enumerable
25
+ # benefits for paginated, embedded items.
26
+ #
27
+ # Returns an Enumerator.
28
+ def each(&block)
29
+ if block_given?
30
+ current = self
31
+ while current
32
+ coll = current.respond_to?(@key) ? current.send(@key) : _resource
33
+ coll.each(&block)
34
+ break unless current._links[:next]
35
+
36
+ current = current._links.next
37
+ end
38
+ else
39
+ to_enum(:each)
40
+ end
41
+ end
42
+
22
43
  # Public: Indicates if the link is an URITemplate or a regular URI.
23
44
  #
24
45
  # Returns true if it is templated.
@@ -111,9 +111,7 @@ module Hyperclient
111
111
  elsif !Array.method_defined?(method)
112
112
  %i[_attributes _embedded _links].each do |target|
113
113
  target = send(target)
114
- if target.respond_to?(method.to_s)
115
- return target.send(method, *args, &block)
116
- end
114
+ return target.send(method, *args, &block) if target.respond_to?(method.to_s)
117
115
  end
118
116
  super
119
117
  end
@@ -23,9 +23,7 @@ module Hyperclient
23
23
  private
24
24
 
25
25
  def build_resource(representation)
26
- if representation.is_a?(Array)
27
- return representation.map(&method(:build_resource))
28
- end
26
+ return representation.map(&method(:build_resource)) if representation.is_a?(Array)
29
27
 
30
28
  Resource.new(representation, @entry_point)
31
29
  end
@@ -1,3 +1,3 @@
1
1
  module Hyperclient
2
- VERSION = '0.9.3'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -12,29 +12,29 @@ module Hyperclient
12
12
  end
13
13
 
14
14
  it 'does not set _links as an attribute' do
15
- attributes.wont_respond_to :_links
15
+ _(attributes).wont_respond_to :_links
16
16
  end
17
17
 
18
18
  it 'does not set _embedded as an attribute' do
19
- attributes.wont_respond_to :_embedded
19
+ _(attributes).wont_respond_to :_embedded
20
20
  end
21
21
 
22
22
  it 'sets normal attributes' do
23
- attributes.must_respond_to :permitted
24
- attributes.permitted.must_equal true
23
+ _(attributes).must_respond_to :permitted
24
+ _(attributes.permitted).must_equal true
25
25
 
26
- attributes.must_respond_to :title
27
- attributes.title.must_equal 'Real World ASP.NET MVC3'
26
+ _(attributes).must_respond_to :title
27
+ _(attributes.title).must_equal 'Real World ASP.NET MVC3'
28
28
  end
29
29
 
30
30
  # Underscores should be allowed per http://tools.ietf.org/html/draft-kelly-json-hal#appendix-B.4
31
31
  it 'sets _hidden_attribute as an attribute' do
32
- attributes.must_respond_to :_hidden_attribute
33
- attributes._hidden_attribute.must_equal 'useful value'
32
+ _(attributes).must_respond_to :_hidden_attribute
33
+ _(attributes._hidden_attribute).must_equal 'useful value'
34
34
  end
35
35
 
36
36
  it 'is a collection' do
37
- Attributes.ancestors.must_include Collection
37
+ _(Attributes.ancestors).must_include Collection
38
38
  end
39
39
  end
40
40
  end
@@ -12,19 +12,19 @@ module Hyperclient
12
12
  end
13
13
 
14
14
  it 'exposes the collection as methods' do
15
- collection.title.must_equal 'Real World ASP.NET MVC3'
16
- collection.description.must_match(/production/)
17
- collection.permitted.must_equal true
15
+ _(collection.title).must_equal 'Real World ASP.NET MVC3'
16
+ _(collection.description).must_match(/production/)
17
+ _(collection.permitted).must_equal true
18
18
  end
19
19
 
20
20
  it 'exposes collection as a hash' do
21
- collection['title'].must_equal 'Real World ASP.NET MVC3'
22
- collection['description'].must_match(/production/)
23
- collection['permitted'].must_equal true
21
+ _(collection['title']).must_equal 'Real World ASP.NET MVC3'
22
+ _(collection['description']).must_match(/production/)
23
+ _(collection['permitted']).must_equal true
24
24
  end
25
25
 
26
26
  it 'correctly responds to methods' do
27
- collection.must_respond_to :title
27
+ _(collection).must_respond_to :title
28
28
  end
29
29
 
30
30
  it 'acts as enumerable' do
@@ -32,41 +32,41 @@ module Hyperclient
32
32
  name
33
33
  end
34
34
 
35
- names.must_equal %w[_links title description permitted _hidden_attribute _embedded]
35
+ _(names).must_equal %w[_links title description permitted _hidden_attribute _embedded]
36
36
  end
37
37
 
38
38
  describe '#to_hash' do
39
39
  it 'returns the wrapped collection as a hash' do
40
- collection.to_hash.must_be_kind_of Hash
40
+ _(collection.to_hash).must_be_kind_of Hash
41
41
  end
42
42
  end
43
43
 
44
44
  describe 'include?' do
45
45
  it 'returns true for keys that exist' do
46
- collection.include?('_links').must_equal true
46
+ _(collection.include?('_links')).must_equal true
47
47
  end
48
48
 
49
49
  it 'returns false for missing keys' do
50
- collection.include?('missing key').must_equal false
50
+ _(collection.include?('missing key')).must_equal false
51
51
  end
52
52
  end
53
53
 
54
54
  describe '#fetch' do
55
55
  it 'returns the value for keys that exist' do
56
- collection.fetch('title').must_equal 'Real World ASP.NET MVC3'
56
+ _(collection.fetch('title')).must_equal 'Real World ASP.NET MVC3'
57
57
  end
58
58
 
59
59
  it 'raises an error for missing keys' do
60
- proc { collection.fetch('missing key') }.must_raise KeyError
60
+ _(proc { collection.fetch('missing key') }).must_raise KeyError
61
61
  end
62
62
 
63
63
  describe 'with a default value' do
64
64
  it 'returns the value for keys that exist' do
65
- collection.fetch('title', 'default').must_equal 'Real World ASP.NET MVC3'
65
+ _(collection.fetch('title', 'default')).must_equal 'Real World ASP.NET MVC3'
66
66
  end
67
67
 
68
68
  it 'returns the default value for missing keys' do
69
- collection.fetch('missing key', 'default').must_equal 'default'
69
+ _(collection.fetch('missing key', 'default')).must_equal 'default'
70
70
  end
71
71
  end
72
72
  end
@@ -11,13 +11,13 @@ module Hyperclient
11
11
  it 'returns true if the curie is templated' do
12
12
  curie = Curie.new({ 'name' => 'image', 'templated' => true }, entry_point)
13
13
 
14
- curie.templated?.must_equal true
14
+ _(curie.templated?).must_equal true
15
15
  end
16
16
 
17
17
  it 'returns false if the curie is not templated' do
18
18
  curie = Curie.new({ 'name' => 'image' }, entry_point)
19
19
 
20
- curie.templated?.must_equal false
20
+ _(curie.templated?).must_equal false
21
21
  end
22
22
  end
23
23
 
@@ -26,12 +26,12 @@ module Hyperclient
26
26
  end
27
27
  describe '_name' do
28
28
  it 'returns curie name' do
29
- curie.name.must_equal 'image'
29
+ _(curie.name).must_equal 'image'
30
30
  end
31
31
  end
32
32
  describe 'expand' do
33
33
  it 'expands link' do
34
- curie.expand('thumbnail').must_equal '/images/thumbnail'
34
+ _(curie.expand('thumbnail')).must_equal '/images/thumbnail'
35
35
  end
36
36
  end
37
37
  end
@@ -10,60 +10,52 @@ module Hyperclient
10
10
 
11
11
  describe 'connection' do
12
12
  it 'creates a Faraday connection with the entry point url' do
13
- entry_point.connection.url_prefix.to_s.must_equal 'http://my.api.org/'
13
+ _(entry_point.connection.url_prefix.to_s).must_equal 'http://my.api.org/'
14
14
  end
15
15
 
16
16
  it 'creates a Faraday connection with the default headers' do
17
- entry_point.headers['Content-Type'].must_equal 'application/hal+json'
18
- entry_point.headers['Accept'].must_equal 'application/hal+json,application/json'
17
+ _(entry_point.headers['Content-Type']).must_equal 'application/hal+json'
18
+ _(entry_point.headers['Accept']).must_equal 'application/hal+json,application/json'
19
19
  end
20
20
 
21
21
  it 'can update headers after a connection has been constructed' do
22
- entry_point.connection.must_be_kind_of Faraday::Connection
22
+ _(entry_point.connection).must_be_kind_of Faraday::Connection
23
23
  entry_point.headers.update('Content-Type' => 'application/foobar')
24
- entry_point.headers['Content-Type'].must_equal 'application/foobar'
24
+ _(entry_point.headers['Content-Type']).must_equal 'application/foobar'
25
25
  end
26
26
 
27
27
  it 'can insert additional middleware after a connection has been constructed' do
28
- entry_point.connection.must_be_kind_of Faraday::Connection
29
-
30
- warning = 'WARNING: Unexpected middleware set after the adapter. ' \
31
- "This won't be supported from Faraday 1.0.\n"
32
-
33
- assert_output nil, warning do
34
- entry_point.connection.use :instrumentation
35
- end
36
-
28
+ _(entry_point.connection).must_be_kind_of Faraday::Connection
29
+ entry_point.connection.use Faraday::Request::Instrumentation
37
30
  handlers = entry_point.connection.builder.handlers
38
- handlers.must_include FaradayMiddleware::Instrumentation
31
+ _(handlers).must_include Faraday::Request::Instrumentation
39
32
  end
40
33
 
41
34
  it 'creates a Faraday connection with the default block' do
42
35
  handlers = entry_point.connection.builder.handlers
43
36
 
44
- handlers.must_include Faraday::Response::RaiseError
45
- handlers.must_include FaradayMiddleware::FollowRedirects
46
- handlers.must_include FaradayMiddleware::EncodeHalJson
47
- handlers.must_include FaradayMiddleware::ParseHalJson
48
- handlers.must_include Faraday::Adapter::NetHttp
37
+ _(handlers).must_include Faraday::Response::RaiseError
38
+ _(handlers).must_include Faraday::FollowRedirects::Middleware
39
+ _(handlers).must_include Faraday::HalJson::Request
40
+ _(handlers).must_include Faraday::HalJson::Response
49
41
 
50
- entry_point.connection.options.params_encoder.must_equal Faraday::FlatParamsEncoder
42
+ _(entry_point.connection.options.params_encoder).must_equal Faraday::FlatParamsEncoder
51
43
  end
52
44
 
53
45
  it 'raises a ConnectionAlreadyInitializedError if attempting to modify headers' do
54
- entry_point.connection.must_be_kind_of Faraday::Connection
55
- -> { entry_point.headers = {} }.must_raise ConnectionAlreadyInitializedError
46
+ _(entry_point.connection).must_be_kind_of Faraday::Connection
47
+ _(-> { entry_point.headers = {} }).must_raise ConnectionAlreadyInitializedError
56
48
  end
57
49
 
58
50
  it 'raises a ConnectionAlreadyInitializedError if attempting to modify the faraday block' do
59
- entry_point.connection.must_be_kind_of Faraday::Connection
60
- -> { entry_point.connection {} }.must_raise ConnectionAlreadyInitializedError
51
+ _(entry_point.connection).must_be_kind_of Faraday::Connection
52
+ _(-> { entry_point.connection {} }).must_raise ConnectionAlreadyInitializedError
61
53
  end
62
54
  end
63
55
 
64
56
  describe 'initialize' do
65
57
  it 'sets a Link with the entry point url' do
66
- entry_point._url.must_equal 'http://my.api.org'
58
+ _(entry_point._url).must_equal 'http://my.api.org'
67
59
  end
68
60
  end
69
61
  end
@@ -77,17 +69,17 @@ module Hyperclient
77
69
 
78
70
  describe 'connection' do
79
71
  it 'creates a Faraday connection with the entry point url' do
80
- entry_point.connection.url_prefix.to_s.must_equal 'http://my.api.org/'
72
+ _(entry_point.connection.url_prefix.to_s).must_equal 'http://my.api.org/'
81
73
  end
82
74
 
83
75
  it 'creates a Faraday connection with the default headers' do
84
- entry_point.headers['Content-Type'].must_equal 'application/hal+json'
85
- entry_point.headers['Accept'].must_equal 'application/hal+json,application/json'
76
+ _(entry_point.headers['Content-Type']).must_equal 'application/hal+json'
77
+ _(entry_point.headers['Accept']).must_equal 'application/hal+json,application/json'
86
78
  end
87
79
 
88
80
  it 'creates a Faraday connection with options' do
89
- entry_point.connection.proxy.must_be_kind_of Faraday::ProxyOptions
90
- entry_point.connection.proxy.uri.to_s.must_equal 'http://my.proxy:8080'
81
+ _(entry_point.connection.proxy).must_be_kind_of Faraday::ProxyOptions
82
+ _(entry_point.connection.proxy.uri.to_s).must_equal 'http://my.proxy:8080'
91
83
  end
92
84
  end
93
85
  end
@@ -101,17 +93,17 @@ module Hyperclient
101
93
 
102
94
  describe 'connection' do
103
95
  it 'creates a Faraday connection with the entry point url' do
104
- entry_point.connection.url_prefix.to_s.must_equal 'http://my.api.org/'
96
+ _(entry_point.connection.url_prefix.to_s).must_equal 'http://my.api.org/'
105
97
  end
106
98
 
107
99
  it 'creates a Faraday connection with the default headers' do
108
- entry_point.headers['Content-Type'].must_equal 'application/hal+json'
109
- entry_point.headers['Accept'].must_equal 'application/hal+json,application/json'
100
+ _(entry_point.headers['Content-Type']).must_equal 'application/hal+json'
101
+ _(entry_point.headers['Accept']).must_equal 'application/hal+json,application/json'
110
102
  end
111
103
 
112
104
  it 'creates a Faraday connection with options' do
113
- entry_point.connection.proxy.must_be_kind_of Faraday::ProxyOptions
114
- entry_point.connection.proxy.uri.to_s.must_equal 'http://my.proxy:8080'
105
+ _(entry_point.connection.proxy).must_be_kind_of Faraday::ProxyOptions
106
+ _(entry_point.connection.proxy.uri.to_s).must_equal 'http://my.proxy:8080'
115
107
  end
116
108
  end
117
109
  end
@@ -134,21 +126,20 @@ module Hyperclient
134
126
 
135
127
  describe 'connection' do
136
128
  it 'creates a Faraday connection with the entry point url' do
137
- entry_point.connection.url_prefix.to_s.must_equal 'http://my.api.org/'
129
+ _(entry_point.connection.url_prefix.to_s).must_equal 'http://my.api.org/'
138
130
  end
139
131
 
140
132
  it 'creates a Faraday connection with non-default headers' do
141
- entry_point.headers['Content-Type'].must_equal 'application/foobar'
142
- entry_point.headers['Accept'].must_equal 'application/foobar'
133
+ _(entry_point.headers['Content-Type']).must_equal 'application/foobar'
134
+ _(entry_point.headers['Accept']).must_equal 'application/foobar'
143
135
  end
144
136
 
145
137
  it 'creates a Faraday connection with the default block' do
146
138
  handlers = entry_point.connection.builder.handlers
147
- handlers.wont_include Faraday::Response::RaiseError
148
- handlers.wont_include FaradayMiddleware::FollowRedirects
149
- handlers.must_include FaradayMiddleware::EncodeJson
150
- handlers.must_include FaradayMiddleware::ParseJson
151
- handlers.must_include Faraday::Adapter::NetHttp
139
+ _(handlers).wont_include Faraday::Response::RaiseError
140
+ _(handlers).wont_include Faraday::FollowRedirects
141
+ _(handlers).must_include Faraday::Request::Json
142
+ _(handlers).must_include Faraday::Response::Json
152
143
  end
153
144
  end
154
145
  end
@@ -157,7 +148,7 @@ module Hyperclient
157
148
  let(:entry_point) do
158
149
  EntryPoint.new 'http://my.api.org' do |entry_point|
159
150
  entry_point.connection do |conn|
160
- conn.use Faraday::Request::OAuth
151
+ conn.use Faraday::Request::Instrumentation
161
152
  end
162
153
  entry_point.headers['Access-Token'] = 'token'
163
154
  end
@@ -165,26 +156,25 @@ module Hyperclient
165
156
 
166
157
  describe 'connection' do
167
158
  it 'creates a Faraday connection with the default and additional headers' do
168
- entry_point.headers['Content-Type'].must_equal 'application/hal+json'
169
- entry_point.headers['Accept'].must_equal 'application/hal+json,application/json'
170
- entry_point.headers['Access-Token'].must_equal 'token'
159
+ _(entry_point.headers['Content-Type']).must_equal 'application/hal+json'
160
+ _(entry_point.headers['Accept']).must_equal 'application/hal+json,application/json'
161
+ _(entry_point.headers['Access-Token']).must_equal 'token'
171
162
  end
172
163
 
173
164
  it 'creates a Faraday connection with the entry point url' do
174
- entry_point.connection.url_prefix.to_s.must_equal 'http://my.api.org/'
165
+ _(entry_point.connection.url_prefix.to_s).must_equal 'http://my.api.org/'
175
166
  end
176
167
 
177
168
  it 'creates a Faraday connection with the default block plus any additional handlers' do
178
169
  handlers = entry_point.connection.builder.handlers
179
170
 
180
- handlers.must_include Faraday::Request::OAuth
181
- handlers.must_include Faraday::Response::RaiseError
182
- handlers.must_include FaradayMiddleware::FollowRedirects
183
- handlers.must_include FaradayMiddleware::EncodeHalJson
184
- handlers.must_include FaradayMiddleware::ParseHalJson
185
- handlers.must_include Faraday::Adapter::NetHttp
171
+ _(handlers).must_include Faraday::Request::Instrumentation
172
+ _(handlers).must_include Faraday::Response::RaiseError
173
+ _(handlers).must_include Faraday::FollowRedirects::Middleware
174
+ _(handlers).must_include Faraday::HalJson::Request
175
+ _(handlers).must_include Faraday::HalJson::Response
186
176
 
187
- entry_point.connection.options.params_encoder.must_equal Faraday::FlatParamsEncoder
177
+ _(entry_point.connection.options.params_encoder).must_equal Faraday::FlatParamsEncoder
188
178
  end
189
179
  end
190
180
  end
@@ -14,33 +14,33 @@ module Hyperclient
14
14
  end
15
15
 
16
16
  it 'is a collection' do
17
- LinkCollection.ancestors.must_include Collection
17
+ _(LinkCollection.ancestors).must_include Collection
18
18
  end
19
19
 
20
20
  it 'initializes the collection with links' do
21
- links.must_respond_to :search
22
- links.must_respond_to :gizmos
21
+ _(links).must_respond_to :search
22
+ _(links).must_respond_to :gizmos
23
23
  end
24
24
 
25
25
  it 'returns link objects for each link' do
26
- links.search.must_be_kind_of Link
27
- links['self'].must_be_kind_of Link
26
+ _(links.search).must_be_kind_of Link
27
+ _(links['self']).must_be_kind_of Link
28
28
 
29
- links.gizmos.must_be_kind_of Array
30
- links['gizmos'].must_be_kind_of Array
29
+ _(links.gizmos).must_be_kind_of Array
30
+ _(links['gizmos']).must_be_kind_of Array
31
31
  end
32
32
 
33
33
  describe 'plain link' do
34
34
  let(:plain_link) { links.self }
35
35
  it 'must be correct' do
36
- plain_link._url.must_equal '/productions/1'
36
+ _(plain_link._url).must_equal '/productions/1'
37
37
  end
38
38
  end
39
39
 
40
40
  describe 'templated link' do
41
41
  let(:templated_link) { links.search }
42
42
  it 'must expand' do
43
- templated_link._expand(search: 'gizmos')._url.must_equal '/productions/1?categories=gizmos'
43
+ _(templated_link._expand(search: 'gizmos')._url).must_equal '/productions/1?categories=gizmos'
44
44
  end
45
45
  end
46
46
 
@@ -48,10 +48,10 @@ module Hyperclient
48
48
  let(:curied_link) { links['image:thumbnail'] }
49
49
  let(:curie) { links._curies['image'] }
50
50
  it 'must expand' do
51
- curied_link._expand(version: 'small')._url.must_equal '/images/thumbnails/small.jpg'
51
+ _(curied_link._expand(version: 'small')._url).must_equal '/images/thumbnails/small.jpg'
52
52
  end
53
53
  it 'exposes curie' do
54
- curie.expand('thumbnail').must_equal '/docs/images/thumbnail'
54
+ _(curie.expand('thumbnail')).must_equal '/docs/images/thumbnail'
55
55
  end
56
56
  end
57
57
 
@@ -59,12 +59,12 @@ module Hyperclient
59
59
  let(:gizmos) { links.gizmos }
60
60
 
61
61
  it 'should have 2 items' do
62
- gizmos.length.must_equal 2
62
+ _(gizmos.length).must_equal 2
63
63
  end
64
64
 
65
65
  it 'must be an array of Links' do
66
66
  gizmos.each do |link|
67
- link.must_be_kind_of Link
67
+ _(link).must_be_kind_of Link
68
68
  end
69
69
  end
70
70
  end
@@ -72,7 +72,7 @@ module Hyperclient
72
72
  describe 'null link value' do
73
73
  let(:null_link) { links.null_link }
74
74
  it 'must be nil' do
75
- null_link.must_be_nil
75
+ _(null_link).must_be_nil
76
76
  end
77
77
  end
78
78
  end