lookout 2.3.0 → 3.0.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 +7 -0
 - data/README +351 -181
 - data/Rakefile +20 -5
 - data/lib/lookout-3.0.rb +138 -0
 - data/lib/lookout-3.0/actual.rb +30 -0
 - data/lib/lookout-3.0/actual/method.rb +31 -0
 - data/lib/lookout-3.0/actual/not.rb +13 -0
 - data/lib/lookout-3.0/actual/not/method.rb +10 -0
 - data/lib/lookout-3.0/aphonic.rb +44 -0
 - data/lib/lookout-3.0/diff.rb +29 -0
 - data/lib/{lookout → lookout-3.0}/diff/algorithms.rb +1 -1
 - data/lib/lookout-3.0/diff/algorithms/difflib.rb +62 -0
 - data/lib/lookout-3.0/diff/algorithms/difflib/position.rb +63 -0
 - data/lib/{lookout/diff/algorithms/difflib/position/to.rb → lookout-3.0/diff/algorithms/difflib/position/new.rb} +8 -17
 - data/lib/lookout-3.0/diff/formats.rb +5 -0
 - data/lib/lookout-3.0/diff/formats/inline.rb +43 -0
 - data/lib/lookout-3.0/diff/formats/set.rb +48 -0
 - data/lib/lookout-3.0/diff/formats/unified.rb +56 -0
 - data/lib/lookout-3.0/diff/group.rb +57 -0
 - data/lib/lookout-3.0/diff/groups.rb +47 -0
 - data/lib/lookout-3.0/diff/match.rb +31 -0
 - data/lib/lookout-3.0/diff/operation.rb +41 -0
 - data/lib/lookout-3.0/diff/operations.rb +35 -0
 - data/lib/lookout-3.0/diff/operations/copy.rb +25 -0
 - data/lib/lookout-3.0/diff/operations/delete.rb +5 -0
 - data/lib/lookout-3.0/diff/operations/insert.rb +5 -0
 - data/lib/lookout-3.0/diff/operations/replace.rb +6 -0
 - data/lib/lookout-3.0/diff/slice.rb +97 -0
 - data/lib/lookout-3.0/difference.rb +10 -0
 - data/lib/lookout-3.0/difference/array.rb +22 -0
 - data/lib/lookout-3.0/difference/exception.rb +40 -0
 - data/lib/lookout-3.0/difference/hash.rb +31 -0
 - data/lib/lookout-3.0/difference/lookout.rb +5 -0
 - data/lib/lookout-3.0/difference/lookout/actual.rb +6 -0
 - data/lib/lookout-3.0/difference/lookout/actual/method.rb +13 -0
 - data/lib/lookout-3.0/difference/lookout/actual/not.rb +6 -0
 - data/lib/lookout-3.0/difference/lookout/actual/not/method.rb +9 -0
 - data/lib/lookout-3.0/difference/lookout/output.rb +8 -0
 - data/lib/lookout-3.0/difference/lookout/reception.rb +21 -0
 - data/lib/lookout-3.0/difference/lookout/warning.rb +9 -0
 - data/lib/lookout-3.0/difference/module.rb +12 -0
 - data/lib/lookout-3.0/difference/object.rb +73 -0
 - data/lib/lookout-3.0/difference/range.rb +12 -0
 - data/lib/lookout-3.0/difference/regexp.rb +12 -0
 - data/lib/lookout-3.0/difference/string.rb +21 -0
 - data/lib/lookout-3.0/difference/symbol.rb +21 -0
 - data/lib/lookout-3.0/encode.rb +20 -0
 - data/lib/lookout-3.0/exception.rb +79 -0
 - data/lib/lookout-3.0/exception/backtrace.rb +65 -0
 - data/lib/lookout-3.0/exception/unknown.rb +25 -0
 - data/lib/lookout-3.0/expect.rb +32 -0
 - data/lib/lookout-3.0/expect/classes.rb +6 -0
 - data/lib/lookout-3.0/expect/classes/exception.rb +27 -0
 - data/lib/lookout-3.0/expect/exception.rb +30 -0
 - data/lib/lookout-3.0/expect/object.rb +54 -0
 - data/lib/lookout-3.0/expect/object/context.rb +149 -0
 - data/lib/lookout-3.0/expectations.rb +69 -0
 - data/lib/lookout-3.0/expectations/context.rb +52 -0
 - data/lib/lookout-3.0/expected.rb +10 -0
 - data/lib/lookout-3.0/expected/array.rb +16 -0
 - data/lib/lookout-3.0/expected/classes.rb +5 -0
 - data/lib/lookout-3.0/expected/classes/exception.rb +14 -0
 - data/lib/lookout-3.0/expected/exception.rb +46 -0
 - data/lib/lookout-3.0/expected/falseclass.rb +9 -0
 - data/lib/lookout-3.0/expected/hash.rb +14 -0
 - data/lib/lookout-3.0/expected/lookout.rb +5 -0
 - data/lib/lookout-3.0/expected/lookout/actual.rb +5 -0
 - data/lib/lookout-3.0/expected/lookout/actual/method.rb +13 -0
 - data/lib/lookout-3.0/expected/lookout/actual/not.rb +6 -0
 - data/lib/lookout-3.0/expected/lookout/actual/not/method.rb +13 -0
 - data/lib/lookout-3.0/expected/lookout/output.rb +26 -0
 - data/lib/lookout-3.0/expected/lookout/reception.rb +24 -0
 - data/lib/lookout-3.0/expected/lookout/warning.rb +29 -0
 - data/lib/lookout-3.0/expected/module.rb +12 -0
 - data/lib/lookout-3.0/expected/object.rb +30 -0
 - data/lib/lookout-3.0/expected/range.rb +12 -0
 - data/lib/lookout-3.0/expected/regexp.rb +12 -0
 - data/lib/lookout-3.0/expected/string.rb +11 -0
 - data/lib/lookout-3.0/expected/symbol.rb +21 -0
 - data/lib/lookout-3.0/expected/trueclass.rb +9 -0
 - data/lib/lookout-3.0/inspect.rb +45 -0
 - data/lib/lookout-3.0/interfaces.rb +5 -0
 - data/lib/lookout-3.0/interfaces/commandline.rb +109 -0
 - data/lib/lookout-3.0/literal.rb +18 -0
 - data/lib/lookout-3.0/mock.rb +24 -0
 - data/lib/lookout-3.0/object.rb +6 -0
 - data/lib/lookout-3.0/object/not.rb +16 -0
 - data/lib/lookout-3.0/object/not/receive.rb +18 -0
 - data/lib/lookout-3.0/object/to.rb +12 -0
 - data/lib/lookout-3.0/object/to/receive.rb +18 -0
 - data/lib/lookout-3.0/output.rb +20 -0
 - data/lib/lookout-3.0/plugins.rb +7 -0
 - data/lib/lookout-3.0/reception.rb +128 -0
 - data/lib/lookout-3.0/reception/arguments.rb +20 -0
 - data/lib/lookout-3.0/reception/arguments/any.rb +16 -0
 - data/lib/lookout-3.0/reception/arguments/error.rb +5 -0
 - data/lib/lookout-3.0/reception/arguments/list.rb +17 -0
 - data/lib/lookout-3.0/reception/arguments/none.rb +6 -0
 - data/lib/lookout-3.0/reception/error.rb +24 -0
 - data/lib/lookout-3.0/result.rb +16 -0
 - data/lib/lookout-3.0/results.rb +5 -0
 - data/lib/lookout-3.0/results/error.rb +18 -0
 - data/lib/lookout-3.0/results/failure.rb +15 -0
 - data/lib/lookout-3.0/results/success.rb +7 -0
 - data/lib/lookout-3.0/stub.rb +55 -0
 - data/lib/lookout-3.0/version.rb +133 -0
 - data/lib/lookout-3.0/warning.rb +40 -0
 - data/test/unit/examples.rb +208 -83
 - data/test/unit/{lookout.rb → lookout-3.0.rb} +0 -0
 - data/test/unit/lookout-3.0/actual.rb +13 -0
 - data/test/unit/lookout-3.0/actual/method.rb +31 -0
 - data/test/unit/lookout-3.0/actual/not.rb +15 -0
 - data/test/unit/lookout-3.0/actual/not/method.rb +7 -0
 - data/test/unit/lookout-3.0/aphonic.rb +31 -0
 - data/test/unit/{lookout → lookout-3.0}/diff.rb +0 -0
 - data/test/unit/{lookout/diff/group.rb → lookout-3.0/diff/algorithms.rb} +0 -0
 - data/test/unit/lookout-3.0/diff/algorithms/difflib.rb +56 -0
 - data/test/unit/lookout-3.0/diff/algorithms/difflib/position.rb +92 -0
 - data/test/unit/{lookout/diff/algorithms/difflib/position/to.rb → lookout-3.0/diff/algorithms/difflib/position/new.rb} +1 -2
 - data/test/unit/{lookout/results.rb → lookout-3.0/diff/formats.rb} +0 -0
 - data/test/unit/{lookout → lookout-3.0}/diff/formats/inline.rb +0 -0
 - data/test/unit/lookout-3.0/diff/formats/set.rb +26 -0
 - data/test/unit/{lookout → lookout-3.0}/diff/formats/unified.rb +0 -0
 - data/test/unit/{lookout/results/error.rb → lookout-3.0/diff/group.rb} +0 -0
 - data/test/unit/lookout-3.0/diff/groups.rb +102 -0
 - data/test/unit/{lookout → lookout-3.0}/diff/match.rb +0 -0
 - data/test/unit/lookout-3.0/diff/operation.rb +17 -0
 - data/test/unit/lookout-3.0/diff/operations.rb +22 -0
 - data/test/unit/lookout-3.0/diff/operations/copy.rb +50 -0
 - data/test/unit/lookout-3.0/diff/operations/delete.rb +45 -0
 - data/test/unit/lookout-3.0/diff/operations/insert.rb +45 -0
 - data/test/unit/lookout-3.0/diff/operations/replace.rb +45 -0
 - data/test/unit/lookout-3.0/diff/slice.rb +56 -0
 - data/test/unit/{lookout/results/failures/behavior.rb → lookout-3.0/difference.rb} +0 -0
 - data/test/unit/lookout-3.0/difference/array.rb +32 -0
 - data/test/unit/lookout-3.0/difference/exception.rb +69 -0
 - data/test/unit/lookout-3.0/difference/hash.rb +30 -0
 - data/test/unit/{lookout/results/failures/state.rb → lookout-3.0/difference/lookout.rb} +0 -0
 - data/test/unit/{lookout/results/fulfilled.rb → lookout-3.0/difference/lookout/actual.rb} +0 -0
 - data/test/unit/lookout-3.0/difference/lookout/actual/method.rb +7 -0
 - data/test/unit/{lookout/runners/console.rb → lookout-3.0/difference/lookout/actual/not.rb} +0 -0
 - data/test/unit/lookout-3.0/difference/lookout/actual/not/method.rb +7 -0
 - data/test/unit/lookout-3.0/difference/lookout/output.rb +11 -0
 - data/test/unit/lookout-3.0/difference/lookout/reception.rb +11 -0
 - data/test/unit/lookout-3.0/difference/lookout/warning.rb +11 -0
 - data/test/unit/lookout-3.0/difference/module.rb +11 -0
 - data/test/unit/lookout-3.0/difference/object.rb +31 -0
 - data/test/unit/lookout-3.0/difference/range.rb +11 -0
 - data/test/unit/lookout-3.0/difference/regexp.rb +11 -0
 - data/test/unit/lookout-3.0/difference/string.rb +29 -0
 - data/test/unit/lookout-3.0/difference/symbol.rb +11 -0
 - data/test/unit/lookout-3.0/encode.rb +28 -0
 - data/test/unit/lookout-3.0/exception.rb +107 -0
 - data/test/unit/lookout-3.0/exception/backtrace.rb +75 -0
 - data/test/unit/lookout-3.0/exception/unknown.rb +23 -0
 - data/test/unit/lookout-3.0/expect.rb +15 -0
 - data/test/unit/{lookout/ui/console.rb → lookout-3.0/expect/classes.rb} +0 -0
 - data/test/unit/lookout-3.0/expect/classes/exception.rb +41 -0
 - data/test/unit/lookout-3.0/expect/exception.rb +63 -0
 - data/test/unit/lookout-3.0/expect/object.rb +55 -0
 - data/test/unit/lookout-3.0/expect/object/context.rb +120 -0
 - data/test/unit/lookout-3.0/expectations.rb +55 -0
 - data/test/unit/lookout-3.0/expectations/context.rb +44 -0
 - data/test/unit/lookout-3.0/expected.rb +4 -0
 - data/test/unit/lookout-3.0/expected/array.rb +19 -0
 - data/test/unit/lookout-3.0/expected/classes.rb +4 -0
 - data/test/unit/lookout-3.0/expected/classes/exception.rb +7 -0
 - data/test/unit/lookout-3.0/expected/exception.rb +24 -0
 - data/test/unit/lookout-3.0/expected/falseclass.rb +23 -0
 - data/test/unit/lookout-3.0/expected/hash.rb +23 -0
 - data/test/unit/lookout-3.0/expected/lookout.rb +4 -0
 - data/test/unit/lookout-3.0/expected/lookout/actual.rb +4 -0
 - data/test/unit/lookout-3.0/expected/lookout/actual/method.rb +11 -0
 - data/test/unit/lookout-3.0/expected/lookout/actual/not.rb +4 -0
 - data/test/unit/lookout-3.0/expected/lookout/actual/not/method.rb +11 -0
 - data/test/unit/lookout-3.0/expected/lookout/output.rb +27 -0
 - data/test/unit/lookout-3.0/expected/lookout/reception.rb +25 -0
 - data/test/unit/lookout-3.0/expected/lookout/warning.rb +48 -0
 - data/test/unit/lookout-3.0/expected/module.rb +23 -0
 - data/test/unit/lookout-3.0/expected/object.rb +24 -0
 - data/test/unit/lookout-3.0/expected/range.rb +19 -0
 - data/test/unit/lookout-3.0/expected/regexp.rb +19 -0
 - data/test/unit/lookout-3.0/expected/string.rb +44 -0
 - data/test/unit/lookout-3.0/expected/symbol.rb +35 -0
 - data/test/unit/lookout-3.0/expected/trueclass.rb +23 -0
 - data/test/unit/lookout-3.0/inspect.rb +39 -0
 - data/test/unit/lookout-3.0/interfaces.rb +4 -0
 - data/test/unit/lookout-3.0/interfaces/commandline.rb +4 -0
 - data/test/unit/lookout-3.0/literal.rb +15 -0
 - data/test/unit/lookout-3.0/mock.rb +22 -0
 - data/test/unit/lookout-3.0/object.rb +4 -0
 - data/test/unit/lookout-3.0/object/not.rb +7 -0
 - data/test/unit/lookout-3.0/object/not/receive.rb +9 -0
 - data/test/unit/lookout-3.0/object/to.rb +7 -0
 - data/test/unit/lookout-3.0/object/to/receive.rb +9 -0
 - data/test/unit/lookout-3.0/output.rb +31 -0
 - data/test/unit/lookout-3.0/plugins.rb +4 -0
 - data/test/unit/lookout-3.0/reception.rb +86 -0
 - data/test/unit/lookout-3.0/reception/arguments.rb +23 -0
 - data/test/unit/lookout-3.0/reception/arguments/any.rb +15 -0
 - data/test/unit/lookout-3.0/reception/arguments/error.rb +4 -0
 - data/test/unit/lookout-3.0/reception/arguments/list.rb +19 -0
 - data/test/unit/lookout-3.0/reception/arguments/none.rb +15 -0
 - data/test/unit/lookout-3.0/reception/error.rb +4 -0
 - data/test/unit/lookout-3.0/result.rb +27 -0
 - data/test/unit/lookout-3.0/results.rb +4 -0
 - data/test/unit/lookout-3.0/results/error.rb +37 -0
 - data/test/unit/lookout-3.0/results/failure.rb +21 -0
 - data/test/unit/lookout-3.0/results/success.rb +4 -0
 - data/test/unit/lookout-3.0/stub.rb +53 -0
 - data/test/unit/lookout-3.0/version.rb +4 -0
 - data/test/unit/lookout-3.0/warning.rb +47 -0
 - metadata +1159 -456
 - data/lib/lookout.rb +0 -30
 - data/lib/lookout/aphonic.rb +0 -40
 - data/lib/lookout/diff.rb +0 -10
 - data/lib/lookout/diff/algorithms/difflib.rb +0 -38
 - data/lib/lookout/diff/algorithms/difflib/position.rb +0 -92
 - data/lib/lookout/diff/formats.rb +0 -7
 - data/lib/lookout/diff/formats/hash.rb +0 -53
 - data/lib/lookout/diff/formats/inline.rb +0 -39
 - data/lib/lookout/diff/formats/unified.rb +0 -57
 - data/lib/lookout/diff/group.rb +0 -61
 - data/lib/lookout/diff/groups.rb +0 -34
 - data/lib/lookout/diff/match.rb +0 -36
 - data/lib/lookout/diff/operation.rb +0 -33
 - data/lib/lookout/diff/operations.rb +0 -36
 - data/lib/lookout/diff/operations/delete.rb +0 -9
 - data/lib/lookout/diff/operations/equal.rb +0 -27
 - data/lib/lookout/diff/operations/insert.rb +0 -9
 - data/lib/lookout/diff/operations/replace.rb +0 -9
 - data/lib/lookout/diff/range.rb +0 -91
 - data/lib/lookout/equalities.rb +0 -13
 - data/lib/lookout/equalities/array.rb +0 -22
 - data/lib/lookout/equalities/boolean.rb +0 -9
 - data/lib/lookout/equalities/hash.rb +0 -25
 - data/lib/lookout/equalities/include.rb +0 -9
 - data/lib/lookout/equalities/object.rb +0 -24
 - data/lib/lookout/equalities/output.rb +0 -19
 - data/lib/lookout/equalities/standarderror.rb +0 -32
 - data/lib/lookout/equalities/string.rb +0 -19
 - data/lib/lookout/equalities/warning.rb +0 -16
 - data/lib/lookout/equality.rb +0 -36
 - data/lib/lookout/expectation.rb +0 -69
 - data/lib/lookout/expectations.rb +0 -49
 - data/lib/lookout/expectations/behavior.rb +0 -20
 - data/lib/lookout/expectations/line.rb +0 -29
 - data/lib/lookout/expectations/state.rb +0 -31
 - data/lib/lookout/expectations/state/warning.rb +0 -26
 - data/lib/lookout/mock.rb +0 -20
 - data/lib/lookout/mock/method.rb +0 -70
 - data/lib/lookout/mock/method/arguments.rb +0 -33
 - data/lib/lookout/mock/method/arguments/any.rb +0 -11
 - data/lib/lookout/mock/method/arguments/anything.rb +0 -11
 - data/lib/lookout/mock/method/arguments/list.rb +0 -15
 - data/lib/lookout/mock/method/arguments/none.rb +0 -11
 - data/lib/lookout/mock/method/arguments/one.rb +0 -11
 - data/lib/lookout/mock/method/calls.rb +0 -11
 - data/lib/lookout/mock/method/calls/class.rb +0 -21
 - data/lib/lookout/mock/method/calls/exactly.rb +0 -28
 - data/lib/lookout/mock/method/calls/instance.rb +0 -25
 - data/lib/lookout/mock/method/calls/lower.rb +0 -22
 - data/lib/lookout/mock/method/calls/upper.rb +0 -22
 - data/lib/lookout/mock/methods.rb +0 -12
 - data/lib/lookout/mock/object.rb +0 -12
 - data/lib/lookout/object.rb +0 -11
 - data/lib/lookout/output.rb +0 -21
 - data/lib/lookout/rake/tasks.rb +0 -36
 - data/lib/lookout/rake/tasks/gem.rb +0 -49
 - data/lib/lookout/rake/tasks/tags.rb +0 -16
 - data/lib/lookout/rake/tasks/test.rb +0 -46
 - data/lib/lookout/rake/tasks/test/loader.rb +0 -22
 - data/lib/lookout/recorder.rb +0 -45
 - data/lib/lookout/recorder/not.rb +0 -11
 - data/lib/lookout/recorder/tape.rb +0 -21
 - data/lib/lookout/recorders.rb +0 -6
 - data/lib/lookout/recorders/reception.rb +0 -47
 - data/lib/lookout/recorders/state.rb +0 -35
 - data/lib/lookout/result.rb +0 -13
 - data/lib/lookout/results.rb +0 -25
 - data/lib/lookout/results/error.rb +0 -18
 - data/lib/lookout/results/error/exception.rb +0 -34
 - data/lib/lookout/results/error/exception/backtrace.rb +0 -50
 - data/lib/lookout/results/failure.rb +0 -16
 - data/lib/lookout/results/failures.rb +0 -6
 - data/lib/lookout/results/failures/behavior.rb +0 -5
 - data/lib/lookout/results/failures/state.rb +0 -5
 - data/lib/lookout/results/fulfilled.rb +0 -5
 - data/lib/lookout/results/unsuccessful.rb +0 -31
 - data/lib/lookout/runners.rb +0 -6
 - data/lib/lookout/runners/console.rb +0 -49
 - data/lib/lookout/runners/trackers.rb +0 -5
 - data/lib/lookout/runners/trackers/failure.rb +0 -14
 - data/lib/lookout/stub.rb +0 -18
 - data/lib/lookout/stub/method.rb +0 -105
 - data/lib/lookout/stub/methods.rb +0 -18
 - data/lib/lookout/stub/object.rb +0 -11
 - data/lib/lookout/ui.rb +0 -7
 - data/lib/lookout/ui/console.rb +0 -19
 - data/lib/lookout/ui/silent.rb +0 -9
 - data/lib/lookout/version.rb +0 -5
 - data/lib/lookout/warning.rb +0 -7
 - data/lib/lookout/xml.rb +0 -17
 - data/test/unit/lookout/diff/algorithms/difflib.rb +0 -56
 - data/test/unit/lookout/diff/algorithms/difflib/position.rb +0 -92
 - data/test/unit/lookout/diff/groups.rb +0 -102
 - data/test/unit/lookout/diff/operations.rb +0 -22
 - data/test/unit/lookout/diff/operations/delete.rb +0 -45
 - data/test/unit/lookout/diff/operations/equal.rb +0 -45
 - data/test/unit/lookout/diff/operations/insert.rb +0 -45
 - data/test/unit/lookout/diff/operations/replace.rb +0 -45
 - data/test/unit/lookout/diff/range.rb +0 -50
 - data/test/unit/lookout/equality.rb +0 -113
 - data/test/unit/lookout/expectation.rb +0 -47
 - data/test/unit/lookout/expectations.rb +0 -36
 - data/test/unit/lookout/expectations/behavior.rb +0 -35
 - data/test/unit/lookout/expectations/line.rb +0 -29
 - data/test/unit/lookout/expectations/state.rb +0 -29
 - data/test/unit/lookout/mock/method.rb +0 -143
 - data/test/unit/lookout/mock/method/arguments.rb +0 -57
 - data/test/unit/lookout/mock/method/arguments/any.rb +0 -11
 - data/test/unit/lookout/recorder.rb +0 -11
 - data/test/unit/lookout/results/error/exception/backtrace.rb +0 -20
 - data/test/unit/lookout/results/unsuccessful.rb +0 -9
 - data/test/unit/lookout/runners/trackers/failure.rb +0 -30
 - data/test/unit/lookout/stub/method.rb +0 -48
 - data/test/unit/lookout/stub/methods.rb +0 -19
 - data/test/unit/lookout/xml.rb +0 -55
 
