Module: Rutabaga::Feature
- Defined in:
- lib/rutabaga/feature.rb
Instance Method Summary collapse
Instance Method Details
#feature(feature_file = find_feature) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rutabaga/feature.rb', line 6 def feature(feature_file = find_feature) example_group_class = self.class # Hack turnip into the rspec only when needed example_group_class.send(:include, Turnip::RSpec::Execute) example_group_class.send(:include, Turnip::Steps) run(feature_file, example_group_class) end |
#find_feature ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rutabaga/feature.rb', line 17 def find_feature return get_example.description if File.exists?(get_example.description) feature_file = caller(0).find do |call| call =~ /_spec.rb:/ end.gsub(/_spec.rb:.*\Z/, '.feature') return feature_file if File.exists?(feature_file) raise "Feature file not found. Tried: #{get_example.description} and #{feature_file}" end |