diff test/functional/admin_controller_test.rb @ 1464:261b3d9a4903 redmine-2.4

Update to Redmine 2.4 branch rev 12663
author Chris Cannam
date Tue, 14 Jan 2014 14:37:42 +0000
parents 433d4f72a19b
children e248c7af89ec
line wrap: on
line diff
--- a/test/functional/admin_controller_test.rb	Fri Jun 14 09:05:06 2013 +0100
+++ b/test/functional/admin_controller_test.rb	Tue Jan 14 14:37:42 2014 +0000
@@ -1,5 +1,5 @@
 # Redmine - project management software
-# Copyright (C) 2006-2012  Jean-Philippe Lang
+# Copyright (C) 2006-2013  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -27,15 +27,13 @@
 
   def test_index
     get :index
-    assert_no_tag :tag => 'div',
-                  :attributes => { :class => /nodata/ }
+    assert_select 'div.nodata', 0
   end
 
   def test_index_with_no_configuration_data
     delete_configuration_data
     get :index
-    assert_tag :tag => 'div',
-               :attributes => { :class => /nodata/ }
+    assert_select 'div.nodata'
   end
 
   def test_projects
@@ -85,12 +83,12 @@
 
   def test_test_email
     user = User.find(1)
-    user.pref[:no_self_notified] = '1'
+    user.pref.no_self_notified = '1'
     user.pref.save!
     ActionMailer::Base.deliveries.clear
 
     get :test_email
-    assert_redirected_to '/settings/edit?tab=notifications'
+    assert_redirected_to '/settings?tab=notifications'
     mail = ActionMailer::Base.deliveries.last
     assert_not_nil mail
     user = User.find(1)
@@ -100,7 +98,7 @@
   def test_test_email_failure_should_display_the_error
     Mailer.stubs(:test_email).raises(Exception, 'Some error message')
     get :test_email
-    assert_redirected_to '/settings/edit?tab=notifications'
+    assert_redirected_to '/settings?tab=notifications'
     assert_match /Some error message/, flash[:error]
   end
 
@@ -128,8 +126,14 @@
     assert_response :success
     assert_template 'plugins'
 
-    assert_tag :td, :child => { :tag => 'span', :content => 'Foo plugin' }
-    assert_tag :td, :child => { :tag => 'span', :content => 'Bar' }
+    assert_select 'tr#plugin-foo' do
+      assert_select 'td span.name', :text => 'Foo plugin'
+      assert_select 'td.configure a[href=/settings/plugin/foo]'
+    end
+    assert_select 'tr#plugin-bar' do
+      assert_select 'td span.name', :text => 'Bar'
+      assert_select 'td.configure a', 0
+    end
   end
 
   def test_info
@@ -145,8 +149,7 @@
 
     get :index
     assert_response :success
-    assert_tag :a, :attributes => { :href => '/foo/bar' },
-                   :content => 'Test'
+    assert_select 'div#admin-menu a[href=/foo/bar]', :text => 'Test'
 
     Redmine::MenuManager.map :admin_menu do |menu|
       menu.delete :test_admin_menu_plugin_extension