Commit 368e9f58 authored by Mario de la Ossa's avatar Mario de la Ossa Committed by Ash McKenzie

Iteration - do not default include ancestors when IID provided

parent f3ea409a
......@@ -28,7 +28,7 @@ module Resolvers
authorize!
args[:include_ancestors] = true if args[:include_ancestors].nil?
args[:include_ancestors] = true if args[:include_ancestors].nil? && args[:iid].nil?
iterations = IterationsFinder.new(context[:current_user], iterations_finder_params(args)).execute
......
......@@ -45,7 +45,7 @@ RSpec.describe Resolvers::IterationsResolver do
search = 'wow'
id = 1
iid = 2
params = { id: id, iid: iid, group_ids: Group.where(id: group.id).select(:id), state: 'closed', start_date: start_date, end_date: end_date, search_title: search }
params = { id: id, iid: iid, group_ids: group.id, state: 'closed', start_date: start_date, end_date: end_date, search_title: search }
expect(IterationsFinder).to receive(:new).with(current_user, params).and_call_original
......@@ -64,6 +64,14 @@ RSpec.describe Resolvers::IterationsResolver do
resolve_group_iterations({}, subgroup)
end
it 'does not default to include_ancestors if IID is supplied' do
params = { id: nil, iid: 1, group_ids: subgroup.id, state: 'all', start_date: nil, end_date: nil, search_title: nil }
expect(IterationsFinder).to receive(:new).with(current_user, params).and_call_original
resolve_group_iterations({ iid: 1, include_ancestors: false }, subgroup)
end
it 'accepts include_ancestors false' do
params = { id: nil, iid: nil, group_ids: subgroup.id, state: 'all', start_date: nil, end_date: nil, search_title: nil }
......
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