Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make step_dirs a bit more straightforward

  • Loading branch information...
commit 9890f30ee2c6579e70692f273f9d0196a9549c38 1 parent dfa7f4b
@jnicklas authored
View
5 lib/turnip.rb
@@ -18,6 +18,10 @@ class Ambiguous < StandardError; end
autoload :Table, 'turnip/table'
autoload :StepLoader, 'turnip/step_loader'
+ class << self
+ attr_accessor :step_dirs
+ end
+
module Execute
def step(description, extra_arg=nil)
matches = methods.map do |method|
@@ -85,6 +89,7 @@ def run(feature_file)
end
Turnip.type = :turnip
+Turnip.step_dirs = ['spec']
RSpec::Core::Configuration.send(:include, Turnip::Loader)
View
8 lib/turnip/config.rb
@@ -2,13 +2,5 @@ module Turnip
module Config
extend self
- def step_dirs
- @step_dirs ||= ['spec']
- end
-
- def step_dirs=(dirs)
- @step_dirs = [] unless @step_dirs
- @step_dirs.concat(Array(dirs))
- end
end
end
View
2  lib/turnip/step_loader.rb
@@ -17,7 +17,7 @@ def steps_loaded?
private
def load_step_files
- Turnip::Config.step_dirs.each do |dir|
+ Turnip.step_dirs.each do |dir|
Pathname.glob(Pathname.new(dir) + '**' + "*steps.rb").each do |step_file|
load step_file, true
end
View
2  spec/spec_helper.rb
@@ -1,3 +1,3 @@
RSpec.configure do |config|
- Turnip::Config.step_dirs = 'examples'
+ Turnip.step_dirs = ['examples']
end
Please sign in to comment.
Something went wrong with that request. Please try again.