Sha256: 09f59104373db75319b0d0f32a4eb9a4726e08a40a51f08a4b7c6842f302bf8b

Contents?: true

Size: 861 Bytes

Versions: 28

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 exti 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

28 entries across 28 versions & 1 rubygems

Version Path
methadone-1.9.5 test/test_exit_now.rb
methadone-1.9.4 test/test_exit_now.rb
methadone-1.9.3 test/test_exit_now.rb
methadone-1.9.2 test/test_exit_now.rb
methadone-1.9.1 test/test_exit_now.rb
methadone-1.9.0 test/test_exit_now.rb
methadone-1.8.0 test/test_exit_now.rb
methadone-1.7.0 test/test_exit_now.rb
methadone-1.6.0 test/test_exit_now.rb
methadone-1.5.1 test/test_exit_now.rb
methadone-1.5.0 test/test_exit_now.rb
methadone-1.4.0 test/test_exit_now.rb
methadone-1.3.2 test/test_exit_now.rb
methadone-1.3.1 test/test_exit_now.rb
methadone-1.3.0 test/test_exit_now.rb
methadone-1.2.6 test/test_exit_now.rb
methadone-1.2.5 test/test_exit_now.rb
methadone-1.2.4 test/test_exit_now.rb
methadone-1.2.3 test/test_exit_now.rb
methadone-1.2.2 test/test_exit_now.rb