Sha256: 17cb0fdd75d1ecdeb8f6a5b6b37e13534f0717cffeb1bf49ae07a380ab994718

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

$:.unshift(File.dirname(__FILE__))
require 'abstract_unit'

class LuRuJuServerTest < Test::Unit::TestCase
  
  def setup
    super
    Luruju::Configuration.uninstall    
  end
  
  def teardown
    super
    Luruju::Configuration.install
  end
    
  def test_default_config
    default_config = Luruju::Configuration.default
    assert_equal :drb, default_config.access_jruby_with 
    assert_equal 3937, default_config.drb_port 
  end

  def test_set_config
    config = Luruju::Configuration.new do |config|
      config.access_jruby_with = :command
      config.drb_port = 9999
    end
    assert_equal :command, config.access_jruby_with 
    assert_equal 9999, config.drb_port 
  end
  
  def test_access_jruby_with_validate_invarid
    assert_raise ArgumentError do
      Luruju::Configuration.new do |config|
	config.access_jruby_with = :hoge
      end
    end
  end

  def test_drb_port_validate_invarid
    assert_raise ArgumentError do
      Luruju::Configuration.new do |config|
	config.drb_port = "hoge"
      end
    end
  end
  
  def test_install_default
    Luruju::Configuration.install
    assert_equal :drb, Luruju.config.access_jruby_with
  end

  def test_install_with_arg
    config = Luruju::Configuration.new do |config|
      config.access_jruby_with = :command
    end
    Luruju::Configuration.install config
    assert_equal :command, Luruju.config.access_jruby_with
  end

  def test_install_with_block
    Luruju::Configuration.install do |config|
      config.access_jruby_with = :command
    end
    assert_equal :command, Luruju.config.access_jruby_with
  end
  
  def test_uninstall
    Luruju::Configuration.install do |config|
      config.access_jruby_with = :command
    end
    assert_equal :command, Luruju.config.access_jruby_with
    Luruju::Configuration.uninstall
    assert_equal :drb, Luruju.config.access_jruby_with
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
luruju-0.2.0 test/luruju_server_test.rb