debian-mirror-gitlab/spec/features/issues/award_spec.rb

56 lines
1.5 KiB
Ruby
Raw Normal View History

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
2017-08-17 22:00:37 +05:30
include WaitForVueResource
before do
login_as(user)
visit namespace_project_issue_path(project.namespace, project, issue)
2017-08-17 22:00:37 +05:30
wait_for_vue_resource
end
2016-09-13 17:45:13 +05:30
it 'adds 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
2016-09-13 17:45:13 +05:30
it 'removes 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
2016-09-13 17:45:13 +05:30
it 'only has 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
2017-08-17 22:00:37 +05:30
include WaitForVueResource
before do
visit namespace_project_issue_path(project.namespace, project, issue)
2017-08-17 22:00:37 +05:30
wait_for_vue_resource
end
2016-09-13 17:45:13 +05:30
it 'does not see award menu button' do
expect(page).not_to have_selector('.js-award-holder')
end
end
end