Sha256: b10fa4b2dff9f55e8639c29dbfc45f05a43ad19dee6cd50de7c62c9f40f73045

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

describe "repl_runner" do
  def start(hash={})
    Hirb.stubs(:enable)
    Boson.start(hash.merge(:verbose=>false))
  end

  before_all { reset }
  before { ConsoleRunner.instance_eval("@initialized = false") }

  it "loads default libraries and libraries in :console_defaults config" do
    defaults = Runner.default_libraries + ['yo']
    with_config(:console_defaults=>['yo']) do
      Manager.expects(:load).with {|*args| args[0] == defaults }
      start
    end
  end

  it "doesn't call init twice" do
    capture_stderr { start }
    ConsoleRunner.expects(:init).never
    start
  end

  it "loads multiple libraries with :libraries option" do
    ConsoleRunner.expects(:init)
    Manager.expects(:load).with([:lib1,:lib2], anything)
    start(:libraries=>[:lib1, :lib2])
  end

  it "autoloader autoloads libraries" do
    start(:autoload_libraries=>true)
    Index.expects(:read)
    Index.expects(:find_library).with('blah').returns('blah')
    Manager.expects(:load).with('blah', anything)
    Boson.main_object.blah
  end
  after_all { FileUtils.rm_r File.dirname(__FILE__)+'/config', :force=>true }
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
boson-0.4.0 test/runner_test.rb
bosonson-0.304.3 test/runner_test.rb
bosonson-0.304.2 test/runner_test.rb
bosonson-0.304.1 test/runner_test.rb
boson-0.3.4 test/runner_test.rb
boson-0.3.3 test/runner_test.rb
boson-0.3.2 test/runner_test.rb
boson-0.3.1 test/runner_test.rb
boson-0.3.0 test/runner_test.rb
boson-0.2.5 test/runner_test.rb
boson-0.2.4 test/runner_test.rb