summaryrefslogtreecommitdiff
path: root/spec/spec_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r--spec/spec_helper.rb72
1 files changed, 36 insertions, 36 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index deedffed91..2d95ddcae9 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -28,15 +28,15 @@ end
$:.unshift File.expand_path("../..", __FILE__)
-require 'rubygems'
-require 'rspec/mocks'
+require "rubygems"
+require "rspec/mocks"
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
$:.unshift(File.expand_path("../lib", __FILE__))
$:.unshift(File.dirname(__FILE__))
if ENV["COVERAGE"]
- require 'simplecov'
+ require "simplecov"
SimpleCov.start do
add_filter "/spec/"
add_group "Remote File", "remote_file"
@@ -46,34 +46,34 @@ if ENV["COVERAGE"]
end
end
-require 'chef'
-require 'chef/knife'
+require "chef"
+require "chef/knife"
-Dir['lib/chef/knife/**/*.rb'].
- map {|f| f.gsub('lib/', '') }.
- map {|f| f.gsub(%r[\.rb$], '') }.
+Dir["lib/chef/knife/**/*.rb"].
+ map {|f| f.gsub("lib/", "") }.
+ map {|f| f.gsub(%r[\.rb$], "") }.
each {|f| require f }
-require 'chef/resource_resolver'
-require 'chef/provider_resolver'
+require "chef/resource_resolver"
+require "chef/provider_resolver"
-require 'chef/mixins'
-require 'chef/dsl'
-require 'chef/application'
-require 'chef/applications'
+require "chef/mixins"
+require "chef/dsl"
+require "chef/application"
+require "chef/applications"
-require 'chef/shell'
-require 'chef/util/file_edit'
+require "chef/shell"
+require "chef/util/file_edit"
-require 'chef/config'
+require "chef/config"
# If you want to load anything into the testing environment
# without versioning it, add it to spec/support/local_gems.rb
-require 'spec/support/local_gems.rb' if File.exists?(File.join(File.dirname(__FILE__), 'support', 'local_gems.rb'))
+require "spec/support/local_gems.rb" if File.exists?(File.join(File.dirname(__FILE__), "support", "local_gems.rb"))
# Explicitly require spec helpers that need to load first
-require 'spec/support/platform_helpers'
-require 'spec/support/shared/unit/mock_shellout'
+require "spec/support/platform_helpers"
+require "spec/support/shared/unit/mock_shellout"
# Autoloads support files
# Excludes support/platforms by default
@@ -81,23 +81,23 @@ require 'spec/support/shared/unit/mock_shellout'
Dir["spec/support/**/*.rb"].
reject { |f| f =~ %r{^spec/support/platforms} }.
reject { |f| f =~ %r{^spec/support/pedant} }.
- map { |f| f.gsub(%r{.rb$}, '') }.
- map { |f| f.gsub(%r[spec/], '')}.
+ map { |f| f.gsub(%r{.rb$}, "") }.
+ map { |f| f.gsub(%r[spec/], "")}.
each { |f| require f }
OHAI_SYSTEM = Ohai::System.new
OHAI_SYSTEM.all_plugins("platform")
test_node = Chef::Node.new
-test_node.automatic['os'] = (OHAI_SYSTEM['os'] || 'unknown_os').dup.freeze
-test_node.automatic['platform_family'] = (OHAI_SYSTEM['platform_family'] || 'unknown_platform_family').dup.freeze
-test_node.automatic['platform'] = (OHAI_SYSTEM['platform'] || 'unknown_platform').dup.freeze
-test_node.automatic['platform_version'] = (OHAI_SYSTEM['platform_version'] || 'unknown_platform_version').dup.freeze
+test_node.automatic["os"] = (OHAI_SYSTEM["os"] || "unknown_os").dup.freeze
+test_node.automatic["platform_family"] = (OHAI_SYSTEM["platform_family"] || "unknown_platform_family").dup.freeze
+test_node.automatic["platform"] = (OHAI_SYSTEM["platform"] || "unknown_platform").dup.freeze
+test_node.automatic["platform_version"] = (OHAI_SYSTEM["platform_version"] || "unknown_platform_version").dup.freeze
TEST_NODE = test_node.freeze
-TEST_OS = TEST_NODE['os']
-TEST_PLATFORM = TEST_NODE['platform']
-TEST_PLATFORM_VERSION = TEST_NODE['platform_version']
-TEST_PLATFORM_FAMILY = TEST_NODE['platform_family']
+TEST_OS = TEST_NODE["os"]
+TEST_PLATFORM = TEST_NODE["platform"]
+TEST_PLATFORM_VERSION = TEST_NODE["platform_version"]
+TEST_PLATFORM_FAMILY = TEST_NODE["platform_family"]
RSpec.configure do |config|
config.include(Matchers)
@@ -180,7 +180,7 @@ RSpec.configure do |config|
node = TEST_NODE.dup
resource_class = Chef::ResourceResolver.resolve(type, node: node)
if resource_class
- resource = resource_class.new('test', Chef::RunContext.new(node, nil, nil))
+ resource = resource_class.new("test", Chef::RunContext.new(node, nil, nil))
begin
provider = resource.provider_for_action(Array(resource_class.default_action).first)
provider.class != target_provider
@@ -203,20 +203,20 @@ RSpec.configure do |config|
Chef::Config.treat_deprecation_warnings_as_errors(true)
# Set environment variable so the setting persists in child processes
- ENV['CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS'] = "1"
+ ENV["CHEF_TREAT_DEPRECATION_WARNINGS_AS_ERRORS"] = "1"
end
# raise if anyone commits any test to CI with :focus set on it
config.before(:example, :focus) do
- raise 'This example was committed with `:focus` and should not have been'
- end if ENV['CI']
+ raise "This example was committed with `:focus` and should not have been"
+ end if ENV["CI"]
config.before(:suite) do
ARGV.clear
end
end
-require 'webrick/utils'
+require "webrick/utils"
# Webrick uses a centralized/synchronized timeout manager. It works by
# starting a thread to check for timeouts on an interval. The timeout
@@ -242,4 +242,4 @@ module WEBrick
end
# Enough stuff needs json serialization that I'm just adding it here for equality asserts
-require 'chef/json_compat'
+require "chef/json_compat"