2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.describe 'User manages subscription', :js do
|
2018-03-17 18:26:18 +05:30
|
|
|
let(:project) { create(:project, :public, :repository) }
|
|
|
|
let(:merge_request) { create(:merge_request, source_project: project, target_project: project) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2018-03-17 18:26:18 +05:30
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(merge_request_path(merge_request))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'toggles subscription' do
|
|
|
|
page.within('.js-issuable-subscribe-button') do
|
2020-04-08 14:13:33 +05:30
|
|
|
wait_for_requests
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
expect(page).to have_css 'button:not(.is-checked)'
|
|
|
|
find('button:not(.is-checked)').click
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_css 'button.is-checked'
|
|
|
|
find('button.is-checked').click
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
expect(page).to have_css 'button:not(.is-checked)'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|