summaryrefslogtreecommitdiff
path: root/features/support/hooks.rb
blob: 19928d8869a5be82dec2380bfbcaf1bb1db66fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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