summaryrefslogtreecommitdiff
path: root/spec/unit/knife/core/bootstrap_context_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/knife/core/bootstrap_context_spec.rb')
-rw-r--r--spec/unit/knife/core/bootstrap_context_spec.rb42
1 files changed, 21 insertions, 21 deletions
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index 16c0867610..efcc2659dd 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -26,7 +26,7 @@ describe Chef::Knife::Core::BootstrapContext do
Chef::Config[:fips] = false
end
- let(:config) { {:foo => :bar, :color => true} }
+ let(:config) { { :foo => :bar, :color => true } }
let(:run_list) { Chef::RunList.new("recipe[tmux]", "role[base]") }
let(:chef_config) do
{
@@ -41,7 +41,7 @@ describe Chef::Knife::Core::BootstrapContext do
subject(:bootstrap_context) { described_class.new(config, run_list, chef_config, secret) }
it "initializes with Chef 11 parameters" do
- expect{described_class.new(config, run_list, chef_config)}.not_to raise_error
+ expect { described_class.new(config, run_list, chef_config) }.not_to raise_error
end
it "runs chef with the first-boot.json with no environment specified" do
@@ -49,14 +49,14 @@ describe Chef::Knife::Core::BootstrapContext do
end
describe "when in verbosity mode" do
- let(:config) { {:verbosity => 2, :color => true} }
+ let(:config) { { :verbosity => 2, :color => true } }
it "adds '-l debug' when verbosity is >= 2" do
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json -l debug"
end
end
describe "when no color value has been set in config" do
- let(:config) { {:color => false } }
+ let(:config) { { :color => false } }
it "adds '--no-color' when color is false" do
expect(bootstrap_context.start_chef).to eq "chef-client -j /etc/chef/first-boot.json --no-color"
end
@@ -67,7 +67,7 @@ describe Chef::Knife::Core::BootstrapContext do
end
it "generates the config file data" do
- expected=<<-EXPECTED
+ expected = <<-EXPECTED
log_location STDOUT
chef_server_url "http://chef.example.com:4444"
validation_client_name "chef-validator-testing"
@@ -81,14 +81,14 @@ EXPECTED
end
describe "alternate chef-client path" do
- let(:chef_config){ {:chef_client_path => "/usr/local/bin/chef-client"} }
+ let(:chef_config) { { :chef_client_path => "/usr/local/bin/chef-client" } }
it "runs chef-client from another path when specified" do
expect(bootstrap_context.start_chef).to eq "/usr/local/bin/chef-client -j /etc/chef/first-boot.json"
end
end
describe "validation key path that contains a ~" do
- let(:chef_config){ {:validation_key => "~/my.key"} }
+ let(:chef_config) { { :validation_key => "~/my.key" } }
it "reads the validation key when it contains a ~" do
expect(File).to receive(:exist?).with(File.expand_path("my.key", ENV["HOME"])).and_return(true)
expect(IO).to receive(:read).with(File.expand_path("my.key", ENV["HOME"]))
@@ -97,36 +97,36 @@ EXPECTED
end
describe "when an explicit node name is given" do
- let(:config){ {:chef_node_name => "foobar.example.com" }}
+ let(:config) { { :chef_node_name => "foobar.example.com" } }
it "sets the node name in the client.rb" do
expect(bootstrap_context.config_content).to match(/node_name "foobar\.example\.com"/)
end
end
describe "when bootstrapping into a specific environment" do
- let(:config){ {:environment => "prodtastic", :color => true} }
+ let(:config) { { :environment => "prodtastic", :color => true } }
it "starts chef in the configured environment" do
expect(bootstrap_context.start_chef).to eq("chef-client -j /etc/chef/first-boot.json -E prodtastic")
end
end
describe "when tags are given" do
- let(:config) { {:tags => [ "unicorn" ] } }
+ let(:config) { { :tags => [ "unicorn" ] } }
it "adds the attributes to first_boot" do
- expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({:run_list => run_list, :tags => ["unicorn"]}))
+ expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ :run_list => run_list, :tags => ["unicorn"] }))
end
end
describe "when JSON attributes are given" do
- let(:config) { {:first_boot_attributes => {:baz => :quux}} }
+ let(:config) { { :first_boot_attributes => { :baz => :quux } } }
it "adds the attributes to first_boot" do
- expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({:baz => :quux, :run_list => run_list}))
+ expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ :baz => :quux, :run_list => run_list }))
end
end
describe "when JSON attributes are NOT given" do
it "sets first_boot equal to run_list" do
- expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({:run_list => run_list}))
+ expect(Chef::JSONCompat.to_json(bootstrap_context.first_boot)).to eq(Chef::JSONCompat.to_json({ :run_list => run_list }))
end
end
@@ -160,7 +160,7 @@ EXPECTED
describe "when a bootstrap_version is specified" do
let(:chef_config) do
{
- :knife => {:bootstrap_version => "11.12.4" }
+ :knife => { :bootstrap_version => "11.12.4" }
}
end
@@ -172,7 +172,7 @@ EXPECTED
describe "when a pre-release bootstrap_version is specified" do
let(:chef_config) do
{
- :knife => {:bootstrap_version => "11.12.4.rc.0" }
+ :knife => { :bootstrap_version => "11.12.4.rc.0" }
}
end
@@ -196,7 +196,7 @@ EXPECTED
describe "when configured in config" do
let(:chef_config) do
{
- :knife => {:ssl_verify_mode => :verify_peer}
+ :knife => { :ssl_verify_mode => :verify_peer }
}
end
@@ -205,7 +205,7 @@ EXPECTED
end
describe "when configured via CLI" do
- let(:config) {{:node_ssl_verify_mode => "none"}}
+ let(:config) { { :node_ssl_verify_mode => "none" } }
it "uses CLI value" do
expect(bootstrap_context.config_content).to include("ssl_verify_mode :verify_none")
@@ -222,7 +222,7 @@ EXPECTED
describe "when configured in config" do
let(:chef_config) do
{
- :knife => {:verify_api_cert => :false}
+ :knife => { :verify_api_cert => :false }
}
end
@@ -231,7 +231,7 @@ EXPECTED
end
describe "when configured via CLI" do
- let(:config) {{:node_verify_api_cert => true}}
+ let(:config) { { :node_verify_api_cert => true } }
it "uses CLI value" do
expect(bootstrap_context.config_content).to include("verify_api_cert true")
@@ -246,7 +246,7 @@ EXPECTED
end
describe "when configured via cli" do
- let(:config) {{:prerelease => true}}
+ let(:config) { { :prerelease => true } }
it "uses CLI value" do
expect(bootstrap_context.latest_current_chef_version_string).to eq("-p")