diff test/test_helper.rb @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents 8661b858af72
children 753f1380d6bc cbb26bc654de
line wrap: on
line diff
--- a/test/test_helper.rb	Thu Mar 03 11:42:28 2011 +0000
+++ b/test/test_helper.rb	Mon Jun 06 14:24:13 2011 +0100
@@ -1,5 +1,5 @@
-# redMine - project management software
-# Copyright (C) 2006  Jean-Philippe Lang
+# Redmine - project management software
+# Copyright (C) 2006-2011  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
@@ -87,6 +87,7 @@
     saved_settings = options.keys.inject({}) {|h, k| h[k] = Setting[k].dup; h}
     options.each {|k, v| Setting[k] = v}
     yield
+  ensure
     saved_settings.each {|k, v| Setting[k] = v}
   end
 
@@ -109,6 +110,13 @@
     File.join(RAILS_ROOT.gsub(%r{config\/\.\.}, ''), "/tmp/test/#{vendor.downcase}_repository")
   end
   
+  # Returns the url of the subversion test repository
+  def self.subversion_repository_url
+    path = repository_path('subversion')
+    path = '/' + path unless path.starts_with?('/')
+    "file://#{path}"
+  end
+  
   # Returns true if the +vendor+ test repository is configured
   def self.repository_configured?(vendor)
     File.directory?(repository_path(vendor))
@@ -416,7 +424,7 @@
   # Checks that the response is a valid JSON string
   def self.should_be_a_valid_json_string
     should "be a valid JSON string (or empty)" do
-      assert (response.body.blank? || ActiveSupport::JSON.decode(response.body))
+      assert(response.body.blank? || ActiveSupport::JSON.decode(response.body))
     end
   end