Sha256: 7a0c6d70f9788ffbb25f86d4de4baccfa67a3871ab15b41c49ce0bd8840d205b
Contents?: true
Size: 1.58 KB
Versions: 1
Compression:
Stored size: 1.58 KB
Contents
module Quarry class Markup #:nodoc: # = Step # class Step attr :spec attr :code attr :lineno attr :before attr :after def initialize(spec, code, lineno, ioc={}) @spec = spec @code = code.rstrip @lineno = lineno @before = ioc[:before] @after = ioc[:after] end alias_method :parent, :spec #def description # alias_method :description, :text #end # Run specification step. # # TODO: Would spec.before + spec.code be better? # def run(runner, spec, context, output) output.report_step(self) #context.instance_eval(runner.before, spec.file) if runner.before context.instance_eval(before.code, spec.file) if before begin context.instance_eval(code, spec.file, lineno) output.report_pass(self) rescue Assertion => error output.report_fail(self, error) rescue Exception => error output.report_error(self, error) ensure context.instance_eval(after.code, spec.file) if after #context.instance_eval(runner.after, spec.file) if runner.after end end # def tab @tab ||= to_s.index(/\S/) end # def to_s code end # As could appear in stand-alone script. def to_script script = [] script << before.code if before script << code script << before.code if after script .join("\n") end end end #class Markup end #module Quarry
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quarry-0.5.2 | lib/quarry/markup/step.rb |