summaryrefslogtreecommitdiff
path: root/features/support/hooks.rb
diff options
context:
space:
mode:
Diffstat (limited to 'features/support/hooks.rb')
-rw-r--r--features/support/hooks.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/features/support/hooks.rb b/features/support/hooks.rb
new file mode 100644
index 0000000..19928d8
--- /dev/null
+++ b/features/support/hooks.rb
@@ -0,0 +1,18 @@
+After '@tempfile' do
+ if @tempfile
+ @tempfile.close
+ @tempfile.unlink
+ end
+end
+
+After do |scenario|
+ if scenario.failed?
+ logfile_path = Rails.root + 'tmp'
+ logfile_path += "#{scenario.title.gsub(/\s/, '_')}.log"
+ File.open(logfile_path, 'w') do |test_log|
+ test_log.puts scenario.title
+ test_log.puts "========================="
+ test_log.puts `tail log/test.log -n 200`
+ end
+ end
+end