Update board specs to use board factory instead of project_with_board

parent 2c2a1dea
require 'spec_helper' require 'spec_helper'
describe Projects::Boards::ListsController do describe Projects::Boards::ListsController do
let(:project) { create(:project_with_board) } let(:project) { create(:empty_project) }
let(:board) { project.board } let(:board) { create(:board, project: project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:guest) { create(:user) } let(:guest) { create(:user) }
......
...@@ -4,7 +4,8 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -4,7 +4,8 @@ describe 'Issue Boards', feature: true, js: true do
include WaitForAjax include WaitForAjax
include WaitForVueResource include WaitForVueResource
let(:project) { create(:project_with_board, :public) } let(:project) { create(:empty_project, :public) }
let(:board) { create(:board, project: project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let!(:user2) { create(:user) } let!(:user2) { create(:user) }
...@@ -468,7 +469,7 @@ describe 'Issue Boards', feature: true, js: true do ...@@ -468,7 +469,7 @@ describe 'Issue Boards', feature: true, js: true do
it 'removes filtered labels' do it 'removes filtered labels' do
wait_for_vue_resource wait_for_vue_resource
page.within '.labels-filter' do page.within '.labels-filter' do
click_button('Label') click_button('Label')
wait_for_ajax wait_for_ajax
......
...@@ -4,7 +4,8 @@ describe 'Issue Boards new issue', feature: true, js: true do ...@@ -4,7 +4,8 @@ describe 'Issue Boards new issue', feature: true, js: true do
include WaitForAjax include WaitForAjax
include WaitForVueResource include WaitForVueResource
let(:project) { create(:project_with_board, :public) } let(:project) { create(:empty_project, :public) }
let(:board) { create(:board, project: project) }
let(:user) { create(:user) } let(:user) { create(:user) }
context 'authorized user' do context 'authorized user' do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Boards::Issues::ListService, services: true do describe Boards::Issues::ListService, services: true do
describe '#execute' do describe '#execute' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project_with_board) } let(:project) { create(:empty_project) }
let(:board) { create(:board, project: project) } let(:board) { create(:board, project: project) }
let(:bug) { create(:label, project: project, name: 'Bug') } let(:bug) { create(:label, project: project, name: 'Bug') }
......
...@@ -2,8 +2,8 @@ require 'spec_helper' ...@@ -2,8 +2,8 @@ require 'spec_helper'
describe Boards::Lists::DestroyService, services: true do describe Boards::Lists::DestroyService, services: true do
describe '#execute' do describe '#execute' do
let(:project) { create(:project_with_board) } let(:project) { create(:empty_project) }
let(:board) { project.board } let(:board) { create(:board, project: project) }
let(:user) { create(:user) } let(:user) { create(:user) }
context 'when list type is label' do context 'when list type is label' do
...@@ -15,11 +15,11 @@ describe Boards::Lists::DestroyService, services: true do ...@@ -15,11 +15,11 @@ describe Boards::Lists::DestroyService, services: true do
end end
it 'decrements position of higher lists' do it 'decrements position of higher lists' do
backlog = project.board.backlog_list backlog = board.backlog_list
development = create(:list, board: board, position: 0) development = create(:list, board: board, position: 0)
review = create(:list, board: board, position: 1) review = create(:list, board: board, position: 1)
staging = create(:list, board: board, position: 2) staging = create(:list, board: board, position: 2)
done = project.board.done_list done = board.done_list
described_class.new(project, user).execute(development) described_class.new(project, user).execute(development)
...@@ -31,14 +31,14 @@ describe Boards::Lists::DestroyService, services: true do ...@@ -31,14 +31,14 @@ describe Boards::Lists::DestroyService, services: true do
end end
it 'does not remove list from board when list type is backlog' do it 'does not remove list from board when list type is backlog' do
list = project.board.backlog_list list = board.backlog_list
service = described_class.new(project, user) service = described_class.new(project, user)
expect { service.execute(list) }.not_to change(board.lists, :count) expect { service.execute(list) }.not_to change(board.lists, :count)
end end
it 'does not remove list from board when list type is done' do it 'does not remove list from board when list type is done' do
list = project.board.done_list list = board.done_list
service = described_class.new(project, user) service = described_class.new(project, user)
expect { service.execute(list) }.not_to change(board.lists, :count) expect { service.execute(list) }.not_to change(board.lists, :count)
......
...@@ -6,13 +6,11 @@ describe Boards::Lists::ListService, services: true do ...@@ -6,13 +6,11 @@ describe Boards::Lists::ListService, services: true do
project = create(:empty_project) project = create(:empty_project)
board = create(:board, project: project) board = create(:board, project: project)
label = create(:label, project: project) label = create(:label, project: project)
backlog_list = create(:backlog_list, board: board)
list = create(:list, board: board, label: label) list = create(:list, board: board, label: label)
done_list = create(:done_list, board: board)
service = described_class.new(project, double) service = described_class.new(project, double)
expect(service.execute(board)).to eq [backlog_list, list, done_list] expect(service.execute(board)).to eq [board.backlog_list, list, board.done_list]
end end
end end
end end
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