1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

add basic CommandSet#[]= tests.

This commit is contained in:
Robert Gleeson 2013-09-22 11:21:51 +02:00
parent c05c8f31c1
commit df4b2aa14e

View file

@ -12,6 +12,26 @@ describe Pry::CommandSet do
}
end
describe "[]=" do
it "removes a command from the command set" do
@set["help"].should.not == nil
@set["help"] = nil
@set["help"].should == nil
lambda { @set.run_command(TOPLEVEL_BINDING, "help") }.should.raise Pry::NoCommandError
end
it "replaces a command" do
old_help = @set["help"]
@set["help"] = @set["pry-version"]
@set["help"].should.not == old_help
end
it "rebinds the command with key" do
@set["help-1"] = @set["help"]
@set["help-1"].match.should == "help-1"
end
end
it 'should call the block used for the command when it is called' do
run = false
@set.command 'foo' do