Created
April 28, 2010 13:34
-
-
Save pmenglund/382136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ||= "[email protected]" | |
@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 ||= "[email protected]" | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment