pork 0.1.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.gitignore +1 -0
 - data/CHANGES.md +9 -0
 - data/README.md +580 -2
 - data/lib/pork.rb +132 -94
 - data/lib/pork/auto.rb +4 -0
 - data/lib/pork/version.rb +1 -1
 - data/pork.gemspec +12 -9
 - data/task/gemgem.rb +0 -4
 - data/test/test_bacon.rb +112 -106
 - data/test/test_nested.rb +30 -12
 - data/test/test_readme.rb +14 -0
 - metadata +11 -6
 - data/lib/pork/task.rb +0 -2
 - data/pkg/pork-0.1.0.gem +0 -0
 
    
        data/lib/pork.rb
    CHANGED
    
    | 
         @@ -1,71 +1,57 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
       2 
2 
     | 
    
         
             
            require 'thread'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
            module  
     | 
| 
       5 
     | 
    
         
            -
               
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
       7 
     | 
    
         
            -
                  @mutex = Mutex.new
         
     | 
| 
       8 
     | 
    
         
            -
                  super(0, 0, 0, [], [])
         
     | 
| 
       9 
     | 
    
         
            -
                end
         
     | 
| 
       10 
     | 
    
         
            -
                def assertions= num; @mutex.synchronize{ super                    }; end
         
     | 
| 
       11 
     | 
    
         
            -
                def tests=      num; @mutex.synchronize{ super                    }; end
         
     | 
| 
       12 
     | 
    
         
            -
                def skips=      num; @mutex.synchronize{ super        ; print('s')}; end
         
     | 
| 
       13 
     | 
    
         
            -
                def add_failure *e ; @mutex.synchronize{ failures << e; print('F')}; end
         
     | 
| 
       14 
     | 
    
         
            -
                def add_error   *e ; @mutex.synchronize{ errors   << e; print('E')}; end
         
     | 
| 
       15 
     | 
    
         
            -
                def numbers
         
     | 
| 
       16 
     | 
    
         
            -
                  [tests, assertions, failures.size, errors.size, skips]
         
     | 
| 
       17 
     | 
    
         
            -
                end
         
     | 
| 
       18 
     | 
    
         
            -
                def start
         
     | 
| 
       19 
     | 
    
         
            -
                  @start ||= Time.now
         
     | 
| 
       20 
     | 
    
         
            -
                end
         
     | 
| 
       21 
     | 
    
         
            -
                def report
         
     | 
| 
       22 
     | 
    
         
            -
                  puts
         
     | 
| 
       23 
     | 
    
         
            -
                  puts (failures + errors).map{ |(e, m)|
         
     | 
| 
       24 
     | 
    
         
            -
                    "\n#{m}\n#{e.class}: #{e.message}\n  #{backtrace(e)}"
         
     | 
| 
       25 
     | 
    
         
            -
                  }
         
     | 
| 
       26 
     | 
    
         
            -
                  printf("\nFinished in %f seconds.\n", Time.now - @start)
         
     | 
| 
       27 
     | 
    
         
            -
                  printf("%d tests, %d assertions, %d failures, %d errors, %d skips\n",
         
     | 
| 
       28 
     | 
    
         
            -
                         *numbers)
         
     | 
| 
       29 
     | 
    
         
            -
                end
         
     | 
| 
       30 
     | 
    
         
            -
                private
         
     | 
| 
       31 
     | 
    
         
            -
                def backtrace e
         
     | 
| 
       32 
     | 
    
         
            -
                  if $VERBOSE
         
     | 
| 
       33 
     | 
    
         
            -
                    e.backtrace
         
     | 
| 
       34 
     | 
    
         
            -
                  else
         
     | 
| 
       35 
     | 
    
         
            -
                    e.backtrace.reject{ |line| line =~ %r{/pork\.rb:\d+} }
         
     | 
| 
       36 
     | 
    
         
            -
                  end.join("\n  ")
         
     | 
| 
       37 
     | 
    
         
            -
                end
         
     | 
| 
      
 4 
     | 
    
         
            +
            module Kernel
         
     | 
| 
      
 5 
     | 
    
         
            +
              def should message=nil, &checker
         
     | 
| 
      
 6 
     | 
    
         
            +
                Pork::Should.new(self, message, &checker)
         
     | 
| 
       38 
7 
     | 
    
         
             
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            module Pork
         
     | 
| 
      
 11 
     | 
    
         
            +
              Error   = Class.new(Exception)
         
     | 
| 
      
 12 
     | 
    
         
            +
              Failure = Class.new(Error)
         
     | 
| 
      
 13 
     | 
    
         
            +
              Skip    = Class.new(Error)
         
     | 
| 
       39 
14 
     | 
    
         | 
| 
       40 
15 
     | 
    
         
             
              def self.stats ; @stats ||= Stats.new; end
         
     | 
| 
       41 
16 
     | 
    
         
             
              def self.reset ; @stats   = nil      ; end
         
     | 
| 
       42 
17 
     | 
    
         
             
              def self.report; stats.report; reset ; end
         
     | 
| 
      
 18 
     | 
    
         
            +
              def self.report_at_exit
         
     | 
| 
      
 19 
     | 
    
         
            +
                Pork.stats.start
         
     | 
| 
      
 20 
     | 
    
         
            +
                @report_at_exit ||= at_exit do
         
     | 
| 
      
 21 
     | 
    
         
            +
                  stats.report
         
     | 
| 
      
 22 
     | 
    
         
            +
                  exit stats.failures.size + stats.errors.size
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
       43 
25 
     | 
    
         | 
| 
       44 
26 
     | 
    
         
             
              module API
         
     | 
| 
       45 
27 
     | 
    
         
             
                module_function
         
     | 
| 
       46 
     | 
    
         
            -
                def  
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
             
     | 
| 
       50 
     | 
    
         
            -
                end
         
     | 
| 
      
 28 
     | 
    
         
            +
                def before █ Executor.before(&block); end
         
     | 
| 
      
 29 
     | 
    
         
            +
                def after  █ Executor.after( &block); end
         
     | 
