summaryrefslogtreecommitdiff
path: root/spec/unit/mixin
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/mixin')
-rw-r--r--spec/unit/mixin/api_version_request_handling_spec.rb8
-rw-r--r--spec/unit/mixin/checksum_spec.rb6
-rw-r--r--spec/unit/mixin/command_spec.rb2
-rw-r--r--spec/unit/mixin/convert_to_class_name_spec.rb2
-rw-r--r--spec/unit/mixin/deep_merge_spec.rb16
-rw-r--r--spec/unit/mixin/deprecation_spec.rb6
-rw-r--r--spec/unit/mixin/enforce_ownership_and_permissions_spec.rb14
-rw-r--r--spec/unit/mixin/homebrew_user_spec.rb22
-rw-r--r--spec/unit/mixin/params_validate_spec.rb22
-rw-r--r--spec/unit/mixin/path_sanity_spec.rb16
-rw-r--r--spec/unit/mixin/powershell_out_spec.rb4
-rw-r--r--spec/unit/mixin/powershell_type_coercions_spec.rb40
-rw-r--r--spec/unit/mixin/properties_spec.rb54
-rw-r--r--spec/unit/mixin/proxified_socket_spec.rb8
-rw-r--r--spec/unit/mixin/securable_spec.rb64
-rw-r--r--spec/unit/mixin/shell_out_spec.rb112
-rw-r--r--spec/unit/mixin/subclass_directive_spec.rb2
-rw-r--r--spec/unit/mixin/template_spec.rb16
-rw-r--r--spec/unit/mixin/unformatter_spec.rb4
-rw-r--r--spec/unit/mixin/uris_spec.rb12
-rw-r--r--spec/unit/mixin/windows_architecture_helper_spec.rb4
-rw-r--r--spec/unit/mixin/xml_escape_spec.rb2
22 files changed, 218 insertions, 218 deletions
diff --git a/spec/unit/mixin/api_version_request_handling_spec.rb b/spec/unit/mixin/api_version_request_handling_spec.rb
index fc42d76d72..ac1122bbcf 100644
--- a/spec/unit/mixin/api_version_request_handling_spec.rb
+++ b/spec/unit/mixin/api_version_request_handling_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::ApiVersionRequestHandling do
let(:dummy_class) { Class.new { include Chef::Mixin::ApiVersionRequestHandling } }
@@ -27,7 +27,7 @@ describe Chef::Mixin::ApiVersionRequestHandling do
context "when the response code is not 406" do
- let(:response) { OpenStruct.new(:code => '405') }
+ let(:response) { OpenStruct.new(:code => "405") }
let(:exception) { Net::HTTPServerException.new("405 Something Else", response) }
it "returns nil" do
@@ -38,7 +38,7 @@ describe Chef::Mixin::ApiVersionRequestHandling do
end # when the response code is not 406
context "when the response code is 406" do
- let(:response) { OpenStruct.new(:code => '406') }
+ let(:response) { OpenStruct.new(:code => "406") }
let(:exception) { Net::HTTPServerException.new("406 Not Acceptable", response) }
context "when x-ops-server-api-version header does not exist" do
@@ -59,7 +59,7 @@ describe Chef::Mixin::ApiVersionRequestHandling do
}
before(:each) do
- allow(response).to receive(:[]).with('x-ops-server-api-version').and_return(Chef::JSONCompat.to_json(return_hash))
+ allow(response).to receive(:[]).with("x-ops-server-api-version").and_return(Chef::JSONCompat.to_json(return_hash))
end
context "when there is no intersection between client and server versions" do
diff --git a/spec/unit/mixin/checksum_spec.rb b/spec/unit/mixin/checksum_spec.rb
index 864b15f2bc..080220ec81 100644
--- a/spec/unit/mixin/checksum_spec.rb
+++ b/spec/unit/mixin/checksum_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/checksum'
-require 'stringio'
+require "spec_helper"
+require "chef/mixin/checksum"
+require "stringio"
class Chef::CMCCheck
include Chef::Mixin::Checksum
diff --git a/spec/unit/mixin/command_spec.rb b/spec/unit/mixin/command_spec.rb
index cedabcbe49..8a4bb1acbf 100644
--- a/spec/unit/mixin/command_spec.rb
+++ b/spec/unit/mixin/command_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::Command, :volatile do
diff --git a/spec/unit/mixin/convert_to_class_name_spec.rb b/spec/unit/mixin/convert_to_class_name_spec.rb
index 4cf6728d64..cf90cf31a0 100644
--- a/spec/unit/mixin/convert_to_class_name_spec.rb
+++ b/spec/unit/mixin/convert_to_class_name_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class ConvertToClassTestHarness
include Chef::Mixin::ConvertToClassName
diff --git a/spec/unit/mixin/deep_merge_spec.rb b/spec/unit/mixin/deep_merge_spec.rb
index d107323f32..1212ff2b53 100644
--- a/spec/unit/mixin/deep_merge_spec.rb
+++ b/spec/unit/mixin/deep_merge_spec.rb
@@ -22,26 +22,26 @@
# available under the MIT license from
# http://trac.misuse.org/science/wiki/DeepMerge
-require 'spec_helper'
+require "spec_helper"
# Test coverage from the original author converted to rspec
describe Chef::Mixin::DeepMerge, "deep_merge!" do
before do
@dm = Chef::Mixin::DeepMerge
- @field_ko_prefix = '!merge'
+ @field_ko_prefix = "!merge"
end
# deep_merge core tests - moving from basic to more complex
it "tests merging an hash w/array into blank hash" do
- hash_src = {'id' => '2'}
+ hash_src = {"id" => "2"}
hash_dst = {}
@dm.deep_merge!(hash_src.dup, hash_dst)
expect(hash_dst).to eq(hash_src)
end
it "tests merging an hash w/array into blank hash" do
- hash_src = {'region' => {'id' => ['227', '2']}}
+ hash_src = {"region" => {"id" => ["227", "2"]}}
hash_dst = {}
@dm.deep_merge!(hash_src, hash_dst)
expect(hash_dst).to eq(hash_src)
@@ -181,10 +181,10 @@ describe Chef::Mixin::DeepMerge, "deep_merge!" do
end
it "tests merging of hash with blank hash, and make sure that source array split does not function when turned off" do
- hash_src = {'property' => {'bedroom_count' => ["1","2,3"]}}
+ hash_src = {"property" => {"bedroom_count" => ["1","2,3"]}}
hash_dst = {}
@dm.deep_merge!(hash_src, hash_dst)
- expect(hash_dst).to eq({'property' => {'bedroom_count' => ["1","2,3"]}})
+ expect(hash_dst).to eq({"property" => {"bedroom_count" => ["1","2,3"]}})
end
it "tests merging into a blank hash" do
@@ -247,13 +247,13 @@ describe Chef::Mixin::DeepMerge do
describe "merge" do
it "should merge a hash into an empty hash" do
hash_dst = {}
- hash_src = {'id' => '2'}
+ hash_src = {"id" => "2"}
expect(@dm.merge(hash_dst, hash_src)).to eq(hash_src)
end
it "should merge a nested hash into an empty hash" do
hash_dst = {}
- hash_src = {'region' => {'id' => ['227', '2']}}
+ hash_src = {"region" => {"id" => ["227", "2"]}}
expect(@dm.merge(hash_dst, hash_src)).to eq(hash_src)
end
diff --git a/spec/unit/mixin/deprecation_spec.rb b/spec/unit/mixin/deprecation_spec.rb
index 6d9f39af9f..3ac0936f60 100644
--- a/spec/unit/mixin/deprecation_spec.rb
+++ b/spec/unit/mixin/deprecation_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/deprecation'
+require "spec_helper"
+require "chef/mixin/deprecation"
describe Chef::Mixin do
describe "deprecating constants (Class/Module)" do
@@ -46,7 +46,7 @@ describe Chef::Mixin::Deprecation::DeprecatedInstanceVariable do
before do
Chef::Log.logger = Logger.new(StringIO.new)
- @deprecated_ivar = Chef::Mixin::Deprecation::DeprecatedInstanceVariable.new('value', 'an_ivar')
+ @deprecated_ivar = Chef::Mixin::Deprecation::DeprecatedInstanceVariable.new("value", "an_ivar")
end
it "forward method calls to the target object" do
diff --git a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
index 408926293e..9da7270bc3 100644
--- a/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
+++ b/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'etc'
-require 'ostruct'
+require "spec_helper"
+require "etc"
+require "ostruct"
describe Chef::Mixin::EnforceOwnershipAndPermissions do
@@ -52,8 +52,8 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
allow_any_instance_of(Chef::FileAccessControl).to receive(:describe_changes)
passwd_struct = OpenStruct.new(:name => "root", :passwd => "x",
- :uid => 0, :gid => 0, :dir => '/root',
- :shell => '/bin/bash')
+ :uid => 0, :gid => 0, :dir => "/root",
+ :shell => "/bin/bash")
group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
@@ -76,8 +76,8 @@ describe Chef::Mixin::EnforceOwnershipAndPermissions do
allow_any_instance_of(Chef::FileAccessControl).to receive(:describe_changes)
passwd_struct = OpenStruct.new(:name => "root", :passwd => "x",
- :uid => 0, :gid => 0, :dir => '/root',
- :shell => '/bin/bash')
+ :uid => 0, :gid => 0, :dir => "/root",
+ :shell => "/bin/bash")
group_struct = OpenStruct.new(:name => "root", :passwd => "x", :gid => 0)
allow(Etc).to receive(:getpwuid).and_return(passwd_struct)
diff --git a/spec/unit/mixin/homebrew_user_spec.rb b/spec/unit/mixin/homebrew_user_spec.rb
index 57b89720dc..77e37a030c 100644
--- a/spec/unit/mixin/homebrew_user_spec.rb
+++ b/spec/unit/mixin/homebrew_user_spec.rb
@@ -15,8 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'spec_helper'
-require 'chef/mixin/homebrew_user'
+require "spec_helper"
+require "chef/mixin/homebrew_user"
class ExampleHomebrewUser
include Chef::Mixin::HomebrewUser
@@ -24,22 +24,22 @@ end
describe Chef::Mixin::HomebrewUser do
before(:each) do
- node.default['homebrew']['owner'] = nil
+ node.default["homebrew"]["owner"] = nil
end
let(:homebrew_user) { ExampleHomebrewUser.new }
let(:node) { Chef::Node.new }
- describe 'when the homebrew user is provided' do
+ describe "when the homebrew user is provided" do
let(:uid) { 1001 }
let(:user) { "foo" }
- it 'returns the homebrew user without looking at the file when uid is provided' do
+ it "returns the homebrew user without looking at the file when uid is provided" do
expect(File).to receive(:exist?).exactly(0).times
expect(homebrew_user.find_homebrew_uid(uid)).to eq(uid)
end
- it 'returns the homebrew user without looking at the file when name is provided' do
+ it "returns the homebrew user without looking at the file when name is provided" do
expect(File).to receive(:exist?).exactly(0).times
allow(Etc).to receive_message_chain(:getpwnam, :uid).and_return(uid)
expect(homebrew_user.find_homebrew_uid(user)).to eq(uid)
@@ -50,7 +50,7 @@ describe Chef::Mixin::HomebrewUser do
shared_examples "successfully find executable" do
let(:user) { nil }
let(:brew_owner) { 2001 }
- let(:default_brew_path) { '/usr/local/bin/brew' }
+ let(:default_brew_path) { "/usr/local/bin/brew" }
let(:stat_double) {
d = double()
expect(d).to receive(:uid).and_return(brew_owner)
@@ -63,13 +63,13 @@ describe Chef::Mixin::HomebrewUser do
expect(Etc).to receive(:getpwuid).with(brew_owner).and_return(OpenStruct.new(:name => "name"))
end
- it 'returns the owner of the brew executable when it is at a default location' do
+ it "returns the owner of the brew executable when it is at a default location" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(true)
expect(File).to receive(:stat).with(default_brew_path).and_return(stat_double)
expect(homebrew_user.find_homebrew_uid(user)).to eq(brew_owner)
end
- it 'returns the owner of the brew executable when it is not at a default location' do
+ it "returns the owner of the brew executable when it is not at a default location" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(false)
allow(homebrew_user).to receive_message_chain(:shell_out, :stdout, :strip).and_return("/foo")
expect(File).to receive(:stat).with("/foo").and_return(stat_double)
@@ -79,9 +79,9 @@ describe Chef::Mixin::HomebrewUser do
end
end
- describe 'when the homebrew user is not provided' do
+ describe "when the homebrew user is not provided" do
- it 'raises an error if no executable is found' do
+ it "raises an error if no executable is found" do
expect(File).to receive(:exist?).with(default_brew_path).and_return(false)
allow(homebrew_user).to receive_message_chain(:shell_out, :stdout, :strip).and_return("")
expect { homebrew_user.find_homebrew_uid(user) }.to raise_error(Chef::Exceptions::CannotDetermineHomebrewOwner)
diff --git a/spec/unit/mixin/params_validate_spec.rb b/spec/unit/mixin/params_validate_spec.rb
index 99d5230a75..15f99d98f8 100644
--- a/spec/unit/mixin/params_validate_spec.rb
+++ b/spec/unit/mixin/params_validate_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class TinyClass
include Chef::Mixin::ParamsValidate
@@ -372,12 +372,12 @@ describe Chef::Mixin::ParamsValidate do
end
it "should allow DelayedEvaluator instance to be set for value regardless of restriction" do
- value = Chef::DelayedEvaluator.new{ 'test' }
+ value = Chef::DelayedEvaluator.new{ "test" }
@vo.set_or_return(:test, value, {:kind_of => Numeric})
end
it "should raise an error when delayed evaluated attribute is not valid" do
- value = Chef::DelayedEvaluator.new{ 'test' }
+ value = Chef::DelayedEvaluator.new{ "test" }
@vo.set_or_return(:test, value, {:kind_of => Numeric})
expect do
@vo.set_or_return(:test, nil, {:kind_of => Numeric})
@@ -385,22 +385,22 @@ describe Chef::Mixin::ParamsValidate do
end
it "should create DelayedEvaluator instance when #lazy is used" do
- @vo.set_or_return(:delayed, @vo.lazy{ 'test' }, {})
+ @vo.set_or_return(:delayed, @vo.lazy{ "test" }, {})
expect(@vo.instance_variable_get(:@delayed)).to be_a(Chef::DelayedEvaluator)
end
it "should execute block on each call when DelayedEvaluator" do
- value = 'fubar'
+ value = "fubar"
@vo.set_or_return(:test, @vo.lazy{ value }, {})
- expect(@vo.set_or_return(:test, nil, {})).to eq('fubar')
- value = 'foobar'
- expect(@vo.set_or_return(:test, nil, {})).to eq('foobar')
- value = 'fauxbar'
- expect(@vo.set_or_return(:test, nil, {})).to eq('fauxbar')
+ expect(@vo.set_or_return(:test, nil, {})).to eq("fubar")
+ value = "foobar"
+ expect(@vo.set_or_return(:test, nil, {})).to eq("foobar")
+ value = "fauxbar"
+ expect(@vo.set_or_return(:test, nil, {})).to eq("fauxbar")
end
it "should not evaluate non DelayedEvaluator instances" do
- value = lambda{ 'test' }
+ value = lambda{ "test" }
@vo.set_or_return(:test, value, {})
expect(@vo.set_or_return(:test, nil, {}).object_id).to eq(value.object_id)
expect(@vo.set_or_return(:test, nil, {})).to be_a(Proc)
diff --git a/spec/unit/mixin/path_sanity_spec.rb b/spec/unit/mixin/path_sanity_spec.rb
index 3a924b9538..547c78f706 100644
--- a/spec/unit/mixin/path_sanity_spec.rb
+++ b/spec/unit/mixin/path_sanity_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class PathSanityTestHarness
include Chef::Mixin::PathSanity
@@ -31,10 +31,10 @@ describe Chef::Mixin::PathSanity do
describe "when enforcing path sanity" do
before do
Chef::Config[:enforce_path_sanity] = true
- @ruby_bindir = '/some/ruby/bin'
- @gem_bindir = '/some/gem/bin'
+ @ruby_bindir = "/some/ruby/bin"
+ @gem_bindir = "/some/gem/bin"
allow(Gem).to receive(:bindir).and_return(@gem_bindir)
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(@ruby_bindir)
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(@ruby_bindir)
allow(ChefConfig).to receive(:windows?).and_return(false)
end
@@ -63,10 +63,10 @@ describe Chef::Mixin::PathSanity do
end
it "does not create entries for Ruby/Gem bindirs if they exist in SANE_PATH or PATH" do
- ruby_bindir = '/usr/bin'
- gem_bindir = '/yo/gabba/gabba'
+ ruby_bindir = "/usr/bin"
+ gem_bindir = "/yo/gabba/gabba"
allow(Gem).to receive(:bindir).and_return(gem_bindir)
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(ruby_bindir)
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(ruby_bindir)
env = {"PATH" => gem_bindir}
@sanity.enforce_path_sanity(env)
expect(env["PATH"]).to eq("/yo/gabba/gabba:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")
@@ -76,7 +76,7 @@ describe Chef::Mixin::PathSanity do
ruby_bindir = 'C:\ruby\bin'
gem_bindir = 'C:\gems\bin'
allow(Gem).to receive(:bindir).and_return(gem_bindir)
- allow(RbConfig::CONFIG).to receive(:[]).with('bindir').and_return(ruby_bindir)
+ allow(RbConfig::CONFIG).to receive(:[]).with("bindir").and_return(ruby_bindir)
allow(ChefConfig).to receive(:windows?).and_return(true)
env = {"PATH" => 'C:\Windows\system32;C:\mr\softie'}
@sanity.enforce_path_sanity(env)
diff --git a/spec/unit/mixin/powershell_out_spec.rb b/spec/unit/mixin/powershell_out_spec.rb
index 79faf8127d..e8ba6036c5 100644
--- a/spec/unit/mixin/powershell_out_spec.rb
+++ b/spec/unit/mixin/powershell_out_spec.rb
@@ -15,8 +15,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/powershell_out'
+require "spec_helper"
+require "chef/mixin/powershell_out"
describe Chef::Mixin::PowershellOut do
let(:shell_out_class) { Class.new { include Chef::Mixin::PowershellOut } }
diff --git a/spec/unit/mixin/powershell_type_coercions_spec.rb b/spec/unit/mixin/powershell_type_coercions_spec.rb
index 988c3926c1..7f49784e8b 100644
--- a/spec/unit/mixin/powershell_type_coercions_spec.rb
+++ b/spec/unit/mixin/powershell_type_coercions_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/powershell_type_coercions'
-require 'base64'
+require "spec_helper"
+require "chef/mixin/powershell_type_coercions"
+require "base64"
class Chef::PSTypeTester
include Chef::Mixin::PowershellTypeCoercions
@@ -28,45 +28,45 @@ describe Chef::Mixin::PowershellTypeCoercions do
let (:test_class) { Chef::PSTypeTester.new }
describe '#translate_type' do
- it 'should single quote a string' do
- expect(test_class.translate_type('foo')).to eq("'foo'")
+ it "should single quote a string" do
+ expect(test_class.translate_type("foo")).to eq("'foo'")
end
- ["'", '"', '#', '`'].each do |c|
+ ["'", '"', '#', "`"].each do |c|
it "should base64 encode a string that contains #{c}" do
expect(test_class.translate_type("#{c}")).to match(Base64.strict_encode64(c))
end
end
- it 'should not quote an integer' do
- expect(test_class.translate_type(123)).to eq('123')
+ it "should not quote an integer" do
+ expect(test_class.translate_type(123)).to eq("123")
end
- it 'should not quote a floating point number' do
- expect(test_class.translate_type(123.4)).to eq('123.4')
+ it "should not quote a floating point number" do
+ expect(test_class.translate_type(123.4)).to eq("123.4")
end
- it 'should return $false when an instance of FalseClass is provided' do
- expect(test_class.translate_type(false)).to eq('$false')
+ it "should return $false when an instance of FalseClass is provided" do
+ expect(test_class.translate_type(false)).to eq("$false")
end
- it 'should return $true when an instance of TrueClass is provided' do
- expect(test_class.translate_type(true)).to eq('$true')
+ it "should return $true when an instance of TrueClass is provided" do
+ expect(test_class.translate_type(true)).to eq("$true")
end
- it 'should translate all members of a hash and wrap them in @{} separated by ;' do
+ it "should translate all members of a hash and wrap them in @{} separated by ;" do
expect(test_class.translate_type({"a" => 1, "b" => 1.2, "c" => false, "d" => true
})).to eq("@{a=1;b=1.2;c=$false;d=$true}")
end
- it 'should translat all members of an array and them by a ,' do
- expect(test_class.translate_type([true, false])).to eq('@($true,$false)')
+ it "should translat all members of an array and them by a ," do
+ expect(test_class.translate_type([true, false])).to eq("@($true,$false)")
end
- it 'should fall back :to_psobject if we have not defined at explicit rule' do
+ it "should fall back :to_psobject if we have not defined at explicit rule" do
ps_obj = double("PSObject")
- expect(ps_obj).to receive(:to_psobject).and_return('$true')
- expect(test_class.translate_type(ps_obj)).to eq('($true)')
+ expect(ps_obj).to receive(:to_psobject).and_return("$true")
+ expect(test_class.translate_type(ps_obj)).to eq("($true)")
end
end
end
diff --git a/spec/unit/mixin/properties_spec.rb b/spec/unit/mixin/properties_spec.rb
index 18178619e4..00e339a221 100644
--- a/spec/unit/mixin/properties_spec.rb
+++ b/spec/unit/mixin/properties_spec.rb
@@ -1,5 +1,5 @@
-require 'support/shared/integration/integration_helper'
-require 'chef/mixin/properties'
+require "support/shared/integration/integration_helper"
+require "chef/mixin/properties"
module ChefMixinPropertiesSpec
describe "Chef::Resource.property" do
@@ -8,46 +8,46 @@ module ChefMixinPropertiesSpec
context "with a base class A with properties a, ab, and ac" do
class A
include Chef::Mixin::Properties
- property :a, 'a', default: 'a'
- property :ab, ['a', 'b'], default: 'a'
- property :ac, ['a', 'c'], default: 'a'
+ property :a, "a", default: "a"
+ property :ab, ["a", "b"], default: "a"
+ property :ac, ["a", "c"], default: "a"
end
context "and a module B with properties b, ab and bc" do
module B
include Chef::Mixin::Properties
- property :b, 'b', default: 'b'
- property :ab, default: 'b'
- property :bc, ['b', 'c'], default: 'c'
+ property :b, "b", default: "b"
+ property :ab, default: "b"
+ property :bc, ["b", "c"], default: "c"
end
context "and a derived class C < A with properties c, ac and bc" do
class C < A
include B
- property :c, 'c', default: 'c'
- property :ac, default: 'c'
- property :bc, default: 'c'
+ property :c, "c", default: "c"
+ property :ac, default: "c"
+ property :bc, default: "c"
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 ]
- expect(A.properties[:a].validation_options[:is]).to eq 'a'
- expect(A.properties[:ab].validation_options[:is]).to eq [ 'a', 'b' ]
- expect(A.properties[:ac].validation_options[:is]).to eq [ 'a', 'c' ]
+ expect(A.properties[:a].validation_options[:is]).to eq "a"
+ expect(A.properties[:ab].validation_options[:is]).to eq [ "a", "b" ]
+ expect(A.properties[:ac].validation_options[:is]).to eq [ "a", "c" ]
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[:b].validation_options[:is]).to eq 'b'
+ 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 [ 'b', 'c' ]
+ expect(B.properties[:bc].validation_options[:is]).to eq [ "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, :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'
- expect(C.properties[:ac].validation_options[:is]).to eq [ 'a', 'c' ]
- expect(C.properties[:bc].validation_options[:is]).to eq [ 'b', '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"
+ expect(C.properties[:ac].validation_options[:is]).to eq [ "a", "c" ]
+ expect(C.properties[:bc].validation_options[:is]).to eq [ "b", "c" ]
end
it "C.properties has ab with a non-merged type (from B)" do
expect(C.properties[:ab].validation_options[:is]).to be_nil
@@ -57,12 +57,12 @@ module ChefMixinPropertiesSpec
let(:c) { C.new }
it "all properties can be retrieved and merged properties default to ab->b, ac->c, bc->c" do
- expect(c.a).to eq('a')
- expect(c.b).to eq('b')
- expect(c.c).to eq('c')
- expect(c.ab).to eq('b')
- expect(c.ac).to eq('c')
- expect(c.bc).to eq('c')
+ expect(c.a).to eq("a")
+ expect(c.b).to eq("b")
+ expect(c.c).to eq("c")
+ expect(c.ab).to eq("b")
+ expect(c.ac).to eq("c")
+ expect(c.bc).to eq("c")
end
end
end
diff --git a/spec/unit/mixin/proxified_socket_spec.rb b/spec/unit/mixin/proxified_socket_spec.rb
index 88f71ae48b..70c1ff95cd 100644
--- a/spec/unit/mixin/proxified_socket_spec.rb
+++ b/spec/unit/mixin/proxified_socket_spec.rb
@@ -63,8 +63,8 @@ describe Chef::Mixin::ProxifiedSocket do
before do
# I'm purposefully setting both of these because we prefer the https
# variable
- ENV['https_proxy'] = https_uri
- ENV['http_proxy'] = http_uri
+ ENV["https_proxy"] = https_uri
+ ENV["http_proxy"] = http_uri
end
let(:proxy_uri) { https_uri }
@@ -74,7 +74,7 @@ describe Chef::Mixin::ProxifiedSocket do
# This is testing that no_proxy is also provided to Proxified
# when it is set
before do
- ENV['no_proxy'] = no_proxy_spec
+ ENV["no_proxy"] = no_proxy_spec
end
let(:no_proxy_spec) { "somehost1,somehost2" }
@@ -84,7 +84,7 @@ describe Chef::Mixin::ProxifiedSocket do
context "when http_proxy is set" do
before do
- ENV['http_proxy'] = http_uri
+ ENV["http_proxy"] = http_uri
end
let(:proxy_uri) { http_uri }
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index 33d5eb2141..d52dcd7cbe 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::Securable do
@@ -59,32 +59,32 @@ describe Chef::Mixin::Securable do
end
it "should accept group/owner names that are a single character or digit" do
- expect { @securable.group 'v' }.not_to raise_error
- expect { @securable.group '1' }.not_to raise_error
- expect { @securable.owner 'v' }.not_to raise_error
- expect { @securable.owner '1' }.not_to raise_error
+ expect { @securable.group "v" }.not_to raise_error
+ expect { @securable.group "1" }.not_to raise_error
+ expect { @securable.owner "v" }.not_to raise_error
+ expect { @securable.owner "1" }.not_to raise_error
end
it "should not accept group/owner names starting with '-', '+', or '~'" do
- expect { @securable.group '-test' }.to raise_error(ArgumentError)
- expect { @securable.group '+test' }.to raise_error(ArgumentError)
- expect { @securable.group '~test' }.to raise_error(ArgumentError)
- expect { @securable.group 'te-st' }.not_to raise_error
- expect { @securable.group 'te+st' }.not_to raise_error
- expect { @securable.group 'te~st' }.not_to raise_error
- expect { @securable.owner '-test' }.to raise_error(ArgumentError)
- expect { @securable.owner '+test' }.to raise_error(ArgumentError)
- expect { @securable.owner '~test' }.to raise_error(ArgumentError)
- expect { @securable.owner 'te-st' }.not_to raise_error
- expect { @securable.owner 'te+st' }.not_to raise_error
- expect { @securable.owner 'te~st' }.not_to raise_error
+ expect { @securable.group "-test" }.to raise_error(ArgumentError)
+ expect { @securable.group "+test" }.to raise_error(ArgumentError)
+ expect { @securable.group "~test" }.to raise_error(ArgumentError)
+ expect { @securable.group "te-st" }.not_to raise_error
+ expect { @securable.group "te+st" }.not_to raise_error
+ expect { @securable.group "te~st" }.not_to raise_error
+ expect { @securable.owner "-test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "+test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "~test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te-st" }.not_to raise_error
+ expect { @securable.owner "te+st" }.not_to raise_error
+ expect { @securable.owner "te~st" }.not_to raise_error
end
it "should not accept group/owner names containing ':', ',' or non-space whitespace" do
- expect { @securable.group ':test' }.to raise_error(ArgumentError)
- expect { @securable.group 'te:st' }.to raise_error(ArgumentError)
- expect { @securable.group ',test' }.to raise_error(ArgumentError)
- expect { @securable.group 'te,st' }.to raise_error(ArgumentError)
+ expect { @securable.group ":test" }.to raise_error(ArgumentError)
+ expect { @securable.group "te:st" }.to raise_error(ArgumentError)
+ expect { @securable.group ",test" }.to raise_error(ArgumentError)
+ expect { @securable.group "te,st" }.to raise_error(ArgumentError)
expect { @securable.group "\ttest" }.to raise_error(ArgumentError)
expect { @securable.group "te\tst" }.to raise_error(ArgumentError)
expect { @securable.group "\rtest" }.to raise_error(ArgumentError)
@@ -93,10 +93,10 @@ describe Chef::Mixin::Securable do
expect { @securable.group "te\fst" }.to raise_error(ArgumentError)
expect { @securable.group "\0test" }.to raise_error(ArgumentError)
expect { @securable.group "te\0st" }.to raise_error(ArgumentError)
- expect { @securable.owner ':test' }.to raise_error(ArgumentError)
- expect { @securable.owner 'te:st' }.to raise_error(ArgumentError)
- expect { @securable.owner ',test' }.to raise_error(ArgumentError)
- expect { @securable.owner 'te,st' }.to raise_error(ArgumentError)
+ expect { @securable.owner ":test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te:st" }.to raise_error(ArgumentError)
+ expect { @securable.owner ",test" }.to raise_error(ArgumentError)
+ expect { @securable.owner "te,st" }.to raise_error(ArgumentError)
expect { @securable.owner "\ttest" }.to raise_error(ArgumentError)
expect { @securable.owner "te\tst" }.to raise_error(ArgumentError)
expect { @securable.owner "\rtest" }.to raise_error(ArgumentError)
@@ -124,10 +124,10 @@ describe Chef::Mixin::Securable do
end
it "should accept group/owner names in UTF-8" do
- expect { @securable.group 'tëst' }.not_to raise_error
- expect { @securable.group 'ë' }.not_to raise_error
- expect { @securable.owner 'tëst' }.not_to raise_error
- expect { @securable.owner 'ë' }.not_to raise_error
+ expect { @securable.group "tëst" }.not_to raise_error
+ expect { @securable.group "ë" }.not_to raise_error
+ expect { @securable.owner "tëst" }.not_to raise_error
+ expect { @securable.owner "ë" }.not_to raise_error
end
it "should accept a unix file mode in string form as an octal number" do
@@ -262,19 +262,19 @@ describe Chef::Mixin::Securable do
expect { @securable.rights :read, "The Dude", :applies_to_children => true }.not_to raise_error
expect { @securable.rights :read, "The Dude", :applies_to_children => :containers_only }.not_to raise_error
expect { @securable.rights :read, "The Dude", :applies_to_children => :objects_only }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => 'poop' }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_children => "poop" }.to raise_error(ArgumentError)
end
it "should allow you to specify whether the permissions applies_to_self with true/false" do
expect { @securable.rights :read, "The Dude", :applies_to_children => true, :applies_to_self => false }.not_to raise_error
expect { @securable.rights :read, "The Dude", :applies_to_self => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_self => 'poop' }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_self => "poop" }.to raise_error(ArgumentError)
end
it "should allow you to specify whether the permissions applies one_level_deep with true/false" do
expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => false }.not_to raise_error
expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => true }.not_to raise_error
- expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => 'poop' }.to raise_error(ArgumentError)
+ expect { @securable.rights :read, "The Dude", :applies_to_children => true, :one_level_deep => "poop" }.to raise_error(ArgumentError)
end
it "should allow multiple rights and deny_rights declarations" do
diff --git a/spec/unit/mixin/shell_out_spec.rb b/spec/unit/mixin/shell_out_spec.rb
index c22d45e5fd..8a2fea651a 100644
--- a/spec/unit/mixin/shell_out_spec.rb
+++ b/spec/unit/mixin/shell_out_spec.rb
@@ -20,7 +20,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
describe Chef::Mixin::ShellOut do
let(:shell_out_class) { Class.new { include Chef::Mixin::ShellOut } }
@@ -34,25 +34,25 @@ describe Chef::Mixin::ShellOut do
let!(:capture_log_output) { Chef::Log.logger = Logger.new(output) }
let(:assume_deprecation_log_level) { allow(Chef::Log).to receive(:level).and_return(:warn) }
- context 'without options' do
+ context "without options" do
let(:command_args) { [ cmd ] }
- it 'should not edit command args' do
+ it "should not edit command args" do
is_expected.to eql(command_args)
end
end
- context 'without deprecated options' do
+ context "without deprecated options" do
let(:options) { { :environment => environment } }
- let(:environment) { { 'LC_ALL' => 'C', 'LANG' => 'C', 'LANGUAGE' => 'C' } }
+ let(:environment) { { "LC_ALL" => "C", "LANG" => "C", "LANGUAGE" => "C" } }
- it 'should not edit command args' do
+ it "should not edit command args" do
is_expected.to eql(command_args)
end
end
def self.should_emit_deprecation_warning_about(old_option, new_option)
- it 'should emit a deprecation warning' do
+ it "should emit a deprecation warning" do
assume_deprecation_log_level and capture_log_output
subject
expect(output.string).to match /DEPRECATION:/
@@ -61,22 +61,22 @@ describe Chef::Mixin::ShellOut do
end
end
- context 'with :command_log_level option' do
+ context "with :command_log_level option" do
let(:options) { { :command_log_level => command_log_level } }
let(:command_log_level) { :warn }
- it 'should convert :command_log_level to :log_level' do
+ it "should convert :command_log_level to :log_level" do
is_expected.to eql [ cmd, { :log_level => command_log_level } ]
end
should_emit_deprecation_warning_about :command_log_level, :log_level
end
- context 'with :command_log_prepend option' do
+ context "with :command_log_prepend option" do
let(:options) { { :command_log_prepend => command_log_prepend } }
- let(:command_log_prepend) { 'PROVIDER:' }
+ let(:command_log_prepend) { "PROVIDER:" }
- it 'should convert :command_log_prepend to :log_tag' do
+ it "should convert :command_log_prepend to :log_tag" do
is_expected.to eql [ cmd, { :log_tag => command_log_prepend } ]
end
@@ -84,7 +84,7 @@ describe Chef::Mixin::ShellOut do
end
context "with 'command_log_level' option" do
- let(:options) { { 'command_log_level' => command_log_level } }
+ let(:options) { { "command_log_level" => command_log_level } }
let(:command_log_level) { :warn }
it "should convert 'command_log_level' to :log_level" do
@@ -95,8 +95,8 @@ describe Chef::Mixin::ShellOut do
end
context "with 'command_log_prepend' option" do
- let(:options) { { 'command_log_prepend' => command_log_prepend } }
- let(:command_log_prepend) { 'PROVIDER:' }
+ let(:options) { { "command_log_prepend" => command_log_prepend } }
+ let(:command_log_prepend) { "PROVIDER:" }
it "should convert 'command_log_prepend' to :log_tag" do
is_expected.to eql [ cmd, { :log_tag => command_log_prepend } ]
@@ -124,95 +124,95 @@ describe Chef::Mixin::ShellOut do
describe "when the last argument is a Hash" do
describe "and environment is an option" do
it "should not change environment language settings when they are set to nil" do
- options = { :environment => { 'LC_ALL' => nil, 'LANGUAGE' => nil, 'LANG' => nil } }
+ options = { :environment => { "LC_ALL" => nil, "LANGUAGE" => nil, "LANG" => nil } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, options)
end
it "should not change environment language settings when they are set to non-nil" do
- options = { :environment => { 'LC_ALL' => 'en_US.UTF-8', 'LANGUAGE' => 'en_US.UTF-8', 'LANG' => 'en_US.UTF-8' } }
+ options = { :environment => { "LC_ALL" => "en_US.UTF-8", "LANGUAGE" => "en_US.UTF-8", "LANG" => "en_US.UTF-8" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, options)
end
it "should set environment language settings to the configured internal locale when they are not present" do
- options = { :environment => { 'HOME' => '/Users/morty' } }
+ options = { :environment => { "HOME" => "/Users/morty" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
end
it "should not mutate the options hash when it adds language settings" do
- options = { :environment => { 'HOME' => '/Users/morty' } }
+ options = { :environment => { "HOME" => "/Users/morty" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
- expect(options[:environment].has_key?('LC_ALL')).to be false
+ expect(options[:environment].has_key?("LC_ALL")).to be false
end
end
describe "and env is an option" do
it "should not change env when langauge options are set to nil" do
- options = { :env => { 'LC_ALL' => nil, 'LANG' => nil, 'LANGUAGE' => nil } }
+ options = { :env => { "LC_ALL" => nil, "LANG" => nil, "LANGUAGE" => nil } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, options)
end
it "should not change env when language options are set to non-nil" do
- options = { :env => { 'LC_ALL' => 'de_DE.UTF-8', 'LANG' => 'de_DE.UTF-8', 'LANGUAGE' => 'de_DE.UTF-8' }}
+ options = { :env => { "LC_ALL" => "de_DE.UTF-8", "LANG" => "de_DE.UTF-8", "LANGUAGE" => "de_DE.UTF-8" }}
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out(cmd, options)
end
it "should set environment language settings to the configured internal locale when they are not present" do
- options = { :env => { 'HOME' => '/Users/morty' } }
+ options = { :env => { "HOME" => "/Users/morty" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:env => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
end
it "should not mutate the options hash when it adds language settings" do
- options = { :env => { 'HOME' => '/Users/morty' } }
+ options = { :env => { "HOME" => "/Users/morty" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:env => {
- 'HOME' => '/Users/morty',
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "HOME" => "/Users/morty",
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
- expect(options[:env].has_key?('LC_ALL')).to be false
+ expect(options[:env].has_key?("LC_ALL")).to be false
end
end
describe "and no env/environment option is present" do
it "should set environment language settings to the configured internal locale" do
- options = { :user => 'morty' }
+ options = { :user => "morty" }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
- :user => 'morty',
+ :user => "morty",
:environment => {
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
},
},).and_return(true)
shell_out_obj.shell_out(cmd, options)
@@ -224,9 +224,9 @@ describe Chef::Mixin::ShellOut do
it "should set environment language settings to the configured internal locale" do
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, {
:environment => {
- 'LC_ALL' => Chef::Config[:internal_locale],
- 'LANG' => Chef::Config[:internal_locale],
- 'LANGUAGE' => Chef::Config[:internal_locale],
+ "LC_ALL" => Chef::Config[:internal_locale],
+ "LANG" => Chef::Config[:internal_locale],
+ "LANGUAGE" => Chef::Config[:internal_locale],
}
},).and_return(true)
shell_out_obj.shell_out(cmd)
@@ -240,19 +240,19 @@ describe Chef::Mixin::ShellOut do
describe "when the last argument is a Hash" do
describe "and environment is an option" do
it "should not change environment['LC_ALL'] when set to nil" do
- options = { :environment => { 'LC_ALL' => nil } }
+ options = { :environment => { "LC_ALL" => nil } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should not change environment['LC_ALL'] when set to non-nil" do
- options = { :environment => { 'LC_ALL' => 'en_US.UTF-8' } }
+ options = { :environment => { "LC_ALL" => "en_US.UTF-8" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should no longer set environment['LC_ALL'] to nil when 'LC_ALL' not present" do
- options = { :environment => { 'HOME' => '/Users/morty' } }
+ options = { :environment => { "HOME" => "/Users/morty" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
@@ -260,19 +260,19 @@ describe Chef::Mixin::ShellOut do
describe "and env is an option" do
it "should not change env when set to nil" do
- options = { :env => { 'LC_ALL' => nil } }
+ options = { :env => { "LC_ALL" => nil } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should not change env when set to non-nil" do
- options = { :env => { 'LC_ALL' => 'en_US.UTF-8'}}
+ options = { :env => { "LC_ALL" => "en_US.UTF-8"}}
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
it "should no longer set env['LC_ALL'] to nil when 'LC_ALL' not present" do
- options = { :env => { 'HOME' => '/Users/morty' } }
+ options = { :env => { "HOME" => "/Users/morty" } }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
@@ -280,7 +280,7 @@ describe Chef::Mixin::ShellOut do
describe "and no env/environment option is present" do
it "should no longer add environment option and set environment['LC_ALL'] to nil" do
- options = { :user => 'morty' }
+ options = { :user => "morty" }
expect(shell_out_obj).to receive(:shell_out_command).with(cmd, options).and_return(true)
shell_out_obj.shell_out_with_systems_locale(cmd, options)
end
diff --git a/spec/unit/mixin/subclass_directive_spec.rb b/spec/unit/mixin/subclass_directive_spec.rb
index 552f26c0c1..38357883d3 100644
--- a/spec/unit/mixin/subclass_directive_spec.rb
+++ b/spec/unit/mixin/subclass_directive_spec.rb
@@ -15,7 +15,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class SubclassDirectiveParent
extend Chef::Mixin::SubclassDirective
diff --git a/spec/unit/mixin/template_spec.rb b/spec/unit/mixin/template_spec.rb
index 95d0eb6711..2fb384866d 100644
--- a/spec/unit/mixin/template_spec.rb
+++ b/spec/unit/mixin/template_spec.rb
@@ -16,9 +16,9 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
-require 'cgi'
+require "cgi"
describe Chef::Mixin::Template, "render_template" do
let(:sep) { Chef::Platform.windows? ? "\r\n" : "\n" }
@@ -85,10 +85,10 @@ describe Chef::Mixin::Template, "render_template" do
@events = Chef::EventDispatch::Dispatcher.new
@run_context = Chef::RunContext.new(@node, @cookbook_collection, @events)
- @rendered_file_location = Dir.tmpdir + '/openldap_stuff.conf'
+ @rendered_file_location = Dir.tmpdir + "/openldap_stuff.conf"
@resource = Chef::Resource::Template.new(@rendered_file_location)
- @resource.cookbook_name = 'openldap'
+ @resource.cookbook_name = "openldap"
@current_resource = @resource.dup
@content_provider = Chef::Provider::Template::Content.new(@resource, @current_resource, @run_context)
@@ -117,7 +117,7 @@ describe Chef::Mixin::Template, "render_template" do
end
it "should render partials from a different cookbook" do
- @template_context[:template_finder] = Chef::Provider::TemplateFinder.new(@run_context, 'apache2', @node)
+ @template_context[:template_finder] = Chef::Provider::TemplateFinder.new(@run_context, "apache2", @node)
output = @template_context.render_template_from_string("before {<%= render('test.erb', :cookbook => 'openldap').strip %>} after")
expect(output).to eq("before {We could be diving for pearls!} after")
@@ -144,7 +144,7 @@ describe Chef::Mixin::Template, "render_template" do
end
it "should pass the original variables to partials" do
- @template_context[:secret] = 'candy'
+ @template_context[:secret] = "candy"
output = @template_context.render_template_from_string("before {<%= render 'openldap_variable_stuff.conf.erb' %>} after")
output == "before {super secret is candy} after"
@@ -161,7 +161,7 @@ describe Chef::Mixin::Template, "render_template" do
end
it "should pass variables to partials even if they are named the same" do
- @template_context[:secret] = 'one'
+ @template_context[:secret] = "one"
output = @template_context.render_template_from_string("before {<%= render 'openldap_variable_stuff.conf.erb', :variables => {:secret => 'two' } %>} after <%= @secret %>")
expect(output).to eq("before {super secret is two} after one")
@@ -206,7 +206,7 @@ describe Chef::Mixin::Template, "render_template" do
def render_template_from_string
end
end
- ['node', 'render', 'render_template', 'render_template_from_string'].each do |method_name|
+ ["node", "render", "render_template", "render_template_from_string"].each do |method_name|
expect(Chef::Log).to receive(:warn).with(/^Core template method `#{method_name}' overridden by extension module/)
end
@template_context._extend_modules([mod])
diff --git a/spec/unit/mixin/unformatter_spec.rb b/spec/unit/mixin/unformatter_spec.rb
index 2eae0ac9bb..c63ed62b8d 100644
--- a/spec/unit/mixin/unformatter_spec.rb
+++ b/spec/unit/mixin/unformatter_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/unformatter'
+require "spec_helper"
+require "chef/mixin/unformatter"
class Chef::UnformatterTest
include Chef::Mixin::Unformatter
diff --git a/spec/unit/mixin/uris_spec.rb b/spec/unit/mixin/uris_spec.rb
index d4985c4f67..7012ecd861 100644
--- a/spec/unit/mixin/uris_spec.rb
+++ b/spec/unit/mixin/uris_spec.rb
@@ -16,8 +16,8 @@
# limitations under the License.
#
-require 'spec_helper'
-require 'chef/mixin/uris'
+require "spec_helper"
+require "chef/mixin/uris"
class Chef::UrisTest
include Chef::Mixin::Uris
@@ -28,19 +28,19 @@ describe Chef::Mixin::Uris do
describe "#uri_scheme?" do
it "matches 'scheme://foo.com'" do
- expect(uris.uri_scheme?('scheme://foo.com')).to eq(true)
+ expect(uris.uri_scheme?("scheme://foo.com")).to eq(true)
end
it "does not match 'c:/foo.com'" do
- expect(uris.uri_scheme?('c:/foo.com')).to eq(false)
+ expect(uris.uri_scheme?("c:/foo.com")).to eq(false)
end
it "does not match '/usr/bin/foo.com'" do
- expect(uris.uri_scheme?('/usr/bin/foo.com')).to eq(false)
+ expect(uris.uri_scheme?("/usr/bin/foo.com")).to eq(false)
end
it "does not match 'c:/foo.com://bar.com'" do
- expect(uris.uri_scheme?('c:/foo.com://bar.com')).to eq(false)
+ expect(uris.uri_scheme?("c:/foo.com://bar.com")).to eq(false)
end
end
diff --git a/spec/unit/mixin/windows_architecture_helper_spec.rb b/spec/unit/mixin/windows_architecture_helper_spec.rb
index 55eca28dc2..58e1927ea7 100644
--- a/spec/unit/mixin/windows_architecture_helper_spec.rb
+++ b/spec/unit/mixin/windows_architecture_helper_spec.rb
@@ -17,8 +17,8 @@
#
-require 'spec_helper'
-require 'chef/mixin/windows_architecture_helper'
+require "spec_helper"
+require "chef/mixin/windows_architecture_helper"
diff --git a/spec/unit/mixin/xml_escape_spec.rb b/spec/unit/mixin/xml_escape_spec.rb
index c5156cfb7b..a3f4bc839e 100644
--- a/spec/unit/mixin/xml_escape_spec.rb
+++ b/spec/unit/mixin/xml_escape_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
class XMLEscapingTestHarness
include Chef::Mixin::XMLEscape