diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-09 07:53:56 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-09 07:53:56 -0800 |
commit | f073747786abbe6ada55ed24b696a03e39c3c45d (patch) | |
tree | 7971d871e89d522a58291713761a6c83f68e8d19 /spec/unit/resource | |
parent | c6e69783705cfd48bfea0c943dc071964dd21311 (diff) | |
download | chef-f073747786abbe6ada55ed24b696a03e39c3c45d.tar.gz |
auto fixing some rubocops
Style/NegatedWhile
Style/ParenthesesAroundCondition
Style/WhileUntilDo
Style/WordArray
Performance/ReverseEach
Style/ColonMethodCall
Diffstat (limited to 'spec/unit/resource')
-rw-r--r-- | spec/unit/resource/chocolatey_package_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/resource/cron_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/resource/dsc_script_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/resource/group_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/resource/mdadm_spec.rb | 4 | ||||
-rw-r--r-- | spec/unit/resource/mount_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/resource/resource_notification_spec.rb | 4 |
7 files changed, 21 insertions, 21 deletions
diff --git a/spec/unit/resource/chocolatey_package_spec.rb b/spec/unit/resource/chocolatey_package_spec.rb index dfd6a3e679..34874ac6b1 100644 --- a/spec/unit/resource/chocolatey_package_spec.rb +++ b/spec/unit/resource/chocolatey_package_spec.rb @@ -42,13 +42,13 @@ describe Chef::Resource::ChocolateyPackage do end it "the package_name setter should accept arrays" do - resource.package_name(["git", "unzip"]) - expect(resource.package_name).to eql(["git", "unzip"]) + resource.package_name(%w(git unzip)) + expect(resource.package_name).to eql(%w(git unzip)) end it "the name should accept arrays" do - resource = Chef::Resource::ChocolateyPackage.new(["git", "unzip"]) - expect(resource.package_name).to eql(["git", "unzip"]) + resource = Chef::Resource::ChocolateyPackage.new(%w(git unzip)) + expect(resource.package_name).to eql(%w(git unzip)) end it "the default version should be nil" do diff --git a/spec/unit/resource/cron_spec.rb b/spec/unit/resource/cron_spec.rb index 037bbaf733..1e3f629864 100644 --- a/spec/unit/resource/cron_spec.rb +++ b/spec/unit/resource/cron_spec.rb @@ -106,19 +106,19 @@ describe Chef::Resource::Cron do end it "should allow * for all time and date values" do - [ "minute", "hour", "day", "month", "weekday" ].each do |x| + %w(minute hour day month weekday).each do |x| expect(@resource.send(x, "*")).to eql("*") end end it "should allow ranges for all time and date values" do - [ "minute", "hour", "day", "month", "weekday" ].each do |x| + %w(minute hour day month weekday).each do |x| expect(@resource.send(x, "1-2,5")).to eql("1-2,5") end end it "should have a default value of * for all time and date values" do - [ "minute", "hour", "day", "month", "weekday" ].each do |x| + %w(minute hour day month weekday).each do |x| expect(@resource.send(x)).to eql("*") end end @@ -153,7 +153,7 @@ describe Chef::Resource::Cron do end it "should convert integer schedule values to a string" do - [ "minute", "hour", "day", "month", "weekday" ].each do |x| + %w(minute hour day month weekday).each do |x| expect(@resource.send(x, 5)).to eql("5") end end diff --git a/spec/unit/resource/dsc_script_spec.rb b/spec/unit/resource/dsc_script_spec.rb index 55473e3146..d5954119d2 100644 --- a/spec/unit/resource/dsc_script_spec.rb +++ b/spec/unit/resource/dsc_script_spec.rb @@ -77,7 +77,7 @@ describe Chef::Resource::DscScript do context "when calling imports" do let(:module_name) { "FooModule" } let(:module_name_b) { "BarModule" } - let(:dsc_resources) { ["ResourceA", "ResourceB"] } + let(:dsc_resources) { %w(ResourceA ResourceB) } it "allows an arbitrary number of resources to be set for a module to be set" do dsc_test_resource.imports module_name, *dsc_resources diff --git a/spec/unit/resource/group_spec.rb b/spec/unit/resource/group_spec.rb index 7cfec23365..40a184c08b 100644 --- a/spec/unit/resource/group_spec.rb +++ b/spec/unit/resource/group_spec.rb @@ -111,8 +111,8 @@ describe Chef::Resource::Group, "members" do end it "(#{method}) should allow an array" do - @resource.send(method, [ "aj", "adam" ]) - expect(@resource.send(method)).to eql( ["aj", "adam"] ) + @resource.send(method, %w(aj adam)) + expect(@resource.send(method)).to eql( %w(aj adam) ) end it "(#{method}) should not allow a hash" do @@ -142,12 +142,12 @@ describe Chef::Resource::Group, "append" do describe "when it has members" do before do @resource.group_name("pokemon") - @resource.members(["blastoise", "pikachu"]) + @resource.members(%w(blastoise pikachu)) end it "describes its state" do state = @resource.state - expect(state[:members]).to eql(["blastoise", "pikachu"]) + expect(state[:members]).to eql(%w(blastoise pikachu)) end it "returns the group name as its identity" do diff --git a/spec/unit/resource/mdadm_spec.rb b/spec/unit/resource/mdadm_spec.rb index 6a446a2815..b6f9c191b7 100644 --- a/spec/unit/resource/mdadm_spec.rb +++ b/spec/unit/resource/mdadm_spec.rb @@ -82,14 +82,14 @@ describe Chef::Resource::Mdadm do describe "when it has devices, level, and chunk" do before do @resource.raid_device("raider") - @resource.devices(["device1", "device2"]) + @resource.devices(%w(device1 device2)) @resource.level(1) @resource.chunk(42) end it "describes its state" do state = @resource.state - expect(state[:devices]).to eql(["device1", "device2"]) + expect(state[:devices]).to eql(%w(device1 device2)) expect(state[:level]).to eq(1) expect(state[:chunk]).to eq(42) end diff --git a/spec/unit/resource/mount_spec.rb b/spec/unit/resource/mount_spec.rb index ea20511990..8741ac3e75 100644 --- a/spec/unit/resource/mount_spec.rb +++ b/spec/unit/resource/mount_spec.rb @@ -87,19 +87,19 @@ describe Chef::Resource::Mount do end it "should allow options attribute as an array" do - @resource.options ["ro", "nosuid"] + @resource.options %w(ro nosuid) expect(@resource.options).to be_a_kind_of(Array) end it "should allow options to be sent as a delayed evaluator" do - @resource.options Chef::DelayedEvaluator.new { ["rw", "noexec"] } - expect(@resource.options).to eql(["rw", "noexec"]) + @resource.options Chef::DelayedEvaluator.new { %w(rw noexec) } + expect(@resource.options).to eql(%w(rw noexec)) end it "should allow options to be sent as a delayed evaluator, and convert to array" do @resource.options Chef::DelayedEvaluator.new { "rw,noexec" } expect(@resource.options).to be_a_kind_of(Array) - expect(@resource.options).to eql(["rw", "noexec"]) + expect(@resource.options).to eql(%w(rw noexec)) end it "should accept true for mounted" do diff --git a/spec/unit/resource/resource_notification_spec.rb b/spec/unit/resource/resource_notification_spec.rb index 5bb3ba95ea..c720156cec 100644 --- a/spec/unit/resource/resource_notification_spec.rb +++ b/spec/unit/resource/resource_notification_spec.rb @@ -100,7 +100,7 @@ describe Chef::Resource::Notification do end it "raises a RuntimeError if you try to reference multiple resources" do - notification.resource = { :cat => ["keyboard_cat", "cheez_cat"] } + notification.resource = { :cat => %w(keyboard_cat cheez_cat) } @keyboard_cat = Chef::Resource::Cat.new("keyboard_cat") @cheez_cat = Chef::Resource::Cat.new("cheez_cat") @resource_collection = Chef::ResourceCollection.new @@ -112,7 +112,7 @@ describe Chef::Resource::Notification do end it "raises a RuntimeError if you try to reference multiple notifying resources" do - notification.notifying_resource = { :cat => ["long_cat", "cheez_cat"] } + notification.notifying_resource = { :cat => %w(long_cat cheez_cat) } @long_cat = Chef::Resource::Cat.new("long_cat") @cheez_cat = Chef::Resource::Cat.new("cheez_cat") @resource_collection = Chef::ResourceCollection.new |