diff options
Diffstat (limited to 'spec/unit/mixin')
-rw-r--r-- | spec/unit/mixin/params_validate_spec.rb | 12 | ||||
-rw-r--r-- | spec/unit/mixin/properties_spec.rb | 8 | ||||
-rw-r--r-- | spec/unit/mixin/shell_out_spec.rb | 6 | ||||
-rw-r--r-- | spec/unit/mixin/windows_architecture_helper_spec.rb | 2 |
4 files changed, 14 insertions, 14 deletions
diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb index 1cc7fef58e..29d69af403 100644 --- a/spec/unit/mixin/params_validate_spec.rb +++ b/spec/unit/mixin/params_validate_spec.rb @@ -236,7 +236,7 @@ describe Chef::Mixin::ParamsValidate do { one: { kind_of: String, - respond_to: [ :to_s, :upcase ], + respond_to: %i{to_s upcase}, regex: /^is good/, callbacks: { "should be your friend" => lambda do |a| @@ -260,7 +260,7 @@ describe Chef::Mixin::ParamsValidate do { one: { kind_of: String, - respond_to: [ :to_s, :upcase ], + respond_to: %i{to_s upcase}, regex: /^is good/, callbacks: { "should be your friend" => lambda do |a| @@ -334,22 +334,22 @@ describe Chef::Mixin::ParamsValidate do it "asserts that a value returns false from a predicate method" do expect do @vo.validate({ not_blank: "should pass" }, - { not_blank: { cannot_be: [ :nil, :empty ] } }) + { not_blank: { cannot_be: %i{nil empty} } }) end.not_to raise_error expect do @vo.validate({ not_blank: "" }, - { not_blank: { cannot_be: [ :nil, :empty ] } }) + { not_blank: { cannot_be: %i{nil empty} } }) end.to raise_error(Chef::Exceptions::ValidationFailed) end it "allows a custom validation message" do expect do @vo.validate({ not_blank: "should pass" }, - { not_blank: { cannot_be: [ :nil, :empty ], validation_message: "my validation message" } }) + { not_blank: { cannot_be: %i{nil empty}, validation_message: "my validation message" } }) end.not_to raise_error expect do @vo.validate({ not_blank: "" }, - { not_blank: { cannot_be: [ :nil, :empty ], validation_message: "my validation message" } }) + { not_blank: { cannot_be: %i{nil empty}, validation_message: "my validation message" } }) end.to raise_error(Chef::Exceptions::ValidationFailed, "my validation message") end diff --git a/spec/unit/mixin/properties_spec.rb b/spec/unit/mixin/properties_spec.rb index ee0c252381..25b94178e5 100644 --- a/spec/unit/mixin/properties_spec.rb +++ b/spec/unit/mixin/properties_spec.rb @@ -31,7 +31,7 @@ module ChefMixinPropertiesSpec end it "A.properties has a, ab, and ac with types 'a', ['a', 'b'], and ['b', 'c']" do - expect(A.properties.keys).to eq [ :a, :ab, :ac, :d ] + expect(A.properties.keys).to eq %i{a ab ac d} expect(A.properties[:a].validation_options[:is]).to eq "a" expect(A.properties[:ab].validation_options[:is]).to eq %w{a b} expect(A.properties[:ac].validation_options[:is]).to eq %w{a c} @@ -46,13 +46,13 @@ module ChefMixinPropertiesSpec end it "B.properties has b, ab, and bc with types 'b', nil and ['b', 'c']" do - expect(B.properties.keys).to eq [ :b, :ab, :bc ] + expect(B.properties.keys).to eq %i{b ab bc} expect(B.properties[:b].validation_options[:is]).to eq "b" expect(B.properties[:ab].validation_options[:is]).to be_nil expect(B.properties[:bc].validation_options[:is]).to eq %w{b c} end it "C.properties has a, b, c, ac and bc with merged types" do - expect(C.properties.keys).to eq [ :a, :ab, :ac, :d, :b, :bc, :c ] + expect(C.properties.keys).to eq %i{a ab ac d b bc c} expect(C.properties[:a].validation_options[:is]).to eq "a" expect(C.properties[:b].validation_options[:is]).to eq "b" expect(C.properties[:c].validation_options[:is]).to eq "c" @@ -99,7 +99,7 @@ module ChefMixinPropertiesSpec end it "Outerest.properties.validation_options[:is] inner, outer, outerest" do - expect(Outerest.properties.keys).to eq [:inner, :outer, :outerest] + expect(Outerest.properties.keys).to eq %i{inner outer outerest} end end end diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb index 4f8e4dafac..1c4f59b50b 100644 --- a/spec/unit/mixin/shell_out_spec.rb +++ b/spec/unit/mixin/shell_out_spec.rb @@ -51,7 +51,7 @@ describe Chef::Mixin::ShellOut do let(:retobj) { instance_double(Mixlib::ShellOut, "error!" => false) } let(:cmd) { "echo '#{rand(1000)}'" } - [ :shell_out, :shell_out! ].each do |method| + %i{shell_out shell_out!}.each do |method| describe "##{method}" do describe "when the last argument is a Hash" do @@ -248,7 +248,7 @@ describe Chef::Mixin::ShellOut do let(:provider) { new_resource.provider_for_action(:install) } describe "on Chef-15", chef: ">= 15" do - [ :shell_out, :shell_out! ].each do |method| + %i{shell_out shell_out!}.each do |method| stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted! it "#{method} defaults to 900 seconds" do expect(provider).to receive(stubbed_method).with("foo", timeout: 900) @@ -284,7 +284,7 @@ describe Chef::Mixin::ShellOut do let(:new_resource) { Chef::Resource::Package.new("foo") } let(:provider) { new_resource.provider_for_action(:install) } - [ :shell_out, :shell_out! ].each do |method| + %i{shell_out shell_out!}.each do |method| stubbed_method = (method == :shell_out) ? :shell_out_compacted : :shell_out_compacted! it "#{method} defaults to 900 seconds" do expect(provider).to receive(stubbed_method).with("foo", timeout: 900) diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb index 4559702e1c..06acbe49c9 100644 --- a/spec/unit/mixin/windows_architecture_helper_spec.rb +++ b/spec/unit/mixin/windows_architecture_helper_spec.rb @@ -23,7 +23,7 @@ describe Chef::Mixin::WindowsArchitectureHelper do include Chef::Mixin::WindowsArchitectureHelper before do - @valid_architectures = [ :i386, :x86_64 ] + @valid_architectures = %i{i386 x86_64} @invalid_architectures = [ "i386", "x86_64", :x64, :x86, :arm ] @node_i386 = Chef::Node.new |