summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-04-09 01:34:07 -0500
committerJacob Schatz <jacobschatz@Jacobs-MBP.fios-router.home>2016-04-16 07:21:28 -0400
commit40efb4eb1fb3a1863f16488c7a468d4ca140500a (patch)
tree1fd5d054134154165306a5b2b07624273b39ebcb
parenta740f0bc99a67d25ed156353055de3b4fe0064a6 (diff)
downloadgitlab-ce-40efb4eb1fb3a1863f16488c7a468d4ca140500a.tar.gz
Add tests for autocomplete on a Merge Request
-rw-r--r--spec/features/participants_autocomplete_spec.rb81
1 files changed, 52 insertions, 29 deletions
diff --git a/spec/features/participants_autocomplete_spec.rb b/spec/features/participants_autocomplete_spec.rb
index f966fcbbfa1..5f1b5fd6b54 100644
--- a/spec/features/participants_autocomplete_spec.rb
+++ b/spec/features/participants_autocomplete_spec.rb
@@ -5,49 +5,72 @@ feature 'Member autocomplete', feature: true do
let(:user) { create(:user) }
let(:participant) { create(:user) }
let(:author) { create(:user) }
- let(:issue) { create(:issue, author: author, project: project) }
before do
login_as user
end
- describe 'On a Issue', js: true do
+ shared_examples "open suggestions" do
+ it 'suggestions are displayed' do
+ expect(page).to have_selector('.atwho-view', visible: true)
+ end
+
+ it 'author is suggested' do
+ page.within('.atwho-view', visible: true) do
+ expect(page).to have_content(author.username)
+ end
+ end
+
+ it 'participant is suggested' do
+ page.within('.atwho-view', visible: true) do
+ expect(page).to have_content(participant.username)
+ end
+ end
+ end
+
+ context 'On a Issue adding a new note', js: true do
before do
- create(:note, note: 'ultralight beam', noteable: issue, author: participant)
+ issue = create(:issue, author: author, project: project)
+ create(:note, note: 'Ultralight Beam', noteable: issue, author: participant)
visit_issue(project, issue)
end
- describe 'adding a new note' do
- describe 'when typing @' do
-
- before do
- sleep 1
- page.within('.new-note') do
- sleep 1
- find('#note_note').native.send_keys('@')
- end
- end
-
- it 'suggestions are displayed' do
- expect(page).to have_selector('.atwho-view', visible: true)
- end
-
- it 'author is a suggestion' do
- page.within('.atwho-view', visible: true) do
- expect(page).to have_content(author.username)
- end
- end
-
- it 'participant is a suggestion' do
- page.within('.atwho-view', visible: true) do
- expect(page).to have_content(participant.username)
- end
- end
+ context 'when typing @' do
+ include_examples "open suggestions"
+ before do
+ open_member_suggestions
end
end
end
+ context 'On a Merge Request adding a new note', js: true do
+ before do
+ merge = create(:merge_request, source_project: project, target_project: project, author: author)
+ create(:note, note: 'Ultralight Beam', noteable: merge, author: participant)
+ visit_merge_request(project, merge)
+ end
+
+ context 'when typing @' do
+ include_examples "open suggestions"
+ before do
+ open_member_suggestions
+ end
+ end
+ end
+
+ def open_member_suggestions
+ sleep 1
+ page.within('.new-note') do
+ sleep 1
+ find('#note_note').native.send_keys('@')
+ end
+ end
+
def visit_issue(project, issue)
visit namespace_project_issue_path(project.namespace, project, issue)
end
+
+ def visit_merge_request(project, merge)
+ visit namespace_project_merge_request_path(project.namespace, project, merge)
+ end
end