diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-07-29 10:02:57 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-07-29 10:10:52 +0100 |
commit | 7573586c3be6318e19ae02ff008dfb2a576b5980 (patch) | |
tree | df84452dada69c64ebe0c09d51a994b9715fd67f /spec/spec_helper.rb | |
parent | 51a74f4b275fab25ac567843ab99b885a8444789 (diff) |
To make tests pass with RawEmails on the filesystem, instead of hacky dependency on existence of text_binary field in raw_emails model, rewrite tests (and their fixtures) to explicitly load data from FS when raw_emails are used.
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 086def32a..42c5ff6bf 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,9 +13,6 @@ config['ADMIN_PASSWORD'] = 'baz' # tests assume 20 days config['REPLY_LATE_AFTER_DAYS'] = 20 -# tests assume 20 days -config['RAW_EMAILS_LOCATION'] = 'files/raw_emails_tests' - # Uncomment the next line to use webrat's matchers #require 'webrat/integrations/rspec-rails' @@ -31,21 +28,6 @@ Spec::Runner.configure do |config| config.fixture_path = RAILS_ROOT + '/spec/fixtures/' - config.before(:each) do - # XXX this is a hack around the fact that our raw_email model - # is in transition to something that doesn't actually live in - # the database at all. The raw_email *fixture* saves to the - # model, the model then needs to be told to save itself on the - # filesystem. - begin - raw_email = raw_emails(:useless_raw_email) - raw_email.data=raw_email.dbdata - rescue NoMethodError - # only do it in tests with raw_emails fixtures - end - end - - # == Fixtures # # You can declare fixtures for each example_group like this: @@ -164,3 +146,12 @@ if $tempfilecount.nil? puts "WARNING: HTML validation script " + $html_validation_script + " not found" end end + +def load_raw_emails_data(raw_emails) + raw_email = raw_emails(:useless_raw_email) + begin + raw_email.destroy_file_representation! + rescue Errno::ENOENT + end + raw_email.data = load_file_fixture("useless_raw_email.email") +end |