| 
         @@ -0,0 +1,69 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents the “Expectations” keyword in expectation files and the
         
     | 
| 
      
 4 
     | 
    
         
            +
            # expectation files themselves.  Used by {Interfaces::Commandline} and should
         
     | 
| 
      
 5 
     | 
    
         
            +
            # be used by other interfaces as the main access point to expectation files.
         
     | 
| 
      
 6 
     | 
    
         
            +
            # Implemented as an Enumerable over the expect blocks found in any of the
         
     | 
| 
      
 7 
     | 
    
         
            +
            # expectations blocks in the expectation file.
         
     | 
| 
      
 8 
     | 
    
         
            +
            class Lookout::Expectations
         
     | 
| 
      
 9 
     | 
    
         
            +
              # Prepares the enumeration of the expect blocks found in the expectations
         
     | 
| 
      
 10 
     | 
    
         
            +
              # file pointed to by the expanded PATH.
         
     | 
| 
      
 11 
     | 
    
         
            +
              # @param [String] path
         
     | 
| 
      
 12 
     | 
    
         
            +
              Value(:path)
         
     | 
| 
      
 13 
     | 
    
         
            +
              include Enumerable
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              @@expectations = {}
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 18 
     | 
    
         
            +
                def load(path)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @@expectations[path] = []
         
     | 
