]> source.dussan.org Git - redmine.git/commitdiff
Adds a test for creating an issue with watchers.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Feb 2013 10:31:38 +0000 (10:31 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Feb 2013 10:31:38 +0000 (10:31 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11340 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/ui/issues_test.rb

index 43f3536ac9f4692ad31a6acb7dd5e93ccf83785e..97fd2fb795fa0eb10913156fa953a01324e4b5f5 100644 (file)
@@ -56,6 +56,32 @@ class Redmine::UiTest::IssuesTest < Redmine::UiTest::Base
     assert_equal 'Value for field 2', issue.custom_field_value(CustomField.find_by_name('Searchable field'))
   end
 
+  def test_create_issue_with_watchers
+    User.generate!(:firstname => 'Some', :lastname => 'Watcher')
+
+    assert_difference 'Issue.count' do
+      log_user('jsmith', 'jsmith')
+      visit '/projects/ecookbook/issues/new'
+      fill_in 'Subject', :with => 'Issue with watchers'
+      # Add a project member as watcher
+      check 'Dave Lopper'
+      # Search for another user
+      click_link 'Search for watchers to add'
+      within('form#new-watcher-form') do
+        assert page.has_content?('Some One')
+        fill_in 'user_search', :with => 'watch'
+        sleep(2) # autocomplete delay
+        assert !page.has_content?('Some One')
+        check 'Some Watcher'
+        click_button 'Add'
+      end
+      find('input[name=commit]').click
+    end
+
+    issue = Issue.order('id desc').first
+    assert_equal ['Dave Lopper', 'Some Watcher'], issue.watcher_users.map(&:name).sort
+  end
+
   def test_preview_issue_description
     log_user('jsmith', 'jsmith')
     visit new_issue_path(:project_id => 1)