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.rb62
1 files changed, 31 insertions, 31 deletions
diff --git a/spec/unit/knife/core/bootstrap_context_spec.rb b/spec/unit/knife/core/bootstrap_context_spec.rb
index 3a32155063..7ee177a7d1 100644
--- a/spec/unit/knife/core/bootstrap_context_spec.rb
+++ b/spec/unit/knife/core/bootstrap_context_spec.rb
@@ -26,15 +26,15 @@ 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
{
- :config_log_level => "info",
- :config_log_location => "/tmp/log",
- :validation_key => File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"),
- :chef_server_url => "http://chef.example.com:4444",
- :validation_client_name => "chef-validator-testing",
+ config_log_level: "info",
+ config_log_location: "/tmp/log",
+ validation_key: File.join(CHEF_SPEC_DATA, "ssl", "private_key.pem"),
+ chef_server_url: "http://chef.example.com:4444",
+ validation_client_name: "chef-validator-testing",
}
end
@@ -51,14 +51,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
@@ -80,14 +80,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"]))
@@ -96,36 +96,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
@@ -159,7 +159,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
@@ -171,7 +171,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
@@ -195,7 +195,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
@@ -204,7 +204,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")
@@ -238,7 +238,7 @@ EXPECTED
describe "when configured in config" do
let(:chef_config) do
{
- :knife => { :verify_api_cert => :false },
+ knife: { verify_api_cert: :false },
}
end
@@ -247,7 +247,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")
@@ -262,7 +262,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")
@@ -272,49 +272,49 @@ EXPECTED
describe "#config_log_location" do
context "when config_log_location is nil" do
- let(:chef_config) { { :config_log_location => nil } }
+ let(:chef_config) { { config_log_location: nil } }
it "sets the default config_log_location in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDOUT"
end
end
context "when config_log_location is empty" do
- let(:chef_config) { { :config_log_location => "" } }
+ let(:chef_config) { { config_log_location: "" } }
it "sets the default config_log_location in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDOUT"
end
end
context "when config_log_location is :win_evt" do
- let(:chef_config) { { :config_log_location => :win_evt } }
+ let(:chef_config) { { config_log_location: :win_evt } }
it "raise error when config_log_location is :win_evt " do
expect { bootstrap_context.get_log_location }.to raise_error("The value :win_evt is not supported for config_log_location on Linux Platforms \n")
end
end
context "when config_log_location is :syslog" do
- let(:chef_config) { { :config_log_location => :syslog } }
+ let(:chef_config) { { config_log_location: :syslog } }
it "sets the config_log_location value as :syslog in the client.rb" do
expect(bootstrap_context.get_log_location).to eq ":syslog"
end
end
context "When config_log_location is STDOUT" do
- let(:chef_config) { { :config_log_location => STDOUT } }
+ let(:chef_config) { { config_log_location: STDOUT } }
it "Sets the config_log_location value as STDOUT in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDOUT"
end
end
context "when config_log_location is STDERR" do
- let(:chef_config) { { :config_log_location => STDERR } }
+ let(:chef_config) { { config_log_location: STDERR } }
it "sets the config_log_location value as STDERR in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "STDERR"
end
end
context "when config_log_location is a path" do
- let(:chef_config) { { :config_log_location => "/tmp/ChefLogFile" } }
+ let(:chef_config) { { config_log_location: "/tmp/ChefLogFile" } }
it "sets the config_log_location path in the client.rb" do
expect(bootstrap_context.get_log_location).to eq "\"/tmp/ChefLogFile\""
end