| 
      
 20 
     | 
    
         
            +
                  begin
         
     | 
| 
      
 21 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 22 
     | 
    
         
            +
                      Kernel.load path, true
         
     | 
| 
      
 23 
     | 
    
         
            +
                    rescue LoadError => e
         
     | 
| 
      
 24 
     | 
    
         
            +
                      raise e,
         
     | 
| 
      
 25 
     | 
    
         
            +
                        'cannot load expectations from file: %s' % e,
         
     | 
| 
      
 26 
     | 
    
         
            +
                        [(Array(e.backtrace).find{ |b| b.start_with? path } or '%s:0' % path)] +
         
     | 
| 
      
 27 
     | 
    
         
            +
                          Array(e.backtrace) unless e.message.end_with? path
         
     | 
| 
      
 28 
     | 
    
         
            +
                      raise e,
         
     | 
| 
      
 29 
     | 
    
         
            +
                        'cannot load expectations from file: no such file or directory',
         
     | 
| 
      
 30 
     | 
    
         
            +
                        ['%s:0' % path]
         
     | 
| 
      
 31 
     | 
    
         
            +
                    rescue SyntaxError => e
         
     | 
| 
      
 32 
     | 
    
         
            +
                      raise unless matches = (/\A(.*?:\d+): (.*)/m.match(e.message) rescue nil)
         
     | 
