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

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>
This commit is contained in:
Kyrylo Silin 2012-07-06 21:23:31 +03:00
parent c3e38a37fd
commit caeb6b58b6

View file

@ -696,17 +696,25 @@ describe "Pry::Command" do
describe 'group' do
before do
@set.import Pry::DefaultCommands::Cd
end
it 'should not change once it is initialized' do
@set.commands["cd"].group("-==CD COMMAND==-")
@set.commands["cd"].group.should == "Context"
@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["cd"].group.should == "Context"
@set.commands["help"].group.should == "Help"
end
it 'should not change once it is initialized' do
@set.commands["magic"].group("-==CD COMMAND==-")
@set.commands["magic"].group.should == "Not for a public use"
end
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