Sha256: 0228a85e065209b6955de72f642902370e3c2b788dd042e168dfd0b67e811b73

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require 'test/test_helper'

describe "Loader" do
  before { Gem.stubs(:loaded_specs).returns({}) }
  describe 'load' do
    before { reset }

    it "loads a library with dependencies" do
      File.stubs(:exists?).returns(true)
      File.stubs(:read).returns("module Water; def water; end; end", "module Oaks; def oaks; end; end")
      with_config(:libraries=>{"water"=>{:dependencies=>"oaks"}}) do
        load 'water', :no_mock=>true
        library_has_module('water', "Boson::Commands::Water")
        library_has_module('oaks', "Boson::Commands::Oaks")
        command_exists?('water')
        command_exists?('oaks')
      end
    end

    it "prints error for library with invalid dependencies" do
      GemLibrary.stubs(:is_a_gem?).returns(true) #mock all as gem libs
      Util.stubs(:safe_require).returns(true)
      with_config(:libraries=>{"water"=>{:dependencies=>"fire"}, "fire"=>{:dependencies=>"man"}}) do
        capture_stderr {
          load('water', :no_mock=>true)
        }.should == "Unable to load library fire. Reason: Can't load dependency man\nUnable to load"+
        " library water. Reason: Can't load dependency fire\n"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
boson-more-0.3.1 test/todo/more_manager_test.rb
boson-more-0.3.0 test/todo/more_manager_test.rb
boson-more-0.2.2 test/todo/more_manager_test.rb