| 
      
 33 
     | 
    
         
            +
                      raise SyntaxError, matches[2], [matches[1]] + Array(e.backtrace)
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
                    @@expectations[path]
         
     | 
| 
      
 36 
     | 
    
         
            +
                  ensure
         
     | 
| 
      
 37 
     | 
    
         
            +
                    @@expectations.delete path
         
     | 
| 
      
 38 
     | 
    
         
            +
                  end
         
     | 
| 
      
 39 
     | 
    
         
            +
                end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                def evaluate(path, &block) @@expectations[path] << block; self end
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              # @overload
         
     | 
| 
      
 45 
     | 
    
         
            +
              #   Enumerates the expect blocks.
         
     | 
| 
      
 46 
     | 
    
         
            +
              #
         
     | 
| 
      
 47 
     | 
    
         
            +
              #   @yieldparam [Expect::Object] expect
         
     | 
| 
      
 48 
     | 
    
         
            +
              #   @raise [NoMemoryError, SignalException, SystemExit] If raised; all other
         
     | 
| 
      
 49 
     | 
    
         
            +
              #     exceptions are caught and turned into failing expect blocks, located at
         
     | 
| 
      
 50 
     | 
    
         
            +
              #     the source of the exception
         
     | 
| 
      
 51 
     | 
    
         
            +
              # @overload
         
     | 
