Permalink
Browse files

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

Don't hide LoadError exceptions raised in the spec helper
  • Loading branch information...
2 parents d430c01 + 642e6c5 commit 822ef6314e81a1b1eb422eab1fd0fc6e7c0af30e @jnicklas committed Sep 7, 2012
Showing with 12 additions and 2 deletions.
  1. +12 −2 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
##

0 comments on commit 822ef63

Please sign in to comment.