method
store_and_call
1.1.4 -
Show latest stable
- Class:
Spec::Story::World
store_and_call(world, type, name, *args, &block)public
No documentation available.
# File lib/spec/story/world.rb, line 57
def store_and_call(world, type, name, *args, &block)
if block_given?
step_mother.store(type, Step.new(name, &block))
end
step = step_mother.find(type, name)
step_name = step.name
step_names << step_name
# It's important to have access to the parsed args here, so
# we can give them to the listeners. The HTML reporter needs
# the args so it can style them. See the generated output in
# story_server/prototype/rspec_stories.html (generated by rake stories)
args = step.parse_args(name) if args.empty?
begin
listeners.each { |l| l.step_upcoming(type, step_name, *args) }
step.perform(world, *args) unless ::Spec::Story::Runner.dry_run
listeners.each { |l| l.step_succeeded(type, step_name, *args) }
rescue Exception => e
case e
when Spec::Example::ExamplePendingError
@listeners.each { |l| l.step_pending(type, step_name, *args) }
else
@listeners.each { |l| l.step_failed(type, step_name, *args) }
end
errors << e
end
end