Created
August 26, 2009 03:44
-
-
Save georg/175282 to your computer and use it in GitHub Desktop.
Revisions
-
georg created this gist
Aug 26, 2009 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ # Put this in features/env/mailtrap.rb to automatically run mailtrap for your Cucumber tests. class Mailtrap def self.start @mailtrap_file = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tmp', 'mailtrap.log')) clear_mailtrap_file @mailtrap = IO.popen("mailtrap run --file=#{@mailtrap_file}") end def self.clear_mailtrap_file FileUtils.rm_f @mailtrap_file end def self.stop Process.kill('HUP', @mailtrap.pid) end def self.content File.read(@mailtrap_file) end end Mailtrap.start at_exit do Mailtrap.stop end After do |scenario| unless scenario.failed? Mailtrap.clear_mailtrap_file end end