Sha256: b7f661b8521e97dbd0d6fbcd9763fc99e9c602b6d7ee076edd4ba5512d564618
Contents?: true
Size: 1.28 KB
Versions: 3
Compression:
Stored size: 1.28 KB
Contents
describe "Loader" do describe "load" do before { reset } describe "gem library" do def mock_library(lib, options={}) options[:file_string] ||= '' File.stubs(:exists?).returns(false) GemLibrary.expects(:is_a_gem?).returns(true) Util.expects(:safe_require).with { eval options.delete(:file_string) || ''; true}.returns(true) end it "loads" do with_config(:libraries=>{"dude"=>{:module=>'Dude'}}) do load "dude", :file_string=>"module ::Dude; def blah; end; end" library_has_module('dude', "Dude") command_exists?("blah") end end it "with kernel methods loads" do load "dude", :file_string=>"module ::Kernel; def dude; end; end" library_loaded? 'dude' library('dude').module.should == nil command_exists?("dude") end it "prints error when nonexistent" do capture_stderr { load('blah') }.should =~ /Library blah did not/ end it "with invalid module prints error" do with_config(:libraries=>{"coolio"=>{:module=>"Cool"}}) do capture_stderr { load('coolio', :file_string=>"module ::Coolio; def coolio; end; end") }.should =~ /Unable.*coolio.*No module/ end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
boson-more-0.2.1 | test/gem_library_test.rb |
boson-more-0.2.0 | test/gem_library_test.rb |
boson-more-0.1.0 | test/gem_library_test.rb |