Sha256: b31564b5b02e2fbc88d7852dcaea10c4efbba4fd1293afee78517ceafb732d07

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

require 'spec_helper'
require 'fileutils'

describe Safely::Backtrace do
  before(:each) do
    @temp_dir = File.expand_path('../backtrace/tmp', __FILE__)

    FileUtils.rm_rf( @temp_dir )
    FileUtils.mkdir_p( @temp_dir )
  end

  it "can be configured" do
    Safely::Backtrace.should respond_to(:trace_directory)
  end

  it "can be enabled" do
    Safely::Backtrace.enable!
  end

  it "should log a backtrace on unsafe shutdown" do
    `ruby #{File.expand_path('../backtrace/unsafe.rb', __FILE__)}`

    entries = Dir["#{@temp_dir}/backtrace-*.log"]
    entries.should_not be_empty
  end

  it "should not log a backtrace on a safe shutdown" do
    `ruby #{File.expand_path('../backtrace/safe.rb', __FILE__)}`

    entries = Dir["#{@temp_dir}/backtrace-*.log"]
    entries.should be_empty
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
safely-0.3.2 spec/backtrace_spec.rb
safely-0.3.1 spec/backtrace_spec.rb
safely-0.3.0 spec/backtrace_spec.rb