| 
      
 52 
     | 
    
         
            +
              #   @return [Enumerator<Expect::Object>] An Enumerator over the expect blocks
         
     | 
| 
      
 53 
     | 
    
         
            +
              def each
         
     | 
| 
      
 54 
     | 
    
         
            +
                return enum_for(__method__) unless block_given?
         
     | 
| 
      
 55 
     | 
    
         
            +
                context = Lookout::Expectations::Context.new{ |expect| yield expect }
         
     | 
| 
      
 56 
     | 
    
         
            +
                self.class.load(path).each do |expectations|
         
     | 
| 
      
 57 
     | 
    
         
            +
                  context.instance_eval(&expectations)
         
     | 
| 
      
 58 
     | 
    
         
            +
                end
         
     | 
| 
      
 59 
     | 
    
         
            +
                self
         
     | 
| 
      
 60 
     | 
    
         
            +
              rescue NoMemoryError, SignalException, SystemExit
         
     | 
| 
      
 61 
     | 
    
         
            +
                raise
         
     | 
| 
      
 62 
     | 
    
         
            +
              rescue Exception => e
         
     | 
| 
      
 63 
     | 
    
         
            +
                raise unless location = (Array(e.backtrace).first rescue nil)
         
     | 
| 
      
 64 
     | 
    
         
            +
                file, line = Lookout.location(location)
         
     | 
| 
      
 65 
     | 
    
         
            +
                raise unless file and line
         
     | 
| 
      
 66 
     | 
    
         
            +
                yield nil.to_lookout_expected.expect(file, line){ raise e }
         
     | 
| 
      
 67 
     | 
    
         
            +
                self
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,52 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Context in which expectations blocks are evaluated.  Plug-ins may add private
         
     | 
| 
      
 4 
     | 
    
         
            +
            # methods to this class to make them available to expectations blocks.
         
     | 
| 
      
 5 
     | 
    
         
            +
            class Lookout::Expectations::Context
         
     | 
| 
      
 6 
     | 
    
         
            +
              # Sets up a context in which the given block will be passed each expect block
         
     | 
| 
      
 7 
     | 
    
         
            +
              # found in the expectations blocks evaluated in this context via
         
     | 
| 
      
 8 
     | 
    
         
            +
              #  #instance_eval.
         
     | 
| 
      
 9 
     | 
    
         
            +
              # @yieldparam [Expect] expect
         
     | 
| 
      
 10 
     | 
    
         
            +
              def initialize(&block) @block = block end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              private
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              # Sets up an expect block, expecting EXPECTED and evaluating BLOCK for the
         
     | 
| 
      
 15 
     | 
    
         
            +
              # actual result, then passes it to the block given to the constructor.
         
     | 
| 
      
 16 
     | 
    
         
            +
              # @param (see Expect.expect)
         
     | 
| 
      
 17 
     | 
    
         
            +
              # @return [self]
         
     | 
| 
      
 18 
     | 
    
         
            +
              # @see Expect.expect
         
     | 
| 
      
 19 
     | 
    
         
            +
              def expect(expected, &block)
         
     | 
| 
      
 20 
     | 
    
         
            +
                @block.call Lookout::Expect.expect(expected,
         
     | 
| 
      
 21 
     | 
    
         
            +
                                                   *(block.respond_to?(:source_location) ?
         
     | 
| 
      
 22 
     | 
    
         
            +
                                                     block.source_location :
         
     | 
| 
      
 23 
     | 
    
         
            +
                                                     Lookout.location(caller.first)),
         
     | 
| 
      
 24 
     | 
    
         
            +
                                                   &block)
         
     | 
| 
      
 25 
     | 
    
         
            +
                self
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              # @return [Actual] A result wrapper for explicit query expectations
         
     | 
| 
      
 29 
     | 
    
         
            +
              def result; Lookout::Actual.new end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              # @param [Object] expected
         
     | 
