summaryrefslogtreecommitdiff
path: root/spec/features/issues/award_spec.rb
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-06-14 00:31:45 +0300
committerFatih Acet <acetfatih@gmail.com>2016-06-14 00:31:45 +0300
commit6dbca80c46093443e69f3faace6f1967570b15fa (patch)
treed3e351e4ed25c347978f33176c729c0495b7de74 /spec/features/issues/award_spec.rb
parent8c058e8563c287817b81a9a122ceeb5a69f6b221 (diff)
parent4a8ae77ebac46545fa4811ea60bf53d1e81f10fc (diff)
downloadgitlab-ce-remove-comment-toggle.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into remove-comment-toggleremove-comment-toggle
Diffstat (limited to 'spec/features/issues/award_spec.rb')
-rw-r--r--spec/features/issues/award_spec.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/features/issues/award_spec.rb b/spec/features/issues/award_spec.rb
new file mode 100644
index 00000000000..63efecf8780
--- /dev/null
+++ b/spec/features/issues/award_spec.rb
@@ -0,0 +1,49 @@
+require 'rails_helper'
+
+feature 'Issue awards', js: true, feature: true do
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :public) }
+ let(:issue) { create(:issue, project: project) }
+
+ describe 'logged in' do
+ before do
+ login_as(user)
+ visit namespace_project_issue_path(project.namespace, project, issue)
+ end
+
+ it 'should add award to issue' do
+ first('.js-emoji-btn').click
+ expect(page).to have_selector('.js-emoji-btn.active')
+ expect(first('.js-emoji-btn')).to have_content '1'
+
+ visit namespace_project_issue_path(project.namespace, project, issue)
+ expect(first('.js-emoji-btn')).to have_content '1'
+ end
+
+ it 'should remove award from issue' do
+ first('.js-emoji-btn').click
+ find('.js-emoji-btn.active').click
+ expect(first('.js-emoji-btn')).to have_content '0'
+
+ visit namespace_project_issue_path(project.namespace, project, issue)
+ expect(first('.js-emoji-btn')).to have_content '0'
+ end
+
+ it 'should only have one menu on the page' do
+ first('.js-add-award').click
+ expect(page).to have_selector('.emoji-menu')
+
+ expect(page).to have_selector('.emoji-menu', count: 1)
+ end
+ end
+
+ describe 'logged out' do
+ before do
+ visit namespace_project_issue_path(project.namespace, project, issue)
+ end
+
+ it 'should not see award menu button' do
+ expect(page).not_to have_selector('.js-award-holder')
+ end
+ end
+end