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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/boards_helper_spec.rb')
-rw-r--r--spec/helpers/boards_helper_spec.rb59
1 files changed, 47 insertions, 12 deletions
diff --git a/spec/helpers/boards_helper_spec.rb b/spec/helpers/boards_helper_spec.rb
index a805b96a8cc..b85ebec5545 100644
--- a/spec/helpers/boards_helper_spec.rb
+++ b/spec/helpers/boards_helper_spec.rb
@@ -34,23 +34,58 @@ RSpec.describe BoardsHelper do
end
describe '#board_data' do
- let(:user) { create(:user) }
- let(:board) { create(:board, project: project) }
+ let_it_be(:user) { create(:user) }
+ let_it_be(:board) { create(:board, project: project) }
- before do
- assign(:board, board)
- assign(:project, project)
+ context 'project_board' do
+ before do
+ assign(:project, project)
+ assign(:board, board)
- allow(helper).to receive(:current_user) { user }
- allow(helper).to receive(:can?).with(user, :create_non_backlog_issues, board).and_return(true)
- end
+ allow(helper).to receive(:current_user) { user }
+ allow(helper).to receive(:can?).with(user, :create_non_backlog_issues, board).and_return(true)
+ allow(helper).to receive(:can?).with(user, :admin_issue, board).and_return(true)
+ end
+
+ it 'returns a board_lists_path as lists_endpoint' do
+ expect(helper.board_data[:lists_endpoint]).to eq(board_lists_path(board))
+ end
- it 'returns a board_lists_path as lists_endpoint' do
- expect(helper.board_data[:lists_endpoint]).to eq(board_lists_path(board))
+ it 'returns board type as parent' do
+ expect(helper.board_data[:parent]).to eq('project')
+ end
+
+ it 'returns can_update for user permissions on the board' do
+ expect(helper.board_data[:can_update]).to eq('true')
+ end
+
+ it 'returns required label endpoints' do
+ expect(helper.board_data[:labels_fetch_path]).to eq("/#{project.full_path}/-/labels.json?include_ancestor_groups=true")
+ expect(helper.board_data[:labels_manage_path]).to eq("/#{project.full_path}/-/labels")
+ end
end
- it 'returns board type as parent' do
- expect(helper.board_data[:parent]).to eq('project')
+ context 'group board' do
+ let_it_be(:group) { create(:group, path: 'base') }
+ let_it_be(:board) { create(:board, group: group) }
+
+ before do
+ assign(:group, group)
+ assign(:board, board)
+
+ allow(helper).to receive(:current_user) { user }
+ allow(helper).to receive(:can?).with(user, :create_non_backlog_issues, board).and_return(true)
+ allow(helper).to receive(:can?).with(user, :admin_issue, board).and_return(true)
+ end
+
+ it 'returns correct path for base group' do
+ expect(helper.build_issue_link_base).to eq('/base/:project_path/issues')
+ end
+
+ it 'returns required label endpoints' do
+ expect(helper.board_data[:labels_fetch_path]).to eq("/groups/base/-/labels.json?include_ancestor_groups=true&only_group_labels=true")
+ expect(helper.board_data[:labels_manage_path]).to eq("/groups/base/-/labels")
+ end
end
end