| 
      
 32 
     | 
    
         
            +
              # @return [Literal] A literal expected value for EXPECTED
         
     | 
| 
      
 33 
     | 
    
         
            +
              def literal(expected) Lookout::Literal.new(expected) end
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
              # @param (see Stub::Object#initialize)
         
     | 
| 
      
 36 
     | 
    
         
            +
              # @return [Mock::Object] A mock object set up with METHODS
         
     | 
| 
      
 37 
     | 
    
         
            +
              def mock(methods = {}) Lookout::Mock.new(methods) end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
              # @return [Mock::Method::Arguments::None] An object representing
         
     | 
| 
      
 40 
     | 
    
         
            +
              #   “without arguments” for mock argument expectations
         
     | 
| 
      
 41 
     | 
    
         
            +
              def without_arguments; Lookout::Reception::Arguments::None.new end
         
     | 
| 
      
 42 
     | 
    
         
            +
             
     | 
| 
      
 43 
     | 
    
         
            +
              # @param (see Stub::Object#initialize)
         
     | 
| 
      
 44 
     | 
    
         
            +
              # @return [Stub::Object] A stub object set up with METHODS
         
     | 
| 
      
 45 
     | 
    
         
            +
              def stub(methods = {}) Lookout::Stub.new(methods) end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              # @return [Output] An expected output wrapper around STRING
         
     | 
| 
      
 48 
     | 
    
         
            +
              def output(string) Lookout::Output.new(string) end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
              # @return [Output] An expected warning wrapper around STRING
         
     | 
| 
      
 51 
     | 
    
         
            +
              def warning(string) Lookout::Warning.new(string) end
         
     | 
| 
      
 52 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Function-like namespace for type-specific expected values.  Every {::Object}
         
     | 
| 
      
 4 
     | 
    
         
            +
            # should be convertable to a {Lookout::Expected::Object} when it receives
         
     | 
| 
      
 5 
     | 
    
         
            +
            #  #to_lookout_expected.  ::Object implements this method, so all objects are
         
     | 
| 
      
 6 
     | 
    
         
            +
            # covered by default.  If you have a type that would benefit from more specific
         
     | 
| 
      
 7 
     | 
    
         
            +
            # treatment, implement #to_lookout_expected by returning an instance of a
         
     | 
| 
      
 8 
     | 
    
         
            +
            # subclass {Lookout::Expected::Object}.
         
     | 
