Sha256: 95e619bef04f735e3a541f97e2588c56c08f26a3a5993bf92c9f59c7aa592000
Contents?: true
Size: 1.4 KB
Versions: 1
Compression:
Stored size: 1.4 KB
Contents
require 'pork/runner' require 'pork/context' module Pork class Suite < Struct.new(:pork_stat, :pork_description) module Imp attr_reader :desc, :tests def before █ @tests << [:before, block]; end def after █ @tests << [:after , block]; end def copy desc=:default, &suite @stash[desc] = suite end def paste desc=:default, *args module_exec(*args, &search_stash(desc)) end def describe desc=:default, opts={}, &suite executor = Class.new(self){ init(desc) } executor.module_eval(&suite) @tests << [:describe, executor, suite, opts] end def would desc=:default, opts={}, &test raise ArgumentError.new("no block given") unless test @tests << [:would , desc , test, opts] end def description_for name='' if @super_executor "#{@super_executor.description_for}#{@desc}: #{name}" else name end end def run *args Runner.new(self, Pork.reseed, *args).run end private def init desc='' @desc, @tests, @stash = desc, [], {} @super_executor = ancestors[1..-1].find{ |a| a <= Suite } end protected def search_stash desc @stash[desc] or @super_executor && @super_executor.search_stash(desc) end end extend Imp include Context init end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pork-2.0.0 | lib/pork/suite.rb |