2018-04-03 06:27:56 -04:00
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
describe "User toggles subscription", :js do
|
2018-05-01 03:18:32 -04:00
|
|
|
let(:project) { create(:project_empty_repo, :public) }
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:issue) { create(:issue, project: project, author: user) }
|
2018-04-03 06:27:56 -04:00
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_developer(user)
|
|
|
|
sign_in(user)
|
|
|
|
|
|
|
|
visit(project_issue_path(project, issue))
|
|
|
|
end
|
|
|
|
|
2018-05-01 03:18:32 -04:00
|
|
|
it "unsubscribes from issue" do
|
2018-04-03 06:27:56 -04:00
|
|
|
subscription_button = find(".js-issuable-subscribe-button")
|
|
|
|
|
|
|
|
# Check we're subscribed.
|
|
|
|
expect(subscription_button).to have_css("button.is-checked")
|
|
|
|
|
|
|
|
# Toggle subscription.
|
|
|
|
find(".js-issuable-subscribe-button button").click
|
|
|
|
wait_for_requests
|
|
|
|
|
|
|
|
# Check we're unsubscribed.
|
|
|
|
expect(subscription_button).to have_css("button:not(.is-checked)")
|
|
|
|
end
|
|
|
|
end
|