| 
      
 9 
     | 
    
         
            +
            module Lookout::Expected
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Array}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Array < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [::Array] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Array, nil] A difference report between ACTUAL and
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   {#expected} unless their content exhibit no {Object differences}
         
     | 
| 
      
 8 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 9 
     | 
    
         
            +
                Lookout::Difference::Array.new(actual, expected) unless
         
     | 
| 
      
 10 
     | 
    
         
            +
                  Array === actual and
         
     | 
| 
      
 11 
     | 
    
         
            +
                  expected.size == actual.size and
         
     | 
| 
      
 12 
     | 
    
         
            +
                  expected.enum_for(:none?).with_index{ |v, i|
         
     | 
| 
      
 13 
     | 
    
         
            +
                    v.to_lookout_expected.difference(actual[i])
         
     | 
| 
      
 14 
     | 
    
         
            +
                  }
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected values that are descendants of {::Exception}.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Classes::Exception < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param (see Object#expect)
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @yieldparam [Class] class
         
     | 
| 
      
 7 
     | 
    
         
            +
              # @yieldreturn [Class]
         
     | 
| 
      
 8 
     | 
    
         
            +
              # @return [Expect::Classes::Exception] An expect block for the receiver at
         
     | 
| 
      
 9 
     | 
    
         
            +
              #   LINE in FILE that’ll yield the {#expected} exception class and expect it
         
     | 
| 
      
 10 
     | 
    
         
            +
              #   or one of its descendants to be raised
         
     | 
| 
      
 11 
     | 
    
         
            +
              def expect(file, line, &block)
         
     | 
| 
      
 12 
     | 
    
         
            +
                Lookout::Expect::Classes::Exception.new(self, file, line, &block)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,46 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Exception}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Exception < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param (see Object#expect)
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @yieldparam [::Exception] exception
         
     | 
| 
      
 7 
     | 
    
         
            +
              # @yieldreturn [::Exception]
         
     | 
| 
      
 8 
     | 
    
         
            +
              # @return [Expect::Exception] An expect block for the receiver at LINE in
         
     | 
| 
      
 9 
     | 
    
         
            +
              #   FILE that’ll yield the expected EXCEPTION and expect the exception to be
         
     | 
| 
      
 10 
     | 
    
         
            +
              #   raised
         
     | 
| 
      
 11 
     | 
    
         
            +
              def expect(file, line, &block)
         
     | 
| 
      
 12 
     | 
    
         
            +
                Lookout::Expect::Exception.new(self, file, line, &block)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              # @param [::Exception] actual
         
     | 
| 
      
 16 
     | 
    
         
            +
              # @return [Difference::Exception, nil] A difference report between ACTUAL
         
     | 
| 
      
 17 
     | 
    
         
            +
              #   and {#expected} unless they’re #equal? or their classes are `#==` and
         
     | 
| 
      
 18 
     | 
    
         
            +
              #   their messages match or {#expected}s message is a Regexp that matches
         
     | 
| 
      
 19 
     | 
    
         
            +
              #   actual’s message
         
     | 
| 
      
 20 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 21 
     | 
    
         
            +
                Lookout::Difference::Exception.new(actual, expected, regexp) unless
         
     | 
| 
      
 22 
     | 
    
         
            +
                  expected.equal?(actual) or
         
     | 
| 
      
 23 
     | 
    
         
            +
                  (expected.class == actual.class and
         
     | 
| 
      
 24 
     | 
    
         
            +
                   (actual.respond_to? :message rescue false) and
         
     | 
| 
      
 25 
     | 
    
         
            +
                   (m = actual.message rescue nil) and
         
     | 
| 
      
 26 
     | 
    
         
            +
                   (regexp ? regexp === m : expected.message == m))
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              private
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
              # The first test works in Ruby 1.8.  In Ruby 1.9, however, #message always
         
     | 
| 
      
 32 
     | 
    
         
            +
              # returns a String, unless the conversion raises an error.  Sadly, this
         
     | 
| 
      
 33 
     | 
    
         
            +
              # conversion can’t keep track of the ‘e’ and ‘n’ options for encoding
         
     | 
| 
      
 34 
     | 
    
         
            +
              # handling.
         
     | 
| 
      
 35 
     | 
    
         
            +
              # @private
         
     | 
| 
      
 36 
     | 
    
         
            +
              def regexp
         
     | 
| 
      
 37 
     | 
    
         
            +
                return @regexp if defined? @regexp
         
     | 
| 
      
 38 
     | 
    
         
            +
                return @regexp = expected.message if Regexp === expected.message
         
     | 
| 
      
 39 
     | 
    
         
            +
                return @regexp = nil unless expected.message =~ /\A\(\?([mix]*)(-[mix]+)?:(.*)\)\z/
         
     | 
| 
      
 40 
     | 
    
         
            +
                @regexp = Regexp.new($3,
         
     | 
| 
      
 41 
     | 
    
         
            +
                                     0 |
         
     | 
| 
      
 42 
     | 
    
         
            +
                                     ($1.include?('m') ? Regexp::MULTILINE : 0) |
         
     | 
| 
      
 43 
     | 
    
         
            +
                                     ($1.include?('i') ? Regexp::IGNORECASE : 0) |
         
     | 
| 
      
 44 
     | 
    
         
            +
                                     ($1.include?('x') ? Regexp::EXTENDED : 0))
         
     | 
| 
      
 45 
     | 
    
         
            +
              end
         
     | 
| 
      
 46 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,9 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected FalseClasses (of which `false` is the only instance).
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::FalseClass < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [Boolean] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Object] A difference report between ACTUAL and
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   {#expected} unless ACTUAL is falseful
         
     | 
| 
      
 8 
     | 
    
         
            +
              def difference(actual) super((not not actual)) end
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Hash}es.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Hash < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [::Hash] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Hash, nil] A difference report between ACTUAL and
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   {#expected} unless their content exhibit no {Object differences}
         
     | 
| 
      
 8 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 9 
     | 
    
         
            +
                Lookout::Difference::Hash.new(actual, expected) unless
         
     | 
| 
      
 10 
     | 
    
         
            +
                  Hash === actual and
         
     | 
| 
      
 11 
     | 
    
         
            +
                  expected.size == actual.size and
         
     | 
| 
      
 12 
     | 
    
         
            +
                  expected.none?{ |k, v| v.to_lookout_expected.difference(actual[k]) }
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Lookout::Actual::Method}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Lookout::Actual::Method < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [::Object] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Lookout::Actual::Method, nil] A difference report
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   between ACTUAL and {#expected} unless invoking {#expected} on ACTUAL
         
     | 
| 
      
 8 
     | 
    
         
            +
              #   returns true
         
     | 
| 
      
 9 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 10 
     | 
    
         
            +
                Lookout::Difference::Lookout::Actual::Method.new(actual, expected) unless
         
     | 
| 
      
 11 
     | 
    
         
            +
                  expected.call(actual)
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Lookout::Actual::Not::Method}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Lookout::Actual::Not::Method < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [::Object] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Lookout::Actual::Not::Method, nil] A difference report
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   between ACTUAL and {#expected} unless invoking {#expected} on ACTUAL
         
     | 
| 
      
 8 
     | 
    
         
            +
              #   returns false
         
     | 
| 
      
 9 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 10 
     | 
    
         
            +
                Lookout::Difference::Lookout::Actual::Not::Method.new(actual, expected) if
         
     | 
| 
      
 11 
     | 
    
         
            +
                  expected.call(actual)
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Lookout::Output}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Lookout::Output < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param (see Object#expect)
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @yieldparam [::IO] io
         
     | 
| 
      
 7 
     | 
    
         
            +
              # @yieldreturn [::Lookout::Output]
         
     | 
| 
      
 8 
     | 
    
         
            +
              # @return [Expect::Lookout::Output] An expect block for the receiver at LINE
         
     | 
| 
      
 9 
     | 
    
         
            +
              #   in FILE that’ll yield an IO object that’ll expect to see the {#expected}
         
     | 
| 
      
 10 
     | 
    
         
            +
              #   output during the execution of the block
         
     | 
| 
      
 11 
     | 
    
         
            +
              def expect(file, line, &block)
         
     | 
| 
      
 12 
     | 
    
         
            +
                super(file, line){ |expected|
         
     | 
| 
      
 13 
     | 
    
         
            +
                  output = StringIO.new
         
     | 
| 
      
 14 
     | 
    
         
            +
                  block.call output
         
     | 
| 
      
 15 
     | 
    
         
            +
                  expected.class.new(output.string)
         
     | 
| 
      
 16 
     | 
    
         
            +
                }
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
              # @param [::Lookout::Output] actual
         
     | 
| 
      
 20 
     | 
    
         
            +
              # @return [Difference::Lookout::Output, nil] A difference report between
         
     | 
| 
      
 21 
     | 
    
         
            +
              #   ACTUAL and {#expected} unless they’re `#==`
         
     | 
| 
      
 22 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 23 
     | 
    
         
            +
                Lookout::Difference::Lookout::Output.new(actual, expected) unless
         
     | 
| 
      
 24 
     | 
    
         
            +
                  expected == actual
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Lookout::Reception}s.  This is used to check mock
         
     | 
| 
      
 4 
     | 
    
         
            +
            # method invocation counts and arguments.
         
     | 
