Commit b07c0960 authored by Brett Walker's avatar Brett Walker

Allow Boards:: ListService not to create default

board
parent b9c77f7d
...@@ -12,7 +12,7 @@ module Resolvers ...@@ -12,7 +12,7 @@ module Resolvers
return Board.none unless parent return Board.none unless parent
Boards::ListService.new(parent, context[:current_user]).execute Boards::ListService.new(parent, context[:current_user]).execute(create_default_board: false)
end end
end end
end end
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
module Boards module Boards
class ListService < Boards::BaseService class ListService < Boards::BaseService
def execute def execute(create_default_board: true)
create_board! if parent.boards.empty? create_board! if create_default_board && parent.boards.empty?
if parent.multiple_issue_boards_available? if parent.multiple_issue_boards_available?
boards boards
......
...@@ -8,8 +8,8 @@ describe Resolvers::BoardsResolver do ...@@ -8,8 +8,8 @@ describe Resolvers::BoardsResolver do
let_it_be(:user) { create(:user) } let_it_be(:user) { create(:user) }
shared_examples_for 'group and project boards resolver' do shared_examples_for 'group and project boards resolver' do
it 'creates the first board' do it 'does not create a default board' do
expect { resolve_boards }.to change { board_parent.boards.count }.from(0).to(1) expect(resolve_boards).to eq []
end end
it 'calls Boards::ListService' do it 'calls Boards::ListService' do
......
...@@ -11,6 +11,12 @@ RSpec.shared_examples 'boards list service' do ...@@ -11,6 +11,12 @@ RSpec.shared_examples 'boards list service' do
service.execute service.execute
end end
context 'when create_default_board is false' do
it 'does not create a new parent board' do
expect { service.execute(create_default_board: false) }.not_to change(parent.boards, :count)
end
end
end end
context 'when parent has a board' do context 'when parent has a board' do
......
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