]> source.dussan.org Git - redmine.git/commitdiff
Small test refactoring, extract method.
authorEric Davis <edavis@littlestreamsoftware.com>
Thu, 19 Aug 2010 01:28:33 +0000 (01:28 +0000)
committerEric Davis <edavis@littlestreamsoftware.com>
Thu, 19 Aug 2010 01:28:33 +0000 (01:28 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3951 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/integration/layout_test.rb
test/test_helper.rb

index 03d407d248942f34eea44509acfebf9ba0d28cbd..001bf50d2a55b769d43e3a005cac75d5e93587da 100644 (file)
@@ -13,9 +13,7 @@ class LayoutTest < ActionController::IntegrationTest
   end
 
   test "browsing to an unauthorized page should render the base layout" do
-    user = User.find(9)
-    user.password, user.password_confirmation = 'test', 'test'
-    user.save!
+    change_user_password('miscuser9', 'test')
     
     log_user('miscuser9','test')
 
index 15a1f15702d91df4c6fa3868b96510709e1a5174..dc04fa82d6aaf92249d2971de1e1c13d5123ff98 100644 (file)
@@ -86,6 +86,12 @@ class ActiveSupport::TestCase
     saved_settings.each {|k, v| Setting[k] = v}
   end
 
+  def change_user_password(login, new_password)
+    user = User.first(:conditions => {:login => login})
+    user.password, user.password_confirmation = new_password, new_password
+    user.save!
+  end
+
   def self.ldap_configured?
     @test_ldap = Net::LDAP.new(:host => '127.0.0.1', :port => 389)
     return @test_ldap.bind