Sha256: 0bc51919856112e43cb4d1d48eb8a11708cd6067bb5d3fedeedb5b054346b27f
Contents?: true
Size: 1.64 KB
Versions: 2
Compression:
Stored size: 1.64 KB
Contents
require File.join(File.dirname(__FILE__), 'test_helper') class Bond::ObjectMissionTest < Test::Unit::TestCase before(:all) {|e| Bond.debrief(:readline_plugin=>valid_readline_plugin) } before(:each) {|e| Bond.agent.instance_eval("@missions = []") } context "object mission" do test "with default action completes" do Bond.complete(:object=>"String") Bond.complete(:on=>/man/) { %w{upper upster upful}} complete("'man'.u").should == ["'man'.upcase!", "'man'.unpack", "'man'.untaint", "'man'.upcase", "'man'.upto"] end test "with regex condition completes" do Bond.complete(:object=>/Str/) {|e| e.object.class.superclass.instance_methods(true) } Bond.complete(:on=>/man/) { %w{upper upster upful}} complete("'man'.u").should == ["'man'.untaint"] end test "with explicit action completes" do Bond.complete(:object=>"String") {|e| e.object.class.superclass.instance_methods(true) } Bond.complete(:on=>/man/) { %w{upper upster upful}} complete("'man'.u").should == ["'man'.untaint"] end test "ignores invalid invalid ruby" do Bond.complete(:object=>"String") complete("blah.upt").should == [] end # needed to ensure Bond works in irbrc test "doesn't evaluate irb binding on definition" do Object.expects(:const_defined?).never Bond.complete(:object=>"String") end test "sets binding to toplevel binding when not in irb" do Object.expects(:const_defined?).with(:IRB).returns(false) mission = Bond::Mission.create(:object=>'Symbol') mission.matches?(':ok.') mission.eval_binding.should == ::TOPLEVEL_BINDING end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
cldwalker-bond-0.1.1 | test/object_mission_test.rb |
bond-0.1.1 | test/object_mission_test.rb |