60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/rspec-gherkin/rspec-dsl.rb', line 60
def scenario(name = nil, new_metadata = {}, &block)
raise ArgumentError.new("requires a name") if name.nil?
matching_scenario = find_scenario(self.metadata[:current_feature], name)
if matching_scenario
if matching_scenario.tags.include?('updated')
pending_scenario(name, new_metadata, block.source_location, [
"Scenario has been marked as updated",
"Update specs for this scenario and remove the @updated tag",
"Feature file: '#{feature_path(block.source_location)}'"
])
elsif matching_scenario.arguments
specify "Scenario: #{name}", new_metadata do
instance_exec(*matching_scenario.arguments, &block)
end
else
specify("Scenario: #{name}", new_metadata, &block)
end
else
pending_scenario(name, new_metadata, block.source_location,
"No such scenario in '#{feature_path(block.source_location)}'"
)
end
end
|