2017-10-04 18:31:34 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'User manages subscription', :js do
|
|
|
|
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-07-11 10:36:08 -04:00
|
|
|
project.add_maintainer(user)
|
2017-10-04 18:31:34 -04:00
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(merge_request_path(merge_request))
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'toggles subscription' do
|
2018-01-12 02:40:31 -05:00
|
|
|
page.within('.js-issuable-subscribe-button') do
|
|
|
|
expect(page).to have_css 'button:not(.is-checked)'
|
|
|
|
find('button:not(.is-checked)').click
|
2017-10-04 18:31:34 -04:00
|
|
|
|
2018-01-12 02:40:31 -05:00
|
|
|
wait_for_requests
|
2017-10-04 18:31:34 -04:00
|
|
|
|
2018-01-12 02:40:31 -05:00
|
|
|
expect(page).to have_css 'button.is-checked'
|
|
|
|
find('button.is-checked').click
|
2017-10-04 18:31:34 -04:00
|
|
|
|
2018-01-12 02:40:31 -05:00
|
|
|
wait_for_requests
|
2017-10-04 18:31:34 -04:00
|
|
|
|
2018-01-12 02:40:31 -05:00
|
|
|
expect(page).to have_css 'button:not(.is-checked)'
|
|
|
|
end
|
2017-10-04 18:31:34 -04:00
|
|
|
end
|
|
|
|
end
|