2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-06-16 23:09:34 +05:30
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Dashboard > Todo target states' do
|
2016-06-16 23:09:34 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:author) { create(:user) }
|
2017-09-10 17:25:29 +05:30
|
|
|
let(:project) { create(:project, :public) }
|
2016-06-16 23:09:34 +05:30
|
|
|
|
|
|
|
before do
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'on a closed issue todo has closed label' do
|
2016-06-16 23:09:34 +05:30
|
|
|
issue_closed = create(:issue, state: 'closed')
|
|
|
|
create_todo issue_closed
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).to have_content('Closed')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'on an open issue todo does not have an open label' do
|
2016-06-16 23:09:34 +05:30
|
|
|
issue_open = create(:issue)
|
|
|
|
create_todo issue_open
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).not_to have_content('Open')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'on a merged merge request todo has merged label' do
|
2017-09-10 17:25:29 +05:30
|
|
|
mr_merged = create(:merge_request, :simple, :merged, author: user)
|
2016-06-16 23:09:34 +05:30
|
|
|
create_todo mr_merged
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).to have_content('Merged')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'on a closed merge request todo has closed label' do
|
2017-09-10 17:25:29 +05:30
|
|
|
mr_closed = create(:merge_request, :simple, :closed, author: user)
|
2016-06-16 23:09:34 +05:30
|
|
|
create_todo mr_closed
|
|
|
|
visit dashboard_todos_path
|
|
|
|
|
|
|
|
page.within '.todos-list' do
|
|
|
|
expect(page).to have_content('Closed')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it 'on an open merge request todo does not have an open label' do
|
2016-06-16 23:09:34 +05:30
|
|
|
mr_open = create(:merge_request, :simple, author: user)
|
|
|
|
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
|