Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Load `turnip_helper` before loading `spec_helper`, closes #58

  • Loading branch information...
commit 110af0f0bb3219ce4ba10f1dea6b168a82266760 1 parent 2bf007b
@jnicklas authored
Showing with 7 additions and 4 deletions.
  1. +5 −0 README.md
  2. +2 −4 lib/turnip/rspec.rb
View
5 README.md
@@ -206,6 +206,11 @@ you were to put your steps in `spec/steps`, you could load them like this:
Dir.glob("spec/steps/**/*steps.rb") { |f| load f, true }
```
+Before loading your `spec_helper`, Turnip also tries to load a file called
+`turnip_helper` where you can setup anything specific to your turnip examples.
+You might find it beneficial to load your steps from this file so that they
+don't have to be loaded when you run your other tests.
+
### Calling steps from other steps
Since steps are Ruby methods you can call them like other Ruby methods.
View
6 lib/turnip/rspec.rb
@@ -12,10 +12,8 @@ module RSpec
module Loader
def load(*a, &b)
if a.first.end_with?('.feature')
- begin
- require 'spec_helper'
- rescue LoadError
- end
+ begin; require 'turnip_helper'; rescue LoadError; end
+ begin; require 'spec_helper'; rescue LoadError; end
Turnip::RSpec.run(a.first)
else
super
Please sign in to comment.
Something went wrong with that request. Please try again.