Commit 5ceca81d authored by Simon Knox's avatar Simon Knox

Separate context for logged in user in boards_spec

parent 7874f42c
......@@ -12,6 +12,7 @@ RSpec.describe 'Project issue boards', :js do
let_it_be(:user) { create(:user) }
let_it_be(:user2) { create(:user) }
context 'signed in user' do
before do
project.add_maintainer(user)
project.add_maintainer(user2)
......@@ -67,8 +68,6 @@ RSpec.describe 'Project issue boards', :js do
let_it_be(:issue10) { create(:labeled_issue, project: project, title: 'issue +', description: 'A+ great issue', labels: [a_plus]) }
before do
stub_feature_flags(board_new_list: false)
visit_project_board_path_without_query_limit(project, board)
end
......@@ -304,91 +303,6 @@ RSpec.describe 'Project issue boards', :js do
end
end
end
context 'new list' do
it 'shows all labels in new list dropdown' do
click_button 'Add list'
wait_for_requests
page.within('.dropdown-menu-issues-board-new') do
expect(page).to have_content(planning.title)
expect(page).to have_content(development.title)
expect(page).to have_content(testing.title)
end
end
it 'creates new list for label' do
click_button 'Add list'
wait_for_requests
page.within('.dropdown-menu-issues-board-new') do
click_link testing.title
end
wait_for_requests
expect(page).to have_selector('.board', count: 5)
end
it 'creates new list for Backlog label' do
click_button 'Add list'
wait_for_requests
page.within('.dropdown-menu-issues-board-new') do
click_link backlog.title
end
wait_for_requests
expect(page).to have_selector('.board', count: 5)
end
it 'creates new list for Closed label' do
click_button 'Add list'
wait_for_requests
page.within('.dropdown-menu-issues-board-new') do
click_link closed.title
end
wait_for_requests
expect(page).to have_selector('.board', count: 5)
end
it 'keeps dropdown open after adding new list' do
click_button 'Add list'
wait_for_requests
page.within('.dropdown-menu-issues-board-new') do
click_link closed.title
end
wait_for_requests
expect(page).to have_css('#js-add-list.show')
end
it 'creates new list from a new label' do
click_button 'Add list'
wait_for_requests
click_link 'Create project label'
fill_in('new_label_name', with: 'Testing New Label - with list')
first('.suggest-colors a').click
click_button 'Create'
wait_for_requests
wait_for_requests
expect(page).to have_selector('.board', count: 5)
end
end
end
context 'filtering' do
......@@ -596,10 +510,10 @@ RSpec.describe 'Project issue boards', :js do
expect(page).to have_content('New Issue')
end
end
end
context 'signed out user' do
before do
sign_out(:user)
visit project_board_path(project, board)
wait_for_requests
end
......@@ -609,7 +523,7 @@ RSpec.describe 'Project issue boards', :js do
end
it 'does not show create new list' do
expect(page).not_to have_button('.js-new-board-list')
expect(page).not_to have_button('Create list')
end
it 'does not allow dragging' do
......@@ -622,14 +536,13 @@ RSpec.describe 'Project issue boards', :js do
before do
project.add_guest(user_guest)
sign_out(:user)
sign_in(user_guest)
visit project_board_path(project, board)
wait_for_requests
end
it 'does not show create new list' do
expect(page).not_to have_selector('.js-new-board-list')
expect(page).not_to have_button('Create list')
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