Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #76 from dasch/spec-helper-madness

Don't hide LoadError exceptions raised in the spec helper
  • Loading branch information...
commit 822ef6314e81a1b1eb422eab1fd0fc6e7c0af30e 2 parents d430c01 + 642e6c5
@jnicklas authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/turnip/rspec.rb
View
14 lib/turnip/rspec.rb
@@ -12,13 +12,23 @@ module RSpec
module Loader
def load(*a, &b)
if a.first.end_with?('.feature')
- begin; require 'turnip_helper'; rescue LoadError; end
- begin; require 'spec_helper'; rescue LoadError; end
+ require_if_exists 'turnip_helper'
+ require_if_exists 'spec_helper'
+
Turnip::RSpec.run(a.first)
else
super
end
end
+
+ private
+
+ def require_if_exists(filename)
+ require filename
+ rescue LoadError => e
+ # Don't hide LoadErrors raised in the spec helper.
+ raise unless e.message.include?(filename)
+ end
end
##
Please sign in to comment.
Something went wrong with that request. Please try again.