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

Add a test for custom-subclass based commands

This commit is contained in:
Conrad Irwin 2012-04-01 16:18:11 -07:00
parent 7c5d55d354
commit 12a4eb5784

View file

@ -594,4 +594,29 @@ describe "Pry::Command" do
end end
end end
end end
describe "commands made with custom sub-classes" do
before do
class MyTestCommand < Pry::ClassCommand
match /my-*test/
description "So just how many sound technicians does it take to change a lightbulb? 1? 2? 3? 1-2-3? Testing?"
options :shellwords => false, :listing => "my-test"
def process
output.puts command_name * 2
end
end
Pry.commands.add_command MyTestCommand
end
after do
Pry.commands.delete 'my-test'
end
it "should allow creating custom sub-classes of Pry::Command" do
mock_pry("my---test").should =~ /my-testmy-test/
end
end
end end