summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/chef/knife/environment_compare.rb8
-rw-r--r--spec/unit/knife/environment_compare_spec.rb7
2 files changed, 5 insertions, 10 deletions
diff --git a/lib/chef/knife/environment_compare.rb b/lib/chef/knife/environment_compare.rb
index d7e6e57b86..21160e8ac3 100644
--- a/lib/chef/knife/environment_compare.rb
+++ b/lib/chef/knife/environment_compare.rb
@@ -38,10 +38,10 @@ class Chef
# Get the commandline environments or all if none are provided.
environments = environment_list
- # Get a list of all cookbooks that have constraninst and their environment.
+ # Get a list of all cookbooks that have constraints and their environment.
constraints = constraint_list(environments)
- # Get the total list of cookbooks that have contraints
+ # Get the total list of cookbooks that have constraints
cookbooks = cookbook_list(constraints)
# If we cannot find any cookbooks, we can stop here.
@@ -77,10 +77,10 @@ class Chef
constraints = {}
environments.each do |env,url|
# Because you cannot modify the default environment I filter it out here.
- unless "#{env}" == "_default"
+ unless env == "_default"
envdata = Chef::Environment.load(env)
ver = envdata.cookbook_versions
- constraints["#{env}"] = ver
+ constraints[env] = ver
end
end
constraints
diff --git a/spec/unit/knife/environment_compare_spec.rb b/spec/unit/knife/environment_compare_spec.rb
index a288fd2146..16e3b4d13d 100644
--- a/spec/unit/knife/environment_compare_spec.rb
+++ b/spec/unit/knife/environment_compare_spec.rb
@@ -49,8 +49,6 @@ describe Chef::Knife::EnvironmentCompare do
@knife.stub(:cookbook_list).and_return(@cookbooks)
- # cookbooks = rest.get_rest("/cookbooks?num_versions=1")
-
@rest_double = double('rest')
@knife.stub(:rest).and_return(@rest_double)
@cookbook_names = ['apache2', 'mysql', 'foo', 'bar', 'dummy', 'chef_handler']
@@ -62,9 +60,6 @@ describe Chef::Knife::EnvironmentCompare do
'url' => "#{@base_url}/#{item}/1.0.1"}]}
end
- # @rest_mock.should_receive(:get_rest).with('/cookbooks?num_versions=1').
- # and_return(@cookbook_data)
-
@rest_double.stub(:get_rest).with("/cookbooks?num_versions=1").and_return(@cookbook_data)
@stdout = StringIO.new
@@ -89,7 +84,7 @@ describe Chef::Knife::EnvironmentCompare do
end
describe 'with -m or --mismatch' do
- it 'should display mismatch environments / cookbooks and the version constrants of the cookbooks' do
+ it 'should display mismatch environments / cookbooks and the version constraints of the cookbooks' do
@knife.config[:format] = 'summary'
@knife.config[:mismatch] = true
@knife.run