summaryrefslogtreecommitdiff
path: root/spec/features/discussion_comments_spec.rb
diff options
context:
space:
mode:
authorLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-06 21:15:19 +0100
committerLuke "Jared" Bennett <lbennett@gitlab.com>2017-04-06 21:15:42 +0100
commita33aacd5e0e612a3c8b8cce34ed1a4dfd86ed8b8 (patch)
tree8b13f7cc9d87083facdb4be916d8644325f86e3d /spec/features/discussion_comments_spec.rb
parent1065ba4097bd50720ef8777d05c36f2e79048d46 (diff)
downloadgitlab-ce-a33aacd5e0e612a3c8b8cce34ed1a4dfd86ed8b8.tar.gz
Further fixes for feature spec
Diffstat (limited to 'spec/features/discussion_comments_spec.rb')
-rw-r--r--spec/features/discussion_comments_spec.rb55
1 files changed, 30 insertions, 25 deletions
diff --git a/spec/features/discussion_comments_spec.rb b/spec/features/discussion_comments_spec.rb
index 1c3cc086f8c..73787fb8d51 100644
--- a/spec/features/discussion_comments_spec.rb
+++ b/spec/features/discussion_comments_spec.rb
@@ -12,6 +12,34 @@ shared_examples 'discussion comments' do |resource_name|
expect(page).to have_selector toggle_selector
end
+ it '"Comment" will post a comment' do
+ find("#{form_selector} .note-textarea").send_keys('a')
+
+ find(submit_selector).click
+
+ find('.timeline .timeline-entry', match: :first)
+ new_comment = all('.timeline .timeline-entry').last
+
+ expect(new_comment).to have_content 'a'
+ expect(new_comment).not_to have_selector '.discussion'
+ end
+
+ if resource_name =~ /(issue|merge request)/
+ it "'Comment & close #{resource_name}' will post a comment and close the #{resource_name}" do
+ find("#{form_selector} .note-textarea").send_keys('a')
+
+ find(close_selector).click
+
+ find('.timeline .timeline-entry', match: :first)
+ entries = all('.timeline .timeline-entry')
+ close_note = entries.last
+ new_comment = entries[-2]
+
+ expect(close_note).to have_content 'closed'
+ expect(new_comment).not_to have_selector '.discussion'
+ end
+ end
+
describe 'when the toggle is clicked' do
before do
find("#{form_selector} .note-textarea").send_keys('a')
@@ -50,30 +78,6 @@ shared_examples 'discussion comments' do |resource_name|
expect(items.last['class']).not_to match 'droplab-item-selected'
end
- it '"Comment" will post a comment' do
- find(submit_selector).click
-
- find('.timeline .timeline-entry', match: :first)
- new_comment = all('.timeline .timeline-entry').last
-
- expect(new_comment).to have_content 'a'
- expect(new_comment).not_to have_selector '.discussion'
- end
-
- if resource_name =~ /(issue|merge request)/
- it "Comment & close' will post a comment and close the #{resource_name}" do
- find(close_selector).click
-
- find('.timeline .timeline-entry', match: :first)
- entries = all('.timeline .timeline-entry')
- close_note = entries.last
- new_comment = entries[-2]
-
- expect(close_note).to have_content 'closed'
- expect(new_comment).not_to have_selector '.discussion'
- end
- end
-
it 'closes the menu when clicking the toggle' do
find(toggle_selector).click
@@ -121,7 +125,7 @@ shared_examples 'discussion comments' do |resource_name|
end
if resource_name =~ /(issue|merge request)/
- it "'Start discussion & close' will post a discussion and close the #{resource_name}" do
+ it "'Start discussion & close #{resource_name}' will post a discussion and close the #{resource_name}" do
find(close_selector).click
find('.timeline .timeline-entry', match: :first)
@@ -204,6 +208,7 @@ end
describe 'Discussion Comments', :feature, :js do
include RepoHelpers
+ include WaitForAjax
let(:user) { create(:user) }
let(:project) { create(:project) }