Commit 31f77568 authored by Bob Van Landuyt's avatar Bob Van Landuyt
Browse files

`current_user:` as a keyword argument

parent 53baf4c140ae
......@@ -118,7 +118,9 @@ def destroy
protected
def setup_children(parent)
@children = GroupChildrenFinder.new(current_user, parent_group: parent, params: params).execute
@children = GroupChildrenFinder.new(current_user: current_user,
parent_group: parent,
params: params).execute
@children = @children.page(params[:page])
end
......
......@@ -3,7 +3,7 @@ class GroupChildrenFinder
attr_reader :current_user, :parent_group, :params
def initialize(current_user = nil, parent_group:, params: {})
def initialize(current_user: nil, parent_group:, params: {})
@current_user = current_user
@parent_group = parent_group
@params = params
......
......@@ -55,7 +55,8 @@ def permission
unless: lambda { |_instance, _options| project? }
def children_finder
@children_finder ||= GroupChildrenFinder.new(request.current_user, parent_group: object)
@children_finder ||= GroupChildrenFinder.new(current_user: request.current_user,
parent_group: object)
end
def children_count
......
......@@ -4,7 +4,9 @@
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:params) { {} }
subject(:finder) { described_class.new(user, parent_group: group, params: params) }
subject(:finder) do
described_class.new(current_user: user, parent_group: group, params: params)
end
before do
group.add_owner(user)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment