Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#### Fixes

* [#2586](https://github.com/ruby-grape/grape/pull/2586): Limit helpers DSL public scope - [@ericproulx](https://github.com/ericproulx).
* [#2588](https://github.com/ruby-grape/grape/pull/2588): Fix defaut format regression on */* - [@ericproulx](https://github.com/ericproulx).
* Your contribution here.

Expand Down
2 changes: 1 addition & 1 deletion lib/grape/dsl/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def helpers(*new_modules, &block)
include_all_in_scope if !block && new_modules.empty?
end

protected
private

def include_new_modules(modules)
return if modules.empty?
Expand Down
6 changes: 6 additions & 0 deletions spec/grape/dsl/helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,11 @@ def test
expect { api_class }.not_to raise_exception
end
end

context 'public scope' do
it 'returns helpers only' do
expect(Class.new { extend Grape::DSL::Helpers }.singleton_methods - Class.methods).to contain_exactly(:helpers)
end
end
end
end