diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-01-29 20:24:39 +0000 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-01-29 20:24:39 +0000 |
commit | 59b5b15d56600ffc26d657dfea134ffcfc879725 (patch) | |
tree | 46b2fd44234965ff32725c499571b4c9d2814ec4 /spec/spec_helper.rb | |
parent | cb9c215d3eb3369d7f619d98c55e357247ca72d1 (diff) | |
parent | 500b4d37702cdbad113ccb94c875e90dd770231a (diff) |
Merge branch 'release/0.5' into develop
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 33a28449e..065d9d080 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -107,7 +107,7 @@ def validate_html(html) File.open(tempfilename, "w+") do |f| f.puts html end - if not system($html_validation_script, tempfilename) + if not system($html_validation_script, *($html_validation_script_options +[tempfilename])) raise "HTML validation error in " + tempfilename + " HTTP status: " + @response.response_code.to_s end File.unlink(tempfilename) @@ -131,6 +131,7 @@ utility_search_path = MySociety::Config.get("UTILITY_SEARCH_PATH", ["/usr/bin", $html_validation_script_found = false utility_search_path.each do |d| $html_validation_script = File.join(d, "validate") + $html_validation_script_options = ["--charset=utf-8"] if File.file? $html_validation_script and File.executable? $html_validation_script $html_validation_script_found = true break @@ -178,13 +179,12 @@ def safe_mock_model(model, args = {}) mock end -def load_raw_emails_data(raw_emails) - raw_email = raw_emails(:useless_raw_email) - begin - raw_email.destroy_file_representation! - rescue Errno::ENOENT +def load_raw_emails_data + raw_emails_yml = File.join(Spec::Runner.configuration.fixture_path, "raw_emails.yml") + for raw_email_id in YAML::load_file(raw_emails_yml).map{|k,v| v["id"]} do + raw_email = RawEmail.find(raw_email_id) + raw_email.data = load_file_fixture("raw_emails/%d.email" % [raw_email_id]) end - raw_email.data = load_file_fixture("useless_raw_email.email") end def parse_all_incoming_messages |