diff options
author | Serdar Sutay <serdar@opscode.com> | 2014-11-06 11:53:37 -0800 |
---|---|---|
committer | Serdar Sutay <serdar@opscode.com> | 2014-11-07 15:46:09 -0800 |
commit | ad06b3700f0aa004e6d5b7752da61810aa043aae (patch) | |
tree | eaeeff8d8da20c80bd195603f6194c91f588a07d /spec | |
parent | 1888a8a9c5cbc1bdcfb1d9aa919a911c72cbbff4 (diff) | |
download | chef-ad06b3700f0aa004e6d5b7752da61810aa043aae.tar.gz |
Make sure that :distro is evaluated later than :bootstrap_template and :template_file in order for knife cloud plugins to work corectly with Chef 12.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/knife/bootstrap_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index 4de2b4531d..01752875fc 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -29,7 +29,7 @@ describe Chef::Knife::Bootstrap do Chef::Log.logger = Logger.new(StringIO.new) Chef::Config[:knife][:bootstrap_template] = bootstrap_template unless bootstrap_template.nil? - k = Chef::Knife::Bootstrap.new + k = Chef::Knife::Bootstrap.new(bootstrap_cli_options) k.merge_configs allow(k.ui).to receive(:stderr).and_return(stderr) @@ -41,11 +41,37 @@ describe Chef::Knife::Bootstrap do let(:bootstrap_template) { nil } + let(:bootstrap_cli_options) { [ ] } + it "should use chef-full as default template" do expect(knife.bootstrap_template).to be_a_kind_of(String) expect(File.basename(knife.bootstrap_template)).to eq("chef-full") end + context "with :distro and :bootstrap_template cli options" do + let(:bootstrap_cli_options) { [ "--bootstrap-template", "my-template", "--distro", "other-template" ] } + + it "should select bootstrap template" do + File.basename(knife.bootstrap_template).should eq("my-template") + end + end + + context "with :distro and :template_file cli options" do + let(:bootstrap_cli_options) { [ "--distro", "my-template", "--template-file", "other-template" ] } + + it "should select bootstrap template" do + File.basename(knife.bootstrap_template).should eq("other-template") + end + end + + context "with :bootstrap_template and :template_file cli options" do + let(:bootstrap_cli_options) { [ "--bootstrap-template", "my-template", "--template-file", "other-template" ] } + + it "should select bootstrap template" do + File.basename(knife.bootstrap_template).should eq("my-template") + end + end + context "when finding templates" do context "when :bootstrap_template config is set to a file" do context "that doesn't exist" do |