Update board specs to use board factory instead of project_with_board

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