Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-22 21:04:29 +0300
committerRémy Coutable <remy@rymai.me>2017-03-22 23:55:02 +0300
commit709a566700df5cb2b43adfd1ad90a997aa36251d (patch)
tree6ed858f614a981fa0a36fdd7da1236440b374415 /spec/features/participants_autocomplete_spec.rb
parentf879e40da73b0c149c0928883ad8965224fab8d3 (diff)
Fix spec/features/participants_autocomplete_spec.rb
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/features/participants_autocomplete_spec.rb')
-rw-r--r--spec/features/participants_autocomplete_spec.rb95
1 files changed, 28 insertions, 67 deletions
diff --git a/spec/features/participants_autocomplete_spec.rb b/spec/features/participants_autocomplete_spec.rb
index c2545b0c259..decad589c23 100644
--- a/spec/features/participants_autocomplete_spec.rb
+++ b/spec/features/participants_autocomplete_spec.rb
@@ -1,101 +1,62 @@
require 'spec_helper'
-feature 'Member autocomplete', feature: true do
- include WaitForAjax
-
+feature 'Member autocomplete', :js do
let(:project) { create(:project, :public) }
let(:user) { create(:user) }
- let(:participant) { create(:user) }
let(:author) { create(:user) }
+ let(:note) { create(:note, noteable: noteable, project: noteable.project) }
before do
- allow_any_instance_of(Commit).to receive(:author).and_return(author)
- login_as user
+ note # actually create the note
+ login_as(user)
end
- shared_examples "open suggestions" do
- it 'displays suggestions' do
- expect(page).to have_selector('.atwho-view', visible: true)
- end
-
- it 'suggests author' do
- page.within('.atwho-view', visible: true) do
- expect(page).to have_content(author.username)
+ shared_examples "open suggestions when typing @" do
+ before do
+ page.within('.new-note') do
+ find('#note_note').send_keys('@')
end
end
- it 'suggests participant' do
+ it 'suggests noteable author and note author' do
page.within('.atwho-view', visible: true) do
- expect(page).to have_content(participant.username)
+ expect(page).to have_content(author.username)
+ expect(page).to have_content(note.author.username)
end
end
end
- context 'adding a new note on a Issue', js: true do
+ context 'adding a new note on a Issue' do
+ let(:noteable) { create(:issue, author: author, project: project) }
before do
- issue = create(:issue, author: author, project: project)
- create(:note, note: 'Ultralight Beam', noteable: issue,
- project: project, author: participant)
- visit_issue(project, issue)
+ visit namespace_project_issue_path(project.namespace, project, noteable)
end
- context 'when typing @' do
- include_examples "open suggestions"
- before do
- open_member_suggestions
- end
- end
+ include_examples "open suggestions when typing @"
end
- context 'adding a new note on a Merge Request ', js: true do
+ context 'adding a new note on a Merge Request' do
+ let(:noteable) do
+ create(:merge_request, source_project: project,
+ target_project: project, author: author)
+ end
before do
- merge = create(:merge_request, source_project: project, target_project: project, author: author)
- create(:note, note: 'Ultralight Beam', noteable: merge,
- project: project, author: participant)
- visit_merge_request(project, merge)
+ visit namespace_project_merge_request_path(project.namespace, project, noteable)
end
- context 'when typing @' do
- include_examples "open suggestions"
- before do
- open_member_suggestions
- end
- end
+ include_examples "open suggestions when typing @"
end
- context 'adding a new note on a Commit ', js: true do
- let(:commit) { project.commit }
+ context 'adding a new note on a Commit' do
+ let(:noteable) { project.commit }
+ let(:note) { create(:note_on_commit, project: project, commit_id: project.commit.id) }
before do
- allow(commit).to receive(:author).and_return(author)
- create(:note_on_commit, author: participant, project: project, commit_id: project.repository.commit.id, note: 'No More Parties in LA')
- visit_commit(project, commit)
- end
-
- context 'when typing @' do
- include_examples "open suggestions"
- before do
- open_member_suggestions
- end
- end
- end
+ allow_any_instance_of(Commit).to receive(:author).and_return(author)
- def open_member_suggestions
- page.within('.new-note') do
- find('#note_note').send_keys('@')
+ visit namespace_project_commit_path(project.namespace, project, noteable)
end
- wait_for_ajax
- 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
- def visit_commit(project, commit)
- visit namespace_project_commit_path(project.namespace, project, commit)
+ include_examples "open suggestions when typing @"
end
end