aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Landauer <matthew@openaustralia.org>2012-10-10 09:52:47 +1100
committerMatthew Landauer <matthew@openaustralia.org>2012-10-10 09:52:47 +1100
commitfa4d356514c2fab1a55c2bb5e9d6eebb01624354 (patch)
treefb49223db0421c14ea3450427cddab575097242c
parent4047684a7b3ae795852711af747402ab6aceae16 (diff)
Add a second log line to the test
-rw-r--r--spec/models/exim_log_spec.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/models/exim_log_spec.rb b/spec/models/exim_log_spec.rb
index f4fc984e9..3151bcbe8 100644
--- a/spec/models/exim_log_spec.rb
+++ b/spec/models/exim_log_spec.rb
@@ -5,16 +5,23 @@ describe EximLog do
it "loads relevant lines of an uncompressed exim log file" do
Configuration.stub!(:incoming_email_domain).and_return("example.com")
File.stub_chain(:stat, :mtime).and_return(Date.new(2012, 10, 10))
- log = ["This is a line of a logfile relevant to foi+request-1234@example.com"]
+ log = [
+ "This is a line of a logfile relevant to foi+request-1234@example.com",
+ "This is the second line for the same foi+request-1234@example.com email address"
+ ]
File.should_receive(:open).with("/var/log/exim4/exim-mainlog-2012-10-10", "r").and_return(log)
ir = info_requests(:fancy_dog_request)
- InfoRequest.should_receive(:find_by_incoming_email).with("request-1234@example.com").and_return(ir)
+ InfoRequest.should_receive(:find_by_incoming_email).with("request-1234@example.com").twice.and_return(ir)
EximLog.load_file("/var/log/exim4/exim-mainlog-2012-10-10")
- ir.exim_logs.count.should == 1
- log = ir.exim_logs.first
+ ir.exim_logs.count.should == 2
+ log = ir.exim_logs[0]
log.order.should == 1
log.line.should == "This is a line of a logfile relevant to foi+request-1234@example.com"
+
+ log = ir.exim_logs[1]
+ log.order.should == 2
+ log.line.should == "This is the second line for the same foi+request-1234@example.com email address"
end
end
end