summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-07-16 18:18:52 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-07-30 15:01:26 +0200
commitf1d3ea63cf74d2791a9a863b29ab2d919ea61bd0 (patch)
treec36c2b272fba917af321a4f16c34a5047407f3b2 /spec/features
parentb4c4b48a8c0258ff266c523488aa169a1b5ea0f3 (diff)
downloadgitlab-ce-f1d3ea63cf74d2791a9a863b29ab2d919ea61bd0.tar.gz
Show the status of a user in interactions
The status is shown for - The author of a commit when viewing a commit - Notes on a commit (regular/diff) - The user that triggered a pipeline when viewing a pipeline - The author of a merge request when viewing a merge request - The author of notes on a merge request (regular/diff) - The author of an issue when viewing an issue - The author of notes on an issue - The author of a snippet when viewing a snippet - The author of notes on a snippet - A user's profile page - The list of members of a group/user
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/groups/members/list_members_spec.rb14
-rw-r--r--spec/features/projects/commit/user_views_user_status_on_commit_spec.rb40
-rw-r--r--spec/features/projects/issues/user_views_issue_spec.rb18
-rw-r--r--spec/features/projects/members/group_members_spec.rb8
-rw-r--r--spec/features/projects/merge_requests/user_views_user_status_on_merge_request_spec.rb36
-rw-r--r--spec/features/projects/pipelines/pipeline_spec.rb6
-rw-r--r--spec/features/projects/snippets/show_spec.rb12
-rw-r--r--spec/features/snippets/notes_on_personal_snippets_spec.rb11
-rw-r--r--spec/features/snippets/show_spec.rb8
-rw-r--r--spec/features/users/show_spec.rb8
10 files changed, 160 insertions, 1 deletions
diff --git a/spec/features/groups/members/list_members_spec.rb b/spec/features/groups/members/list_members_spec.rb
index 33f93fcc470..e1587a8b6a5 100644
--- a/spec/features/groups/members/list_members_spec.rb
+++ b/spec/features/groups/members/list_members_spec.rb
@@ -9,7 +9,7 @@ describe 'Groups > Members > List members' do
let(:nested_group) { create(:group, parent: group) }
before do
- gitlab_sign_in(user1)
+ sign_in(user1)
end
it 'show members from current group and parent', :nested_groups do
@@ -32,6 +32,18 @@ describe 'Groups > Members > List members' do
expect(second_row).to be_blank
end
+ describe 'showing status of members' do
+ before do
+ group.add_developer(user2)
+ end
+
+ subject { visit group_group_members_path(group) }
+
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { user2 }
+ end
+ end
+
def first_row
page.all('ul.content-list > li')[0]
end
diff --git a/spec/features/projects/commit/user_views_user_status_on_commit_spec.rb b/spec/features/projects/commit/user_views_user_status_on_commit_spec.rb
new file mode 100644
index 00000000000..e78b7f7ae08
--- /dev/null
+++ b/spec/features/projects/commit/user_views_user_status_on_commit_spec.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'Project > Commit > View user status' do
+ include RepoHelpers
+
+ set(:project) { create(:project, :repository) }
+ set(:user) { create(:user) }
+ let(:commit_author) { create(:user, email: sample_commit.author_email) }
+
+ before do
+ sign_in(user)
+ project.add_developer(user)
+ end
+
+ subject { visit(project_commit_path(project, sample_commit.id)) }
+
+ describe 'status for the commit author' do
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { commit_author }
+ end
+ end
+
+ describe 'status for a comment on the commit' do
+ let(:note) { create(:note, :on_commit, project: project) }
+
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { note.author }
+ end
+ end
+
+ describe 'status for a diff note on the commit' do
+ let(:note) { create(:diff_note_on_commit, project: project) }
+
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { note.author }
+ end
+ end
+end
diff --git a/spec/features/projects/issues/user_views_issue_spec.rb b/spec/features/projects/issues/user_views_issue_spec.rb
index 4093876c289..117e5986f29 100644
--- a/spec/features/projects/issues/user_views_issue_spec.rb
+++ b/spec/features/projects/issues/user_views_issue_spec.rb
@@ -29,4 +29,22 @@ describe "User views issue" do
expect(page).not_to have_link('Close issue')
end
end
+
+ describe 'user status' do
+ subject { visit(project_issue_path(project, issue)) }
+
+ describe 'showing status of the author of the issue' do
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { issue.author }
+ end
+ end
+
+ describe 'showing status of a user who commented on an issue', :js do
+ let!(:note) { create(:note, noteable: issue, project: project, author: user_with_status) }
+
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { create(:user) }
+ end
+ end
+ end
end
diff --git a/spec/features/projects/members/group_members_spec.rb b/spec/features/projects/members/group_members_spec.rb
index 41b2beb40b9..0b2cd13b8ec 100644
--- a/spec/features/projects/members/group_members_spec.rb
+++ b/spec/features/projects/members/group_members_spec.rb
@@ -87,4 +87,12 @@ describe 'Projects members' do
end
end
end
+
+ describe 'showing status of members' do
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { developer }
+
+ subject { visit project_settings_members_path(project) }
+ end
+ end
end
diff --git a/spec/features/projects/merge_requests/user_views_user_status_on_merge_request_spec.rb b/spec/features/projects/merge_requests/user_views_user_status_on_merge_request_spec.rb
new file mode 100644
index 00000000000..78d9c6c6db1
--- /dev/null
+++ b/spec/features/projects/merge_requests/user_views_user_status_on_merge_request_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'Project > Merge request > View user status' do
+ let(:project) { create(:project, :public, :repository) }
+ let(:merge_request) do
+ create(:merge_request, source_project: project, target_project: project, author: create(:user))
+ end
+
+ subject { visit merge_request_path(merge_request) }
+
+ describe 'the status of the merge request author' do
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { merge_request.author }
+ end
+ end
+
+ context 'for notes', :js do
+ describe 'the status of the author of a note on a merge request' do
+ let(:note) { create(:note, noteable: merge_request, project: project, author: create(:user)) }
+
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { note.author }
+ end
+ end
+
+ describe 'the status of the author of a diff note on a merge request' do
+ let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project, author: create(:user)) }
+
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { note.author }
+ end
+ end
+ end
+end
diff --git a/spec/features/projects/pipelines/pipeline_spec.rb b/spec/features/projects/pipelines/pipeline_spec.rb
index ecc7cf84138..a84492ea5f1 100644
--- a/spec/features/projects/pipelines/pipeline_spec.rb
+++ b/spec/features/projects/pipelines/pipeline_spec.rb
@@ -63,6 +63,12 @@ describe 'Pipeline', :js do
expect(page).to have_css('#js-tab-pipeline.active')
end
+ it_behaves_like 'showing user status' do
+ let(:user_with_status) { pipeline.user }
+
+ subject { visit project_pipeline_path(project, pipeline) }
+ end
+
describe 'pipeline graph' do
context 'when pipeline has running builds' do
it 'shows a running icon and a cancel action for the running build' do
diff --git a/spec/features/projects/snippets/show_spec.rb b/spec/features/projects/snippets/show_spec.rb
index 3cc797277dd..f3dc13fb52f 100644
--- a/spec/features/projects/snippets/show_spec.rb
+++ b/spec/features/projects/snippets/show_spec.rb
@@ -141,4 +141,16 @@ describe 'Projects > Snippets > Project snippet', :js do
end
end
end
+
+ it_behaves_like 'showing user status' do
+ let(:file_name) { 'ruby-style-guide.md' }
+ let(:content) { project.repository.blob_at('master', 'files/markdown/ruby-style-guide.md').data }
+
+ let(:user_with_status) { snippet.author }
+
+ subject do
+ visit project_snippet_path(project, snippet)
+ wait_for_requests
+ end
+ end
end
diff --git a/spec/features/snippets/notes_on_personal_snippets_spec.rb b/spec/features/snippets/notes_on_personal_snippets_spec.rb
index 269351e55c9..1442e011d52 100644
--- a/spec/features/snippets/notes_on_personal_snippets_spec.rb
+++ b/spec/features/snippets/notes_on_personal_snippets_spec.rb
@@ -16,6 +16,8 @@ describe 'Comments on personal snippets', :js do
before do
sign_in user
visit snippet_path(snippet)
+
+ wait_for_requests
end
subject { page }
@@ -42,6 +44,15 @@ describe 'Comments on personal snippets', :js do
expect(page).to have_selector('.note-emoji-button')
end
end
+
+ it 'shows the status of a note author' do
+ status = create(:user_status, user: user)
+ visit snippet_path(snippet)
+
+ within("#note_#{snippet_notes[0].id}") do
+ expect(page).to show_user_status(status)
+ end
+ end
end
context 'when submitting a note' do
diff --git a/spec/features/snippets/show_spec.rb b/spec/features/snippets/show_spec.rb
index f31457db92f..3fe0b60b18f 100644
--- a/spec/features/snippets/show_spec.rb
+++ b/spec/features/snippets/show_spec.rb
@@ -155,4 +155,12 @@ describe 'Snippet', :js do
end
end
end
+
+ it_behaves_like 'showing user status' do
+ let(:file_name) { 'popen.rb' }
+ let(:content) { project.repository.blob_at('master', 'files/ruby/popen.rb').data }
+ let(:user_with_status) { snippet.author }
+
+ subject { visit snippet_path(snippet) }
+ end
end
diff --git a/spec/features/users/show_spec.rb b/spec/features/users/show_spec.rb
index 207c333c636..bc07ab48c39 100644
--- a/spec/features/users/show_spec.rb
+++ b/spec/features/users/show_spec.rb
@@ -53,6 +53,14 @@ describe 'User page' do
end
end
+ it 'shows the status if there was one' do
+ create(:user_status, user: user, message: "Working hard!")
+
+ visit(user_path(user))
+
+ expect(page).to have_content("Working hard!")
+ end
+
context 'signup disabled' do
it 'shows the sign in link' do
stub_application_setting(signup_enabled: false)