grape-entity 0.8.1 → 0.8.2

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
  SHA256:
3
- metadata.gz: fb3365afa36454c797c3d44adfa51ecc757a105fe6cb6644f3f3896ff06af48d
4
- data.tar.gz: 1e3c91d73fb17727c931443910b2f602e037384eb4f04e055207bbaf471c3962
3
+ metadata.gz: aa38cbc30d489d88e91c10c688c581251392a448330eca12ff79ebe22958bd9c
4
+ data.tar.gz: a96f1d0ada161d659f71aaca4e44588afc2727f4966e3f46058189483d46aa0c
5
5
  SHA512:
6
- metadata.gz: ba4bd4207a7c5f5f09806017b29723ba0f3ed0fc749cd360d55ebba9a41465165f91a7ae974d6af4baed71109c2ad5b7f19514a6f510953fe3733b46d35f405e
7
- data.tar.gz: 4ac4db65df766dd004c35e926a6a43e08023d86b4477d6e396b8c9ce9b125ee889bbbe86fecf7f6f4a60f847c2ae5d38beb829ce017957737de7a52f0ab802d3
6
+ metadata.gz: 12f8a447cf4f297bb4c07375d08efa41e5d1691a907ccbfdc7cef8c2f394cfc03a041318f76ab2475089b5d1b7438414cd00dca6305105bf616b3c2465b1c000
7
+ data.tar.gz: 0a7c13fec63e43adb8269d0639c1e4abfef77cba02a3a7b234716588e968116e1875e94bab08f68cdec60e656b65f159d42f308342eeac6f42846a6f5aec9b27
@@ -5,6 +5,8 @@ AllCops:
5
5
  - vendor/**/*
6
6
  - example/**/*
7
7
  TargetRubyVersion: 2.7
8
+ UseCache: true
9
+ NewCops: enable
8
10
 
9
11
  # Layout stuff
10
12
  #
@@ -27,25 +29,18 @@ Layout/SpaceAroundMethodCallOperator:
27
29
 
28
30
  # Lint stuff
29
31
  #
30
- Lint/DeprecatedOpenSSLConstant:
31
- Enabled: true
32
-
33
- Lint/DuplicateElsifCondition:
34
- Enabled: true
35
-
36
- Lint/MixedRegexpCaptureTypes:
37
- Enabled: true
38
-
39
- Lint/RaiseException:
40
- Enabled: true
41
-
42
- Lint/StructNewOverride:
32
+ Lint/ConstantDefinitionInBlock:
43
33
  Enabled: true
34
+ Exclude:
35
+ - spec/**/*
44
36
 
45
37
  # Metrics stuff
46
38
  #
47
39
  Metrics/AbcSize:
48
40
  Max: 25
41
+ IgnoredMethods:
42
+ # from lib/grape_entity/exposure/nesting_exposure.rb
43
+ - 'normalized_exposures'
49
44
 
50
45
  Metrics/BlockLength:
51
46
  Exclude:
@@ -64,6 +59,12 @@ Metrics/MethodLength:
64
59
 
65
60
  Metrics/PerceivedComplexity:
66
61
  Max: 11
62
+ IgnoredMethods:
63
+ # from lib/grape_entity/entity.rb
64
+ - 'expose'
65
+ - 'merge_options'
66
+ # from lib/grape_entity/exposure/nesting_exposure.rb
67
+ - 'normalized_exposures'
67
68
 
68
69
  # Naming stuff
69
70
  #
@@ -73,56 +74,13 @@ Naming:
73
74
 
74
75
  # Style stuff
75
76
  #
76
- Style/AccessorGrouping:
77
- Enabled: true
78
-
79
- Style/ArrayCoercion:
80
- Enabled: true
81
-
82
- Style/BisectedAttrAccessor:
83
- Enabled: true
84
-
85
- Style/CaseLikeIf:
86
- Enabled: true
87
-
88
77
  Style/Documentation:
89
78
  Enabled: false
90
79
 