| 
      
 5 
     | 
    
         
            +
            class Lookout::Expected::Lookout::Reception < Lookout::Expected::Object
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @param (see Object#expect)
         
     | 
| 
      
 7 
     | 
    
         
            +
              # @yieldparam (see Object#expect)
         
     | 
| 
      
 8 
     | 
    
         
            +
              # @yieldreturn (see Object#expect)
         
     | 
| 
      
 9 
     | 
    
         
            +
              # @return [Expect::Object] An expect block for the receiver at LINE in FILE
         
     | 
| 
      
 10 
     | 
    
         
            +
              #   that’ll yield the {#expected} object and expect the block to call the
         
     | 
| 
      
 11 
     | 
    
         
            +
              #   method the appropriate number of times
         
     | 
| 
      
 12 
     | 
    
         
            +
              def expect(file, line, &block)
         
     | 
| 
      
 13 
     | 
    
         
            +
                super file, line, &expected.block(&block)
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              # @param [Integer] actual
         
     | 
| 
      
 17 
     | 
    
         
            +
              # @return [Difference::Lookout::Reception, nil] A difference report between
         
     | 
| 
      
 18 
     | 
    
         
            +
              #   the ACTUAL number of times the method was received and the range of
         
     | 
| 
      
 19 
     | 
    
         
            +
              #   expected number of receptions unless the earlier lay within the latter
         
     | 
| 
      
 20 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 21 
     | 
    
         
            +
                Lookout::Difference::Lookout::Reception.
         
     | 
| 
      
 22 
     | 
    
         
            +
                  new(actual, expected) unless expected.range === actual
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Lookout::Warning}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Lookout::Warning < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param (see Object#expect)
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @yield
         
     | 
| 
      
 7 
     | 
    
         
            +
              # @yieldreturn [::Lookout::Warning]
         
     | 
| 
      
 8 
     | 
    
         
            +
              # @return [Expected::Output] An expect block for the receiver at LINE in FILE
         
     | 
| 
      
 9 
     | 
    
         
            +
              #   that’ll yield and expect the warning to be output to `$stderr` during the
         
     | 
| 
      
 10 
     | 
    
         
            +
              #   execution of the block
         
     | 
| 
      
 11 
     | 
    
         
            +
              def expect(file, line, &block)
         
     | 
| 
      
 12 
     | 
    
         
            +
                super(file, line){ |expected|
         
     | 
| 
      
 13 
     | 
    
         
            +
                  with_global :$stderr, StringIO.new do
         
     | 
| 
      
 14 
     | 
    
         
            +
                    with_verbose do
         
     | 
| 
      
 15 
     | 
    
         
            +
                      block.call
         
     | 
| 
      
 16 
     | 
    
         
            +
                      expected.class.new($stderr.string)
         
     | 
| 
      
 17 
     | 
    
         
            +
                    end
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
                }
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              # @param [::Lookout::Warning] actual
         
     | 
| 
      
 23 
     | 
    
         
            +
              # @return [Difference::Lookout::Warning, nil] A difference report between
         
     | 
| 
      
 24 
     | 
    
         
            +
              #   ACTUAL and {#expected} unless they’re `#===`
         
     | 
| 
      
 25 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 26 
     | 
    
         
            +
                Lookout::Difference::Lookout::Warning.new(actual, expected) unless
         
     | 
| 
      
 27 
     | 
    
         
            +
                  expected === actual
         
     | 
| 
      
 28 
     | 
    
         
            +
              end
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Module}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Module < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [::Module] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Module, nil] A difference report between ACTUAL and
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   {#expected} unless they’re `#==` or ACTUAL is an {#expected}
         
     | 
| 
      
 8 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 9 
     | 
    
         
            +
                Lookout::Difference::Module.new(actual, expected) unless
         
     | 
| 
      
 10 
     | 
    
         
            +
                  expected == actual or expected === actual
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Object}s.  This is the base expected-value class and
         
     | 
| 
      
 4 
     | 
    
         
            +
            # may be subclassed if you have a type that would benefit from more specific
         
     | 
| 
      
 5 
     | 
    
         
            +
            # treatment than what this class affords.  Such a subclass should override
         
     | 
| 
      
 6 
     | 
    
         
            +
            # {#expect} and/or {#difference} to set up type-specific expect blocks and/or
         
     | 
| 
      
 7 
     | 
    
         
            +
            # difference checks and difference report generation.
         
     | 
| 
      
 8 
     | 
    
         
            +
            class Lookout::Expected::Object
         
     | 
| 
      
 9 
     | 
    
         
            +
              # Wraps the EXPECTED value.
         
     | 
| 
      
 10 
     | 
    
         
            +
              # @param [::Object] expected The expected value
         
     | 
| 
      
 11 
     | 
    
         
            +
              Value(:expected)
         
     | 
| 
      
 12 
     | 
    
         
            +
              public :expected
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              # @param (see Expect::Object#initialize)
         
     | 
| 
      
 15 
     | 
    
         
            +
              # @yieldparam (see Expect::Object#initialize)
         
     | 
| 
      
 16 
     | 
    
         
            +
              # @yieldreturn (see Expect::Object#initialize)
         
     | 
| 
      
 17 
     | 
    
         
            +
              # @return [Expect::Object] An expect block for the receiver at LINE in FILE
         
     | 
| 
      
 18 
     | 
    
         
            +
              #   that’ll yield the {#expected} object and expect an object that’ll exhibit
         
     | 
| 
      
 19 
     | 
    
         
            +
              #   no {#difference}s from it to be returned
         
     | 
| 
      
 20 
     | 
    
         
            +
              def expect(file, line, &block)
         
     | 
| 
      
 21 
     | 
    
         
            +
                Lookout::Expect::Object.new(self, file, line, &block)
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              # @param [::Object] actual
         
     | 
| 
      
 25 
     | 
    
         
            +
              # @return [Difference::Object, nil] A difference report between ACTUAL and
         
     | 
| 
      
 26 
     | 
    
         
            +
              #   {#expected} unless they’re `#==`
         
     | 
| 
      
 27 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 28 
     | 
    
         
            +
                Lookout::Difference::Object.new(actual, expected) unless expected == actual
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Range}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Range < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [::Range] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Range, nil] A difference report between ACTUAL and
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   {#expected} unless they’re `#==` or ACTUAL lays within {#expected}
         
     | 
| 
      
 8 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 9 
     | 
    
         
            +
                Lookout::Difference::Range.new(actual, expected) unless
         
     | 
| 
      
 10 
     | 
    
         
            +
                  expected == actual or expected === actual
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # -*- coding: utf-8 -*-
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            # Represents expected {::Regexp}s.
         
     | 
| 
      
 4 
     | 
    
         
            +
            class Lookout::Expected::Regexp < Lookout::Expected::Object
         
     | 
| 
      
 5 
     | 
    
         
            +
              # @param [::Regexp] actual
         
     | 
| 
      
 6 
     | 
    
         
            +
              # @return [Difference::Regexp, nil] A difference report between ACTUAL and
         
     | 
| 
      
 7 
     | 
    
         
            +
              #   {#expected} unless they’re `#==` or ACTUAL is matched by {#expected}
         
     | 
| 
      
 8 
     | 
    
         
            +
              def difference(actual)
         
     | 
| 
      
 9 
     | 
    
         
            +
                Lookout::Difference::Regexp.new(actual, expected) unless
         
     | 
| 
      
 10 
     | 
    
         
            +
                  expected == actual or expected === actual
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
            end
         
     |