lookout 2.3.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/lookout/recorder/not.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Recorder::Tape
|
4
|
-
Method = Struct.new(:name, :args)
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
@methods = []
|
8
|
-
end
|
9
|
-
|
10
|
-
def empty?
|
11
|
-
@methods.empty?
|
12
|
-
end
|
13
|
-
|
14
|
-
def record(method, args)
|
15
|
-
@methods << Method.new(method, args)
|
16
|
-
end
|
17
|
-
|
18
|
-
def play_for(subject)
|
19
|
-
@methods.inject(subject){ |result, method| result.send(method.name, *method.args) }
|
20
|
-
end
|
21
|
-
end
|
data/lib/lookout/recorders.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout::Recorders::Reception
|
4
|
-
def subject!(mocks, stubs)
|
5
|
-
@mock = @method._lookout_define(mocks)
|
6
|
-
methods.play_for @mock
|
7
|
-
subject
|
8
|
-
end
|
9
|
-
|
10
|
-
def verify
|
11
|
-
@mock.verify
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def receive!
|
17
|
-
@method = Method.new(self, @negated)
|
18
|
-
end
|
19
|
-
|
20
|
-
def methods
|
21
|
-
@methods ||= Lookout::Recorder::Tape.new
|
22
|
-
end
|
23
|
-
|
24
|
-
def method_missing(method, *args, &block)
|
25
|
-
super unless defined? @method
|
26
|
-
methods.record method, args
|
27
|
-
self
|
28
|
-
end
|
29
|
-
|
30
|
-
class Method < Lookout::Aphonic
|
31
|
-
undef extend
|
32
|
-
undef is_a?
|
33
|
-
|
34
|
-
def initialize(recorder, negated)
|
35
|
-
@recorder, @negated = recorder, negated
|
36
|
-
end
|
37
|
-
|
38
|
-
def method_missing(method, *args, &body)
|
39
|
-
@method, @args, @body = method, args, body
|
40
|
-
@recorder
|
41
|
-
end
|
42
|
-
|
43
|
-
def _lookout_define(mocks)
|
44
|
-
mocks.define(@recorder.subject, @method, *@args, &@body).tap{ |m| m.never if @negated }
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout::Recorders::State
|
4
|
-
Error = Class.new(StandardError)
|
5
|
-
|
6
|
-
def verify
|
7
|
-
!!methods.play_for(subject) ^ @negated or
|
8
|
-
raise Error,
|
9
|
-
case [@negated, @verb]
|
10
|
-
when [true, :be] then 'expected %p not to be %s'
|
11
|
-
when [true, :have] then 'expected %p not to have %s'
|
12
|
-
when [true, nil] then 'expected %p not to %s'
|
13
|
-
when [false, :be] then 'expected %p to be %s'
|
14
|
-
when [false, :have] then 'expected %p to have %s'
|
15
|
-
when [false, nil] then 'expected %p to %s'
|
16
|
-
end % [subject, description.join(' ')]
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def methods
|
22
|
-
@methods ||= Lookout::Recorder::Tape.new
|
23
|
-
end
|
24
|
-
|
25
|
-
def description
|
26
|
-
@description ||= []
|
27
|
-
end
|
28
|
-
|
29
|
-
def method_missing(method, *args)
|
30
|
-
description << method.to_s
|
31
|
-
args.each{ |arg| description << arg.inspect }
|
32
|
-
methods.record method, args
|
33
|
-
self
|
34
|
-
end
|
35
|
-
end
|
data/lib/lookout/result.rb
DELETED
data/lib/lookout/results.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Results
|
4
|
-
autoload :Error, 'lookout/results/error'
|
5
|
-
autoload :Failure, 'lookout/results/failure'
|
6
|
-
autoload :Failures, 'lookout/results/failures'
|
7
|
-
autoload :Fulfilled, 'lookout/results/fulfilled'
|
8
|
-
autoload :Unsuccessful, 'lookout/results/unsuccessful'
|
9
|
-
|
10
|
-
def initialize
|
11
|
-
@listeners = []
|
12
|
-
end
|
13
|
-
|
14
|
-
def on_new(&block)
|
15
|
-
@listeners << block
|
16
|
-
self
|
17
|
-
end
|
18
|
-
|
19
|
-
def <<(result)
|
20
|
-
@listeners.each do |listener|
|
21
|
-
listener.call result
|
22
|
-
end
|
23
|
-
self
|
24
|
-
end
|
25
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Results::Error
|
4
|
-
include Lookout::Result
|
5
|
-
|
6
|
-
autoload :Exception, 'lookout/results/error/exception'
|
7
|
-
|
8
|
-
def initialize(file, line, message, exception)
|
9
|
-
super file, line
|
10
|
-
@message, @exception = message, Exception.new(exception)
|
11
|
-
end
|
12
|
-
|
13
|
-
attr_reader :message, :exception
|
14
|
-
|
15
|
-
def to_s
|
16
|
-
[super, message, exception].compact.join(': ')
|
17
|
-
end
|
18
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Results::Error::Exception
|
4
|
-
autoload :Backtrace, 'lookout/results/error/exception/backtrace'
|
5
|
-
|
6
|
-
def initialize(exception)
|
7
|
-
@exception = exception
|
8
|
-
end
|
9
|
-
|
10
|
-
def message
|
11
|
-
# Chomping off a \n here isn’t 100 percent compatible with how Ruby 1.9
|
12
|
-
# does it, but it simplifies the code and also makes the output better if
|
13
|
-
# the message is a lone \n.
|
14
|
-
message = @exception.message.to_str.chomp("\n")
|
15
|
-
if @exception.class == RuntimeError and message.empty?
|
16
|
-
'unhandled exception'
|
17
|
-
elsif message.empty?
|
18
|
-
@exception.class.name
|
19
|
-
elsif @exception.class.name.empty? or @exception.class.name =~ /^#/
|
20
|
-
message
|
21
|
-
else
|
22
|
-
before, newline, after = message.partition("\n")
|
23
|
-
'%s (%s)%s%s' % [before, @exception.class.name, newline, after]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def backtrace
|
28
|
-
@backtrace ||= Backtrace.new(@exception.backtrace, SystemStackError === @exception)
|
29
|
-
end
|
30
|
-
|
31
|
-
def to_s
|
32
|
-
"%s\n%s" % [message, backtrace]
|
33
|
-
end
|
34
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Results::Error::Exception::Backtrace
|
4
|
-
def initialize(backtrace, trim, filter = ENV['LOOKOUT_DO_NOT_FILTER_BACKTRACE'].nil?)
|
5
|
-
@backtrace = case backtrace
|
6
|
-
when nil then []
|
7
|
-
when String then [backtrace]
|
8
|
-
when Array then backtrace.select{ |l| String === l }
|
9
|
-
end
|
10
|
-
@trim, @filter = trim, filter
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_s
|
14
|
-
trim(backtrace.map{ |location| "\tfrom %s" % location }).join("\n")
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def backtrace
|
20
|
-
return @backtrace unless @filter
|
21
|
-
before or outside or @backtrace
|
22
|
-
end
|
23
|
-
|
24
|
-
def before
|
25
|
-
nilify(@backtrace.take_while{ |location| not reject? location })
|
26
|
-
end
|
27
|
-
|
28
|
-
def outside
|
29
|
-
nilify(@backtrace.reject{ |location| reject? location })
|
30
|
-
end
|
31
|
-
|
32
|
-
def nilify(backtrace)
|
33
|
-
backtrace.empty? ? nil : backtrace
|
34
|
-
end
|
35
|
-
|
36
|
-
def reject?(location)
|
37
|
-
location.start_with? Root
|
38
|
-
end
|
39
|
-
|
40
|
-
def trim(locations)
|
41
|
-
return locations unless @trim and locations.length > Head + Tail + 5
|
42
|
-
locations[0...Head] +
|
43
|
-
["\t ... %d levels ..." % (locations.length - Head - Tail)] +
|
44
|
-
locations[-Tail..-1]
|
45
|
-
end
|
46
|
-
|
47
|
-
Root = 4.times.reduce(__FILE__){ |path, _| File.dirname(path) }
|
48
|
-
Head = 8
|
49
|
-
Tail = 5
|
50
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout::Results::Failure
|
4
|
-
include Lookout::Result
|
5
|
-
|
6
|
-
def initialize(file, line, message)
|
7
|
-
super file, line
|
8
|
-
@message = message
|
9
|
-
end
|
10
|
-
|
11
|
-
attr_reader :message
|
12
|
-
|
13
|
-
def to_s
|
14
|
-
[super, message].compact.join(': ')
|
15
|
-
end
|
16
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Results::Unsuccessful < Lookout::Results
|
4
|
-
include Enumerable
|
5
|
-
|
6
|
-
def initialize
|
7
|
-
super
|
8
|
-
@unsuccessful = []
|
9
|
-
end
|
10
|
-
|
11
|
-
def <<(result)
|
12
|
-
@unsuccessful << result unless Lookout::Results::Fulfilled === result
|
13
|
-
super
|
14
|
-
self
|
15
|
-
end
|
16
|
-
|
17
|
-
def each
|
18
|
-
@unsuccessful.each do |result|
|
19
|
-
yield result
|
20
|
-
end
|
21
|
-
self
|
22
|
-
end
|
23
|
-
|
24
|
-
def errors
|
25
|
-
select{ |result| Lookout::Results::Error === result }
|
26
|
-
end
|
27
|
-
|
28
|
-
def failures
|
29
|
-
select{ |result| Lookout::Results::Failure === result }
|
30
|
-
end
|
31
|
-
end
|
data/lib/lookout/runners.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Runners::Console
|
4
|
-
def initialize(results = Lookout::Results.new,
|
5
|
-
expectations = Lookout::Expectations.new(results),
|
6
|
-
ui = Lookout::UI::Console.new(results))
|
7
|
-
@results, @expectations, @ui = results, expectations, ui
|
8
|
-
@ui.start
|
9
|
-
@failed = Lookout::Runners::Trackers::Failure.new(@results)
|
10
|
-
end
|
11
|
-
|
12
|
-
def install
|
13
|
-
Kernel.module_exec(self) do |runner|
|
14
|
-
define_method :Expectations do |&block|
|
15
|
-
runner.expectations_eval(&block)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
self
|
19
|
-
end
|
20
|
-
|
21
|
-
def load(file)
|
22
|
-
expectations_eval do
|
23
|
-
begin
|
24
|
-
load file
|
25
|
-
rescue SyntaxError => e
|
26
|
-
raise unless matches = %r{\A(.*?:\d+): (.*)}m.match(e.message)
|
27
|
-
raise SyntaxError, matches[2], [matches[1]]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def exit
|
33
|
-
@expectations.flush
|
34
|
-
@ui.flush
|
35
|
-
super 1 if @failed.failed?
|
36
|
-
self
|
37
|
-
end
|
38
|
-
|
39
|
-
def expectations_eval(&block)
|
40
|
-
@expectations.instance_eval(&block)
|
41
|
-
rescue Interrupt, NoMemoryError, SignalException, SystemExit
|
42
|
-
raise
|
43
|
-
rescue Exception => e
|
44
|
-
raise unless location = Array(e.backtrace).first
|
45
|
-
file, line = Lookout.location(location)
|
46
|
-
raise unless file and line
|
47
|
-
@results << Lookout::Results::Error.new(file, line, nil, e)
|
48
|
-
end
|
49
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Runners::Trackers::Failure
|
4
|
-
def initialize(results)
|
5
|
-
@failed = false
|
6
|
-
results.on_new do |result|
|
7
|
-
@failed = !(Lookout::Results::Fulfilled === result) unless @failed
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def failed?
|
12
|
-
@failed
|
13
|
-
end
|
14
|
-
end
|
data/lib/lookout/stub.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout::Stub
|
4
|
-
autoload :Method, 'lookout/stub/method'
|
5
|
-
autoload :Methods, 'lookout/stub/methods'
|
6
|
-
autoload :Object, 'lookout/stub/object'
|
7
|
-
|
8
|
-
class << self
|
9
|
-
def methods
|
10
|
-
methods = Methods.new
|
11
|
-
begin
|
12
|
-
yield methods
|
13
|
-
ensure
|
14
|
-
methods.undefine
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|