Sha256: 3f42a4c30971ee53edca8f86dabe925c776a045ee7b8169a2fd4d65327c9609f

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

require 'base_test'
require 'methadone'
require 'stringio'

class TestExitNow < BaseTest
  include Methadone
  include Methadone::ExitNow

  test_that "exit_now raises the proper error" do
    Given {
      @exit_code = any_int :min => 1
      @message = any_string
    }
    When {
      @code = lambda { exit_now!(@exit_code,@message) }
    }
    Then {
      exception = assert_raises(Methadone::Error,&@code)
      exception.exit_code.should == @exit_code
      exception.message.should == @message
    }
  end

  test_that "exit_now without an exit code uses 1 as the exit code" do
    Given {
      @message = any_string
    }
    When {
      @code = lambda { exit_now!(@message) }
    }
    Then {
      exception = assert_raises(Methadone::Error,&@code)
      exception.exit_code.should == 1
      exception.message.should == @message
    }
  end
end 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
methadone-rehab-1.9.2 test/test_exit_now.rb