Mercurial > hg > soundsoftware-site
comparison test/.svn/text-base/test_helper.rb.svn-base @ 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 |
comparison
equal
deleted
inserted
replaced
245:051f544170fe | 441:cbce1fd3b1b7 |
---|---|
1 # redMine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006 Jean-Philippe Lang | 2 # Copyright (C) 2006-2011 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
85 | 85 |
86 def with_settings(options, &block) | 86 def with_settings(options, &block) |
87 saved_settings = options.keys.inject({}) {|h, k| h[k] = Setting[k].dup; h} | 87 saved_settings = options.keys.inject({}) {|h, k| h[k] = Setting[k].dup; h} |
88 options.each {|k, v| Setting[k] = v} | 88 options.each {|k, v| Setting[k] = v} |
89 yield | 89 yield |
90 ensure | |
90 saved_settings.each {|k, v| Setting[k] = v} | 91 saved_settings.each {|k, v| Setting[k] = v} |
91 end | 92 end |
92 | 93 |
93 def change_user_password(login, new_password) | 94 def change_user_password(login, new_password) |
94 user = User.first(:conditions => {:login => login}) | 95 user = User.first(:conditions => {:login => login}) |
105 end | 106 end |
106 | 107 |
107 # Returns the path to the test +vendor+ repository | 108 # Returns the path to the test +vendor+ repository |
108 def self.repository_path(vendor) | 109 def self.repository_path(vendor) |
109 File.join(RAILS_ROOT.gsub(%r{config\/\.\.}, ''), "/tmp/test/#{vendor.downcase}_repository") | 110 File.join(RAILS_ROOT.gsub(%r{config\/\.\.}, ''), "/tmp/test/#{vendor.downcase}_repository") |
111 end | |
112 | |
113 # Returns the url of the subversion test repository | |
114 def self.subversion_repository_url | |
115 path = repository_path('subversion') | |
116 path = '/' + path unless path.starts_with?('/') | |
117 "file://#{path}" | |
110 end | 118 end |
111 | 119 |
112 # Returns true if the +vendor+ test repository is configured | 120 # Returns true if the +vendor+ test repository is configured |
113 def self.repository_configured?(vendor) | 121 def self.repository_configured?(vendor) |
114 File.directory?(repository_path(vendor)) | 122 File.directory?(repository_path(vendor)) |
414 end | 422 end |
415 | 423 |
416 # Checks that the response is a valid JSON string | 424 # Checks that the response is a valid JSON string |
417 def self.should_be_a_valid_json_string | 425 def self.should_be_a_valid_json_string |
418 should "be a valid JSON string (or empty)" do | 426 should "be a valid JSON string (or empty)" do |
419 assert (response.body.blank? || ActiveSupport::JSON.decode(response.body)) | 427 assert(response.body.blank? || ActiveSupport::JSON.decode(response.body)) |
420 end | 428 end |
421 end | 429 end |
422 | 430 |
423 # Checks that the response is a valid XML string | 431 # Checks that the response is a valid XML string |
424 def self.should_be_a_valid_xml_string | 432 def self.should_be_a_valid_xml_string |