91
- Style/ExponentialNotation:
92
- Enabled: true
93
-
94
- Style/HashAsLastArrayItem:
95
- Enabled: true
96
-
97
- Style/HashEachMethods:
98
- Enabled: true
99
-
100
- Style/HashLikeCase:
101
- Enabled: true
102
-
103
- Style/HashTransformKeys:
104
- Enabled: true
105
-
106
- Style/HashTransformValues:
107
- Enabled: true
108
-
109
- Style/RedundantAssignment:
110
- Enabled: true
111
-
112
- Style/RedundantFetchBlock:
113
- Enabled: true
114
-
115
- Style/RedundantFileExtensionInRequire:
116
- Enabled: true
117
-
118
- Style/RedundantRegexpCharacterClass:
119
- Enabled: true
120
-
121
- Style/RedundantRegexpEscape:
122
- Enabled: true
123
-
124
- Style/RegexpLiteral:
125
- Enabled: false
126
-
127
- Style/SlicingWithRange:
128
- Enabled: true
80
+ Style/OptionalBooleanParameter:
81
+ AllowedMethods:
82
+ # from lib/grape_entity/condition/base.rb
83
+ - 'initialize'
84
+ # form lib/grape_entity/entity.rb
85
+ - 'entity_class'
86
+ - 'present_collection'
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-02-18 16:38:42 +0100 using RuboCop version 0.79.0.
3
+ # on 2020-11-07 00:01:40 UTC using RuboCop version 1.2.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -14,17 +14,11 @@ Gemspec/RequiredRubyVersion:
14
14
  - 'grape-entity.gemspec'
15
15
 
16
16
  # Offense count: 6
17
+ # Cop supports --auto-correct.
17
18
  Lint/BooleanSymbol:
18
19
  Exclude:
19
20
  - 'spec/grape_entity/exposure_spec.rb'
20
21
 
21
- # Offense count: 1
22
- # Configuration parameters: EnforcedStyle.
23
- # SupportedStyles: inline, group
24
- Style/AccessModifierDeclarations:
25
- Exclude:
26
- - 'spec/grape_entity/entity_spec.rb'
27
-
28
22
  # Offense count: 1
29
23
  # Cop supports --auto-correct.
30
24
  # Configuration parameters: IgnoredMethods.
@@ -9,17 +9,18 @@ after_success:
9
9
  rvm:
10
10
  - 2.5.8
11
11
  - 2.6.6
12
- - 2.7.1
12
+ - 2.7.2
13
13
  - ruby-head
14
14
  - jruby-head
15
+ - truffleruby-head
16
+ - 2.4.10
17
+
15
18
 
16
19
  matrix:
17
20
  fast_finish: true
18
21
 
19
- include:
20
- - rvm: 2.4.10
21
-
22
22
  allow_failures:
23
23
  - rvm: 2.4.10
24
24
  - rvm: ruby-head
25
25
  - rvm: jruby-head
26
+ - rvm: truffleruby-head
@@ -8,6 +8,15 @@
8
8
 
9
9
  * Your contribution here.
10
10
 
