Sha256: ba8bc4206e4772e0127969ef75571a69050759c1548983dd5497b28145d398ae
Contents?: true
Size: 1.62 KB
Versions: 3
Compression:
Stored size: 1.62 KB
Contents
require File.join(File.dirname(__FILE__), 'test_helper') module Boson class CommandsTest < Test::Unit::TestCase before(:all) { @higgs = Boson.main_object if Boson.libraries.size.zero? reset_boson ancestors = class <<Boson.main_object; self end.ancestors # allows running just this test file Manager.load Runner.default_libraries unless ancestors.include?(Boson::Commands::Core) end } def render_expects(&block) View.expects(:render).with(&block) end context "libraries" do before(:all) { Boson.libraries << Boson::Library.new(:name=>'blah') Boson.libraries << Boson::Library.new(:name=>'another', :module=>"Cool") } test "lists all when given no argument" do render_expects {|*args| args[0].size == Boson.libraries.size } @higgs.libraries end test "searches with a given search field" do render_expects {|*args| args[0] == [Boson.library('another')]} @higgs.libraries('Cool', :query_fields=>[:module]) end end context "commands" do before(:all) { Boson.commands << Command.create('some', Library.new(:name=>'thing')) Boson.commands << Command.create('and', Library.new(:name=>'this')) } test "lists all when given no argument" do render_expects {|*args| args[0].size == Boson.commands.size } @higgs.commands end test "searches with a given search field" do render_expects {|*args| args[0] == [Command.find('and')]} @higgs.commands('this', :query_fields=>[:lib]) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
boson-more-0.2.1 | test/commands_test.rb |
boson-more-0.2.0 | test/commands_test.rb |
boson-more-0.1.0 | test/commands_test.rb |