Skip to content

Commit 879a6c0

Browse files
committed
Adds CHANGELOG and UPGRADE entries.
1 parent 1a9cbc4 commit 879a6c0

File tree

3 files changed

+33
-7
lines changed

3 files changed

+33
-7
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#### Fixes
88

9+
* Your contribution here.
10+
* [#340](https://github.com/ruby-grape/grape-entity/pull/340): Preparations for 3.0 - [@LeFnord](https://github.com/LeFnord).
911
* [#338](https://github.com/ruby-grape/grape-entity/pull/338): Fix ruby 2.7 deprecation warning - [@begotten63](https://github.com/begotten63).
1012

1113
### 0.8.1 (2020-07-15)

UPGRADING.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Upgrading Grape Entity
22
===============
33

4+
### Upgrading to >= 0.8.2
5+
6+
In Ruby 3.0: the block handling will be changed
7+
[language-changes point 3, Proc](https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes).
8+
This:
9+
```ruby
10+
expose :that_method_without_args, &:method_without_args
11+
```
12+
will be deprecated.
13+
14+
Prefer to use this pattern for simple setting a value
15+
```ruby
16+
expose :method_without_args, as: :that_method_without_args
17+
```
18+
419
### Upgrading to >= 0.6.0
520

621
#### Changes in Grape::Entity#inspect

spec/grape_entity/entity_spec.rb

+16-7
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,25 @@ def method_without_args
283283
end
284284

285285
context 'with block passed in via &' do
286-
specify do
287-
subject.expose :that_method_without_args_again, &:method_without_args
288-
289-
object = SomeObject.new
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
290290

291-
if RUBY_VERSION.start_with?('3')
291+
object = SomeObject.new
292292
expect do
293-
subject.represent(object).value_for(:that_method_without_args_again)
293+
subject.represent(object).value_for(:that_method_without_args)
294294
end.to raise_error Grape::Entity::Deprecated
295-
else
295+
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
302+
303+
object = SomeObject.new
304+
296305
value2 = subject.represent(object).value_for(:that_method_without_args_again)
297306
expect(value2).to eq('result')
298307
end

0 commit comments

Comments
 (0)