diff --git a/lib/knife-solo/deprecated_command.rb b/lib/knife-solo/deprecated_command.rb index eb9220bc..7d908204 100644 --- a/lib/knife-solo/deprecated_command.rb +++ b/lib/knife-solo/deprecated_command.rb @@ -8,6 +8,11 @@ def self.deprecated end banner deprecated + self.options = superclass.options + + def self.load_deps + superclass.load_deps + end end end diff --git a/test/deprecated_command_test.rb b/test/deprecated_command_test.rb index 484855c4..c8b680fb 100644 --- a/test/deprecated_command_test.rb +++ b/test/deprecated_command_test.rb @@ -6,6 +6,10 @@ class DummyNewCommand < Chef::Knife banner "knife dummy_new_command" + option :foo, + :long => '--foo', + :description => 'Foo option' + def run # calls #new_run so we can be sure this gets called new_run @@ -32,13 +36,22 @@ def test_warns_about_deprecation cmd.run end - def test_runs_original_command + def test_runs_new_command cmd = command cmd.ui.stubs(:err) cmd.expects(:new_run) cmd.run end + def test_includes_options_from_new_command + assert DummyDeprecatedCommand.options.include?(:foo) + end + + def test_loads_dependencies_from_new_command + DummyNewCommand.expects(:load_deps) + DummyDeprecatedCommand.load_deps + end + def command(*args) DummyDeprecatedCommand.load_deps DummyDeprecatedCommand.new(args)