[DRE-commits] [ruby-rspec-instafail] 102/108: check gem version

Hideki Yamane henrich at moszumanska.debian.org
Sun Nov 15 18:36:26 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 0f6a8cb06586ea8f1fcf5983a85e94aa5ae715b0
Author: Michael Grosser <michael at grosser.it>
Date:   Wed Sep 2 20:44:43 2015 -0700

    check gem version
---
 Rakefile               |  2 +-
 lib/rspec/instafail.rb | 18 ++----------------
 spec/instafail_spec.rb |  4 ++--
 3 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/Rakefile b/Rakefile
index bb10184..0ba1992 100755
--- a/Rakefile
+++ b/Rakefile
@@ -8,5 +8,5 @@ task :default do
     sh "cd spec/rspec_2 && (bundle check || bundle) > /dev/null"
     sh "cd spec/rspec_3 && (bundle check || bundle) > /dev/null"
   end
-  sh "rspec spec/"
+  sh "rspec spec/instafail_spec.rb"
 end
diff --git a/lib/rspec/instafail.rb b/lib/rspec/instafail.rb
index 8be712d..e08e473 100755
--- a/lib/rspec/instafail.rb
+++ b/lib/rspec/instafail.rb
@@ -1,18 +1,4 @@
 module RSpec
-  # 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.expand_path(File.dirname(File.dirname(__FILE__)))
-  $LOAD_PATH << lib unless $LOAD_PATH.include?(lib)
-
-  if defined?(::RSpec::Core)
-    if ::RSpec::Core::Version::STRING >= '3.0.0'
-      require "rspec/instafail/rspec_3"
-    else
-      require "rspec/instafail/rspec_2"
-    end
-  else
-    require "rspec/instafail/rspec_1"
-  end
-
-  require 'rspec/instafail/version'
+  version = Gem.loaded_specs["rspec"].version
+  require "rspec/instafail/rspec_#{[3, version.segments.first].min}"
 end
diff --git a/spec/instafail_spec.rb b/spec/instafail_spec.rb
index 3257ae6..a4499bf 100755
--- a/spec/instafail_spec.rb
+++ b/spec/instafail_spec.rb
@@ -31,7 +31,7 @@ describe 'RSpec::Instafail' do
   context 'Rspec 2.x' do
     before :all do
       Bundler.with_clean_env do
-        @rspec_result = `cd spec/rspec_2 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color --order defined`
+        @rspec_result = `cd spec/rspec_2 && bundle exec rspec a_test.rb -I ../../lib --require rspec/instafail --format RSpec::Instafail --no-color --order defined`
       end
     end
 
@@ -60,7 +60,7 @@ describe 'RSpec::Instafail' do
   context 'Rspec 3.x' do
     before :all do
       Bundler.with_clean_env do
-        @rspec_result = `cd spec/rspec_3 && bundle exec rspec a_test.rb --require ../../lib/rspec/instafail --format RSpec::Instafail --no-color --order defined`
+        @rspec_result = `cd spec/rspec_3 && bundle exec rspec a_test.rb -I ../../lib --require rspec/instafail --format RSpec::Instafail --no-color --order defined`
       end
     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