summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarc A. Paradise <marc.paradise@gmail.com>2019-05-01 10:35:13 -0400
committerMarc A. Paradise <marc.paradise@gmail.com>2019-05-03 17:30:08 -0400
commitfaeddcb492020f3ead4aa433e93a9903d16ab652 (patch)
treeaa8f5755f147095d190fa063df9ed82d0937c0d8 /spec
parent3e3d4b1ac9c2aefd12eae60982eb321c1029ab44 (diff)
downloadchef-faeddcb492020f3ead4aa433e93a9903d16ab652.tar.gz
Change 'prerelease' to 'channel'.
This adds support for deprecating a boolean flag into a non-boolean value, and uses it to make `--prerelease` deprecated in favor of `--channel current`. By default, `channel` is `stable`. Separately, all deprecated options are now configured to display at the end of the options list, instead of mixed into the non-deprecated list. Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/knife/bootstrap_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb
index 995a2ef4c9..d82dc7614e 100644
--- a/spec/unit/knife/bootstrap_spec.rb
+++ b/spec/unit/knife/bootstrap_spec.rb
@@ -1608,13 +1608,14 @@ describe Chef::Knife::Bootstrap do
knife.merge_configs
end
it "maps the key value to the new key and points the human to the new flag" do
- expect(knife.ui).to receive(:warn).with(/--ssh-user USER is deprecated. Use --connection-user USERNAME instead./)
+ expect(knife.ui).to receive(:warn).with(/You provided --ssh-user. This flag is deprecated. Please use '--connection-user USERNAME' instead./)
knife.verify_deprecated_flags!
expect(knife.config[:connection_user]).to eq "sshuser"
end
end
context "when a deprecated CLI flag is given on the CLI, along with its replacement" do
+ let(:bootstrap_cli_options) { %w{--connection-user a --ssh-user b} }
before do
knife.config[:ssh_user] = "sshuser"
knife.config[:connection_user] = "real-user"
@@ -1626,6 +1627,15 @@ describe Chef::Knife::Bootstrap do
expect { knife.verify_deprecated_flags! }.to raise_error SystemExit
end
end
+
+ context "when a deprecated boolean CLI flag is given on the CLI, and its non-boolean replacement is used" do
+ let(:bootstrap_cli_options) { %w{--prerelease} }
+ it "correctly maps the old boolean value to the new value" do
+ expect(knife.ui).to receive(:warn)
+ knife.verify_deprecated_flags!
+ expect(knife.config[:channel]).to eq "current"
+ end
+ end
end
describe "#register_client" do