79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
# File 'lib/turnip/rspec.rb', line 79
def run(feature_file)
Turnip::Builder.build(feature_file).features.each do |feature|
::RSpec.describe feature.name, feature.metadata_hash do
before do
example = Turnip::RSpec.fetch_current_example(self)
example.metadata[:file_path] ||= feature_file
feature.backgrounds.map(&:steps).flatten.each do |step|
run_step(feature_file, step)
end
end
feature.scenarios.each do |scenario|
instance_eval <<-EOS, feature_file, scenario.line
describe scenario.name, scenario.metadata_hash do it(scenario.steps.map(&:to_s).join(' -> ')) do
scenario.steps.each do |step|
run_step(feature_file, step)
end
end
end
EOS
end
end
end
end
|