summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArinde Eniola <eniolaarinde1@gmail.com>2016-04-05 23:26:17 +0100
committerArinde Eniola <eniolaarinde1@gmail.com>2016-04-09 23:31:45 +0100
commit91905ae3f5a9f755258b770482cd45916ee47fe4 (patch)
treeb2bbabb9b43267f1a5b20e470fa3afebf940724f
parentb95c9217b75d84412d9a3e4f52f31158329755f4 (diff)
downloadgitlab-ce-91905ae3f5a9f755258b770482cd45916ee47fe4.tar.gz
write test to prevent reoccurence of issueprevent_users_from_upvoting_downvoting_emoji
-rw-r--r--spec/features/issues/award_emoji_spec.rb64
1 files changed, 64 insertions, 0 deletions
diff --git a/spec/features/issues/award_emoji_spec.rb b/spec/features/issues/award_emoji_spec.rb
new file mode 100644
index 00000000000..41af789aae2
--- /dev/null
+++ b/spec/features/issues/award_emoji_spec.rb
@@ -0,0 +1,64 @@
+require 'rails_helper'
+
+describe 'Awards Emoji', feature: true do
+ let!(:project) { create(:project) }
+ let!(:user) { create(:user) }
+
+ before do
+ project.team << [user, :master]
+ login_as(user)
+ end
+
+ describe 'Click award emoji from issue#show' do
+ let!(:issue) do
+ create(:issue,
+ author: @user,
+ assignee: @user,
+ project: project)
+ end
+
+ before do
+ visit namespace_project_issue_path(project.namespace, project, issue)
+ end
+
+ it 'should increment the thumbsdown emoji', js: true do
+ find('[data-emoji="thumbsdown"]').click
+ sleep 2
+ expect(thumbsdown_emoji).to have_text("1")
+ end
+
+ context 'click the thumbsup emoji' do
+
+ it 'should increment the thumbsup emoji', js: true do
+ find('[data-emoji="thumbsup"]').click
+ sleep 2
+ expect(thumbsup_emoji).to have_text("1")
+ end
+
+ it 'should decrement the thumbsdown emoji', js: true do
+ expect(thumbsdown_emoji).to have_text("0")
+ end
+ end
+
+ context 'click the thumbsdown emoji' do
+
+ it 'should increment the thumbsdown emoji', js: true do
+ find('[data-emoji="thumbsdown"]').click
+ sleep 2
+ expect(thumbsdown_emoji).to have_text("1")
+ end
+
+ it 'should decrement the thumbsup emoji', js: true do
+ expect(thumbsup_emoji).to have_text("0")
+ end
+ end
+ end
+
+ def thumbsup_emoji
+ page.all('span.js-counter').first
+ end
+
+ def thumbsdown_emoji
+ page.all('span.js-counter').last
+ end
+end