Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d85b6540
Commit
d85b6540
authored
Aug 27, 2021
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab master
parents
4da17a32
beaf02e8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
config/initializers_before_autoloader/grape_entity_patch.rb
config/initializers_before_autoloader/grape_entity_patch.rb
+27
-0
spec/config/grape_entity_patch_spec.rb
spec/config/grape_entity_patch_spec.rb
+21
-0
No files found.
config/initializers_before_autoloader/grape_entity_patch.rb
0 → 100644
View file @
d85b6540
# frozen_string_literal: true
# This can be removed after the problem gets fixed on upstream.
# You can follow https://github.com/ruby-grape/grape-entity/pull/355 to see the progress.
#
# For more information about the issue;
# https://github.com/ruby/did_you_mean/issues/158#issuecomment-906056018
require
'grape-entity'
module
Grape
class
Entity
# Upstream version: https://github.com/ruby-grape/grape-entity/blob/675d3c0e20dfc1d6cf6f5ba5b46741bd404c8be7/lib/grape_entity/entity.rb#L520
def
exec_with_object
(
options
,
&
block
)
if
block
.
parameters
.
count
==
1
instance_exec
(
object
,
&
block
)
else
instance_exec
(
object
,
options
,
&
block
)
end
rescue
StandardError
=>
e
# it handles: https://github.com/ruby/ruby/blob/v3_0_0_preview1/NEWS.md#language-changes point 3, Proc
raise
Grape
::
Entity
::
Deprecated
.
new
e
.
message
,
'in ruby 3.0'
if
e
.
is_a?
(
ArgumentError
)
raise
e
end
end
end
spec/config/grape_entity_patch_spec.rb
0 → 100644
View file @
d85b6540
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'Grape::Entity patch'
do
let
(
:entity_class
)
{
Class
.
new
(
Grape
::
Entity
)
}
describe
'NameError in block exposure with argument'
do
subject
(
:represent
)
{
entity_class
.
represent
({},
serializable:
true
)
}
before
do
entity_class
.
expose
:raise_no_method_error
do
|
_
|
foo
end
end
it
'propagates the error to the caller'
do
expect
{
represent
}.
to
raise_error
(
NameError
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment