Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- When /^I connect to smtp on (.+)$/ do |server|
- @smtp = Net::SMTP.start(server, 25)
- end
- When /^the sender is (\S+)$/ do |from|
- @from = from
- end
- Then /^it should accept email to (\S+)$/ do |to|
- message = "a test message from cucumber-nagios"
- @from ||= "nobody@test.com"
- @response = @smtp.send_message message, @from, to
- end
- Then /^the response should be (\d+)$/ do |code|
- @response.status.should == code
- end
- Then /^it should reject email to (\S+)$/ do |to|
- message = "a test message from cucumber-nagios"
- @from ||= "nobody@test.com"
- lambda {
- @smtp.send_message message, @from, to
- }.should raise_error(Net::SMTPFatalError)
- end
- Then /^it should close the connection successfully$/ do
- response = @smtp.finish
- response.status.should == "221"
- end
Add Comment
Please, Sign In to add comment