Sha256: 7cd87ecf2be00459608793106dcd05bb7f1cf44190650a75ed15bb1de0977cd2

Contents?: true

Size: 984 Bytes

Versions: 15

Compression:

Stored size: 984 Bytes

Contents

require 'test/unit'
require 'rbatch'

class RuncherTest < Test::Unit::TestCase
  def setup
    @config_dir =  File.join(File.dirname(RBatch.program_name), "..", "conf")
    @config_file = File.join(@config_dir , "test_config.yaml")
    Dir::mkdir(@config_dir) if ! Dir.exists? @config_dir
  end

  def teardown
    File.delete @config_file if File.exist? @config_file
  end

  def test_require
  end

  def test_config
    open( @config_file  , "w" ){|f| f.write("key: value")}
    assert_equal "value",  RBatch.config["key"]
  end

  def test_read_error
    assert_raise(Errno::ENOENT){
      RBatch.config
    }
  end

  def test_double_read
    open( @config_file  , "w" ){|f| f.write("key: value")}
    assert_equal "value",  RBatch.config["key"]
    assert_equal "value",  RBatch.config["key"]
  end

  def test_not_exist_key
    open( @config_file  , "w" ){|f| f.write("key: value")}
    assert_raise(RBatch::Config::Exception){
      RBatch.config["not_exist"]
    }
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rbatch-1.13.1 test/cases/test_config.rb
rbatch-1.13.0 test/cases/test_config.rb
rbatch-1.12.3 test/cases/test_config.rb
rbatch-1.12.2 test/cases/test_config.rb
rbatch-1.12.1 test/cases/test_config.rb
rbatch-1.12.0 test/cases/test_config.rb
rbatch-1.11.0 test/cases/test_config.rb
rbatch-1.10.0 test/cases/test_config.rb
rbatch-1.9.0 test/cases/test_config.rb
rbatch-1.8.2 test/cases/test_config.rb
rbatch-1.8.1 test/cases/test_config.rb
rbatch-1.8.0 test/cases/test_config.rb
rbatch-1.7.0 test/cases/test_config.rb
rbatch-1.6.6 test/cases/test_config.rb
rbatch-1.6.4 test/cases/test_config.rb