[DRE-commits] [chef] 09/13: Make specs work against installed package

Antonio Terceiro terceiro at moszumanska.debian.org
Sun Jun 5 03:52:29 UTC 2016


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

terceiro pushed a commit to branch master
in repository chef.

commit 238d2ea8c3438bde58b2d55745492ccb9ece0f16
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Sat Jun 4 23:42:53 2016 -0300

    Make specs work against installed package
---
 debian/changelog                                   |  2 +
 ...Make-specs-work-against-installed-package.patch | 80 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 83 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 335d6c9..3791069 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,8 @@ chef (12.7.2-1) UNRELEASED; urgency=medium
     remove warnings under Ruby 2.3
   * 0003-spec-remove-absolute-require-path.patch: avoid explicitly requiring
     code from source tree.
+  * 0004-Make-specs-work-against-installed-package.patch: fix tests for
+    running under autopkgtest
 
  -- Lucas Kanashiro <kanashiro.duarte at gmail.com>  Thu, 03 Mar 2016 15:18:38 -0300
 
diff --git a/debian/patches/0004-Make-specs-work-against-installed-package.patch b/debian/patches/0004-Make-specs-work-against-installed-package.patch
new file mode 100644
index 0000000..3165e7e
--- /dev/null
+++ b/debian/patches/0004-Make-specs-work-against-installed-package.patch
@@ -0,0 +1,80 @@
+From: Antonio Terceiro <terceiro at debian.org>
+Date: Sat, 4 Jun 2016 23:42:22 -0300
+Subject: Make specs work against installed package
+
+---
+ spec/spec_helper.rb                   | 13 +++----------
+ spec/unit/file_access_control_spec.rb |  2 +-
+ spec/unit/mixin/securable_spec.rb     |  4 ++--
+ 3 files changed, 6 insertions(+), 13 deletions(-)
+
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+index 47432f5..985ef99 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/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
diff --git a/debian/patches/series b/debian/patches/series
index bcbfe79..3fdbcb6 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Update-gemspec-file.patch
 0002-remove-deprecated-Thread.exclusive.patch
 0003-spec-remove-absolute-require-path.patch
+0004-Make-specs-work-against-installed-package.patch

-- 
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