diff options
-rw-r--r-- | spec/models/exim_log_spec.rb | 15 |
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 |