OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/spec/features/work_packages/details/details_toolbar_spec.rb

30 lines
1.0 KiB

9 years ago
require 'spec_helper'
require 'features/work_packages/work_packages_page'
describe 'Work package details toolbar', js: true, selenium: true do
let(:project) { FactoryGirl.create :project_with_types, is_public: true }
let!(:work_package) { FactoryGirl.create :work_package, project: project }
let(:work_packages_page) { WorkPackagesPage.new(project) }
describe 'toggle watch state' do
let(:user) { FactoryGirl.create :admin }
before do
login_as(user)
work_packages_page.visit_index(work_package)
end
it 'toggles the watch state' do
expect(work_package.watcher_users).not_to include(user)
expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Watch')
within '.work-packages--details-toolbar' do
click_button 'Watch'
end
wait_until_requests_completed!
expect(work_package.reload.watcher_users).to include(user)
expect(page).to have_selector('.work-packages--details-toolbar button', text: 'Unwatch')
end
end
end