Welcome to mirror list, hosted at ThFree Co, Russian Federation.

lists_list_service_shared_examples.rb « boards « services « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 07a6353296d04ea1b57b845c0b52783bf702531e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

RSpec.shared_examples 'lists list service' do
  context 'when the board has a backlog list' do
    let!(:backlog_list) { create(:backlog_list, board: board) }

    it 'does not create a backlog list' do
      expect { service.execute(board) }.not_to change(board.lists, :count)
    end

    it "returns board's lists" do
      expect(service.execute(board)).to eq [backlog_list, list, board.closed_list]
    end
  end

  context 'when the board does not have a backlog list' do
    it 'creates a backlog list' do
      expect { service.execute(board) }.to change(board.lists, :count).by(1)
    end

    it 'does not create a backlog list when create_default_lists is false' do
      expect { service.execute(board, create_default_lists: false) }.not_to change(board.lists, :count)
    end

    it "returns board's lists" do
      expect(service.execute(board)).to eq [board.backlog_list, list, board.closed_list]
    end
  end
end