diff options
-rw-r--r-- | spec/spec_helper.rb.rails2 | 12 | ||||
-rw-r--r-- | spec/support/load_email_fixtures.rb | 19 | ||||
-rw-r--r-- | spec/support/load_raw_emails.rb | 7 |
3 files changed, 19 insertions, 19 deletions
diff --git a/spec/spec_helper.rb.rails2 b/spec/spec_helper.rb.rails2 index ab2f11d27..a904f7bad 100644 --- a/spec/spec_helper.rb.rails2 +++ b/spec/spec_helper.rb.rails2 @@ -95,14 +95,6 @@ Spec::Runner.configure do |config| end # XXX No idea what namespace/class/module to put this in -def receive_incoming_mail(email_name, email_to, email_from = 'geraldinequango@localhost') - email_name = file_fixture_name(email_name) - content = File.read(email_name) - content.gsub!('EMAIL_TO', email_to) - content.gsub!('EMAIL_FROM', email_from) - RequestMailer.receive(content) -end - def parse_all_incoming_messages IncomingMessage.find(:all).each{ |x| x.parse_raw_email! } end @@ -164,10 +156,6 @@ def safe_mock_model(model, args = {}) mock end -def get_fixture_mail(filename) - MailHandler.mail_from_raw_email(load_file_fixture(filename)) -end - def load_test_categories PublicBodyCategories.add(:en, [ "Local and regional", diff --git a/spec/support/load_email_fixtures.rb b/spec/support/load_email_fixtures.rb new file mode 100644 index 000000000..d0575f029 --- /dev/null +++ b/spec/support/load_email_fixtures.rb @@ -0,0 +1,19 @@ +def load_raw_emails_data + raw_emails_yml = File.join(RSpec.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 +end + +def receive_incoming_mail(email_name, email_to, email_from = 'geraldinequango@localhost') + email_name = file_fixture_name(email_name) + content = File.read(email_name) + content.gsub!('EMAIL_TO', email_to) + content.gsub!('EMAIL_FROM', email_from) + RequestMailer.receive(content) +end + +def get_fixture_mail(filename) + MailHandler.mail_from_raw_email(load_file_fixture(filename)) +end diff --git a/spec/support/load_raw_emails.rb b/spec/support/load_raw_emails.rb deleted file mode 100644 index db9e2884e..000000000 --- a/spec/support/load_raw_emails.rb +++ /dev/null @@ -1,7 +0,0 @@ -def load_raw_emails_data - raw_emails_yml = File.join(RSpec.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 -end |