Sha256: 8c251d7d60bcf6be43201c736a3ec50c745d71d49ed7c91f15a2e931eef77e95
Contents?: true
Size: 1.53 KB
Versions: 3
Compression:
Stored size: 1.53 KB
Contents
require 'test/test_helper' describe "Loader" do it "loads a library and creates its class commands" do with_config(:libraries=>{"blah"=>{:class_commands=>{"bling"=>"Blah.bling", "Blah"=>['hmm']}}}) do load :blah, :file_string=>"module Blah; def self.bling; end; def self.hmm; end; end" command_exists? 'bling' command_exists? 'hmm' end end it "loads a module library and all its class methods by default" do eval %[module ::Harvey; def self.bird; end; def self.eagle; end; end] load ::Harvey, :no_mock=>true library_has_command('harvey', 'bird') library_has_command('harvey', 'eagle') end it "prints error when nonexistent" do capture_stderr { load('blah') }.should =~ /Library blah did not/ end it "prints error if namespace conflicts with existing commands" do eval "module ::Conflict; def self.bleng; end; end" load Conflict, :no_mock=>true with_config(:libraries=>{'bleng'=>{:namespace=>true}}) do capture_stderr { load 'bleng', :file_string=>"module Bleng; def bling; end; end" }.should =~ /conflict.*bleng/ end end it "hash from inspector recursively merged with user's config" do with_config(:libraries=>{'blah'=>{:commands=>{'blung'=>{:args=>[], :options=>{:sort=>'this'}}}}}) do CommentInspector.expects(:scrape).returns({:options=>{:fields=>['this']}}) load :blah, :file_string=>"module Blah; def blung; end; end" library('blah').command_object('blung').options.should == {:fields=>["this"], :sort=>"this"} end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
boson-more-0.3.1 | test/todo/loader_test.rb |
boson-more-0.3.0 | test/todo/loader_test.rb |
boson-more-0.2.2 | test/todo/loader_test.rb |