| 
      
 30 
     | 
    
         
            +
                def describe desc=:default, &suite; Executor.describe(desc, &suite); end
         
     | 
| 
      
 31 
     | 
    
         
            +
                def copy     desc=:default, &suite; Executor.copy(    desc, &suite); end
         
     | 
| 
      
 32 
     | 
    
         
            +
                def paste    desc=:default, *args ; Executor.paste(   desc, *args ); end
         
     | 
| 
      
 33 
     | 
    
         
            +
                def would    desc=:default, &test ; Executor.would(   desc, &test ); end
         
     | 
| 
       51 
34 
     | 
    
         
             
              end
         
     | 
| 
       52 
35 
     | 
    
         | 
| 
       53 
     | 
    
         
            -
               
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
              class Executor < Struct.new(:name)
         
     | 
| 
       58 
     | 
    
         
            -
                extend Pork::API
         
     | 
| 
       59 
     | 
    
         
            -
                def self.execute caller, desc, &suite
         
     | 
| 
       60 
     | 
    
         
            -
                  parent = if caller.kind_of?(Class) then caller else self end
         
     | 
| 
       61 
     | 
    
         
            -
                  Class.new(parent){
         
     | 
| 
       62 
     | 
    
         
            -
                    @desc, @before, @after = "#{desc}:", [], []
         
     | 
| 
       63 
     | 
    
         
            -
                  }.module_eval(&suite)
         
     | 
| 
      
 36 
     | 
    
         
            +
              module Imp
         
     | 
| 
      
 37 
     | 
    
         
            +
                attr_reader :stash, :desc
         
     | 
| 
      
 38 
     | 
    
         
            +
                def before &block
         
     | 
| 
      
 39 
     | 
    
         
            +
                  if block_given? then @before << block else @before end
         
     | 
| 
       64 
40 
     | 
    
         
             
                end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
                def after  &block
         
     | 
| 
      
 42 
     | 
    
         
            +
                  if block_given? then @after  << block else @after  end
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
                def describe desc=:default, &suite
         
     | 
| 
      
 45 
     | 
    
         
            +
                  Class.new(self){ init("#{desc}: ") }.module_eval(&suite)
         
     | 
| 
      
 46 
     | 
    
         
            +
                end
         
     | 
| 
      
 47 
     | 
    
         
            +
                def copy  desc=:default, &suite; stash[desc] = suite; end
         
     | 
| 
      
 48 
     | 
    
         
            +
                def paste desc=:default, *args
         
     | 
| 
      
 49 
     | 
    
         
            +
                  stashes = [self, super_executor].compact.map(&:stash)
         
     | 
| 
      
 50 
     | 
    
         
            +
                  module_exec(*args, &stashes.find{ |s| s[desc] }[desc])
         
     | 
| 
      
 51 
     | 
    
         
            +
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
                def would desc=:default, &test
         
     | 
| 
       67 
53 
     | 
    
         
             
                  assertions = Pork.stats.assertions
         
     | 
