aboutsummaryrefslogtreecommitdiffstats
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2012-01-18 08:47:35 +0000
committerSeb Bacon <seb.bacon@gmail.com>2012-01-18 08:47:35 +0000
commitebe06a0d61d9e5a65ef4d4301ed93d92aa35bd5c (patch)
tree3cf413323bd9a0b6f3dd26ccdf5941286882d141 /spec/spec_helper.rb
parentb50adc72e533a9c20aca03063a676f6af4d32b85 (diff)
parente190eebf7c4bd6a742706e60f2bf941f70d1a1e4 (diff)
Merge branch 'release/0.5' of github.com:sebbacon/alaveteli into release/0.5
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 8dabfce7f..a290ab5bb 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -121,16 +121,24 @@ def validate_as_body(html)
end
def basic_auth_login(request, username = nil, password = nil)
- username = MySociety::Config.get('ADMIN_USERNAME') if username.nil?
+ username = MySociety::Config.get('ADMIN_USERNAME') if username.nil?
password = MySociety::Config.get('ADMIN_PASSWORD') if password.nil?
request.env["HTTP_AUTHORIZATION"] = "Basic " + Base64::encode64("#{username}:#{password}")
end
# Monkeypatch! Validate HTML in tests.
-$html_validation_script = "/usr/bin/validate" # from Debian package wdg-html-validator
+utility_search_path = MySociety::Config.get("UTILITY_SEARCH_PATH", ["/usr/bin", "/usr/local/bin"])
+$html_validation_script_found = false
+utility_search_path.each do |d|
+ $html_validation_script = File.join(d, "validate")
+ if File.file? $html_validation_script and File.executable? $html_validation_script
+ $html_validation_script_found = true
+ break
+ end
+end
if $tempfilecount.nil?
$tempfilecount = 0
- if File.exist?($html_validation_script)
+ if $html_validation_script_found
module ActionController
module TestProcess
# Hook into the process function, so can automatically get HTML after each request