2019-07-25 01:24:42 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 03:56:52 -04:00
|
|
|
require 'spec_helper'
|
2016-05-09 18:19:26 -04:00
|
|
|
|
2020-06-16 14:09:01 -04:00
|
|
|
RSpec.describe 'Dashboard > Todo target states' do
|
2021-08-03 17:09:39 -04:00
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
let_it_be(:author) { create(:user) }
|
|
|
|
let_it_be(:project) { create(:project, :public) }
|
|
|
|
|
|
|
|
before_all do
|
|
|
|
project.add_developer(user)
|
|
|
|
end
|
2016-05-09 18:19:26 -04:00
|
|
|
|
|
|
|
before do
|
2017-06-26 10:21:31 -04:00
|
|
|
sign_in(user)
|
2016-05-09 18:19:26 -04:00
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'on a closed issue todo has closed label' do
|
2021-08-03 17:09:39 -04:00
|
|
|
issue_closed = create(:issue, state: 'closed', project: project)
|
2016-05-09 18:19:26 -04:00
|
|
|
create_todo issue_closed
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).to have_content('Closed')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'on an open issue todo does not have an open label' do
|
2021-08-03 17:09:39 -04:00
|
|
|
issue_open = create(:issue, project: project)
|
2016-05-09 18:19:26 -04:00
|
|
|
create_todo issue_open
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).not_to have_content('Open')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'on a merged merge request todo has merged label' do
|
2021-08-03 17:09:39 -04:00
|
|
|
mr_merged = create(:merge_request, :simple, :merged, author: user, source_project: project)
|
2016-05-09 18:19:26 -04:00
|
|
|
create_todo mr_merged
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).to have_content('Merged')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'on a closed merge request todo has closed label' do
|
2021-08-03 17:09:39 -04:00
|
|
|
mr_closed = create(:merge_request, :simple, :closed, author: user, source_project: project)
|
2016-05-09 18:19:26 -04:00
|
|
|
create_todo mr_closed
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).to have_content('Closed')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-07-05 02:32:05 -04:00
|
|
|
it 'on an open merge request todo does not have an open label' do
|
2021-08-03 17:09:39 -04:00
|
|
|
mr_open = create(:merge_request, :simple, author: user, source_project: project)
|
2016-05-09 18:19:26 -04:00
|
|
|
create_todo mr_open
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).not_to have_content('Open')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_todo(target)
|
|
|
|
create(:todo, :mentioned, user: user, project: project, target: target, author: author)
|
|
|
|
end
|
|
|
|
end
|