summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-06-20 08:56:37 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-06-20 08:56:37 -0700
commitafc542a82936ef09f6912965773bb641d316f355 (patch)
tree94665a4fe797c73e413e74dd19ad4d597b45f54b
parent14f693ba740decd876e67dbcb9f5d525ebbfdd8a (diff)
downloadchef-afc542a82936ef09f6912965773bb641d316f355.tar.gz
fixes for rubocop 0.49.1 engine
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/group/aix.rb2
-rw-r--r--lib/chef/provider/group/groupadd.rb2
-rw-r--r--lib/chef/provider/user/pw.rb2
-rw-r--r--lib/chef/provider/user/windows.rb2
-rw-r--r--spec/integration/knife/cookbook_bulk_delete_spec.rb4
-rw-r--r--spec/integration/knife/cookbook_show_spec.rb4
-rw-r--r--spec/integration/knife/environment_compare_spec.rb4
-rw-r--r--spec/integration/knife/environment_show_spec.rb4
-rw-r--r--spec/integration/knife/role_show_spec.rb4
-rw-r--r--spec/support/shared/unit/provider/useradd_based_user_provider.rb2
-rw-r--r--spec/unit/provider/group/groupadd_spec.rb2
-rw-r--r--spec/unit/provider/user/pw_spec.rb2
12 files changed, 17 insertions, 17 deletions
diff --git a/lib/chef/provider/group/aix.rb b/lib/chef/provider/group/aix.rb
index 2db6dc32a7..405e43cff2 100644
--- a/lib/chef/provider/group/aix.rb
+++ b/lib/chef/provider/group/aix.rb
@@ -63,7 +63,7 @@ class Chef
def set_options
opts = []
- { gid: "id" }.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
+ { gid: "id" }.sort_by { |a| a[0] }.each do |field, option|
next unless current_resource.send(field) != new_resource.send(field)
if new_resource.send(field)
Chef::Log.debug("#{new_resource} setting #{field} to #{new_resource.send(field)}")
diff --git a/lib/chef/provider/group/groupadd.rb b/lib/chef/provider/group/groupadd.rb
index f73c3b3be9..7826078e55 100644
--- a/lib/chef/provider/group/groupadd.rb
+++ b/lib/chef/provider/group/groupadd.rb
@@ -108,7 +108,7 @@ class Chef
# <string>:: A string containing the option and then the quoted value
def set_options
opts = []
- { gid: "-g" }.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
+ { gid: "-g" }.sort_by { |a| a[0] }.each do |field, option|
next unless current_resource.send(field) != new_resource.send(field)
next unless new_resource.send(field)
opts << option
diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb
index 06bd221d26..48c05cc436 100644
--- a/lib/chef/provider/user/pw.rb
+++ b/lib/chef/provider/user/pw.rb
@@ -74,7 +74,7 @@ class Chef
"uid" => "-u",
"shell" => "-s",
}
- field_list.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
+ field_list.sort_by { |a| a[0] }.each do |field, option|
field_symbol = field.to_sym
next unless current_resource.send(field_symbol) != new_resource.send(field_symbol)
if new_resource.send(field_symbol)
diff --git a/lib/chef/provider/user/windows.rb b/lib/chef/provider/user/windows.rb
index 00a825ecab..2b69197626 100644
--- a/lib/chef/provider/user/windows.rb
+++ b/lib/chef/provider/user/windows.rb
@@ -107,7 +107,7 @@ class Chef
"password" => "password",
}
- field_list.sort { |a, b| a[0] <=> b[0] }.each do |field, option|
+ field_list.sort_by { |a| a[0] }.each do |field, option|
field_symbol = field.to_sym
next unless current_resource.send(field_symbol) != new_resource.send(field_symbol)
next unless new_resource.send(field_symbol)
diff --git a/spec/integration/knife/cookbook_bulk_delete_spec.rb b/spec/integration/knife/cookbook_bulk_delete_spec.rb
index 4740813ce1..912bd3bed5 100644
--- a/spec/integration/knife/cookbook_bulk_delete_spec.rb
+++ b/spec/integration/knife/cookbook_bulk_delete_spec.rb
@@ -34,7 +34,7 @@ describe "knife cookbook bulk delete", :workstation do
cookbook "zfa", "0.6.5"
end
- # rubocop:disable Style/TrailingWhitespace
+ # rubocop:disable Layout/TrailingWhitespace
it "knife cookbook bulk delete deletes all matching cookbooks" do
stdout = <<EOM
All versions of the following cookbooks will be deleted:
@@ -58,7 +58,7 @@ fax 0.6.0
zfa 0.6.5
EOM
end
- # rubocop:enable Style/TrailingWhitespace
+ # rubocop:enable Layout/TrailingWhitespace
end
end
diff --git a/spec/integration/knife/cookbook_show_spec.rb b/spec/integration/knife/cookbook_show_spec.rb
index 1ccf7ffcb7..b89a26198a 100644
--- a/spec/integration/knife/cookbook_show_spec.rb
+++ b/spec/integration/knife/cookbook_show_spec.rb
@@ -34,7 +34,7 @@ describe "knife cookbook show", :workstation do
knife("cookbook show x").should_succeed "x 1.0.0 0.6.5\n"
end
- # rubocop:disable Style/TrailingWhitespace
+ # rubocop:disable Layout/TrailingWhitespace
it "knife cookbook show x 1.0.0 shows the correct version" do
knife("cookbook show x 1.0.0").should_succeed <<EOM
cookbook_name: x
@@ -127,7 +127,7 @@ specificity: default
url: http://127.0.0.1:8900/file_store/checksums/d41d8cd98f00b204e9800998ecf8427e
EOM
end
- # rubocop:enable Style/TrailingWhitespace
+ # rubocop:enable Layout/TrailingWhitespace
it "knife cookbook show x 1.0.0 recipes default.rb shows the default recipe" do
knife("cookbook show x 1.0.0 recipes default.rb").should_succeed "file 'n'\n"
diff --git a/spec/integration/knife/environment_compare_spec.rb b/spec/integration/knife/environment_compare_spec.rb
index 3259b27d1b..720bead8c0 100644
--- a/spec/integration/knife/environment_compare_spec.rb
+++ b/spec/integration/knife/environment_compare_spec.rb
@@ -42,7 +42,7 @@ describe "knife environment compare", :workstation do
}
end
- # rubocop:disable Style/TrailingWhitespace
+ # rubocop:disable Layout/TrailingWhitespace
it "displays the cookbooks for a single environment" do
knife("environment compare x").should_succeed <<EOM
x
@@ -69,6 +69,6 @@ krad >= 1.0.0 >= 1.0.0
EOM
end
- # rubocop:enable Style/TrailingWhitespace
+ # rubocop:enable Layout/TrailingWhitespace
end
end
diff --git a/spec/integration/knife/environment_show_spec.rb b/spec/integration/knife/environment_show_spec.rb
index 56422dc1a5..dabdfac6a2 100644
--- a/spec/integration/knife/environment_show_spec.rb
+++ b/spec/integration/knife/environment_show_spec.rb
@@ -30,7 +30,7 @@ describe "knife environment show", :workstation do
}
end
- # rubocop:disable Style/TrailingWhitespace
+ # rubocop:disable Layout/TrailingWhitespace
it "shows an environment" do
knife("environment show b").should_succeed <<EOM
chef_type: environment
@@ -45,7 +45,7 @@ name: b
override_attributes:
EOM
end
- # rubocop:enable Style/TrailingWhitespace
+ # rubocop:enable Layout/TrailingWhitespace
it "shows the requested attribute of an environment" do
knife("environment show b -a default_attributes").should_succeed <<EOM
diff --git a/spec/integration/knife/role_show_spec.rb b/spec/integration/knife/role_show_spec.rb
index df2572447c..f655c03e8d 100644
--- a/spec/integration/knife/role_show_spec.rb
+++ b/spec/integration/knife/role_show_spec.rb
@@ -31,7 +31,7 @@ describe "knife role show", :workstation do
role "cat", {}
end
- # rubocop:disable Style/TrailingWhitespace
+ # rubocop:disable Layout/TrailingWhitespace
it "shows a cookbook" do
knife("role show cons").should_succeed <<EOM
chef_type: role
@@ -44,7 +44,7 @@ override_attributes:
run_list:
EOM
end
- # rubocop:enable Style/TrailingWhitespace
+ # rubocop:enable Layout/TrailingWhitespace
end
end
diff --git a/spec/support/shared/unit/provider/useradd_based_user_provider.rb b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
index 20bfd37a07..cc2d22f64f 100644
--- a/spec/support/shared/unit/provider/useradd_based_user_provider.rb
+++ b/spec/support/shared/unit/provider/useradd_based_user_provider.rb
@@ -85,7 +85,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
it "should combine all the possible options" do
combined_opts = []
- supported_useradd_options.sort { |a, b| a[0] <=> b[0] }.each do |attribute, option|
+ supported_useradd_options.sort_by { |a| a[0] }.each do |attribute, option|
allow(@new_resource).to receive(attribute).and_return("hola")
combined_opts << option << "hola"
end
diff --git a/spec/unit/provider/group/groupadd_spec.rb b/spec/unit/provider/group/groupadd_spec.rb
index 929dd00450..ded1bc76f1 100644
--- a/spec/unit/provider/group/groupadd_spec.rb
+++ b/spec/unit/provider/group/groupadd_spec.rb
@@ -64,7 +64,7 @@ describe Chef::Provider::Group::Groupadd do
it "should combine all the possible options" do
match_array = []
- field_list.sort { |a, b| a[0] <=> b[0] }.each do |attribute, option|
+ field_list.sort_by { |a| a[0] }.each do |attribute, option|
allow(new_resource).to receive(attribute).and_return("hola")
match_array << option
match_array << "hola"
diff --git a/spec/unit/provider/user/pw_spec.rb b/spec/unit/provider/user/pw_spec.rb
index 8843de344f..079fd44ef5 100644
--- a/spec/unit/provider/user/pw_spec.rb
+++ b/spec/unit/provider/user/pw_spec.rb
@@ -69,7 +69,7 @@ describe Chef::Provider::User::Pw do
it "should combine all the possible options" do
match_array = [ "adam" ]
- field_list.sort { |a, b| a[0] <=> b[0] }.each do |attribute, option|
+ field_list.sort_by { |a| a[0] }.each do |attribute, option|
allow(@new_resource).to receive(attribute).and_return("hola")
match_array << option
match_array << "hola"