Remove label_list factory

This commit is contained in:
Douglas Barbosa Alexandre 2016-07-31 21:55:03 -03:00
parent 4b75c75018
commit baec3d236b
6 changed files with 17 additions and 20 deletions

View file

@ -2,6 +2,8 @@ FactoryGirl.define do
factory :list do factory :list do
board board
label label
list_type :label
sequence(:position)
end end
factory :backlog_list, parent: :list do factory :backlog_list, parent: :list do
@ -10,11 +12,6 @@ FactoryGirl.define do
position nil position nil
end end
factory :label_list, parent: :list do
list_type :label
sequence(:position)
end
factory :done_list, parent: :list do factory :done_list, parent: :list do
list_type :done list_type :done
label nil label nil

View file

@ -34,7 +34,7 @@ describe List do
describe '#destroy' do describe '#destroy' do
it 'can be destroyed when when list_type is set to label' do it 'can be destroyed when when list_type is set to label' do
subject = create(:label_list) subject = create(:list)
expect(subject.destroy).to be_truthy expect(subject.destroy).to be_truthy
end end

View file

@ -11,8 +11,8 @@ describe Boards::Issues::MoveService, services: true do
let(:testing) { create(:label, project: project, name: 'Testing') } let(:testing) { create(:label, project: project, name: 'Testing') }
let(:backlog) { create(:backlog_list, board: board) } let(:backlog) { create(:backlog_list, board: board) }
let(:list1) { create(:label_list, board: board, label: development) } let(:list1) { create(:list, board: board, label: development) }
let(:list2) { create(:label_list, board: board, label: testing) } let(:list2) { create(:list, board: board, label: testing) }
let(:done) { create(:done_list, board: board) } let(:done) { create(:done_list, board: board) }
before do before do

View file

@ -28,8 +28,8 @@ describe Boards::Lists::CreateService, services: true do
context 'when board lists has only labels lists' do context 'when board lists has only labels lists' do
it 'creates a new list at end of the lists' do it 'creates a new list at end of the lists' do
create(:label_list, board: board, position: 1) create(:list, board: board, position: 1)
create(:label_list, board: board, position: 2) create(:list, board: board, position: 2)
list = described_class.new(project, label_id: label.id).execute list = described_class.new(project, label_id: label.id).execute
@ -41,7 +41,7 @@ describe Boards::Lists::CreateService, services: true do
it 'creates a new list at end of the label lists' do it 'creates a new list at end of the label lists' do
create(:backlog_list, board: board) create(:backlog_list, board: board)
create(:done_list, board: board) create(:done_list, board: board)
list1 = create(:label_list, board: board, position: 1) list1 = create(:list, board: board, position: 1)
list2 = described_class.new(project, label_id: label.id).execute list2 = described_class.new(project, label_id: label.id).execute

View file

@ -7,7 +7,7 @@ describe Boards::Lists::DestroyService, services: true do
context 'when list type is label' do context 'when list type is label' do
it 'removes list from board' do it 'removes list from board' do
list = create(:label_list, board: board) list = create(:list, board: board)
service = described_class.new(project, list_id: list.id) service = described_class.new(project, list_id: list.id)
expect { service.execute }.to change(board.lists, :count).by(-1) expect { service.execute }.to change(board.lists, :count).by(-1)
@ -15,9 +15,9 @@ describe Boards::Lists::DestroyService, services: true do
it 'decrements position of higher lists' do it 'decrements position of higher lists' do
backlog = create(:backlog_list, board: board) backlog = create(:backlog_list, board: board)
development = create(:label_list, board: board, position: 1) development = create(:list, board: board, position: 1)
review = create(:label_list, board: board, position: 2) review = create(:list, board: board, position: 2)
staging = create(:label_list, board: board, position: 3) staging = create(:list, board: board, position: 3)
done = create(:done_list, board: board) done = create(:done_list, board: board)
described_class.new(project, list_id: development.id).execute described_class.new(project, list_id: development.id).execute

View file

@ -6,11 +6,11 @@ describe Boards::Lists::MoveService, services: true do
let(:board) { project.board } let(:board) { project.board }
let!(:backlog) { create(:backlog_list, board: board) } let!(:backlog) { create(:backlog_list, board: board) }
let!(:planning) { create(:label_list, board: board, position: 1) } let!(:planning) { create(:list, board: board, position: 1) }
let!(:development) { create(:label_list, board: board, position: 2) } let!(:development) { create(:list, board: board, position: 2) }
let!(:review) { create(:label_list, board: board, position: 3) } let!(:review) { create(:list, board: board, position: 3) }
let!(:staging) { create(:label_list, board: board, position: 4) } let!(:staging) { create(:list, board: board, position: 4) }
let!(:done) { create(:done_list, board: board) } let!(:done) { create(:done_list, board: board) }
context 'when list type is set to label' do context 'when list type is set to label' do
it 'keeps position of lists when new position is nil' do it 'keeps position of lists when new position is nil' do