| 
       68 
     | 
    
         
            -
                  context = new( 
     | 
| 
      
 54 
     | 
    
         
            +
                  context = new(desc)
         
     | 
| 
       69 
55 
     | 
    
         
             
                  run_before(context)
         
     | 
| 
       70 
56 
     | 
    
         
             
                  context.instance_eval(&test)
         
     | 
| 
       71 
57 
     | 
    
         
             
                  if assertions == Pork.stats.assertions
         
     | 
| 
         @@ -74,55 +60,81 @@ module Pork 
     | 
|
| 
       74 
60 
     | 
    
         
             
                rescue Error, StandardError => e
         
     | 
| 
       75 
61 
     | 
    
         
             
                  case e
         
     | 
| 
       76 
62 
     | 
    
         
             
                  when Skip
         
     | 
| 
       77 
     | 
    
         
            -
                    Pork.stats. 
     | 
| 
      
 63 
     | 
    
         
            +
                    Pork.stats.incr_skips
         
     | 
| 
       78 
64 
     | 
    
         
             
                  when Failure
         
     | 
| 
       79 
     | 
    
         
            -
                    Pork.stats.add_failure(e, description_for("would #{ 
     | 
| 
      
 65 
     | 
    
         
            +
                    Pork.stats.add_failure(e, description_for("would #{desc}"))
         
     | 
| 
       80 
66 
     | 
    
         
             
                  when Error, StandardError
         
     | 
| 
       81 
     | 
    
         
            -
                    Pork.stats.add_error(  e, description_for("would #{ 
     | 
| 
      
 67 
     | 
    
         
            +
                    Pork.stats.add_error(  e, description_for("would #{desc}"))
         
     | 
| 
       82 
68 
     | 
    
         
             
                  end
         
     | 
| 
       83 
69 
     | 
    
         
             
                else
         
     | 
| 
       84 
70 
     | 
    
         
             
                  print '.'
         
     | 
| 
       85 
71 
     | 
    
         
             
                ensure
         
     | 
| 
      
 72 
     | 
    
         
            +
                  Pork.stats.incr_tests
         
     | 
| 
       86 
73 
     | 
    
         
             
                  run_after(context)
         
     | 
| 
       87 
74 
     | 
    
         
             
                end
         
     | 
| 
       88 
75 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                 
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
                protected
         
     | 
| 
      
 77 
     | 
    
         
            +
                def init desc=''
         
     | 
| 
      
 78 
     | 
    
         
            +
                  @desc, @before, @after, @stash = desc, [], [], {}
         
     | 
| 
       91 
79 
     | 
    
         
             
                end
         
     | 
| 
       92 
     | 
    
         
            -
                def  
     | 
| 
       93 
     | 
    
         
            -
                   
     | 
| 
       94 
     | 
    
         
            -
                end
         
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
                def self.super_executor
         
     | 
| 
       97 
     | 
    
         
            -
                  @super_executor ||= ancestors[1..-1].find{ |a| a < Executor }
         
     | 
| 
      
 80 
     | 
    
         
            +
                def super_executor
         
     | 
| 
      
 81 
     | 
    
         
            +
                  @super_executor ||= ancestors[1..-1].find{ |a| a <= Executor }
         
     | 
| 
       98 
82 
     | 
    
         
             
                end
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
       101 
     | 
    
         
            -
                  supername = if super_executor
         
     | 
| 
       102 
     | 
    
         
            -
                                " #{super_executor.description_for}"
         
     | 
| 
       103 
     | 
    
         
            -
                              else
         
     | 
| 
       104 
     | 
    
         
            -
                                ' '
         
     | 
| 
       105 
     | 
    
         
            -
                              end
         
     | 
| 
       106 
     | 
    
         
            -
                  "#{@desc}#{supername}#{name}"
         
     | 
| 
      
 83 
     | 
    
         
            +
                def description_for name=''
         
     | 
| 
      
 84 
     | 
    
         
            +
                  "#{desc}#{super_executor && super_executor.description_for}#{name}"
         
     | 
| 
       107 
85 
     | 
    
         
             
                end
         
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                def self.run_before context
         
     | 
| 
      
 86 
     | 
    
         
            +
                def run_before context
         
     | 
| 
       110 
87 
     | 
    
         
             
                  super_executor.run_before(context) if super_executor
         
     | 
| 
       111 
88 
     | 
    
         
             
                  before.each{ |b| context.instance_eval(&b) }
         
     | 
| 
       112 
89 
     | 
    
         
             
                end
         
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
                def self.run_after context
         
     | 
| 
      
 90 
     | 
    
         
            +
                def run_after context
         
     | 
| 
       115 
91 
     | 
    
         
             
                  super_executor.run_after(context) if super_executor
         
     | 
| 
       116 
92 
     | 
    
         
             
                  after.each{ |b| context.instance_eval(&b) }
         
     | 
| 
       117 
93 
     | 
    
         
             
                end
         
     | 
| 
      
 94 
     | 
    
         
            +
              end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
              class Executor < Struct.new(:desc)
         
     | 
| 
      
 97 
     | 
    
         
            +
                extend Pork::Imp, Pork::API
         
     | 
| 
      
 98 
     | 
    
         
            +
                init
         
     | 
| 
      
 99 
     | 
    
         
            +
                def skip                  ; raise Skip.new("Skipping #{desc}"); end
         
     | 
| 
      
 100 
     | 
    
         
            +
                def flunk reason='Flunked'; raise Error.new(reason)           ; end
         
     | 
| 
      
 101 
     | 
    
         
            +
                def ok                    ; Pork.stats.incr_assertions        ; end
         
     | 
| 
      
 102 
     | 
    
         
            +
              end
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
      
 104 
     | 
    
         
            +
              module InspectInlineError
         
     | 
| 
      
 105 
     | 
    
         
            +
                def inspect_error object, msg, args, negate
         
     | 
| 
      
 106 
     | 
    
         
            +
                  a = args.map(&:inspect).join(', ')
         
     | 
| 
      
 107 
     | 
    
         
            +
                  "#{object.inspect}.#{msg}(#{a}) to return #{!negate}"
         
     | 
| 
      
 108 
     | 
    
         
            +
                end
         
     | 
| 
      
 109 
     | 
    
         
            +
              end
         
     | 
| 
       118 
110 
     | 
    
         | 
| 
       119 
     | 
    
         
            -
             
     | 
| 
       120 
     | 
    
         
            -
             
     | 
| 
      
 111 
     | 
    
         
            +
              module InspectNewlineError
         
     | 
| 
      
 112 
     | 
    
         
            +
                def inspect_error object, msg, args, negate
         
     | 
| 
      
 113 
     | 
    
         
            +
                  a = args.map(&:inspect).join(', ')
         
     | 
| 
      
 114 
     | 
    
         
            +
                  "\n#{object.inspect}.#{msg}(\n#{a}) to return #{!negate}"
         
     | 
| 
      
 115 
     | 
    
         
            +
                end
         
     | 
| 
      
 116 
     | 
    
         
            +
              end
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
              module InspectDiffError
         
     | 
| 
      
 119 
     | 
    
         
            +
                def inspect_error object, msg, args, negate
         
     | 
| 
      
 120 
     | 
    
         
            +
                  ::Kernel.require 'tempfile'
         
     | 
| 
      
 121 
     | 
    
         
            +
                  ::Tempfile.open('pork-expect') do |expect|
         
     | 
| 
      
 122 
     | 
    
         
            +
                    ::Tempfile.open('pork-was') do |was|
         
     | 
| 
      
 123 
     | 
    
         
            +
                      expect.puts(object.to_s)
         
     | 
| 
      
 124 
     | 
    
         
            +
                      expect.close
         
     | 
| 
      
 125 
     | 
    
         
            +
                      was.puts(args.map(&:to_s).join(",\n"))
         
     | 
| 
      
 126 
     | 
    
         
            +
                      was.close
         
     | 
| 
      
 127 
     | 
    
         
            +
                      name = "#{object.class}##{msg}(\n"
         
     | 
| 
      
 128 
     | 
    
         
            +
                      diff = ::Kernel.__send__(:`, "diff #{expect.path} #{was.path}")
         
     | 
| 
      
 129 
     | 
    
         
            +
                      "#{name}#{diff}) to return #{!negate}"
         
     | 
| 
      
 130 
     | 
    
         
            +
                    end
         
     | 
| 
      
 131 
     | 
    
         
            +
                  end
         
     | 
| 
       121 
132 
     | 
    
         
             
                end
         
     | 
| 
       122 
133 
     | 
    
         
             
              end
         
     | 
| 
       123 
134 
     | 
    
         | 
| 
       124 
135 
     | 
    
         
             
              class Should < BasicObject
         
     | 
| 
       125 
136 
     | 
    
         
             
                instance_methods.each{ |m| undef_method(m) unless m =~ /^__|^object_id$/ }
         
     | 
| 
      
 137 
     | 
    
         
            +
                include ::Pork::InspectInlineError
         
     | 
| 
       126 
138 
     | 
    
         | 
| 
       127 
139 
     | 
    
         
             
                def initialize object, message, &checker
         
     | 
| 
       128 
140 
     | 
    
         
             
                  @object = object
         
     | 
| 
         @@ -132,8 +144,7 @@ module Pork 
     | 
|
| 
       132 
144 
     | 
    
         
             
                end
         
     | 
| 
       133 
145 
     | 
    
         | 
| 
       134 
146 
     | 
    
         
             
                def method_missing msg, *args, &block
         
     | 
| 
       135 
     | 
    
         
            -
                  satisfy( 
     | 
| 
       136 
     | 
    
         
            -
                          " return #{!@negate}") do
         
     | 
| 
      
 147 
     | 
    
         
            +
                  satisfy(inspect_error(@object, msg, args, @negate)) do
         
     | 
| 
       137 
148 
     | 
    
         
             
                    @object.public_send(msg, *args, &block)
         
     | 
| 
       138 
149 
     | 
    
         
             
                  end
         
     | 
| 
       139 
150 
     | 
    
         
             
                end
         
     | 
| 
         @@ -143,7 +154,7 @@ module Pork 
     | 
|
| 
       143 
154 
     | 
    
         
             
                  if !!result == @negate
         
     | 
| 
       144 
155 
     | 
    
         
             
                    ::Kernel.raise Failure.new("Expect #{desc}\n#{@message}".chomp)
         
     | 
| 
       145 
156 
     | 
    
         
             
                  else
         
     | 
| 
       146 
     | 
    
         
            -
                    ::Pork.stats. 
     | 
| 
      
 157 
     | 
    
         
            +
                    ::Pork.stats.incr_assertions
         
     | 
| 
       147 
158 
     | 
    
         
             
                  end
         
     | 
| 
       148 
159 
     | 
    
         
             
                  result
         
     | 
| 
       149 
160 
     | 
    
         
             
                end
         
     | 
| 
         @@ -154,9 +165,11 @@ module Pork 
     | 
|
| 
       154 
165 
     | 
    
         
             
                  self
         
     | 
| 
       155 
166 
     | 
    
         
             
                end
         
     | 
| 
       156 
167 
     | 
    
         | 
| 
       157 
     | 
    
         
            -
                def eq rhs
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
       159 
     | 
    
         
            -
                end
         
     | 
| 
      
 168 
     | 
    
         
            +
                def eq  rhs; self == rhs; end
         
     | 
| 
      
 169 
     | 
    
         
            +
                def lt  rhs; self <  rhs; end
         
     | 
| 
      
 170 
     | 
    
         
            +
                def gt  rhs; self >  rhs; end
         
     | 
| 
      
 171 
     | 
    
         
            +
                def lte rhs; self <= rhs; end
         
     | 
| 
      
 172 
     | 
    
         
            +
                def gte rhs; self >= rhs; end
         
     | 
| 
       160 
173 
     | 
    
         | 
| 
       161 
174 
     | 
    
         
             
                def raise exception=::RuntimeError
         
     | 
| 
       162 
175 
     | 
    
         
             
                  satisfy("#{__not__}raising #{exception}") do
         
     | 
| 
         @@ -173,18 +186,14 @@ module Pork 
     | 
|
| 
       173 
186 
     | 
    
         
             
                def throw msg
         
     | 
| 
       174 
187 
     | 
    
         
             
                  satisfy("#{__not__}throwing #{msg}") do
         
     | 
| 
       175 
188 
     | 
    
         
             
                    flag = true
         
     | 
| 
       176 
     | 
    
         
            -
                    ::Kernel.catch(msg) do
         
     | 
| 
      
 189 
     | 
    
         
            +
                    data = ::Kernel.catch(msg) do
         
     | 
| 
       177 
190 
     | 
    
         
             
                      if ::Kernel.block_given? then yield else @object.call end
         
     | 
| 
       178 
191 
     | 
    
         
             
                      flag = false
         
     | 
| 
       179 
192 
     | 
    
         
             
                    end
         
     | 
| 
       180 
     | 
    
         
            -
                    flag
         
     | 
| 
      
 193 
     | 
    
         
            +
                    flag && [msg, data]
         
     | 
| 
       181 
194 
     | 
    
         
             
                  end
         
     | 
| 
       182 
195 
     | 
    
         
             
                end
         
     | 
| 
       183 
196 
     | 
    
         | 
| 
       184 
     | 
    
         
            -
                def flunk reason='Flunked'
         
     | 
| 
       185 
     | 
    
         
            -
                  ::Kernel.raise Error.new(reason)
         
     | 
| 
       186 
     | 
    
         
            -
                end
         
     | 
| 
       187 
     | 
    
         
            -
             
     | 
| 
       188 
197 
     | 
    
         
             
                private
         
     | 
| 
       189 
198 
     | 
    
         
             
                def __not__
         
     | 
| 
       190 
199 
     | 
    
         
             
                  if @negate == true
         
     | 
| 
         @@ -194,10 +203,39 @@ module Pork 
     | 
|
| 
       194 
203 
     | 
    
         
             
                  end
         
     | 
| 
       195 
204 
     | 
    
         
             
                end
         
     | 
| 
       196 
205 
     | 
    
         
             
              end
         
     | 
| 
       197 
     | 
    
         
            -
            end
         
     | 
| 
       198 
206 
     | 
    
         | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
      
 207 
     | 
    
         
            +
              class Stats < Struct.new(:tests, :assertions, :skips, :failures, :errors)
         
     | 
| 
      
 208 
     | 
    
         
            +
                def initialize
         
     | 
| 
      
 209 
     | 
    
         
            +
                  @mutex = Mutex.new
         
     | 
| 
      
 210 
     | 
    
         
            +
                  super(0, 0, 0, [], [])
         
     | 
| 
      
 211 
     | 
    
         
            +
                end
         
     | 
| 
      
 212 
     | 
    
         
            +
                def incr_assertions; @mutex.synchronize{ self.assertions += 1       }; end
         
     | 
| 
      
 213 
     | 
    
         
            +
                def incr_tests     ; @mutex.synchronize{ self.tests      += 1       }; end
         
     | 
| 
      
 214 
     | 
    
         
            +
                def incr_skips     ; @mutex.synchronize{ self.skips += 1; print('s')}; end
         
     | 
| 
      
 215 
     | 
    
         
            +
                def add_failure *e ; @mutex.synchronize{ failures << e; print('F')}; end
         
     | 
| 
      
 216 
     | 
    
         
            +
                def add_error   *e ; @mutex.synchronize{ errors   << e; print('E')}; end
         
     | 
| 
      
 217 
     | 
    
         
            +
                def numbers
         
     | 
| 
      
 218 
     | 
    
         
            +
                  [tests, assertions, failures.size, errors.size, skips]
         
     | 
| 
      
 219 
     | 
    
         
            +
                end
         
     | 
| 
      
 220 
     | 
    
         
            +
                def start
         
     | 
| 
      
 221 
     | 
    
         
            +
                  @start ||= Time.now
         
     | 
| 
      
 222 
     | 
    
         
            +
                end
         
     | 
| 
      
 223 
     | 
    
         
            +
                def report
         
     | 
| 
      
 224 
     | 
    
         
            +
                  puts
         
     | 
| 
      
 225 
     | 
    
         
            +
                  puts (failures + errors).map{ |(e, m)|
         
     | 
| 
      
 226 
     | 
    
         
            +
                    "\n#{m}\n#{e.class}: #{e.message}\n  #{backtrace(e)}"
         
     | 
| 
      
 227 
     | 
    
         
            +
                  }
         
     | 
| 
      
 228 
     | 
    
         
            +
                  printf("\nFinished in %f seconds.\n", Time.now - @start)
         
     | 
| 
      
 229 
     | 
    
         
            +
                  printf("%d tests, %d assertions, %d failures, %d errors, %d skips\n",
         
     | 
| 
      
 230 
     | 
    
         
            +
                         *numbers)
         
     | 
| 
      
 231 
     | 
    
         
            +
                end
         
     | 
| 
      
 232 
     | 
    
         
            +
                private
         
     | 
| 
      
 233 
     | 
    
         
            +
                def backtrace e
         
     | 
| 
      
 234 
     | 
    
         
            +
                  if $VERBOSE
         
     | 
| 
      
 235 
     | 
    
         
            +
                    e.backtrace
         
     | 
| 
      
 236 
     | 
    
         
            +
                  else
         
     | 
| 
      
 237 
     | 
    
         
            +
                    e.backtrace.reject{ |line| line =~ %r{/pork\.rb:\d+} }
         
     | 
| 
      
 238 
     | 
    
         
            +
                  end.join("\n  ")
         
     | 
| 
      
 239 
     | 
    
         
            +
                end
         
     | 
| 
       202 
240 
     | 
    
         
             
              end
         
     | 
| 
       203 
241 
     | 
    
         
             
            end
         
     | 
    
        data/lib/pork/auto.rb
    ADDED
    
    
    
        data/lib/pork/version.rb
    CHANGED
    
    
    
        data/pork.gemspec
    CHANGED
    
    | 
         @@ -1,36 +1,39 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # -*- encoding: utf-8 -*-
         
     | 
| 
       2 
     | 
    
         
            -
            # stub: pork 0. 
     | 
| 
      
 2 
     | 
    
         
            +
            # stub: pork 0.9.0 ruby lib
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       5 
5 
     | 
    
         
             
              s.name = "pork"
         
     | 
| 
       6 
     | 
    
         
            -
              s.version = "0. 
     | 
| 
      
 6 
     | 
    
         
            +
              s.version = "0.9.0"
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       9 
9 
     | 
    
         
             
              s.require_paths = ["lib"]
         
     | 
| 
       10 
10 
     | 
    
         
             
              s.authors = ["Lin Jen-Shin (godfat)"]
         
     | 
| 
       11 
     | 
    
         
            -
              s.date = "2014-07- 
     | 
| 
       12 
     | 
    
         
            -
              s.description = "[Bacon][] reimplemented  
     | 
| 
      
 11 
     | 
    
         
            +
              s.date = "2014-07-11"
         
     | 
| 
      
 12 
     | 
    
         
            +
              s.description = "Pork -- Simple and clean and modular testing library.\n\n[Bacon][] reimplemented around 250 lines of code.\n\n[Bacon]: https://github.com/chneukirchen/bacon"
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.email = ["godfat (XD) godfat.org"]
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.files = [
         
     | 
| 
      
 15 
     | 
    
         
            +
              ".gitignore",
         
     | 
| 
       15 
16 
     | 
    
         
             
              ".gitmodules",
         
     | 
| 
       16 
17 
     | 
    
         
             
              ".travis.yml",
         
     | 
| 
      
 18 
     | 
    
         
            +
              "CHANGES.md",
         
     | 
| 
       17 
19 
     | 
    
         
             
              "LICENSE",
         
     | 
| 
       18 
20 
     | 
    
         
             
              "README.md",
         
     | 
| 
       19 
21 
     | 
    
         
             
              "Rakefile",
         
     | 
| 
       20 
22 
     | 
    
         
             
              "lib/pork.rb",
         
     | 
| 
       21 
     | 
    
         
            -
              "lib/pork/ 
     | 
| 
      
 23 
     | 
    
         
            +
              "lib/pork/auto.rb",
         
     | 
| 
       22 
24 
     | 
    
         
             
              "lib/pork/version.rb",
         
     | 
| 
       23 
     | 
    
         
            -
              "pkg/pork-0.1.0.gem",
         
     | 
| 
       24 
25 
     | 
    
         
             
              "pork.gemspec",
         
     | 
| 
       25 
26 
     | 
    
         
             
              "task/README.md",
         
     | 
| 
       26 
27 
     | 
    
         
             
              "task/gemgem.rb",
         
     | 
| 
       27 
28 
     | 
    
         
             
              "test/test_bacon.rb",
         
     | 
| 
       28 
     | 
    
         
            -
              "test/test_nested.rb" 
     | 
| 
      
 29 
     | 
    
         
            +
              "test/test_nested.rb",
         
     | 
| 
      
 30 
     | 
    
         
            +
              "test/test_readme.rb"]
         
     | 
| 
       29 
31 
     | 
    
         
             
              s.homepage = "https://github.com/godfat/pork"
         
     | 
| 
       30 
32 
     | 
    
         
             
              s.licenses = ["Apache License 2.0"]
         
     | 
| 
       31 
33 
     | 
    
         
             
              s.rubygems_version = "2.3.0"
         
     | 
| 
       32 
     | 
    
         
            -
              s.summary = " 
     | 
| 
      
 34 
     | 
    
         
            +
              s.summary = "Pork -- Simple and clean and modular testing library."
         
     | 
| 
       33 
35 
     | 
    
         
             
              s.test_files = [
         
     | 
| 
       34 
36 
     | 
    
         
             
              "test/test_bacon.rb",
         
     | 
| 
       35 
     | 
    
         
            -
              "test/test_nested.rb" 
     | 
| 
      
 37 
     | 
    
         
            +
              "test/test_nested.rb",
         
     | 
| 
      
 38 
     | 
    
         
            +
              "test/test_readme.rb"]
         
     | 
| 
       36 
39 
     | 
    
         
             
            end
         
     | 
    
        data/task/gemgem.rb
    CHANGED
    
    | 
         @@ -227,10 +227,6 @@ end # of gem namespace 
     | 
|
| 
       227 
227 
     | 
    
         
             
            desc 'Run tests'
         
     | 
| 
       228 
228 
     | 
    
         
             
            task :test do
         
     | 
| 
       229 
229 
     | 
    
         
             
              next if Gemgem.test_files.empty?
         
     | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
       231 
     | 
    
         
            -
              # require 'bacon'
         
     | 
| 
       232 
     | 
    
         
            -
              # Bacon.extend(Bacon::TestUnitOutput)
         
     | 
| 
       233 
     | 
    
         
            -
              # Bacon.summary_on_exit
         
     | 
| 
       234 
230 
     | 
    
         
             
              Gemgem.test_files.each{ |file| require "#{Gemgem.dir}/#{file[0..-4]}" }
         
     | 
| 
       235 
231 
     | 
    
         
             
            end
         
     | 
| 
       236 
232 
     | 
    
         | 
    
        data/test/test_bacon.rb
    CHANGED
    
    | 
         @@ -1,23 +1,21 @@ 
     | 
|
| 
       1 
1 
     | 
    
         | 
| 
       2 
     | 
    
         
            -
            require 'pork'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'pork/auto'
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
               
     | 
| 
       7 
     | 
    
         
            -
                block 
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
              def fail block
         
     | 
| 
       11 
     | 
    
         
            -
                block.should.raise Pork::Error
         
     | 
| 
       12 
     | 
    
         
            -
              end
         
     | 
| 
      
 4 
     | 
    
         
            +
            describe Pork do
         
     | 
| 
      
 5 
     | 
    
         
            +
              # Hooray for meta-testing.
         
     | 
| 
      
 6 
     | 
    
         
            +
              include Module.new{
         
     | 
| 
      
 7 
     | 
    
         
            +
                def succeed block
         
     | 
| 
      
 8 
     | 
    
         
            +
                  block.should.not.raise Pork::Error
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
       13 
10 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
                def fail block
         
     | 
| 
      
 12 
     | 
    
         
            +
                  block.should.raise Pork::Error
         
     | 
| 
      
 13 
     | 
    
         
            +
                end
         
     | 
| 
       18 
14 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
                def equal_string x
         
     | 
| 
      
 16 
     | 
    
         
            +
                  lambda{ |s| x == s.to_s }
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              }
         
     | 
| 
       21 
19 
     | 
    
         | 
| 
       22 
20 
     | 
    
         
             
              would "have should.satisfy" do
         
     | 
| 
       23 
21 
     | 
    
         
             
                succeed lambda { should.satisfy { 1 == 1 } }
         
     | 
| 
         @@ -221,13 +219,13 @@ Pork::API.describe Pork do 
     | 
|
| 
       221 
219 
     | 
    
         
             
                succeed lambda { (1+2).should.not(&f) }
         
     | 
| 
       222 
220 
     | 
    
         
             
              end
         
     | 
| 
       223 
221 
     | 
    
         | 
| 
       224 
     | 
    
         
            -
              would "have  
     | 
| 
       225 
     | 
    
         
            -
                fail lambda {  
     | 
| 
       226 
     | 
    
         
            -
                fail lambda {  
     | 
| 
      
 222 
     | 
    
         
            +
              would "have flunk" do
         
     | 
| 
      
 223 
     | 
    
         
            +
                fail lambda { flunk }
         
     | 
| 
      
 224 
     | 
    
         
            +
                fail lambda { flunk "yikes" }
         
     | 
| 
       227 
225 
     | 
    
         
             
              end
         
     | 
| 
       228 
226 
     | 
    
         
             
            end
         
     | 
| 
       229 
227 
     | 
    
         | 
| 
       230 
     | 
    
         
            -
             
     | 
| 
      
 228 
     | 
    
         
            +
            describe "before/after" do
         
     | 
| 
       231 
229 
     | 
    
         
             
              before do
         
     | 
| 
       232 
230 
     | 
    
         
             
                @a = 1
         
     | 
| 
       233 
231 
     | 
    
         
             
                @b = 2
         
     | 
| 
         @@ -287,89 +285,97 @@ Pork::API.describe "before/after" do 
     | 
|
| 
       287 
285 
     | 
    
         
             
              end
         
     | 
| 
       288 
286 
     | 
    
         
             
            end
         
     | 
| 
       289 
287 
     | 
    
         | 
| 
       290 
     | 
    
         
            -
             
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
             
     | 
| 
       293 
     | 
    
         
            -
             
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
       295 
     | 
    
         
            -
             
     | 
| 
       296 
     | 
    
         
            -
             
     | 
| 
       297 
     | 
    
         
            -
             
     | 
| 
       298 
     | 
    
         
            -
             
     | 
| 
       299 
     | 
    
         
            -
             
     | 
| 
       300 
     | 
    
         
            -
             
     | 
| 
       301 
     | 
    
         
            -
             
     | 
| 
       302 
     | 
    
         
            -
             
     | 
| 
       303 
     | 
    
         
            -
             
     | 
| 
       304 
     | 
    
         
            -
             
     | 
| 
       305 
     | 
    
         
            -
             
     | 
| 
       306 
     | 
    
         
            -
             
     | 
| 
       307 
     | 
    
         
            -
             
     | 
| 
       308 
     | 
    
         
            -
             
     | 
| 
       309 
     | 
    
         
            -
             
     | 
| 
       310 
     | 
    
         
            -
             
     | 
| 
       311 
     | 
    
         
            -
             
     | 
| 
       312 
     | 
    
         
            -
             
     | 
| 
       313 
     | 
    
         
            -
             
     | 
| 
       314 
     | 
    
         
            -
             
     | 
| 
       315 
     | 
    
         
            -
             
     | 
| 
       316 
     | 
    
         
            -
             
     | 
| 
       317 
     | 
    
         
            -
             
     | 
| 
       318 
     | 
    
         
            -
             
     | 
| 
       319 
     | 
    
         
            -
             
     | 
| 
       320 
     | 
    
         
            -
             
     | 
| 
       321 
     | 
    
         
            -
             
     | 
| 
       322 
     | 
    
         
            -
             
     | 
| 
       323 
     | 
    
         
            -
             
     | 
| 
       324 
     | 
    
         
            -
             
     | 
| 
       325 
     | 
    
         
            -
             
     | 
| 
       326 
     | 
    
         
            -
             
     | 
| 
       327 
     | 
    
         
            -
             
     | 
| 
       328 
     | 
    
         
            -
             
     | 
| 
       329 
     | 
    
         
            -
             
     | 
| 
       330 
     | 
    
         
            -
             
     | 
| 
       331 
     | 
    
         
            -
             
     | 
| 
       332 
     | 
    
         
            -
             
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
       334 
     | 
    
         
            -
             
     | 
| 
       335 
     | 
    
         
            -
             
     | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
       337 
     | 
    
         
            -
             
     | 
| 
       338 
     | 
    
         
            -
             
     | 
| 
       339 
     | 
    
         
            -
             
     | 
| 
       340 
     | 
    
         
            -
             
     | 
| 
       341 
     | 
    
         
            -
             
     | 
| 
       342 
     | 
    
         
            -
             
     | 
| 
       343 
     | 
    
         
            -
             
     | 
| 
       344 
     | 
    
         
            -
             
     | 
| 
       345 
     | 
    
         
            -
             
     | 
| 
       346 
     | 
    
         
            -
             
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
       348 
     | 
    
         
            -
             
     | 
| 
       349 
     | 
    
         
            -
             
     | 
| 
       350 
     | 
    
         
            -
             
     | 
| 
       351 
     | 
    
         
            -
             
     | 
| 
       352 
     | 
    
         
            -
             
     | 
| 
       353 
     | 
    
         
            -
             
     | 
| 
       354 
     | 
    
         
            -
             
     | 
| 
       355 
     | 
    
         
            -
             
     | 
| 
       356 
     | 
    
         
            -
             
     | 
| 
       357 
     | 
    
         
            -
             
     | 
| 
       358 
     | 
    
         
            -
             
     | 
| 
       359 
     | 
    
         
            -
             
     | 
| 
       360 
     | 
    
         
            -
             
     | 
| 
       361 
     | 
    
         
            -
             
     | 
| 
       362 
     | 
    
         
            -
             
     | 
| 
       363 
     | 
    
         
            -
             
     | 
| 
       364 
     | 
    
         
            -
             
     | 
| 
       365 
     | 
    
         
            -
             
     | 
| 
       366 
     | 
    
         
            -
             
     | 
| 
       367 
     | 
    
         
            -
             
     | 
| 
       368 
     | 
    
         
            -
             
     | 
| 
       369 
     | 
    
         
            -
             
     | 
| 
       370 
     | 
    
         
            -
             
     | 
| 
       371 
     | 
    
         
            -
             
     | 
| 
       372 
     | 
    
         
            -
             
     | 
| 
       373 
     | 
    
         
            -
             
     | 
| 
       374 
     | 
    
         
            -
             
     | 
| 
       375 
     | 
    
         
            -
             
     | 
| 
      
 288 
     | 
    
         
            +
            copy "a shared context" do
         
     | 
| 
      
 289 
     | 
    
         
            +
              would "get called where it is included" do
         
     | 
| 
      
 290 
     | 
    
         
            +
                true.should.eq true
         
     | 
| 
      
 291 
     | 
    
         
            +
              end
         
     | 
| 
      
 292 
     | 
    
         
            +
            end
         
     | 
| 
      
 293 
     | 
    
         
            +
             
     | 
| 
      
 294 
     | 
    
         
            +
            copy "another shared context" do
         
     | 
| 
      
 295 
     | 
    
         
            +
              would "access data" do
         
     | 
| 
      
 296 
     | 
    
         
            +
                @magic.should.eq 42
         
     | 
| 
      
 297 
     | 
    
         
            +
              end
         
     | 
| 
      
 298 
     | 
    
         
            +
            end
         
     | 
| 
      
 299 
     | 
    
         
            +
             
     | 
| 
      
 300 
     | 
    
         
            +
            describe "shared/behaves_like" do
         
     | 
| 
      
 301 
     | 
    
         
            +
              paste "a shared context"
         
     | 
| 
      
 302 
     | 
    
         
            +
             
     | 
| 
      
 303 
     | 
    
         
            +
              ctx = self
         
     | 
| 
      
 304 
     | 
    
         
            +
              would "raise NameError when the context is not found" do
         
     | 
| 
      
 305 
     | 
    
         
            +
                lambda {
         
     | 
| 
      
 306 
     | 
    
         
            +
                  ctx.paste "whoops"
         
     | 
| 
      
 307 
     | 
    
         
            +
                }.should.raise NameError
         
     | 
| 
      
 308 
     | 
    
         
            +
              end
         
     | 
| 
      
 309 
     | 
    
         
            +
             
     | 
| 
      
 310 
     | 
    
         
            +
              paste "a shared context"
         
     | 
| 
      
 311 
     | 
    
         
            +
             
     | 
| 
      
 312 
     | 
    
         
            +
              before {
         
     | 
| 
      
 313 
     | 
    
         
            +
                @magic = 42
         
     | 
| 
      
 314 
     | 
    
         
            +
              }
         
     | 
| 
      
 315 
     | 
    
         
            +
              paste "another shared context"
         
     | 
| 
      
 316 
     | 
    
         
            +
            end
         
     | 
| 
      
 317 
     | 
    
         
            +
             
     | 
| 
      
 318 
     | 
    
         
            +
            describe "Methods" do
         
     | 
| 
      
 319 
     | 
    
         
            +
              def the_meaning_of_life
         
     | 
| 
      
 320 
     | 
    
         
            +
                42
         
     | 
| 
      
 321 
     | 
    
         
            +
              end
         
     | 
| 
      
 322 
     | 
    
         
            +
             
     | 
| 
      
 323 
     | 
    
         
            +
              def the_towels
         
     | 
| 
      
 324 
     | 
    
         
            +
                yield "DON'T PANIC"
         
     | 
| 
      
 325 
     | 
    
         
            +
              end
         
     | 
| 
      
 326 
     | 
    
         
            +
             
     | 
| 
      
 327 
     | 
    
         
            +
              would "be accessible in a test" do
         
     | 
| 
      
 328 
     | 
    
         
            +
                the_meaning_of_life.should.eq 42
         
     | 
| 
      
 329 
     | 
    
         
            +
              end
         
     | 
| 
      
 330 
     | 
    
         
            +
             
     | 
| 
      
 331 
     | 
    
         
            +
              describe "when in a sibling context" do
         
     | 
| 
      
 332 
     | 
    
         
            +
                would "should be accessible in a test" do
         
     | 
| 
      
 333 
     | 
    
         
            +
                  the_meaning_of_life.should.eq 42
         
     | 
| 
      
 334 
     | 
    
         
            +
                end
         
     | 
| 
      
 335 
     | 
    
         
            +
             
     | 
| 
      
 336 
     | 
    
         
            +
                would "should pass the block" do
         
     | 
| 
      
 337 
     | 
    
         
            +
                  the_towels do |label|
         
     | 
| 
      
 338 
     | 
    
         
            +
                    label.should.eq "DON'T PANIC"
         
     | 
| 
      
 339 
     | 
    
         
            +
                  end.should.eq true
         
     | 
| 
      
 340 
     | 
    
         
            +
                end
         
     | 
| 
      
 341 
     | 
    
         
            +
              end
         
     | 
| 
      
 342 
     | 
    
         
            +
            end
         
     | 
| 
      
 343 
     | 
    
         
            +
             
     | 
| 
      
 344 
     | 
    
         
            +
            describe 'describe arguments' do
         
     | 
| 
      
 345 
     | 
    
         
            +
              check = lambda do |ctx, desc, name=nil|
         
     | 
| 
      
 346 
     | 
    
         
            +
                ctx.should.lt Pork::Executor
         
     | 
| 
      
 347 
     | 
    
         
            +
                ctx.description_for(name).should.eq "#{desc}: #{name}"
         
     | 
| 
      
 348 
     | 
    
         
            +
              end
         
     | 
| 
      
 349 
     | 
    
         
            +
             
     | 
| 
      
 350 
     | 
    
         
            +
              would 'work with string' do
         
     | 
| 
      
 351 
     | 
    
         
            +
                str = 'string'
         
     | 
| 
      
 352 
     | 
    
         
            +
                Pork::API.describe(str) do
         
     | 
| 
      
 353 
     | 
    
         
            +
                  check[self, str]
         
     | 
| 
      
 354 
     | 
    
         
            +
                  would 'a' do check[self.class, str, 'a'] end
         
     | 
| 
      
 355 
     | 
    
         
            +
                end
         
     | 
| 
      
 356 
     | 
    
         
            +
              end
         
     | 
| 
      
 357 
     | 
    
         
            +
             
     | 
| 
      
 358 
     | 
    
         
            +
              would 'work with symbols' do
         
     | 
| 
      
 359 
     | 
    
         
            +
                str = 'behaviour'
         
     | 
| 
      
 360 
     | 
    
         
            +
                Pork::API.describe(:behaviour) do
         
     | 
| 
      
 361 
     | 
    
         
            +
                  check[self, str]
         
     | 
| 
      
 362 
     | 
    
         
            +
                  would 'b' do check[self.class, str, 'b'] end
         
     | 
| 
      
 363 
     | 
    
         
            +
                end
         
     | 
| 
      
 364 
     | 
    
         
            +
              end
         
     | 
| 
      
 365 
     | 
    
         
            +
             
     | 
| 
      
 366 
     | 
    
         
            +
              would 'work with modules' do
         
     | 
| 
      
 367 
     | 
    
         
            +
                str = 'Pork'
         
     | 
| 
      
 368 
     | 
    
         
            +
                Pork::API.describe(Pork) do
         
     | 
| 
      
 369 
     | 
    
         
            +
                  check[self, str]
         
     | 
| 
      
 370 
     | 
    
         
            +
                  would 'c' do check[self.class, str, 'c'] end
         
     | 
| 
      
 371 
     | 
    
         
            +
                end
         
     | 
| 
      
 372 
     | 
    
         
            +
              end
         
     | 
| 
      
 373 
     | 
    
         
            +
             
     | 
| 
      
 374 
     | 
    
         
            +
              would 'work with namespaced modules' do
         
     | 
| 
      
 375 
     | 
    
         
            +
                str = 'Pork::Executor'
         
     | 
| 
      
 376 
     | 
    
         
            +
                Pork::API.describe(Pork::Executor) do
         
     | 
| 
      
 377 
     | 
    
         
            +
                  check[self, str]
         
     | 
| 
      
 378 
     | 
    
         
            +
                  would 'd' do check[self.class, str, 'd'] end
         
     | 
| 
      
 379 
     | 
    
         
            +
                end
         
     | 
| 
      
 380 
     | 
    
         
            +
              end
         
     | 
| 
      
 381 
     | 
    
         
            +
            end
         
     |