11
+
12
+ ### 0.8.2 (2020-11-08)
13
+
14
+ #### Fixes
15
+
16
+ * [#340](https://github.com/ruby-grape/grape-entity/pull/340): Preparations for 3.0 - [@LeFnord](https://github.com/LeFnord).
17
+ * [#338](https://github.com/ruby-grape/grape-entity/pull/338): Fix ruby 2.7 deprecation warning - [@begotten63](https://github.com/begotten63).
18
+
19
+
11
20
  ### 0.8.1 (2020-07-15)
12
21
 
13
22
  #### Fixes
@@ -15,6 +24,7 @@
15
24
  * [#336](https://github.com/ruby-grape/grape-entity/pull/336): Pass options to delegators when they accept it - [@dnesteryuk](https://github.com/dnesteryuk).
16
25
  * [#333](https://github.com/ruby-grape/grape-entity/pull/333): Fix typo in CHANGELOG.md - [@eitoball](https://github.com/eitoball).
17
26
 
27
+
18
28
  ### 0.8.0 (2020-02-18)
19
29
 
20
30
  #### Features
@@ -30,12 +40,14 @@
30
40
  * [#320](https://github.com/ruby-grape/grape-entity/pull/320): Gemspec: drop eol'd property rubyforge_project - [@olleolleolle](https://github.com/olleolleolle).
31
41
  * [#307](https://github.com/ruby-grape/grape-entity/pull/307): Allow exposures to call methods defined in modules included in an entity - [@robertoz-01](https://github.com/robertoz-01).
32
42
 
43
+
33
44
  ### 0.7.1 (2018-01-30)
34
45
 
35
46
  #### Features
36
47
 
37
48
  * [#297](https://github.com/ruby-grape/grape-entity/pull/297): Introduce `override` option for expose (fixes [#286](https://github.com/ruby-grape/grape-entity/issues/296)) - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
38
49
 
50
+
39
51
  ### 0.7.0 (2018-01-25)
40
52
 
41
53
  #### Features
@@ -54,6 +66,7 @@
54
66
  * [#291](https://github.com/ruby-grape/grape-entity/pull/291): Refactor and simplify various classes and modules - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
55
67
  * [#292](https://github.com/ruby-grape/grape-entity/pull/292): Allow replace non-conditional non-nesting exposures in child classes (fixes [#286](https://github.com/ruby-grape/grape-entity/issues/286)) - [@DmitryTsepelev](https://github.com/DmitryTsepelev).
56
68
 
69
+
57
70
  ### 0.6.1 (2017-01-09)
58
71
 
59
72
  #### Features
@@ -64,6 +77,7 @@
64
77
 
65
78
  * [#251](https://github.com/ruby-grape/grape-entity/pull/251): Avoid noise when code runs with Ruby warnings - [@cpetschnig](https://github.com/cpetschnig).
66
79
 
80
+
67
81
  ### 0.6.0 (2016-11-20)
68
82
 
69
83
  #### Features
@@ -75,6 +89,7 @@
75
89
  * [#249](https://github.com/ruby-grape/grape-entity/issues/249): Fix leaking of options and internals in default serialization - [@dblock](https://github.com/dblock), [@KingsleyKelly](https://github.com/KingsleyKelly).
76
90
  * [#248](https://github.com/ruby-grape/grape-entity/pull/248): Fix `nil` values causing errors when `merge` option passed - [@arempe93](https://github.com/arempe93).
77
91
 
92
+
78
93
  ### 0.5.2 (2016-11-14)
79
94
 
80
95
  #### Features
@@ -90,6 +105,7 @@
90
105
  * [#219](https://github.com/ruby-grape/grape-entity/pull/219): Double pass options in `serializable_hash` - [@sbatykov](https://github.com/sbatykov).
91
106
  * [#231](https://github.com/ruby-grape/grape-entity/pull/231), [#215](https://github.com/ruby-grape/grape-entity/issues/215): Allow `delegate_attribute` for derived entity - [@sbatykov](https://github.com/sbatykov).
92
107
 
108
+
93
109
  ### 0.5.1 (2016-4-4)
94
110
 
95
111
  #### Features
@@ -101,6 +117,7 @@
101
117
 
102
118
  * [#202](https://github.com/ruby-grape/grape-entity/pull/202): Reset `@using_class` memoization on `.setup` - [@rngtng](https://github.com/rngtng).
103
119
 
120
+
104
121
  ### 0.5.0 (2015-12-07)
105
122
 
106
123
  #### Features
@@ -121,18 +138,21 @@
121
138
  * [#151](https://github.com/ruby-grape/grape-entity/pull/151): Serializing of deeply nested presenter exposures: [#155](https://github.com/ruby-grape/grape-entity/issues/155) - [@marshall-lee](https://github.com/marshall-lee).
122
139
  * [#151](https://github.com/ruby-grape/grape-entity/pull/151): Deep projections (`:only`, `:except`) were unaware of nesting: [#156](https://github.com/ruby-grape/grape-entity/issues/156) - [@marshall-lee](https://github.com/marshall-lee).
123
140
 
141
+
124
142
  ### 0.4.8 (2015-08-10)
125
143
 
126
144
  #### Features
127
145
 
128
146
  * [#167](https://github.com/ruby-grape/grape-entity/pull/167), [#166](https://github.com/ruby-grape/grape-entity/issues/166): Regression with global settings (exposures, formatters) on `Grape::Entity` - [@marshall-lee](https://github.com/marshall-lee).
129
147
 
148
+
130
149
  ### 0.4.7 (2015-08-03)
131
150
 
132
151
  #### Features
133
152
 
134
153
  * [#164](https://github.com/ruby-grape/grape-entity/pull/164): Regression: entity instance methods were exposed with `NoMethodError`: [#163](https://github.com/ruby-grape/grape-entity/issues/163) - [@marshall-lee](https://github.com/marshall-lee).
135
154
 
155
+
136
156
  ### 0.4.6 (2015-07-27)
137
157
 
138
158
  #### Features
@@ -151,6 +171,7 @@
151
171
 
152
172
  * [#147](https://github.com/ruby-grape/grape-entity/pull/147), [#142](https://github.com/ruby-grape/grape-entity/pull/142): Private method values were not exposed with `safe` option - [@marshall-lee](https://github.com/marshall-lee).
153
173
 
174
+
154
175
  ### 0.4.5 (2015-03-10)
155
176
 
156
177
  #### Features
@@ -165,6 +186,7 @@
165
186
  * [#110](https://github.com/ruby-grape/grape-entity/pull/110): Safe exposure when using `Hash` models - [@croeck](https://github.com/croeck).
166
187
  * [#91](https://github.com/ruby-grape/grape-entity/pull/91): OpenStruct serializing - [@etehtsea](https://github.com/etehtsea).
167
188
 
189
+
168
190
  ### 0.4.4 (2014-08-17)
169
191
 
170
192
  #### Features
@@ -172,6 +194,7 @@
172
194
  * [#85](https://github.com/ruby-grape/grape-entity/pull/85): Added `present_collection` to indicate that an `Entity` presents an entire Collection - [@dspaeth-faber](https://github.com/dspaeth-faber).
173
195
  * [#85](https://github.com/ruby-grape/grape-entity/pull/85): Hashes can now be passed as object to be presented and the `Hash` keys can be referenced by expose - [@dspaeth-faber](https://github.com/dspaeth-faber).
174
196
 
197
+
175
198
  ### 0.4.3 (2014-06-12)
176
199
 
177
200
  #### Features
@@ -182,6 +205,7 @@
182
205
 
183
206
  * [#77](https://github.com/ruby-grape/grape-entity/pull/77): Compatibility with Rspec 3 - [@justfalter](https://github.com/justfalter).
184
207
 
208
+
185
209
  ### 0.4.2 (2014-04-03)
186
210
 
187
211
  #### Features
@@ -189,12 +213,14 @@
189
213
  * [#60](https://github.com/ruby-grape/grape-entity/issues/59): Performance issues introduced by nested exposures - [@AlexYankee](https://github.com/AlexYankee).
190
214
  * [#60](https://github.com/ruby-grape/grape-entity/issues/57): Nested exposure double-exposes a field - [@AlexYankee](https://github.com/AlexYankee).
191
215
 
216
+
192
217
  ### 0.4.1 (2014-02-13)
193
218
 
194
219
  #### Fixes
195
220
 
196
221
  * [#54](https://github.com/ruby-grape/grape-entity/issues/54): Fix: undefined method `to_set` - [@aj0strow](https://github.com/aj0strow).
197
222
 
223
+
198
224
  ### 0.4.0 (2014-01-27)
199
225
 
200
226
  #### Features
@@ -214,6 +240,7 @@
214
240
  * [#51](https://github.com/ruby-grape/grape-entity/pull/51): Raise `ArgumentError` if an unknown option is used with `expose` - [@aj0strow](https://github.com/aj0strow).
215
241
  * [#51](https://github.com/ruby-grape/grape-entity/pull/51): Alias `:with` to `:using`, consistently with the Grape api endpoints - [@aj0strow](https://github.com/aj0strow).
216
242
 
243
+
217
244
  ### 0.3.0 (2013-03-29)
218
245
 
219
246
  #### Features
@@ -222,12 +249,14 @@
222
249
  * The `instance.entity` method now optionally accepts `options` - [@mbleigh](https://github.com/mbleigh).
223
250
  * You can pass symbols to `:if` and `:unless` to simply check for truthiness/falsiness of the specified options key - [@mbleigh](https://github.com/mbleigh).
224
251
 
252
+
225
253
  ### 0.2.0 (2013-01-11)
226
254
 
227
255
  #### Features
228
256
 
229
257
  * Moved the namespace back to `Grape::Entity` to preserve compatibility with Grape - [@dblock](https://github.com/dblock).
230
258
 
259
+
231
260
  ### 0.1.0 (2013-01-11)
232
261
 
233
262
  * Initial public release - [@agileanimal](https://github.com/agileanimal).
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ source 'http://rubygems.org'
5
5
  gemspec
6
6
 
7
7
  group :development, :test do
8
- gem 'rubocop', '~> 0.88.0', require: false
8
+ gem 'rubocop', '~> 1.0', require: false
9
9
  end
10
10
 
11
11
  group :test do
@@ -1,5 +1,34 @@
1
- Upgrading Grape Entity
2
- ===============
1
+ # Upgrading Grape Entity
2
+
3
+ ### Upgrading to >= 0.8.2
4
+
5
+ In Ruby 3.0: the block handling will be changed
6
+ [language-changes point 3, Proc](https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes).
7
+ This:
8
+ ```ruby
9
+ expose :that_method_without_args, &:method_without_args
10
+ ```
11
+ will be deprecated.
12
+
13
+ Prefer to use this pattern for simple setting a value
14
+ ```ruby
15
+ expose :method_without_args, as: :that_method_without_args
16
+ ```
17
+
18
+ ### Upgrading to >= 0.8.2
19
+
20
+ In Ruby 3.0: the block handling will be changed
21
+ [language-changes point 3, Proc](https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes).
22
+ This:
23
+ ```ruby
24
+ expose :that_method_without_args, &:method_without_args
25
+ ```
26
+ will be deprecated.
27
+
28
+ Prefer to use this pattern for simple setting a value
29
+ ```ruby
30
+ expose :method_without_args, as: :that_method_without_args
31
+ ```
3
32
 
4
33
  ### Upgrading to >= 0.6.0
5
34
 
@@ -9,3 +9,4 @@ require 'grape_entity/entity'
9
9
  require 'grape_entity/delegator'
10
10
  require 'grape_entity/exposure'
11
11
  require 'grape_entity/options'
12
+ require 'grape_entity/deprecated'
@@ -21,7 +21,7 @@ module Grape
21
21
  end
22
22
 
23
23
  def met?(entity, options)
24
- !@inverse ? if_value(entity, options) : unless_value(entity, options)
24
+ @inverse ? unless_value(entity, options) : if_value(entity, options)
25
25
  end
26
26
 
27
27
  def if_value(_entity, _options)
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Grape
4
+ class Entity
5
+ class Deprecated < StandardError
6
+ def initialize(msg, spec)
7
+ message = "DEPRECATED #{spec}: #{msg}"
8
+
9
+ super(message)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -139,6 +139,8 @@ module Grape
139
139
  def self.inherited(subclass)
140
140
  subclass.root_exposure = root_exposure.dup
141
141
  subclass.formatters = formatters.dup
142
+
143
+ super
142
144
  end
143
145
 
144
146
  # This method is the primary means by which you will declare what attributes
@@ -523,6 +525,11 @@ module Grape
523
525
  else
524
526
  instance_exec(object, options, &block)
525
527
  end
528
+ rescue StandardError => e
529
+ # it handles: https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes point 3, Proc
530
+ raise Grape::Entity::Deprecated.new e.message, 'in ruby 3.0' if e.is_a?(ArgumentError)
531
+
532
+ raise e.class, e.message
526
533
  end
527
534
 
528
535
  def exec_with_attribute(attribute, &block)
@@ -537,7 +544,7 @@ module Grape
537
544
  if is_defined_in_entity?(attribute)
538
545
  send(attribute)
539
546
  elsif @delegator_accepts_opts
540
- delegator.delegate(attribute, self.class.delegation_opts)
547
+ delegator.delegate(attribute, **self.class.delegation_opts)
541
548
  else
542
549
  delegator.delegate(attribute)
543
550
  end
@@ -113,11 +113,9 @@ module Grape
113
113
  @key.respond_to?(:call) ? entity.exec_with_object(@options, &@key) : @key
114
114
  end
115
115
 
116
- def with_attr_path(entity, options)
116
+ def with_attr_path(entity, options, &block)
117
117
  path_part = attr_path(entity, options)
118
- options.with_attr_path(path_part) do
119
- yield
120
- end
118
+ options.with_attr_path(path_part, &block)
121
119
  end
122
120
 
123
121
  def override?
@@ -91,6 +91,7 @@ module Grape
91
91
  output[exposure.key(entity)] ||= []
92
92
  output[exposure.key(entity)] << exposure
93
93
  end
94
+
94
95
  table.map do |key, exposures|
95
96
  last_exposure = exposures.last
96
97
 
@@ -36,6 +36,7 @@ module Grape
36
36
  @exposures.clear
37
37
  end
38
38
 
39
+ # rubocop:disable Style/DocumentDynamicEvalDefinition
39
40
  %i[
40
41
  each
41
42
  to_ary to_a
@@ -55,6 +56,7 @@ module Grape
55
56
  end
56
57
  RUBY
57
58
  end
59
+ # rubocop:enable Style/DocumentDynamicEvalDefinition
58
60
 
59
61
  # Determine if we have any nesting exposures with the same name.
60
62
  def deep_complex_nesting?(entity)
@@ -9,6 +9,8 @@ module Grape
9
9
  @entity = entity
10
10
  @output_hash = {}
11
11
  @output_collection = []
12
+
13
+ super
12
14
  end
13
15
 
14
16
  def add(exposure, result)
@@ -49,6 +51,7 @@ module Grape
49
51
  output
50
52
  end
51
53
 
54
+ # rubocop:disable Lint/EmptyBlock
52
55
  # In case if we want to solve collisions providing lambda to :merge option
53
56
  def merge_strategy(for_merge)
54
57
  if for_merge.respond_to? :call
@@ -57,6 +60,7 @@ module Grape
57
60
  -> {}
58
61
  end
59
62
  end
63
+ # rubocop:enable Lint/EmptyBlock
60
64
  end
61
65
  end
62
66
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrapeEntity
4
- VERSION = '0.8.1'
4
+ VERSION = '0.8.2'
5
5
  end
@@ -30,7 +30,9 @@ describe Grape::Entity do
30
30
 
31
31
  it 'makes sure that :format_with as a proc cannot be used with a block' do
32
32
  # rubocop:disable Style/BlockDelimiters
33
+ # rubocop:disable Lint/EmptyBlock
33
34
  expect { subject.expose :name, format_with: proc {} do p 'hi' end }.to raise_error ArgumentError
35
+ # rubocop:enable Lint/EmptyBlock
34
36
  # rubocop:enable Style/BlockDelimiters
35
37
  end
36
38
 
@@ -260,27 +262,50 @@ describe Grape::Entity do
260
262
  end
261
263
  end
262
264
 
263
- context 'with block passed via &' do
264
- it 'with does not pass options when block is passed via &' do
265
- class SomeObject
266
- def method_without_args
267
- 'result'
268
- end
265
+ describe 'blocks' do
266
+ class SomeObject
267
+ def method_without_args
268
+ 'result'
269
269
  end
270
+ end
271
+
272
+ describe 'with block passed in' do
273
+ specify do
274
+ subject.expose :that_method_without_args do |object|
275
+ object.method_without_args
276
+ end
277
+
278
+ object = SomeObject.new
270
279
 
271
- subject.expose :that_method_without_args do |object|
272
- object.method_without_args
280
+ value = subject.represent(object).value_for(:that_method_without_args)
281
+ expect(value).to eq('result')
273
282
  end
283
+ end
284
+
285
+ context 'with block passed in via &' do
286
+ if RUBY_VERSION.start_with?('3')
287
+ specify do
288
+ subject.expose :that_method_without_args, &:method_without_args
289
+ subject.expose :method_without_args, as: :that_method_without_args_again
274
290
 
275
- subject.expose :that_method_without_args_again, &:method_without_args
291
+ object = SomeObject.new
292
+ expect do
293
+ subject.represent(object).value_for(:that_method_without_args)
294
+ end.to raise_error Grape::Entity::Deprecated
276
295
 
277
- object = SomeObject.new
296
+ value2 = subject.represent(object).value_for(:that_method_without_args_again)
297
+ expect(value2).to eq('result')
298
+ end
299
+ else
300
+ specify do
301
+ subject.expose :that_method_without_args_again, &:method_without_args
278
302
 
279
- value = subject.represent(object).value_for(:that_method_without_args)
280
- expect(value).to eq('result')
303
+ object = SomeObject.new
281
304
 
282
- value2 = subject.represent(object).value_for(:that_method_without_args_again)
283
- expect(value2).to eq('result')
305
+ value2 = subject.represent(object).value_for(:that_method_without_args_again)
306
+ expect(value2).to eq('result')
307
+ end
308
+ end
284
309
  end
285
310
  end
286
311
 
@@ -1693,10 +1718,12 @@ describe Grape::Entity do
1693
1718
  end
1694
1719
  end
1695
1720
 
1721
+ # rubocop:disable Lint/EmptyBlock
1696
1722
  fresh_class.class_eval do
1697
1723
  expose :first_friend, using: EntitySpec::FriendEntity do |_user, _opts|
1698
1724
  end
1699
1725
  end
1726
+ # rubocop:enable Lint/EmptyBlock
1700
1727
 
1701
1728
  rep = subject.value_for(:first_friend)
1702
1729
  expect(rep).to be_kind_of EntitySpec::FriendEntity
@@ -13,7 +13,7 @@ SimpleCov.start do
13
13
  add_filter 'spec/'
14
14
  end
15
15
 
16
- Coveralls.wear!
16
+ Coveralls.wear! unless RUBY_PLATFORM.eql? 'java'
17
17
 
18
18
  $LOAD_PATH.unshift(File.dirname(__FILE__))
19
19
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-entity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-15 00:00:00.000000000 Z
11
+ date: 2020-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -190,6 +190,7 @@ files:
190
190
  - lib/grape_entity/delegator/hash_object.rb
191
191
  - lib/grape_entity/delegator/openstruct_object.rb
192
192
  - lib/grape_entity/delegator/plain_object.rb
193
+ - lib/grape_entity/deprecated.rb
193
194
  - lib/grape_entity/entity.rb
194
195
  - lib/grape_entity/exposure.rb
195
196
  - lib/grape_entity/exposure/base.rb
@@ -229,7 +230,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
230
  - !ruby/object:Gem::Version
230
231
  version: '0'
231
232
  requirements: []
232
- rubygems_version: 3.1.4
233
+ rubygems_version: 3.2.0.rc.1
233
234
  signing_key:
234
235
  specification_version: 4
235
236
  summary: A simple facade for managing the relationship between your model and API.