[DRE-commits] [chef] 07/07: spec: work against source checkout and installed package

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Jun 5 15:26:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

terceiro pushed a commit to branch patch-queue/master
in repository chef.

commit 5777126894cb4be684cc94c8b9cb3e05c32d0490
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sat Jun 4 13:47:47 2016 -0300

    spec: work against source checkout and installed package
    
    All of those are not really necessary; we should just trust the testing
    framework to setup the $LOAD_PATH.
---
 spec/spec_helper.rb                                  | 13 +++----------
 spec/unit/chef_fs/config_spec.rb                     |  2 +-
 spec/unit/chef_fs/data_handler/group_handler_spec.rb |  2 +-
 spec/unit/file_access_control_spec.rb                |  2 +-
 spec/unit/mixin/securable_spec.rb                    |  4 ++--
 5 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 2f6747c..5eb22c0 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -24,16 +24,9 @@ module Shell
   IRB = nil unless defined? IRB
 end
 
-# Ruby 1.9 Compat
-$:.unshift File.expand_path("../..", __FILE__)
-
 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"
   SimpleCov.start do
@@ -48,10 +41,10 @@ end
 require "chef"
 require "chef/knife"
 
-Dir["lib/chef/knife/**/*.rb"].
-  map { |f| f.gsub("lib/", "") }.
+Gem.find_files('chef/knife/**/*.rb').
+  map { |f| f.gsub(%r{.*/chef/knife/}, "chef/knife/") }.
   map { |f| f.gsub(%r{\.rb$}, "") }.
-  each { |f| require f }
+  each { |f| puts f; require f }
 
 require "chef/resource_resolver"
 require "chef/provider_resolver"
diff --git a/spec/unit/chef_fs/config_spec.rb b/spec/unit/chef_fs/config_spec.rb
index 5fc5ad5..57a25ec 100644
--- a/spec/unit/chef_fs/config_spec.rb
+++ b/spec/unit/chef_fs/config_spec.rb
@@ -18,7 +18,7 @@
 
 require "spec_helper"
 require "chef/exceptions"
-require "lib/chef/chef_fs/config.rb"
+require "chef/chef_fs/config.rb"
 
 describe Chef::ChefFS::Config do
   describe "initialize" do
diff --git a/spec/unit/chef_fs/data_handler/group_handler_spec.rb b/spec/unit/chef_fs/data_handler/group_handler_spec.rb
index 849bc84..2fd4a02 100644
--- a/spec/unit/chef_fs/data_handler/group_handler_spec.rb
+++ b/spec/unit/chef_fs/data_handler/group_handler_spec.rb
@@ -17,7 +17,7 @@
 #
 
 require "spec_helper"
-require "lib/chef/chef_fs/data_handler/group_data_handler"
+require "chef/chef_fs/data_handler/group_data_handler"
 
 class TestEntry < Mash
   attr_accessor :name, :org
diff --git a/spec/unit/file_access_control_spec.rb b/spec/unit/file_access_control_spec.rb
index 4357a91..1b4017d 100644
--- a/spec/unit/file_access_control_spec.rb
+++ b/spec/unit/file_access_control_spec.rb
@@ -26,7 +26,7 @@ describe Chef::FileAccessControl do
         # we have to re-load the file so the proper
         # platform specific module is mixed in
         @node = Chef::Node.new
-        load File.join(File.dirname(__FILE__), "..", "..", "lib", "chef", "file_access_control.rb")
+        load Gem.find_files("chef/file_access_control.rb").first
         @resource = Chef::Resource::File.new("/tmp/a_file.txt")
         @resource.owner("toor")
         @resource.group("wheel")
diff --git a/spec/unit/mixin/securable_spec.rb b/spec/unit/mixin/securable_spec.rb
index 6f50ce8..19cecf3 100644
--- a/spec/unit/mixin/securable_spec.rb
+++ b/spec/unit/mixin/securable_spec.rb
@@ -46,7 +46,7 @@ describe Chef::Mixin::Securable do
   describe "unix-specific behavior" do
     before(:each) do
       platform_mock :unix do
-        load File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "chef", "mixin", "securable.rb")
+        load Gem.find_files("chef/mixin/securable.rb").first
         @securable = Object.new
         @securable.send(:extend, Chef::Mixin::Securable)
         @securable.send(:extend, Chef::Mixin::ParamsValidate)
@@ -177,7 +177,7 @@ describe Chef::Mixin::Securable do
   describe "windows-specific behavior" do
     before(:each) do
       platform_mock :windows do
-        load File.join(File.dirname(__FILE__), "..", "..", "..", "lib", "chef", "mixin", "securable.rb")
+        load Gem.find_files("chef/mixin/securable.rb").first
         securable_class = Class.new do
           include Chef::Mixin::Securable
           include Chef::Mixin::ParamsValidate

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/chef.git



More information about the Pkg-ruby-extras-commits mailing list