diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-04-28 15:26:18 -0500 |
---|---|---|
committer | Jacob Schatz <jschatz1@gmail.com> | 2016-05-25 08:15:20 -0400 |
commit | 38d6bc77f9d0b9be1d953d436384e2b023b465c5 (patch) | |
tree | 58ff27a49ca44e6b502b02c2d0a5a2a5c0f83223 /spec | |
parent | 33be8181ac7a7885ccf5ea4850a87908d974ac28 (diff) | |
download | gitlab-ce-38d6bc77f9d0b9be1d953d436384e2b023b465c5.tar.gz |
Add tests for Todos target's state
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/todos/target_state_todos_spec.rb | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/spec/features/todos/target_state_todos_spec.rb b/spec/features/todos/target_state_todos_spec.rb new file mode 100644 index 00000000000..c7c5cdb66b0 --- /dev/null +++ b/spec/features/todos/target_state_todos_spec.rb @@ -0,0 +1,84 @@ +require 'rails_helper' + +describe 'Todos > Target State Labels' do + let(:user) { create(:user) } + let(:author) { create(:user) } + let(:project) { create(:project) } + let(:issue_open) { create(:issue) } + let(:issue_closed) { create(:issue, state: 'closed') } + let(:mr_open) { create(:merge_request, :simple, author: user) } + let(:mr_merged) { create(:merge_request, :simple, author: user, state: 'merged') } + let(:mr_closed) { create(:merge_request, :simple, author: user, state: 'closed') } + + describe 'GET /dashboard/todos' do + context 'On a todo for a Closed Issue' do + before do + create(:todo, :mentioned, user: user, project: project, target: issue_closed, author: author) + login_as user + visit dashboard_todos_path + end + + it 'has closed label' do + page.within '.todos-list' do + expect(page).to have_content('Closed') + end + end + end + + context 'On a todo for a Open Issue' do + before do + create(:todo, :mentioned, user: user, project: project, target: issue_open, author: author) + login_as user + visit dashboard_todos_path + end + + it 'does not have a open label' do + page.within '.todos-list' do + expect(page).not_to have_content('Open') + end + end + end + + context 'On a todo for a merged Merge Request' do + before do + create(:todo, :mentioned, user: user, project: project, target: mr_merged, author: author) + login_as user + visit dashboard_todos_path + end + + it 'has merged label' do + page.within '.todos-list' do + expect(page).to have_content('Merged') + end + end + end + + context 'On a todo for a closed Merge Request' do + before do + create(:todo, :mentioned, user: user, project: project, target: mr_closed, author: author) + login_as user + visit dashboard_todos_path + end + + it 'has closed label' do + page.within '.todos-list' do + expect(page).to have_content('Closed') + end + end + end + + context 'On a todo for a open Merge Request' do + before do + create(:todo, :mentioned, user: user, project: project, target: mr_open, author: author) + login_as user + visit dashboard_todos_path + end + + it 'does not have a open label' do + page.within '.todos-list' do + expect(page).not_to have_content('Open') + end + end + end + end +end |