mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
add CommandSet#[]= spec.
This commit is contained in:
parent
7441f44f2a
commit
4087a2ca32
2 changed files with 5 additions and 1 deletions
|
@ -339,7 +339,7 @@ class Pry
|
||||||
if command.equal?(nil)
|
if command.equal?(nil)
|
||||||
return commands.delete(pattern)
|
return commands.delete(pattern)
|
||||||
end
|
end
|
||||||
unless command < Pry::Command
|
unless Class === command && command < Pry::Command
|
||||||
raise TypeError, "command is not a subclass of Pry::Command"
|
raise TypeError, "command is not a subclass of Pry::Command"
|
||||||
end
|
end
|
||||||
bind_command_to_pattern = pattern != command.match
|
bind_command_to_pattern = pattern != command.match
|
||||||
|
|
|
@ -30,6 +30,10 @@ describe Pry::CommandSet do
|
||||||
@set["help-1"] = @set["help"]
|
@set["help-1"] = @set["help"]
|
||||||
@set["help-1"].match.should == "help-1"
|
@set["help-1"].match.should == "help-1"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "raises a TypeError when command is not a subclass of Pry::Command" do
|
||||||
|
lambda { @set["help"] = "hello" }.should.raise TypeError
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should call the block used for the command when it is called' do
|
it 'should call the block used for the command when it is called' do
|
||||||
|
|
Loading…
Reference in a new issue