Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't hide LoadError exceptions raised in the spec helper

  • Loading branch information...
commit 642e6c5cc61c72450aed35fa7813ecddba976fdb 1 parent d430c01
Daniel Schierbeck dasch authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 lib/turnip/rspec.rb
14 lib/turnip/rspec.rb
View
@@ -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.