Skip to content

Commit

Permalink
Update failing specs around Chef::Config across versions of Chef.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnichol committed Sep 12, 2014
1 parent c6838ef commit a6c600f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/chef/knife/server_bootstrap_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def validate!
"the setup instructions at http://fnichol.github.io/knife-server/"

# rubocop:disable Style/DeprecatedHashMethods
if !Chef::Config.has_key?(:node_name)
if Chef::Config[:node_name].nil?
ui.error knife_fail.gsub(/{{KEY}}/, "node_name")
exit 1
end
if !Chef::Config.has_key?(:client_key)
if Chef::Config[:client_key].nil?
ui.error knife_fail.gsub(/{{KEY}}/, "client_key")
exit 1
end
Expand Down
4 changes: 2 additions & 2 deletions spec/chef/knife/server_bootstrap_ec2_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,13 @@
let(:credentials) { double.as_null_object }

it "exits if Chef::Config[:node_name] is missing" do
Chef::Config.delete(:node_name)
Chef::Config[:node_name] = nil

expect { @knife.run }.to raise_error SystemExit
end

it "exits if Chef::Config[:client_key] is missing" do
Chef::Config.delete(:client_key)
Chef::Config[:client_key] = nil

expect { @knife.run }.to raise_error SystemExit
end
Expand Down
4 changes: 2 additions & 2 deletions spec/chef/knife/server_bootstrap_linode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,13 @@
let(:credentials) { double.as_null_object }

it "exits if Chef::Config[:node_name] is missing" do
Chef::Config.delete(:node_name)
Chef::Config[:node_name] = nil

expect { @knife.run }.to raise_error SystemExit
end

it "exits if Chef::Config[:client_key] is missing" do
Chef::Config.delete(:client_key)
Chef::Config[:client_key] = nil

expect { @knife.run }.to raise_error SystemExit
end
Expand Down
8 changes: 7 additions & 1 deletion spec/chef/knife/server_bootstrap_openstack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,14 @@
let(:ssh) { double }
let(:credentials) { double.as_null_object }

it "exits if Chef::Config[:node_name] is missing" do
Chef::Config[:node_name] = nil

expect { @knife.run }.to raise_error SystemExit
end

it "exits if Chef::Config[:client_key] is missing" do
Chef::Config.delete(:client_key)
Chef::Config[:client_key] = nil

expect { @knife.run }.to raise_error SystemExit
end
Expand Down
4 changes: 2 additions & 2 deletions spec/chef/knife/server_bootstrap_standalone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,13 @@
let(:credentials) { double.as_null_object }

it "exits if Chef::Config[:node_name] is missing" do
Chef::Config.delete(:node_name)
Chef::Config[:node_name] = nil

expect { @knife.run }.to raise_error SystemExit
end

it "exits if Chef::Config[:client_key] is missing" do
Chef::Config.delete(:client_key)
Chef::Config[:client_key] = nil

expect { @knife.run }.to raise_error SystemExit
end
Expand Down

0 comments on commit a6c600f

Please sign in to comment.