[DRE-commits] [ruby-rspec-instafail] 70/108: modify load-path hack

Hideki Yamane henrich at moszumanska.debian.org
Sun Nov 15 18:36:22 UTC 2015


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

henrich pushed a commit to branch debian/sid
in repository ruby-rspec-instafail.

commit 3a80c0734e7ec8162d5dfe435c9a12740a5df2d6
Author: grosser <grosser.michael at gmail.com>
Date:   Mon Nov 21 08:30:22 2011 -0800

    modify load-path hack
---
 lib/rspec/instafail.rb | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/rspec/instafail.rb b/lib/rspec/instafail.rb
index 8a83767..762c694 100644
--- a/lib/rspec/instafail.rb
+++ b/lib/rspec/instafail.rb
@@ -1,12 +1,14 @@
 module RSpec
-  # when installed as plugin in jruby, lib is not in load-path
+  # Rails 3: when installed as plugin, lib is not in load-path when running tests
   # https://github.com/grosser/rspec-instafail/pull/3
-  lib = File.dirname(File.dirname(__FILE__))
+  lib = File.expand_path(File.dirname(File.dirname(__FILE__)))
+  $LOAD_PATH << lib unless $LOAD_PATH.include?(lib)
+
+  require 'rspec/instafail/version'
+
   begin
-    require "#{lib}/rspec/instafail/rspec_2"
+    require "rspec/instafail/rspec_2"
   rescue LoadError # try rspec 1
-    require "#{lib}/rspec/instafail/rspec_1"
+    require "rspec/instafail/rspec_1"
   end
-
-  require 'rspec/instafail/version'
 end

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



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