Permalink
Browse files

Refactor tests for command groups

We should not rely on default commands, because they can be removed or
shuffled around in the future. Use our custom command in the tests.

Also, add a test that ensures that a group does not disappear after the
call without parameters.

Reported-by: John Mair <jrmair@gmail.com>
Signed-off-by: Kyrylo Silin <kyrylosilin@gmail.com>
  • Loading branch information...
1 parent c3e38a3 commit caeb6b58b662d24d9523c9e676b3e5e9adcd58d4 @kyrylo kyrylo committed Jul 6, 2012
Showing with 14 additions and 6 deletions.
  1. +14 −6 test/test_command.rb
View
@@ -696,17 +696,25 @@ def process
describe 'group' do
before do
- @set.import Pry::DefaultCommands::Cd
+ @set.import(
+ Pry::CommandSet.new do
+ create_command("magic") { group("Not for a public use") }
+ end
+ )
+ end
+
+ it 'should be correct for default commands' do
+ @set.commands["help"].group.should == "Help"
end
it 'should not change once it is initialized' do
- @set.commands["cd"].group("-==CD COMMAND==-")
- @set.commands["cd"].group.should == "Context"
+ @set.commands["magic"].group("-==CD COMMAND==-")
+ @set.commands["magic"].group.should == "Not for a public use"
end
- it 'should be correct for default commands' do
- @set.commands["cd"].group.should == "Context"
- @set.commands["help"].group.should == "Help"
+ it 'should not disappear after the call without parameters' do
+ @set.commands["magic"].group
+ @set.commands["magic"].group.should == "Not for a public use"
end
end
end

0 comments on commit caeb6b5

Please sign in to comment.