aboutsummaryrefslogtreecommitdiffstats
path: root/script/load-sample-data
diff options
context:
space:
mode:
authorRobin Houston <robin.houston@gmail.com>2012-01-29 16:26:50 +0000
committerRobin Houston <robin.houston@gmail.com>2012-01-29 16:26:50 +0000
commit5aa2bd13042110e73212f83564c35b3a1d672bbb (patch)
treeba9cea38b8c326a8384da8848fad33e8ee650edb /script/load-sample-data
parentcc3b87f5367679ba9f68e88f02ec16fa9172bb0a (diff)
Load all raw emails for testing
Previously there was just one raw email, and the test code relied on that fact. Generalise it to handle multiple raw emails. This change causes a number of tests to fail, because it exposes failures that should have happened when the second raw email was added but were masked by the fact that the text of this second raw email was never loaded. These failures will be fixed in the next commit.
Diffstat (limited to 'script/load-sample-data')
-rwxr-xr-xscript/load-sample-data13
1 files changed, 6 insertions, 7 deletions
diff --git a/script/load-sample-data b/script/load-sample-data
index 84b8a28eb..92846ce17 100755
--- a/script/load-sample-data
+++ b/script/load-sample-data
@@ -4,17 +4,16 @@
# the fact that the fixtures aren't aware of the fact that RawEmails
# have a filesystem representation of their contents
-LOC=`dirname $0`
+LOC=`dirname "$0"`
+
rake --silent spec:db:fixtures:load
+
"$LOC/runner" /dev/stdin <<END
env = ENV["RAILS_ENV"]
-require "spec/spec_helper.rb" # Sets RAILS_ENV to 'test'
-ENV["RAILS_ENV"] = env
+require "spec/spec_helper.rb" # this sets RAILS_ENV to 'test'
+ENV["RAILS_ENV"] = env # so restore to what it was before
-RawEmail.all().each do |email|
- puts "Writing #{email.filepath}"
- email.data = load_file_fixture("useless_raw_email.email")
-end
+load_raw_emails_data
END
echo "Loaded fixtures."