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
@@ -0,0 +1,86 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect NoMethodError.
|
5
|
+
new("cannot convert upper reception limit to Integer: undefined method `to_int' for nil:NilClass") do
|
6
|
+
Object.new.to.receive.a.at_most(nil)
|
7
|
+
end
|
8
|
+
|
9
|
+
expect ArgumentError.new('upper reception limit must be positive: -1 < 1') do
|
10
|
+
Object.new.to.receive.a.at_most(-1)
|
11
|
+
end
|
12
|
+
|
13
|
+
expect ArgumentError.new('upper reception limit must be positive: 0 < 1') do
|
14
|
+
Object.new.to.receive.a.at_most(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
expect Lookout::Reception do
|
18
|
+
Object.new.to.receive.a.at_most(1)
|
19
|
+
end
|
20
|
+
|
21
|
+
expect ArgumentError.new('expected reception count must be non-negative: -1 < 0') do
|
22
|
+
Object.new.to.receive.a.exactly(-1)
|
23
|
+
end
|
24
|
+
|
25
|
+
expect Lookout::Reception do
|
26
|
+
Object.new.to.receive.a.exactly(0)
|
27
|
+
end
|
28
|
+
|
29
|
+
expect ArgumentError.new('lower reception limit must be positive: -1 < 1') do
|
30
|
+
Object.new.to.receive.a.at_least(-1)
|
31
|
+
end
|
32
|
+
|
33
|
+
expect ArgumentError.new('lower reception limit must be positive: 0 < 1') do
|
34
|
+
Object.new.to.receive.a.at_least(0)
|
35
|
+
end
|
36
|
+
|
37
|
+
expect Lookout::Reception do
|
38
|
+
Object.new.to.receive.a.at_least(1)
|
39
|
+
end
|
40
|
+
|
41
|
+
expect Lookout::Results::Success.new('test', 1) do
|
42
|
+
stub.to.receive.call.to_lookout_expected.expect('test', 1){ |o| o.call }.call
|
43
|
+
end
|
44
|
+
|
45
|
+
expect Lookout::Results::Failure do
|
46
|
+
stub.to.receive.call.to_lookout_expected.expect('test', 1).call
|
47
|
+
end
|
48
|
+
|
49
|
+
if RUBY_VERSION < '1.9'
|
50
|
+
expect Lookout::Results::Error do
|
51
|
+
stub.to.receive.call.to_lookout_expected.expect('test', 1){ raise RuntimeError, 'error', [] }.call
|
52
|
+
end
|
53
|
+
else
|
54
|
+
expect Lookout::Results::Error.new('test', 1, nil, Lookout::Exception.new(RuntimeError.new('error').tap{ |e| e.set_backtrace([]) })) do
|
55
|
+
stub.to.receive.call.to_lookout_expected.expect('test', 1){ raise RuntimeError, 'error', [] }.call
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
expect Lookout::Results::Error do
|
60
|
+
stub.not.to.receive.call.to_lookout_expected.expect('test', 1){ |o| o.call }.call
|
61
|
+
end
|
62
|
+
|
63
|
+
expect 'stub#call: unexpected number of invocations (1 for 0)' do
|
64
|
+
stub.not.to.receive.call.to_lookout_expected.expect('test', 1){ |o| o.call }.call.exception.message
|
65
|
+
end
|
66
|
+
|
67
|
+
expect Lookout::Results::Success.new('test', 1) do
|
68
|
+
stub.not.to.receive.call.to_lookout_expected.expect('test', 1).call{ }
|
69
|
+
end
|
70
|
+
|
71
|
+
expect Lookout::Results::Error do
|
72
|
+
stub.to.receive.call(1).to_lookout_expected.expect('test', 1){ |o| o.call }.call
|
73
|
+
end
|
74
|
+
|
75
|
+
expect 'stub#call: unexpected arguments: []≠[1]' do
|
76
|
+
stub.to.receive.call(1).to_lookout_expected.expect('test', 1){ |o| o.call }.call.exception.message
|
77
|
+
end
|
78
|
+
|
79
|
+
expect Lookout::Results::Error do
|
80
|
+
stub.to.receive.call(1).to_lookout_expected.expect('test', 1){ |o| o.call(1, 2) }.call
|
81
|
+
end
|
82
|
+
|
83
|
+
expect 'stub#call: unexpected arguments: [1, 2]≠[1]' do
|
84
|
+
stub.to.receive.call(1).to_lookout_expected.expect('test', 1){ |o| o.call(1, 2) }.call.exception.message
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect Lookout::Reception::Arguments::Any do
|
5
|
+
Lookout::Reception::Arguments.for
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Reception::Arguments::Any do
|
9
|
+
Lookout::Reception::Arguments.for(1, Lookout::Reception::Arguments::Any.new)
|
10
|
+
end
|
11
|
+
|
12
|
+
expect Lookout::Reception::Arguments::None do
|
13
|
+
Lookout::Reception::Arguments.for(Lookout::Reception::Arguments::None.new)
|
14
|
+
end
|
15
|
+
|
16
|
+
expect Lookout::Reception::Arguments::None do
|
17
|
+
Lookout::Reception::Arguments.for(1, Lookout::Reception::Arguments::None.new)
|
18
|
+
end
|
19
|
+
|
20
|
+
expect Lookout::Reception::Arguments::List.new(1, 2, 3) do
|
21
|
+
Lookout::Reception::Arguments.for(1, 2, 3)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect '*args, &block' do
|
5
|
+
Lookout::Reception::Arguments::Any.new.to_s
|
6
|
+
end
|
7
|
+
|
8
|
+
expect true do
|
9
|
+
Lookout::Reception::Arguments::Any.new =~ []
|
10
|
+
end
|
11
|
+
|
12
|
+
expect true do
|
13
|
+
Lookout::Reception::Arguments::Any.new =~ [1, 2, 3]
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect true do
|
5
|
+
Lookout::Reception::Arguments::List.new(1, Object, 3) =~ [1, 2, 3]
|
6
|
+
end
|
7
|
+
|
8
|
+
expect false do
|
9
|
+
Lookout::Reception::Arguments::List.new(1, 4, 3) =~ [1, 2, 3]
|
10
|
+
end
|
11
|
+
|
12
|
+
expect '1, 2, 3' do
|
13
|
+
Lookout::Reception::Arguments::List.new(1, 2, 3).to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
expect '1, (cannot inspect argument: error), 3' do
|
17
|
+
Lookout::Reception::Arguments::List.new(1, stub(:inspect => proc{ raise 'error' } ), 3).to_s
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect true do
|
5
|
+
Lookout::Reception::Arguments::None.new =~ []
|
6
|
+
end
|
7
|
+
|
8
|
+
expect false do
|
9
|
+
Lookout::Reception::Arguments::None.new =~ [1, 2, 3]
|
10
|
+
end
|
11
|
+
|
12
|
+
expect '' do
|
13
|
+
Lookout::Reception::Arguments::None.new.to_s
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect true do
|
5
|
+
Lookout::Results::Success.new('a', 1) == Lookout::Results::Success.new('a', 1)
|
6
|
+
end
|
7
|
+
|
8
|
+
expect false do
|
9
|
+
Lookout::Results::Success.new('a', 1) == Lookout::Results::Success.new('a', 2)
|
10
|
+
end
|
11
|
+
|
12
|
+
expect false do
|
13
|
+
Lookout::Results::Success.new('a', 1) == Lookout::Results::Success.new('b', 1)
|
14
|
+
end
|
15
|
+
|
16
|
+
expect 'test:1' do
|
17
|
+
Lookout::Results::Success.new('test', 1).to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
expect 'test' do
|
21
|
+
Lookout::Results::Success.new('test', 1).file
|
22
|
+
end
|
23
|
+
|
24
|
+
expect 1 do
|
25
|
+
Lookout::Results::Success.new('test', 1).line
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
# In Ruby 1.8.7, exceptions can’t be compared properly.
|
5
|
+
if RuntimeError.new == RuntimeError.new
|
6
|
+
expect true do
|
7
|
+
Lookout::Results::Error.new('a', 1, nil, Lookout::Exception.new(RuntimeError.new)) ==
|
8
|
+
Lookout::Results::Error.new('a', 1, nil, Lookout::Exception.new(RuntimeError.new))
|
9
|
+
end
|
10
|
+
|
11
|
+
expect false do
|
12
|
+
Lookout::Results::Error.new('a', 1, nil, Lookout::Exception.new(RuntimeError.new)) ==
|
13
|
+
Lookout::Results::Error.new('a', 1, 'a', Lookout::Exception.new(RuntimeError.new))
|
14
|
+
end
|
15
|
+
|
16
|
+
expect false do
|
17
|
+
Lookout::Results::Error.new('a', 1, nil, Lookout::Exception.new(RuntimeError.new)) ==
|
18
|
+
Lookout::Results::Error.new('a', 1, nil, Lookout::Exception.new(StandardError.new))
|
19
|
+
end
|
20
|
+
|
21
|
+
expect Lookout::Exception.new(RuntimeError.new('error')) do
|
22
|
+
Lookout::Results::Error.new('test', 1, 'a≠b', Lookout::Exception.new(RuntimeError.new('error'))).exception
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
expect "test:1: error (RuntimeError)\n" do
|
27
|
+
Lookout::Results::Error.new('test', 1, nil, Lookout::Exception.new(RuntimeError.new('error'))).to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
expect "test:1: a≠b: error (RuntimeError)\n" do
|
31
|
+
Lookout::Results::Error.new('test', 1, 'a≠b', Lookout::Exception.new(RuntimeError.new('error'))).to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
expect 'a≠b' do
|
35
|
+
Lookout::Results::Error.new('test', 1, 'a≠b', Lookout::Exception.new(RuntimeError.new('error'))).message
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect "test:1: 2≠1" do
|
5
|
+
Lookout::Results::Failure.new('test', 1, 1.to_lookout_expected.difference(2)).to_s
|
6
|
+
end
|
7
|
+
|
8
|
+
expect 'test:1: "b"≠"a": [-b-]{+a+}' do
|
9
|
+
Lookout::Results::Failure.new('test', 1, 'a'.to_lookout_expected.difference('b')).to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
expect <<EOM.chomp do
|
13
|
+
test:1: "b\\nc"≠"a"
|
14
|
+
@@ -1,2 +1,1 @@
|
15
|
+
-b
|
16
|
+
-c
|
17
|
+
+a
|
18
|
+
EOM
|
19
|
+
Lookout::Results::Failure.new('test', 1, 'a'.to_lookout_expected.difference("b\nc")).to_s
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect 'stub' do
|
5
|
+
Lookout::Stub.new.inspect
|
6
|
+
end
|
7
|
+
|
8
|
+
expect Lookout::Stub.new do |o|
|
9
|
+
o.any_old_method
|
10
|
+
end
|
11
|
+
|
12
|
+
expect Lookout::Stub.new do |o|
|
13
|
+
o.any_old_method_with_various_arguments(1, [], {})
|
14
|
+
end
|
15
|
+
|
16
|
+
expect Lookout::Stub.new do |o|
|
17
|
+
o.any_old_method_with_a_block{ }
|
18
|
+
end
|
19
|
+
|
20
|
+
if proc{ }.respond_to? :lambda?
|
21
|
+
expect ArgumentError do
|
22
|
+
Lookout::Stub.new(:a => lambda{ 1 }).a(2)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
expect 1 do
|
27
|
+
Lookout::Stub.new(:a => proc{ 1 }).a(2)
|
28
|
+
end
|
29
|
+
|
30
|
+
expect 1 do
|
31
|
+
Lookout::Stub.new(:a => proc{ 1 }).a
|
32
|
+
end
|
33
|
+
|
34
|
+
expect 1 do
|
35
|
+
Lookout::Stub.new(:a => proc{ |i| i }).a(1)
|
36
|
+
end
|
37
|
+
|
38
|
+
expect 1 do
|
39
|
+
Lookout::Stub.new(:a => proc{ |&b| b.call }).a{ 1 }
|
40
|
+
end
|
41
|
+
|
42
|
+
expect 1 do
|
43
|
+
Lookout::Stub.new(:a => 1).a
|
44
|
+
end
|
45
|
+
|
46
|
+
expect 1 do
|
47
|
+
Lookout::Stub.new(:a => 1).a(2)
|
48
|
+
end
|
49
|
+
|
50
|
+
expect 1 do
|
51
|
+
Lookout::Stub.new(:a => 1).a(2){ 3 }
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
Expectations do
|
4
|
+
expect true do
|
5
|
+
Lookout::Warning.new('a') == Lookout::Warning.new('a')
|
6
|
+
end
|
7
|
+
|
8
|
+
expect true do
|
9
|
+
Lookout::Warning.new('a') == Lookout::Warning.new("a\n")
|
10
|
+
end
|
11
|
+
|
12
|
+
expect false do
|
13
|
+
Lookout::Warning.new('a') == Lookout::Warning.new('b')
|
14
|
+
end
|
15
|
+
|
16
|
+
expect false do
|
17
|
+
Lookout::Warning.new('a') == Lookout::Warning.new("b\n")
|
18
|
+
end
|
19
|
+
|
20
|
+
expect true do
|
21
|
+
Lookout::Warning.new('a') === Lookout::Warning.new('/a/b/c:1: warning: a')
|
22
|
+
end
|
23
|
+
|
24
|
+
expect true do
|
25
|
+
Lookout::Warning.new('a') === Lookout::Warning.new("/a/b/c:1: warning: a\n")
|
26
|
+
end
|
27
|
+
|
28
|
+
expect false do
|
29
|
+
Lookout::Warning.new('a') === Lookout::Warning.new('/a/b/c:1: warning: b')
|
30
|
+
end
|
31
|
+
|
32
|
+
expect false do
|
33
|
+
Lookout::Warning.new('a') === Lookout::Warning.new("/a/b/c:1: warning: b\n")
|
34
|
+
end
|
35
|
+
|
36
|
+
expect '[-b-]{+a+}' do
|
37
|
+
Lookout::Warning.new('a').diff(Lookout::Warning.new("/a/b/c:1: warning: b\n")).to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
expect 'warning("this is your final one!")' do
|
41
|
+
Lookout::Warning.new('this is your final one!').inspect
|
42
|
+
end
|
43
|
+
|
44
|
+
expect 'warning("this is your final one!")' do
|
45
|
+
Lookout::Warning.new("this is your final one!\n").inspect
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,478 +1,1183 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 3.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Nikolai Weibull
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-04-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: inventory
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: inventory-rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: inventory-rake-tasks-yard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: lookout-rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
14
69
|
- !ruby/object:Gem::Dependency
|
15
70
|
name: yard
|
16
|
-
requirement:
|
17
|
-
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.8.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.8.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard-heuristics
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard-value
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
18
100
|
requirements:
|
19
101
|
- - ~>
|
20
102
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
103
|
+
version: '1.2'
|
22
104
|
type: :development
|
23
105
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
:
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.2'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: value
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.1'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.1'
|
125
|
+
description: |2
|
126
|
+
Lookout
|
127
|
+
|
128
|
+
Lookout is a unit testing framework for Ruby¹ that puts your results in
|
129
|
+
focus. Tests (expectations) are written as follows
|
130
|
+
|
131
|
+
expect 2 do
|
132
|
+
1 + 1
|
133
|
+
end
|
134
|
+
|
135
|
+
expect ArgumentError do
|
136
|
+
Integer('1 + 1')
|
137
|
+
end
|
138
|
+
|
139
|
+
expect Array do
|
140
|
+
[1, 2, 3].select{ |i| i % 2 == 0 }
|
141
|
+
end
|
142
|
+
|
143
|
+
expect [2, 4, 6] do
|
144
|
+
[1, 2, 3].map{ |i| i * 2 }
|
145
|
+
end
|
146
|
+
|
147
|
+
Lookout is designed to encourage – force, even – unit testing best practices
|
148
|
+
such as
|
149
|
+
|
150
|
+
• Setting up only one expectation per test
|
151
|
+
• Not setting expectations on non-public APIs
|
152
|
+
• Test isolation
|
153
|
+
|
154
|
+
This is done by
|
155
|
+
|
156
|
+
• Only allowing one expectation to be set per test
|
157
|
+
• Providing no (additional) way of accessing private state
|
158
|
+
• Providing no setup and tear-down methods, nor a method of providing test
|
159
|
+
helpers
|
160
|
+
|
161
|
+
Other important points are
|
162
|
+
|
163
|
+
• Putting the expected outcome of a test in focus with the steps of the
|
164
|
+
calculation of the actual result only as a secondary concern
|
165
|
+
• A focus on code readability by providing no mechanism for describing an
|
166
|
+
expectation other than the code in the expectation itself
|
167
|
+
• A unified syntax for setting up both state-based and behavior-based
|
168
|
+
expectations
|
169
|
+
|
170
|
+
The way Lookout works has been heavily influenced by expectations², by
|
171
|
+
{Jay Fields}³. The code base was once also heavily based on expectations,
|
172
|
+
based at Subversion {revision 76}⁴. A lot has happened since then and all of
|
173
|
+
the work past that revision are due to {Nikolai Weibull}⁵.
|
174
|
+
|
175
|
+
¹ Ruby: http://ruby-lang.org/
|
176
|
+
² Expectations: http://expectations.rubyforge.org/
|
177
|
+
³ Jay Fields’s blog: http://blog.jayfields.com/
|
178
|
+
⁴ Lookout revision 76:
|
179
|
+
https://github.com/now/lookout/commit/537bedf3e5b3eb4b31c066b3266f42964ac35ebe
|
180
|
+
⁵ Nikolai Weibull’s home page: http://disu.se/
|
181
|
+
|
182
|
+
§ Installation
|
183
|
+
|
184
|
+
Install Lookout with
|
185
|
+
|
186
|
+
% gem install lookout
|
187
|
+
|
188
|
+
|
189
|
+
§ Usage
|
190
|
+
|
191
|
+
Lookout allows you to set expectations on an object’s state or behavior.
|
192
|
+
We’ll begin by looking at state expectations and then take a look at
|
193
|
+
expectations on behavior.
|
194
|
+
|
195
|
+
§ Expectations on State: Literals
|
196
|
+
|
197
|
+
An expectation can be made on the result of a computation:
|
198
|
+
|
199
|
+
expect 2 do
|
200
|
+
1 + 1
|
201
|
+
end
|
202
|
+
|
203
|
+
Most objects, in fact, have their state expectations checked by invoking
|
204
|
+
‹#==› on the expected value with the result as its argument.
|
205
|
+
|
206
|
+
Checking that a result is within a given range is also simple:
|
207
|
+
|
208
|
+
expect 0.099..0.101 do
|
209
|
+
0.4 - 0.3
|
210
|
+
end
|
211
|
+
|
212
|
+
Here, the more general ‹#===› is being used on the ‹Range›.
|
213
|
+
|
214
|
+
§ Regexps
|
215
|
+
|
216
|
+
‹Strings› of course match against ‹Strings›:
|
217
|
+
|
218
|
+
expect 'ab' do
|
219
|
+
'abc'[0..1]
|
220
|
+
end
|
221
|
+
|
222
|
+
but we can also match a ‹String› against a ‹Regexp›:
|
223
|
+
|
224
|
+
expect %r{a substring} do
|
225
|
+
'a string with a substring'
|
226
|
+
end
|
227
|
+
|
228
|
+
(Note the use of ‹%r{…}› to avoid warnings that will be generated when
|
229
|
+
Ruby parses ‹expect /…/›.)
|
230
|
+
|
231
|
+
§ Modules
|
232
|
+
|
233
|
+
Checking that the result includes a certain module is done by expecting the
|
234
|
+
‹Module›.
|
235
|
+
|
236
|
+
expect Enumerable do
|
237
|
+
[]
|
238
|
+
end
|
239
|
+
|
240
|
+
This, due to the nature of Ruby, of course also works for classes (as
|
241
|
+
they are also modules):
|
242
|
+
|
243
|
+
expect String do
|
244
|
+
'a string'
|
245
|
+
end
|
246
|
+
|
247
|
+
This doesn’t hinder us from expecting the actual ‹Module› itself:
|
248
|
+
|
249
|
+
expect Enumerable do
|
250
|
+
Enumerable
|
251
|
+
end
|
252
|
+
|
253
|
+
or the ‹Class›:
|
254
|
+
|
255
|
+
expect String do
|
256
|
+
String
|
257
|
+
end
|
258
|
+
|
259
|
+
for obvious reasons.
|
260
|
+
|
261
|
+
As you may have figured out yourself, this is accomplished by first
|
262
|
+
trying ‹#==› and, if it returns ‹false›, then trying ‹#===› on the
|
263
|
+
expected ‹Module›. This is also true of ‹Ranges› and ‹Regexps›.
|
264
|
+
|
265
|
+
§ Booleans
|
266
|
+
|
267
|
+
Truthfulness is expected with ‹true› and ‹false›:
|
268
|
+
|
269
|
+
expect true do
|
270
|
+
1
|
271
|
+
end
|
272
|
+
|
273
|
+
expect false do
|
274
|
+
nil
|
275
|
+
end
|
276
|
+
|
277
|
+
Results equaling ‹true› or ‹false› are slightly different:
|
278
|
+
|
279
|
+
expect TrueClass do
|
280
|
+
true
|
281
|
+
end
|
282
|
+
|
283
|
+
expect FalseClass do
|
284
|
+
false
|
285
|
+
end
|
286
|
+
|
287
|
+
The rationale for this is that you should only care if the result of a
|
288
|
+
computation evaluates to a value that Ruby considers to be either true or
|
289
|
+
false, not the exact literals ‹true› or ‹false›.
|
290
|
+
|
291
|
+
§ IO
|
292
|
+
|
293
|
+
Expecting output on an IO object is also common:
|
294
|
+
|
295
|
+
expect output("abc\ndef\n") do |io|
|
296
|
+
io.puts 'abc', 'def'
|
297
|
+
end
|
298
|
+
|
299
|
+
This can be used to capture the output of a formatter that takes an
|
300
|
+
output object as a parameter.
|
301
|
+
|
302
|
+
§ Warnings
|
303
|
+
|
304
|
+
Expecting warnings from code isn’t very common, but should be done:
|
305
|
+
|
306
|
+
expect warning('this is your final one!') do
|
307
|
+
warn 'this is your final one!'
|
308
|
+
end
|
309
|
+
|
310
|
+
expect warning('this is your final one!') do
|
311
|
+
warn '%s:%d: warning: this is your final one!' % [__FILE__, __LINE__]
|
312
|
+
end
|
313
|
+
|
314
|
+
‹$VERBOSE› is set to ‹true› during the execution of the block, so you
|
315
|
+
don’t need to do so yourself. If you have other code that depends on the
|
316
|
+
value of $VERBOSE, that can be done with ‹#with_verbose›
|
317
|
+
|
318
|
+
expect nil do
|
319
|
+
with_verbose nil do
|
320
|
+
$VERBOSE
|
321
|
+
end
|
322
|
+
end
|
323
|
+
|
324
|
+
§ Errors
|
325
|
+
|
326
|
+
You should always be expecting errors from – and in, but that’s a
|
327
|
+
different story – your code:
|
328
|
+
|
329
|
+
expect ArgumentError do
|
330
|
+
Integer('1 + 1')
|
331
|
+
end
|
332
|
+
|
333
|
+
Often, not only the type of the error, but its description, is important
|
334
|
+
to check:
|
335
|
+
|
336
|
+
expect StandardError.new('message') do
|
337
|
+
raise StandardError.new('message')
|
338
|
+
end
|
339
|
+
|
340
|
+
As with ‹Strings›, ‹Regexps› can be used to check the error description:
|
341
|
+
|
342
|
+
expect StandardError.new(/mess/) do
|
343
|
+
raise StandardError.new('message')
|
344
|
+
end
|
345
|
+
|
346
|
+
§ Queries Through Symbols
|
347
|
+
|
348
|
+
Symbols are generally matched against symbols, but as a special case,
|
349
|
+
symbols ending with ‹?› are seen as expectations on the result of query
|
350
|
+
methods on the result of the block, given that the method is of zero
|
351
|
+
arity and that the result isn’t a Symbol itself. Simply expect a symbol
|
352
|
+
ending with ‹?›:
|
353
|
+
|
354
|
+
expect :empty? do
|
355
|
+
[]
|
356
|
+
end
|
357
|
+
|
358
|
+
To expect it’s negation, expect the same symbol beginning with ‹not_›:
|
359
|
+
|
360
|
+
expect :not_nil? do
|
361
|
+
[1, 2, 3]
|
362
|
+
end
|
363
|
+
|
364
|
+
This is the same as
|
365
|
+
|
366
|
+
expect true do
|
367
|
+
[].empty?
|
368
|
+
end
|
369
|
+
|
370
|
+
and
|
371
|
+
|
372
|
+
expect false do
|
373
|
+
[1, 2, 3].empty?
|
374
|
+
end
|
375
|
+
|
376
|
+
but provides much clearer failure messages. It also makes the
|
377
|
+
expectation’s intent a lot clearer.
|
378
|
+
|
379
|
+
§ Queries By Proxy
|
380
|
+
|
381
|
+
There’s also a way to make the expectations of query methods explicit by
|
382
|
+
invoking methods on the result of the block. For example, to check that
|
383
|
+
the even elements of the Array ‹[1, 2, 3]› include ‹1› you could write
|
384
|
+
|
385
|
+
expect result.to.include? 1 do
|
386
|
+
[1, 2, 3].reject{ |e| e.even? }
|
387
|
+
end
|
388
|
+
|
389
|
+
You could likewise check that the result doesn’t include 2:
|
390
|
+
|
391
|
+
expect result.not.to.include? 2 do
|
392
|
+
[1, 2, 3].reject{ |e| e.even? }
|
393
|
+
end
|
394
|
+
|
395
|
+
This is the same as (and executes a little bit slower than) writing
|
396
|
+
|
397
|
+
expect false do
|
398
|
+
[1, 2, 3].reject{ |e| e.even? }.include? 2
|
399
|
+
end
|
400
|
+
|
401
|
+
but provides much clearer failure messages. Given that these two last
|
402
|
+
examples would fail, you’d get a message saying “[1, 2, 3]#include?(2)”
|
403
|
+
instead of the terser “true≠false”. It also clearly separates the actual
|
404
|
+
expectation from the set-up.
|
405
|
+
|
406
|
+
The keyword for this kind of expectations is ‹result›. This may be
|
407
|
+
followed by any of the methods
|
408
|
+
|
409
|
+
• ‹#not›
|
410
|
+
• ‹#to›
|
411
|
+
• ‹#be›
|
412
|
+
• ‹#have›
|
413
|
+
|
414
|
+
or any other method you will want to call on the result. The methods
|
415
|
+
‹#to›, ‹#be›, and ‹#have› do nothing except improve readability. The
|
416
|
+
‹#not› method inverts the expectation.
|
417
|
+
|
418
|
+
§ Literal Literals
|
419
|
+
|
420
|
+
If you need to literally check against any of the types of objects
|
421
|
+
otherwise treated specially, that is, any instances of
|
422
|
+
|
423
|
+
• ‹Module›
|
424
|
+
• ‹Range›
|
425
|
+
• ‹Regexp›
|
426
|
+
• ‹Exception›
|
427
|
+
• ‹Symbol›, given that it ends with ‹?›
|
428
|
+
|
429
|
+
you can do so by wrapping it in ‹literal(…)›:
|
430
|
+
|
431
|
+
expect literal(:empty?) do
|
432
|
+
:empty?
|
433
|
+
end
|
434
|
+
|
435
|
+
You almost never need to do this, as, for all but symbols, instances will
|
436
|
+
match accordingly as well.
|
437
|
+
|
438
|
+
§ Expectations on Behavior
|
439
|
+
|
440
|
+
We expect our objects to be on their best behavior. Lookout allows you
|
441
|
+
to make sure that they are.
|
442
|
+
|
443
|
+
Reception expectations let us verify that a method is called in the way
|
444
|
+
that we expect it to be:
|
445
|
+
|
446
|
+
expect mock.to.receive.to_str(without_arguments){ '123' } do |o|
|
447
|
+
o.to_str
|
448
|
+
end
|
449
|
+
|
450
|
+
Here, ‹#mock› creates a mock object, an object that doesn’t respond to
|
451
|
+
anything unless you tell it to. We tell it to expect to receive a call
|
452
|
+
to ‹#to_str› without arguments and have ‹#to_str› return ‹'123'› when
|
453
|
+
called. The mock object is then passed in to the block so that the
|
454
|
+
expectations placed upon it can be fulfilled.
|
455
|
+
|
456
|
+
Sometimes we only want to make sure that a method is called in the way
|
457
|
+
that we expect it to be, but we don’t care if any other methods are
|
458
|
+
called on the object. A stub object, created with ‹#stub›, expects any
|
459
|
+
method and returns a stub object that, again, expects any method, and
|
460
|
+
thus fits the bill.
|
461
|
+
|
462
|
+
expect stub.to.receive.to_str(without_arguments){ '123' } do |o|
|
463
|
+
o.to_str if o.convertable?
|
464
|
+
end
|
465
|
+
|
466
|
+
You don’t have to use a mock object to verify that a method is called:
|
467
|
+
|
468
|
+
expect Object.to.receive.name do
|
469
|
+
Object.name
|
470
|
+
end
|
471
|
+
|
472
|
+
As you have figured out by now, the expected method call is set up by
|
473
|
+
calling ‹#receive› after ‹#to›. ‹#Receive› is followed by a call to the
|
474
|
+
method to expect with any expected arguments. The body of the expected
|
475
|
+
method can be given as the block to the method. Finally, an expected
|
476
|
+
invocation count may follow the method. Let’s look at this formal
|
477
|
+
specification in more detail.
|
478
|
+
|
479
|
+
The expected method arguments may be given in a variety of ways. Let’s
|
480
|
+
introduce them by giving some examples:
|
481
|
+
|
482
|
+
expect mock.to.receive.a do |m|
|
483
|
+
m.a
|
484
|
+
end
|
485
|
+
|
486
|
+
Here, the method ‹#a› must be called with any number of arguments. It
|
487
|
+
may be called any number of times, but it must be called at least once.
|
488
|
+
|
489
|
+
If a method must receive exactly one argument, you can use ‹Object›, as
|
490
|
+
the same matching rules apply for arguments as they do for state
|
491
|
+
expectations:
|
492
|
+
|
493
|
+
expect mock.to.receive.a(Object) do |m|
|
494
|
+
m.a 0
|
495
|
+
end
|
496
|
+
|
497
|
+
If a method must receive a specific argument, you can use that argument:
|
498
|
+
|
499
|
+
expect mock.to.receive.a(1..2) do |m|
|
500
|
+
m.a 1
|
501
|
+
end
|
502
|
+
|
503
|
+
Again, the same matching rules apply for arguments as they do for state
|
504
|
+
expectations, so the previous example expects a call to ‹#a› with 1, 2,
|
505
|
+
or the Range 1..2 as an argument on ‹m›.
|
506
|
+
|
507
|
+
If a method must be invoked without any arguments you can use
|
508
|
+
‹without_arguments›:
|
509
|
+
|
510
|
+
expect mock.to.receive.a(without_arguments) do |m|
|
511
|
+
m.a
|
512
|
+
end
|
513
|
+
|
514
|
+
You can of course use both ‹Object› and actual arguments:
|
515
|
+
|
516
|
+
expect mock.to.receive.a(Object, 2, Object) do |m|
|
517
|
+
m.a nil, 2, '3'
|
518
|
+
end
|
519
|
+
|
520
|
+
The body of the expected method may be given as the block. Here, calling
|
521
|
+
‹#a› on ‹m› will give the result ‹1›:
|
522
|
+
|
523
|
+
expect mock.to.receive.a{ 1 } do |m|
|
524
|
+
raise 'not 1' unless m.a == 1
|
525
|
+
end
|
526
|
+
|
527
|
+
If no body has been given, the result will be a stub object.
|
528
|
+
|
529
|
+
To take a block, grab a block parameter and ‹#call› it:
|
530
|
+
|
531
|
+
expect mock.to.receive.a{ |&b| b.call(1) } do |m|
|
532
|
+
j = 0
|
533
|
+
m.a{ |i| j = i }
|
534
|
+
raise 'not 1' unless j == 1
|
535
|
+
end
|
536
|
+
|
537
|
+
To simulate an ‹#each›-like method, ‹#call› the block several times.
|
538
|
+
|
539
|
+
Invocation count expectations can be set if the default expectation of
|
540
|
+
“at least once” isn’t good enough. The following expectations are
|
541
|
+
possible
|
542
|
+
|
543
|
+
• ‹#at_most_once›
|
544
|
+
• ‹#once›
|
545
|
+
• ‹#at_least_once›
|
546
|
+
• ‹#twice›
|
547
|
+
|
548
|
+
And, for a given ‹N›,
|
549
|
+
|
550
|
+
• ‹#at_most(N)›
|
551
|
+
• ‹#exactly(N)›
|
552
|
+
• ‹#at_least(N)›
|
553
|
+
|
554
|
+
§ Utilities: Stubs
|
555
|
+
|
556
|
+
Method stubs are another useful thing to have in a unit testing
|
557
|
+
framework. Sometimes you need to override a method that does something a
|
558
|
+
test shouldn’t do, like access and alter bank accounts. We can override
|
559
|
+
– stub out – a method by using the ‹#stub› method. Let’s assume that we
|
560
|
+
have an ‹Account› class that has two methods, ‹#slips› and ‹#total›.
|
561
|
+
‹#Slips› retrieves the bank slips that keep track of your deposits to the
|
562
|
+
‹Account› from a database. ‹#Total› sums the ‹#slips›. In the following
|
563
|
+
test we want to make sure that ‹#total› does what it should do without
|
564
|
+
accessing the database. We therefore stub out ‹#slips› and make it
|
565
|
+
return something that we can easily control.
|
566
|
+
|
567
|
+
expect 6 do |m|
|
568
|
+
stub(Class.new{
|
569
|
+
def slips
|
570
|
+
raise 'database not available'
|
571
|
+
end
|
572
|
+
|
573
|
+
def total
|
574
|
+
slips.reduce(0){ |m, n| m.to_i + n.to_i }
|
575
|
+
end
|
576
|
+
}.new, :slips => [1, 2, 3]){ |account| account.total }
|
577
|
+
end
|
578
|
+
|
579
|
+
To make it easy to create objects with a set of stubbed methods there’s
|
580
|
+
also a convenience method:
|
581
|
+
|
582
|
+
expect 3 do
|
583
|
+
s = stub(:a => 1, :b => 2)
|
584
|
+
s.a + s.b
|
585
|
+
end
|
586
|
+
|
587
|
+
This short-hand notation can also be used for the expected value:
|
588
|
+
|
589
|
+
expect stub(:a => 1, :b => 2).to.receive.a do |o|
|
590
|
+
o.a + o.b
|
591
|
+
end
|
592
|
+
|
593
|
+
and also works for mock objects:
|
594
|
+
|
595
|
+
expect mock(:a => 2, :b => 2).to.receive.a do |o|
|
596
|
+
o.a + o.b
|
597
|
+
end
|
598
|
+
|
599
|
+
Blocks are also allowed when defining stub methods:
|
600
|
+
|
601
|
+
expect 3 do
|
602
|
+
s = stub(:a => proc{ |a, b| a + b })
|
603
|
+
s.a(1, 2)
|
604
|
+
end
|
605
|
+
|
606
|
+
If need be, we can stub out a specific method on an object:
|
607
|
+
|
608
|
+
expect 'def' do
|
609
|
+
stub('abc', :to_str => 'def'){ |a| a.to_str }
|
610
|
+
end
|
611
|
+
|
612
|
+
The stub is active during the execution of the block.
|
613
|
+
|
614
|
+
§ Overriding Constants
|
615
|
+
|
616
|
+
Sometimes you need to override the value of a constant during the
|
617
|
+
execution of some code. Use ‹#with_const› to do just that:
|
618
|
+
|
619
|
+
expect 'hello' do
|
620
|
+
with_const 'A::B::C', 'hello' do
|
621
|
+
A::B::C
|
622
|
+
end
|
623
|
+
end
|
624
|
+
|
625
|
+
Here, the constant ‹A::B::C› is set to ‹'hello'› during the execution of
|
626
|
+
the block. None of the constants ‹A›, ‹B›, and ‹C› need to exist for
|
627
|
+
this to work. If a constant doesn’t exist it’s created and set to a new,
|
628
|
+
empty, ‹Module›. The value of ‹A::B::C›, if any, is restored after the
|
629
|
+
block returns and any constants that didn’t previously exist are removed.
|
630
|
+
|
631
|
+
§ Overriding Environment Variables
|
632
|
+
|
633
|
+
Another thing you often need to control in your tests is the value of
|
634
|
+
environment variables. Depending on such global values is, of course,
|
635
|
+
not a good practice, but is often unavoidable when working with external
|
636
|
+
libraries. ‹#With_env› allows you to override the value of environment
|
637
|
+
variables during the execution of a block by giving it a ‹Hash› of
|
638
|
+
key/value pairs where the key is the name of the environment variable and
|
639
|
+
the value is the value that it should have during the execution of that
|
640
|
+
block:
|
641
|
+
|
642
|
+
expect 'hello' do
|
643
|
+
with_env 'INTRO' => 'hello' do
|
644
|
+
ENV['INTRO']
|
645
|
+
end
|
646
|
+
end
|
647
|
+
|
648
|
+
Any overridden values are restored and any keys that weren’t previously a
|
649
|
+
part of the environment are removed when the block returns.
|
650
|
+
|
651
|
+
§ Overriding Globals
|
652
|
+
|
653
|
+
You may also want to override the value of a global temporarily:
|
654
|
+
|
655
|
+
expect 'hello' do
|
656
|
+
with_global :$stdout, StringIO.new do
|
657
|
+
print 'hello'
|
658
|
+
$stdout.string
|
659
|
+
end
|
660
|
+
end
|
661
|
+
|
662
|
+
You thus provide the name of the global and a value that it should take
|
663
|
+
during the execution of a block of code. The block gets passed the
|
664
|
+
overridden value, should you need it:
|
665
|
+
|
666
|
+
expect true do
|
667
|
+
with_global :$stdout, StringIO.new do |overridden|
|
668
|
+
$stdout != overridden
|
669
|
+
end
|
670
|
+
end
|
671
|
+
|
672
|
+
§ Integration
|
673
|
+
|
674
|
+
Lookout can be used from Rake¹. Simply install Lookout-Rake²:
|
675
|
+
|
676
|
+
% gem install lookout-rake
|
677
|
+
|
678
|
+
and add the following code to your Rakefile
|
679
|
+
|
680
|
+
require 'lookout-rake-3.0'
|
681
|
+
|
682
|
+
Lookout::Rake::Tasks::Test.new
|
683
|
+
|
684
|
+
Make sure to read up on using Lookout-Rake for further benefits and
|
685
|
+
customization.
|
686
|
+
|
687
|
+
¹ Read more about Rake at http://rake.rubyforge.org/
|
688
|
+
² Get information on Lookout-Rake at http://disu.se/software/lookout-rake/
|
689
|
+
|
690
|
+
§ API
|
691
|
+
|
692
|
+
Lookout comes with an API¹ that let’s you create things such as new
|
693
|
+
expected values, difference reports for your types, and so on.
|
694
|
+
|
695
|
+
¹ See http://disu.se/software/lookout/api/
|
696
|
+
|
697
|
+
§ Interface Design
|
698
|
+
|
699
|
+
The default output of Lookout can Spartanly be described as Spartan. If no
|
700
|
+
errors or failures occur, no output is generated. This is unconventional,
|
701
|
+
as unit testing frameworks tend to dump a lot of information on the user,
|
702
|
+
concerning things such as progress, test count summaries, and flamboyantly
|
703
|
+
colored text telling you that your tests passed. None of this output is
|
704
|
+
needed. Your tests should run fast enough to not require progress reports.
|
705
|
+
The lack of output provides you with the same amount of information as
|
706
|
+
reporting success. Test count summaries are only useful if you’re worried
|
707
|
+
that your tests aren’t being run, but if you worry about that, then
|
708
|
+
providing such output doesn’t really help. Testing your tests requires
|
709
|
+
something beyond reporting some arbitrary count that you would have to
|
710
|
+
verify by hand anyway.
|
711
|
+
|
712
|
+
When errors or failures do occur, however, the relevant information is
|
713
|
+
output in a format that can easily be parsed by an ‹'errorformat'› for Vim
|
714
|
+
or with {Compilation Mode}¹ for Emacs². Diffs are generated for Strings,
|
715
|
+
Arrays, Hashes, and I/O.
|
716
|
+
|
717
|
+
¹ Read up on Compilation mode for Emacs at http://www.emacswiki.org/emacs/CompilationMode
|
718
|
+
² Visit The GNU Foundation’s Emacs’ software page at http://www.gnu.org/software/emacs/
|
719
|
+
|
720
|
+
§ External Design
|
721
|
+
|
722
|
+
Let’s now look at some of the points made in the introduction in greater
|
723
|
+
detail.
|
724
|
+
|
725
|
+
Lookout only allows you to set one expectation per test. If you’re testing
|
726
|
+
behavior with a reception expectation, then only one method-invocation
|
727
|
+
expectation can be set. If you’re testing state, then only one result can
|
728
|
+
be verified. It may seem like this would cause unnecessary duplication
|
729
|
+
between tests. While this is certainly a possibility, when you actually
|
730
|
+
begin to try to avoid such duplication you find that you often do so by
|
731
|
+
improving your interfaces. This kind of restriction tends to encourage the
|
732
|
+
use of value objects, which are easy to test, and more focused objects,
|
733
|
+
which require simpler tests, as they have less behavior to test, per
|
734
|
+
method. By keeping your interfaces focused you’re also keeping your tests
|
735
|
+
focused.
|
736
|
+
|
737
|
+
Keeping your tests focused improves, in itself, test isolation, but let’s
|
738
|
+
look at something that hinders it: setup and tear-down methods. Most unit
|
739
|
+
testing frameworks encourage test fragmentation by providing setup and
|
740
|
+
tear-down methods.
|
741
|
+
|
742
|
+
Setup methods create objects and, perhaps, just their behavior for a set of
|
743
|
+
tests. This means that you have to look in two places to figure out what’s
|
744
|
+
being done in a test. This may work fine for few methods with simple
|
745
|
+
set-ups, but makes things complicated when the number of tests increases
|
746
|
+
and the set-up is complex. Often, each test further adjusts the previously
|
747
|
+
set-up object before performing any verifications, further complicating the
|
748
|
+
process of figuring out what state an object has in a given test.
|
749
|
+
|
750
|
+
Tear-down methods clean up after tests, perhaps by removing records from a
|
751
|
+
database or deleting files from the file-system.
|
752
|
+
|
753
|
+
The duplication that setup methods and tear-down methods hope to remove is
|
754
|
+
better avoided by improving your interfaces. This can be done by providing
|
755
|
+
better set-up methods for your objects and using idioms such as {Resource
|
756
|
+
Acquisition Is Initialization}¹ for guaranteed clean-up, test or no test.
|
757
|
+
|
758
|
+
By not using setup and tear-down methods we keep everything pertinent to a
|
759
|
+
test in the test itself, thus improving test isolation. (You also won’t
|
760
|
+
{slow down your tests}² by keeping unnecessary state.)
|
761
|
+
|
762
|
+
Most unit test frameworks also allow you to create arbitrary test helper
|
763
|
+
methods. Lookout doesn’t. The same rationale as that that has been
|
764
|
+
crystallized in the preceding paragraphs applies. If you need helpers
|
765
|
+
you’re interface isn’t good enough. It really is as simple as that.
|
766
|
+
|
767
|
+
To clarify: there’s nothing inherently wrong with test helper methods, but
|
768
|
+
they should be general enough that they reside in their own library. The
|
769
|
+
support for mocks in Lookout is provided through a set of test helper
|
770
|
+
methods that make it easier to create mocks than it would have been without
|
771
|
+
them. Lookout-rack³ is another example of a library providing test helper
|
772
|
+
methods (well, one method, actually) that are very useful in testing web
|
773
|
+
applications that use Rack⁴.
|
774
|
+
|
775
|
+
A final point at which some unit test frameworks try to fragment tests
|
776
|
+
further is documentation. These frameworks provide ways of describing the
|
777
|
+
whats and hows of what’s being tested, the rationale being that this will
|
778
|
+
provide documentation of both the test and the code being tested.
|
779
|
+
Describing how a stack data structure is meant to work is a common example.
|
780
|
+
A stack is, however, a rather simple data structure, so such a description
|
781
|
+
provides little, if any, additional information that can’t be extracted
|
782
|
+
from the implementation and its tests themselves. The implementation and
|
783
|
+
its tests is, in fact, its own best documentation. Taking the points made
|
784
|
+
in the previous paragraphs into account, we should already have simple,
|
785
|
+
self-describing, interfaces that have easily understood tests associated
|
786
|
+
with them. Rationales for the use of a given data structure or
|
787
|
+
system-design design documentation is better suited in separate
|
788
|
+
documentation focused at describing exactly those issues.
|
789
|
+
|
790
|
+
¹ Read the Wikipedia entry for Resource Acquisition Is Initialization at
|
791
|
+
http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization
|
792
|
+
² Read how 37signals had problems with slow Test::Unit tests at
|
793
|
+
http://37signals.com/svn/posts/2742-the-road-to-faster-tests/
|
794
|
+
³ Visit the Lookout-rack GitHub project page at
|
795
|
+
http://github.com/now/lookout-rack/
|
796
|
+
⁴ Visit the Rack Rubyforge project page at
|
797
|
+
http://rack.rubyforge.org/
|
798
|
+
|
799
|
+
§ Internal Design
|
800
|
+
|
801
|
+
The internal design of Lookout has had a couple of goals.
|
802
|
+
|
803
|
+
• As few external dependencies as possible
|
804
|
+
• As few internal dependencies as possible
|
805
|
+
• Internal extensibility provides external extensibility
|
806
|
+
• As fast load times as possible
|
807
|
+
• As high a ratio of value objects to mutable objects as possible
|
808
|
+
• Each object must have a simple, obvious name
|
809
|
+
• Use mix-ins, not inheritance for shared behavior
|
810
|
+
• As few responsibilities per object as possible
|
811
|
+
• Optimizing for speed can only be done when you have all the facts
|
812
|
+
|
813
|
+
§ External Dependencies
|
814
|
+
|
815
|
+
Lookout used to depend on Mocha for mocks and stubs. While benchmarking I
|
816
|
+
noticed that a method in Mocha was taking up more than 300 percent of the
|
817
|
+
runtime. It turned out that Mocha’s method for cleaning up back-traces
|
818
|
+
generated when a mock failed was doing something incredibly stupid:
|
819
|
+
|
820
|
+
backtrace.reject{ |l| Regexp.new(@lib).match(File.expand_path(l)) }
|
821
|
+
|
822
|
+
Here ‹@lib› is a ‹String› containing the path to the lib sub-directory in
|
823
|
+
the Mocha installation directory. I reported it, provided a patch five
|
824
|
+
days later, then waited. Nothing happened. {254 days later}¹, according
|
825
|
+
to {Wolfram Alpha}², half of my patch was, apparently – I say “apparently”,
|
826
|
+
as I received no notification – applied. By that time I had replaced the
|
827
|
+
whole mocking-and-stubbing subsystem and dropped the dependency.
|
828
|
+
|
829
|
+
Many Ruby developers claim that Ruby and its gems are too fast-moving for
|
830
|
+
normal package-managing systems to keep up. This is testament to the fact
|
831
|
+
that this isn’t the case and that the real problem is instead related to
|
832
|
+
sloppy practices.
|
833
|
+
|
834
|
+
Please note that I don’t want to single out the Mocha library nor its
|
835
|
+
developers. I only want to provide an example where relying on external
|
836
|
+
dependencies can be “considered harmful”.
|
837
|
+
|
838
|
+
¹ See the Wolfram Alpha calculation at http://www.wolframalpha.com/input/?i=days+between+march+17%2C+2010+and+november+26%2C+2010
|
839
|
+
² Check out the Wolfram Alpha computational knowledge engine at http://www.wolframalpha.com/
|
840
|
+
|
841
|
+
§ Internal Dependencies
|
842
|
+
|
843
|
+
Lookout has been designed so as to keep each subsystem independent of any
|
844
|
+
other. The diff subsystem is, for example, completely decoupled from any
|
845
|
+
other part of the system as a whole and could be moved into its own library
|
846
|
+
at a time where that would be of interest to anyone. What’s perhaps more
|
847
|
+
interesting is that the diff subsystem is itself very modular. The data
|
848
|
+
passes through a set of filters that depends on what kind of diff has been
|
849
|
+
requested, each filter yielding modified data as it receives it. If you
|
850
|
+
want to read some rather functional Ruby I can highly recommend looking at
|
851
|
+
the code in the ‹lib/lookout/diff› directory.
|
852
|
+
|
853
|
+
This lookout on the design of the library also makes it easy to extend
|
854
|
+
Lookout. Lookout-rack was, for example, written in about four hours and
|
855
|
+
about 5 of those 240 minutes were spent on setting up the interface between
|
856
|
+
the two.
|
857
|
+
|
858
|
+
§ Optimizing For Speed
|
859
|
+
|
860
|
+
The following paragraph is perhaps a bit personal, but might be interesting
|
861
|
+
nonetheless.
|
862
|
+
|
863
|
+
I’ve always worried about speed. The original Expectations library used
|
864
|
+
‹extend› a lot to add new behavior to objects. Expectations, for example,
|
865
|
+
used to hold the result of their execution (what we now term “evaluation”)
|
866
|
+
by being extended by a module representing success, failure, or error. For
|
867
|
+
the longest time I used this same method, worrying about the increased
|
868
|
+
performance cost that creating new objects for results would incur. I
|
869
|
+
finally came to a point where I felt that the code was so simple and clean
|
870
|
+
that rewriting this part of the code for a benchmark wouldn’t take more
|
871
|
+
than perhaps ten minutes. Well, ten minutes later I had my results and
|
872
|
+
they confirmed that creating new objects wasn’t harming performance. I was
|
873
|
+
very pleased.
|
874
|
+
|
875
|
+
§ Naming
|
876
|
+
|
877
|
+
I hate low lines (underscores). I try to avoid them in method names and I
|
878
|
+
always avoid them in file names. Since the current “best practice” in the
|
879
|
+
Ruby community is to put ‹BeginEndStorage› in a file called
|
880
|
+
‹begin_end_storage.rb›, I only name constants using a single noun. This
|
881
|
+
has had the added benefit that classes seem to have acquired less behavior,
|
882
|
+
as using a single noun doesn’t allow you to tack on additional behavior
|
883
|
+
without questioning if it’s really appropriate to do so, given the rather
|
884
|
+
limited range of interpretation for that noun. It also seems to encourage
|
885
|
+
the creation of value objects, as something named ‹Range› feels a lot more
|
886
|
+
like a value than ‹BeginEndStorage›. (To reach object-oriented-programming
|
887
|
+
Nirvana you must achieve complete value.)
|
888
|
+
|
889
|
+
§ News
|
890
|
+
|
891
|
+
§ 3.0.0
|
892
|
+
|
893
|
+
The ‹xml› expectation has been dropped. It wasn’t documented, didn’t
|
894
|
+
suit very many use cases, and can be better implemented by an external
|
895
|
+
library.
|
896
|
+
|
897
|
+
The ‹arg› argument matcher for mock method arguments has been removed, as
|
898
|
+
it didn’t provide any benefit over using Object.
|
899
|
+
|
900
|
+
The ‹#yield› and ‹#each› methods on stub and mock methods have been
|
901
|
+
removed. They were slightly weird and their use case can be implemented
|
902
|
+
using block parameters instead.
|
903
|
+
|
904
|
+
The ‹stub› method inside ‹expect› blocks now stubs out the methods during
|
905
|
+
the execution of a provided block instead of during the execution of the
|
906
|
+
whole except block.
|
907
|
+
|
908
|
+
When a mock method is called too many times, this is reported
|
909
|
+
immediately, with a full backtrace. This makes it easier to pin down
|
910
|
+
what’s wrong with the code.
|
911
|
+
|
912
|
+
Query expectations were added.
|
913
|
+
|
914
|
+
Explicit query expectations were added.
|
915
|
+
|
916
|
+
Fluent boolean expectations, for example, ‹expect nil.to.be.nil?› have
|
917
|
+
been replaced by query expectations (‹expect :nil? do nil end›) and
|
918
|
+
explicit query expectations (‹expect result.to.be.nil? do nil end›).
|
919
|
+
This was done to discourage creating objects as the expected value and
|
920
|
+
creating objects that change during the course of the test.
|
921
|
+
|
922
|
+
The ‹literal› expectation was added.
|
923
|
+
|
924
|
+
Equality (‹#==›) is now checked before “caseity” (‹#===›) for modules,
|
925
|
+
ranges, and regular expressions to match the documentation.
|
926
|
+
|
927
|
+
§ Financing
|
928
|
+
|
929
|
+
Currently, most of my time is spent at my day job and in my rather busy
|
930
|
+
private life. Please motivate me to spend time on this piece of software
|
931
|
+
by donating some of your money to this project. Yeah, I realize that
|
932
|
+
requesting money to develop software is a bit, well, capitalistic of me.
|
933
|
+
But please realize that I live in a capitalistic society and I need money
|
934
|
+
to have other people give me the things that I need to continue living
|
935
|
+
under the rules of said society. So, if you feel that this piece of
|
936
|
+
software has helped you out enough to warrant a reward, please PayPal a
|
937
|
+
donation to now@disu.se¹. Thanks! Your support won’t go unnoticed!
|
938
|
+
|
939
|
+
¹ Send a donation:
|
940
|
+
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=now%40disu%2ese&item_name=Nikolai%20Weibull%20Software%20Services
|
941
|
+
|
942
|
+
§ Reporting Bugs
|
943
|
+
|
944
|
+
Please report any bugs that you encounter to the {issue tracker}¹.
|
945
|
+
|
946
|
+
¹ See https://github.com/now/lookout/issues
|
947
|
+
|
948
|
+
§ Contributors
|
949
|
+
|
950
|
+
Contributors to the original expectations codebase are mentioned there. We
|
951
|
+
hope no one on that list feels left out of this list. Please
|
952
|
+
{let us know}¹ if you do.
|
953
|
+
|
954
|
+
• Nikolai Weibull
|
955
|
+
|
956
|
+
¹ Add an issue to the Lookout issue tracker at https://github.com/now/lookout/issues
|
957
|
+
|
958
|
+
§ License
|
959
|
+
|
960
|
+
You may use, copy, and redistribute this library under the same terms¹
|
961
|
+
as Ruby itself.
|
962
|
+
|
963
|
+
¹ Read the Ruby licensing terms at http://www.ruby-lang.org/en/LICENSE.txt
|
336
964
|
email: now@bitwi.se
|
337
965
|
executables: []
|
338
966
|
extensions: []
|
339
967
|
extra_rdoc_files: []
|
340
968
|
files:
|
341
|
-
- lib/lookout/
|
342
|
-
- lib/lookout/
|
343
|
-
- lib/lookout/
|
344
|
-
- lib/lookout/
|
345
|
-
- lib/lookout/
|
346
|
-
- lib/lookout/
|
347
|
-
- lib/lookout/diff
|
348
|
-
- lib/lookout/diff/
|
349
|
-
- lib/lookout/diff/
|
350
|
-
- lib/lookout/diff/
|
351
|
-
- lib/lookout/diff/
|
352
|
-
- lib/lookout/diff/
|
353
|
-
- lib/lookout/diff/
|
354
|
-
- lib/lookout/diff/
|
355
|
-
- lib/lookout/diff/
|
356
|
-
- lib/lookout/diff/
|
357
|
-
- lib/lookout/diff/
|
358
|
-
- lib/lookout/diff/
|
359
|
-
- lib/lookout/diff/
|
360
|
-
- lib/lookout/diff.rb
|
361
|
-
- lib/lookout/
|
362
|
-
- lib/lookout/
|
363
|
-
- lib/lookout/
|
364
|
-
- lib/lookout/
|
365
|
-
- lib/lookout/
|
366
|
-
- lib/lookout/
|
367
|
-
- lib/lookout/
|
368
|
-
- lib/lookout/
|
369
|
-
- lib/lookout/
|
370
|
-
- lib/lookout/
|
371
|
-
- lib/lookout/
|
372
|
-
- lib/lookout/
|
373
|
-
- lib/lookout/
|
374
|
-
- lib/lookout/
|
375
|
-
- lib/lookout/
|
376
|
-
- lib/lookout/
|
377
|
-
- lib/lookout/
|
378
|
-
- lib/lookout/
|
379
|
-
- lib/lookout/
|
380
|
-
- lib/lookout/
|
381
|
-
- lib/lookout/
|
382
|
-
- lib/lookout/
|
383
|
-
- lib/lookout/
|
384
|
-
- lib/lookout/
|
385
|
-
- lib/lookout/
|
386
|
-
- lib/lookout/
|
387
|
-
- lib/lookout/
|
388
|
-
- lib/lookout/
|
389
|
-
- lib/lookout/
|
390
|
-
- lib/lookout/
|
391
|
-
- lib/lookout/
|
392
|
-
- lib/lookout/
|
393
|
-
- lib/lookout/
|
394
|
-
- lib/lookout/
|
395
|
-
- lib/lookout/
|
396
|
-
- lib/lookout/
|
397
|
-
- lib/lookout/
|
398
|
-
- lib/lookout/
|
399
|
-
- lib/lookout/
|
400
|
-
- lib/lookout/
|
401
|
-
- lib/lookout/
|
402
|
-
- lib/lookout/
|
403
|
-
- lib/lookout/
|
404
|
-
- lib/lookout/
|
405
|
-
- lib/lookout/
|
406
|
-
- lib/lookout/
|
407
|
-
- lib/lookout/
|
408
|
-
- lib/lookout/
|
409
|
-
- lib/lookout/
|
410
|
-
- lib/lookout/
|
411
|
-
- lib/lookout/
|
412
|
-
- lib/lookout/
|
413
|
-
- lib/lookout/
|
414
|
-
- lib/lookout/
|
415
|
-
- lib/lookout/
|
416
|
-
- lib/lookout/
|
417
|
-
- lib/lookout/
|
418
|
-
- lib/lookout/
|
419
|
-
- lib/lookout/
|
420
|
-
- lib/lookout/
|
421
|
-
- lib/lookout/
|
422
|
-
- lib/lookout/stub
|
423
|
-
- lib/lookout/
|
424
|
-
- lib/lookout/
|
425
|
-
- lib/lookout/
|
426
|
-
- lib/lookout/
|
427
|
-
- lib/lookout/
|
428
|
-
- lib/lookout/
|
429
|
-
- lib/lookout/
|
430
|
-
- lib/lookout/
|
431
|
-
- lib/lookout/
|
432
|
-
- lib/lookout.rb
|
969
|
+
- lib/lookout-3.0/object.rb
|
970
|
+
- lib/lookout-3.0/aphonic.rb
|
971
|
+
- lib/lookout-3.0/actual.rb
|
972
|
+
- lib/lookout-3.0/actual/method.rb
|
973
|
+
- lib/lookout-3.0/actual/not.rb
|
974
|
+
- lib/lookout-3.0/actual/not/method.rb
|
975
|
+
- lib/lookout-3.0/diff.rb
|
976
|
+
- lib/lookout-3.0/diff/slice.rb
|
977
|
+
- lib/lookout-3.0/diff/algorithms.rb
|
978
|
+
- lib/lookout-3.0/diff/algorithms/difflib.rb
|
979
|
+
- lib/lookout-3.0/diff/algorithms/difflib/position.rb
|
980
|
+
- lib/lookout-3.0/diff/algorithms/difflib/position/new.rb
|
981
|
+
- lib/lookout-3.0/diff/formats.rb
|
982
|
+
- lib/lookout-3.0/diff/formats/inline.rb
|
983
|
+
- lib/lookout-3.0/diff/formats/set.rb
|
984
|
+
- lib/lookout-3.0/diff/formats/unified.rb
|
985
|
+
- lib/lookout-3.0/diff/group.rb
|
986
|
+
- lib/lookout-3.0/diff/groups.rb
|
987
|
+
- lib/lookout-3.0/diff/match.rb
|
988
|
+
- lib/lookout-3.0/diff/operation.rb
|
989
|
+
- lib/lookout-3.0/diff/operations.rb
|
990
|
+
- lib/lookout-3.0/diff/operations/delete.rb
|
991
|
+
- lib/lookout-3.0/diff/operations/copy.rb
|
992
|
+
- lib/lookout-3.0/diff/operations/insert.rb
|
993
|
+
- lib/lookout-3.0/diff/operations/replace.rb
|
994
|
+
- lib/lookout-3.0/difference.rb
|
995
|
+
- lib/lookout-3.0/difference/object.rb
|
996
|
+
- lib/lookout-3.0/difference/array.rb
|
997
|
+
- lib/lookout-3.0/difference/exception.rb
|
998
|
+
- lib/lookout-3.0/difference/hash.rb
|
999
|
+
- lib/lookout-3.0/difference/range.rb
|
1000
|
+
- lib/lookout-3.0/difference/lookout.rb
|
1001
|
+
- lib/lookout-3.0/difference/lookout/actual.rb
|
1002
|
+
- lib/lookout-3.0/difference/lookout/actual/method.rb
|
1003
|
+
- lib/lookout-3.0/difference/lookout/actual/not.rb
|
1004
|
+
- lib/lookout-3.0/difference/lookout/actual/not/method.rb
|
1005
|
+
- lib/lookout-3.0/difference/lookout/output.rb
|
1006
|
+
- lib/lookout-3.0/difference/lookout/reception.rb
|
1007
|
+
- lib/lookout-3.0/difference/lookout/warning.rb
|
1008
|
+
- lib/lookout-3.0/difference/module.rb
|
1009
|
+
- lib/lookout-3.0/difference/regexp.rb
|
1010
|
+
- lib/lookout-3.0/difference/string.rb
|
1011
|
+
- lib/lookout-3.0/difference/symbol.rb
|
1012
|
+
- lib/lookout-3.0/encode.rb
|
1013
|
+
- lib/lookout-3.0/exception.rb
|
1014
|
+
- lib/lookout-3.0/exception/backtrace.rb
|
1015
|
+
- lib/lookout-3.0/exception/unknown.rb
|
1016
|
+
- lib/lookout-3.0/expect.rb
|
1017
|
+
- lib/lookout-3.0/expect/object.rb
|
1018
|
+
- lib/lookout-3.0/expect/object/context.rb
|
1019
|
+
- lib/lookout-3.0/expect/classes.rb
|
1020
|
+
- lib/lookout-3.0/expect/classes/exception.rb
|
1021
|
+
- lib/lookout-3.0/expect/exception.rb
|
1022
|
+
- lib/lookout-3.0/expected.rb
|
1023
|
+
- lib/lookout-3.0/expected/object.rb
|
1024
|
+
- lib/lookout-3.0/expected/array.rb
|
1025
|
+
- lib/lookout-3.0/expected/classes.rb
|
1026
|
+
- lib/lookout-3.0/expected/classes/exception.rb
|
1027
|
+
- lib/lookout-3.0/expected/exception.rb
|
1028
|
+
- lib/lookout-3.0/expected/falseclass.rb
|
1029
|
+
- lib/lookout-3.0/expected/hash.rb
|
1030
|
+
- lib/lookout-3.0/expected/lookout.rb
|
1031
|
+
- lib/lookout-3.0/expected/lookout/actual.rb
|
1032
|
+
- lib/lookout-3.0/expected/lookout/actual/method.rb
|
1033
|
+
- lib/lookout-3.0/expected/lookout/actual/not.rb
|
1034
|
+
- lib/lookout-3.0/expected/lookout/actual/not/method.rb
|
1035
|
+
- lib/lookout-3.0/expected/lookout/output.rb
|
1036
|
+
- lib/lookout-3.0/expected/lookout/reception.rb
|
1037
|
+
- lib/lookout-3.0/expected/lookout/warning.rb
|
1038
|
+
- lib/lookout-3.0/expected/module.rb
|
1039
|
+
- lib/lookout-3.0/expected/range.rb
|
1040
|
+
- lib/lookout-3.0/expected/regexp.rb
|
1041
|
+
- lib/lookout-3.0/expected/string.rb
|
1042
|
+
- lib/lookout-3.0/expected/symbol.rb
|
1043
|
+
- lib/lookout-3.0/expected/trueclass.rb
|
1044
|
+
- lib/lookout-3.0/expectations.rb
|
1045
|
+
- lib/lookout-3.0/expectations/context.rb
|
1046
|
+
- lib/lookout-3.0/inspect.rb
|
1047
|
+
- lib/lookout-3.0/interfaces.rb
|
1048
|
+
- lib/lookout-3.0/interfaces/commandline.rb
|
1049
|
+
- lib/lookout-3.0/literal.rb
|
1050
|
+
- lib/lookout-3.0/stub.rb
|
1051
|
+
- lib/lookout-3.0/mock.rb
|
1052
|
+
- lib/lookout-3.0/output.rb
|
1053
|
+
- lib/lookout-3.0/plugins.rb
|
1054
|
+
- lib/lookout-3.0/reception.rb
|
1055
|
+
- lib/lookout-3.0/reception/arguments.rb
|
1056
|
+
- lib/lookout-3.0/reception/arguments/any.rb
|
1057
|
+
- lib/lookout-3.0/reception/arguments/error.rb
|
1058
|
+
- lib/lookout-3.0/reception/arguments/list.rb
|
1059
|
+
- lib/lookout-3.0/reception/arguments/none.rb
|
1060
|
+
- lib/lookout-3.0/reception/error.rb
|
1061
|
+
- lib/lookout-3.0/object/not.rb
|
1062
|
+
- lib/lookout-3.0/object/not/receive.rb
|
1063
|
+
- lib/lookout-3.0/object/to.rb
|
1064
|
+
- lib/lookout-3.0/object/to/receive.rb
|
1065
|
+
- lib/lookout-3.0/result.rb
|
1066
|
+
- lib/lookout-3.0/results.rb
|
1067
|
+
- lib/lookout-3.0/results/error.rb
|
1068
|
+
- lib/lookout-3.0/results/failure.rb
|
1069
|
+
- lib/lookout-3.0/results/success.rb
|
1070
|
+
- lib/lookout-3.0/warning.rb
|
1071
|
+
- lib/lookout-3.0.rb
|
1072
|
+
- lib/lookout-3.0/version.rb
|
1073
|
+
- test/unit/lookout-3.0/object.rb
|
1074
|
+
- test/unit/lookout-3.0/aphonic.rb
|
1075
|
+
- test/unit/lookout-3.0/actual.rb
|
1076
|
+
- test/unit/lookout-3.0/actual/method.rb
|
1077
|
+
- test/unit/lookout-3.0/actual/not.rb
|
1078
|
+
- test/unit/lookout-3.0/actual/not/method.rb
|
1079
|
+
- test/unit/lookout-3.0/diff.rb
|
1080
|
+
- test/unit/lookout-3.0/diff/slice.rb
|
1081
|
+
- test/unit/lookout-3.0/diff/algorithms.rb
|
1082
|
+
- test/unit/lookout-3.0/diff/algorithms/difflib.rb
|
1083
|
+
- test/unit/lookout-3.0/diff/algorithms/difflib/position.rb
|
1084
|
+
- test/unit/lookout-3.0/diff/algorithms/difflib/position/new.rb
|
1085
|
+
- test/unit/lookout-3.0/diff/formats.rb
|
1086
|
+
- test/unit/lookout-3.0/diff/formats/inline.rb
|
1087
|
+
- test/unit/lookout-3.0/diff/formats/set.rb
|
1088
|
+
- test/unit/lookout-3.0/diff/formats/unified.rb
|
1089
|
+
- test/unit/lookout-3.0/diff/group.rb
|
1090
|
+
- test/unit/lookout-3.0/diff/groups.rb
|
1091
|
+
- test/unit/lookout-3.0/diff/match.rb
|
1092
|
+
- test/unit/lookout-3.0/diff/operation.rb
|
1093
|
+
- test/unit/lookout-3.0/diff/operations.rb
|
1094
|
+
- test/unit/lookout-3.0/diff/operations/delete.rb
|
1095
|
+
- test/unit/lookout-3.0/diff/operations/copy.rb
|
1096
|
+
- test/unit/lookout-3.0/diff/operations/insert.rb
|
1097
|
+
- test/unit/lookout-3.0/diff/operations/replace.rb
|
1098
|
+
- test/unit/lookout-3.0/difference.rb
|
1099
|
+
- test/unit/lookout-3.0/difference/object.rb
|
1100
|
+
- test/unit/lookout-3.0/difference/array.rb
|
1101
|
+
- test/unit/lookout-3.0/difference/exception.rb
|
1102
|
+
- test/unit/lookout-3.0/difference/hash.rb
|
1103
|
+
- test/unit/lookout-3.0/difference/range.rb
|
1104
|
+
- test/unit/lookout-3.0/difference/lookout.rb
|
1105
|
+
- test/unit/lookout-3.0/difference/lookout/actual.rb
|
1106
|
+
- test/unit/lookout-3.0/difference/lookout/actual/method.rb
|
1107
|
+
- test/unit/lookout-3.0/difference/lookout/actual/not.rb
|
1108
|
+
- test/unit/lookout-3.0/difference/lookout/actual/not/method.rb
|
1109
|
+
- test/unit/lookout-3.0/difference/lookout/output.rb
|
1110
|
+
- test/unit/lookout-3.0/difference/lookout/reception.rb
|
1111
|
+
- test/unit/lookout-3.0/difference/lookout/warning.rb
|
1112
|
+
- test/unit/lookout-3.0/difference/module.rb
|
1113
|
+
- test/unit/lookout-3.0/difference/regexp.rb
|
1114
|
+
- test/unit/lookout-3.0/difference/string.rb
|
1115
|
+
- test/unit/lookout-3.0/difference/symbol.rb
|
1116
|
+
- test/unit/lookout-3.0/encode.rb
|
1117
|
+
- test/unit/lookout-3.0/exception.rb
|
1118
|
+
- test/unit/lookout-3.0/exception/backtrace.rb
|
1119
|
+
- test/unit/lookout-3.0/exception/unknown.rb
|
1120
|
+
- test/unit/lookout-3.0/expect.rb
|
1121
|
+
- test/unit/lookout-3.0/expect/object.rb
|
1122
|
+
- test/unit/lookout-3.0/expect/object/context.rb
|
1123
|
+
- test/unit/lookout-3.0/expect/classes.rb
|
1124
|
+
- test/unit/lookout-3.0/expect/classes/exception.rb
|
1125
|
+
- test/unit/lookout-3.0/expect/exception.rb
|
1126
|
+
- test/unit/lookout-3.0/expected.rb
|
1127
|
+
- test/unit/lookout-3.0/expected/object.rb
|
1128
|
+
- test/unit/lookout-3.0/expected/array.rb
|
1129
|
+
- test/unit/lookout-3.0/expected/classes.rb
|
1130
|
+
- test/unit/lookout-3.0/expected/classes/exception.rb
|
1131
|
+
- test/unit/lookout-3.0/expected/exception.rb
|
1132
|
+
- test/unit/lookout-3.0/expected/falseclass.rb
|
1133
|
+
- test/unit/lookout-3.0/expected/hash.rb
|
1134
|
+
- test/unit/lookout-3.0/expected/lookout.rb
|
1135
|
+
- test/unit/lookout-3.0/expected/lookout/actual.rb
|
1136
|
+
- test/unit/lookout-3.0/expected/lookout/actual/method.rb
|
1137
|
+
- test/unit/lookout-3.0/expected/lookout/actual/not.rb
|
1138
|
+
- test/unit/lookout-3.0/expected/lookout/actual/not/method.rb
|
1139
|
+
- test/unit/lookout-3.0/expected/lookout/output.rb
|
1140
|
+
- test/unit/lookout-3.0/expected/lookout/reception.rb
|
1141
|
+
- test/unit/lookout-3.0/expected/lookout/warning.rb
|
1142
|
+
- test/unit/lookout-3.0/expected/module.rb
|
1143
|
+
- test/unit/lookout-3.0/expected/range.rb
|
1144
|
+
- test/unit/lookout-3.0/expected/regexp.rb
|
1145
|
+
- test/unit/lookout-3.0/expected/string.rb
|
1146
|
+
- test/unit/lookout-3.0/expected/symbol.rb
|
1147
|
+
- test/unit/lookout-3.0/expected/trueclass.rb
|
1148
|
+
- test/unit/lookout-3.0/expectations.rb
|
1149
|
+
- test/unit/lookout-3.0/expectations/context.rb
|
1150
|
+
- test/unit/lookout-3.0/inspect.rb
|
1151
|
+
- test/unit/lookout-3.0/interfaces.rb
|
1152
|
+
- test/unit/lookout-3.0/interfaces/commandline.rb
|
1153
|
+
- test/unit/lookout-3.0/literal.rb
|
1154
|
+
- test/unit/lookout-3.0/stub.rb
|
1155
|
+
- test/unit/lookout-3.0/mock.rb
|
1156
|
+
- test/unit/lookout-3.0/output.rb
|
1157
|
+
- test/unit/lookout-3.0/plugins.rb
|
1158
|
+
- test/unit/lookout-3.0/reception.rb
|
1159
|
+
- test/unit/lookout-3.0/reception/arguments.rb
|
1160
|
+
- test/unit/lookout-3.0/reception/arguments/any.rb
|
1161
|
+
- test/unit/lookout-3.0/reception/arguments/error.rb
|
1162
|
+
- test/unit/lookout-3.0/reception/arguments/list.rb
|
1163
|
+
- test/unit/lookout-3.0/reception/arguments/none.rb
|
1164
|
+
- test/unit/lookout-3.0/reception/error.rb
|
1165
|
+
- test/unit/lookout-3.0/object/not.rb
|
1166
|
+
- test/unit/lookout-3.0/object/not/receive.rb
|
1167
|
+
- test/unit/lookout-3.0/object/to.rb
|
1168
|
+
- test/unit/lookout-3.0/object/to/receive.rb
|
1169
|
+
- test/unit/lookout-3.0/result.rb
|
1170
|
+
- test/unit/lookout-3.0/results.rb
|
1171
|
+
- test/unit/lookout-3.0/results/error.rb
|
1172
|
+
- test/unit/lookout-3.0/results/failure.rb
|
1173
|
+
- test/unit/lookout-3.0/results/success.rb
|
1174
|
+
- test/unit/lookout-3.0/warning.rb
|
1175
|
+
- test/unit/lookout-3.0.rb
|
1176
|
+
- test/unit/lookout-3.0/version.rb
|
433
1177
|
- test/unit/examples.rb
|
434
|
-
- test/unit/lookout/diff/algorithms/difflib/position/to.rb
|
435
|
-
- test/unit/lookout/diff/algorithms/difflib/position.rb
|
436
|
-
- test/unit/lookout/diff/algorithms/difflib.rb
|
437
|
-
- test/unit/lookout/diff/formats/inline.rb
|
438
|
-
- test/unit/lookout/diff/formats/unified.rb
|
439
|
-
- test/unit/lookout/diff/group.rb
|
440
|
-
- test/unit/lookout/diff/groups.rb
|
441
|
-
- test/unit/lookout/diff/match.rb
|
442
|
-
- test/unit/lookout/diff/operations/delete.rb
|
443
|
-
- test/unit/lookout/diff/operations/equal.rb
|
444
|
-
- test/unit/lookout/diff/operations/insert.rb
|
445
|
-
- test/unit/lookout/diff/operations/replace.rb
|
446
|
-
- test/unit/lookout/diff/operations.rb
|
447
|
-
- test/unit/lookout/diff/range.rb
|
448
|
-
- test/unit/lookout/diff.rb
|
449
|
-
- test/unit/lookout/equality.rb
|
450
|
-
- test/unit/lookout/expectation.rb
|
451
|
-
- test/unit/lookout/expectations/behavior.rb
|
452
|
-
- test/unit/lookout/expectations/line.rb
|
453
|
-
- test/unit/lookout/expectations/state.rb
|
454
|
-
- test/unit/lookout/expectations.rb
|
455
|
-
- test/unit/lookout/mock/method/arguments/any.rb
|
456
|
-
- test/unit/lookout/mock/method/arguments.rb
|
457
|
-
- test/unit/lookout/mock/method.rb
|
458
|
-
- test/unit/lookout/recorder.rb
|
459
|
-
- test/unit/lookout/results/error/exception/backtrace.rb
|
460
|
-
- test/unit/lookout/results/error.rb
|
461
|
-
- test/unit/lookout/results/failures/behavior.rb
|
462
|
-
- test/unit/lookout/results/failures/state.rb
|
463
|
-
- test/unit/lookout/results/fulfilled.rb
|
464
|
-
- test/unit/lookout/results/unsuccessful.rb
|
465
|
-
- test/unit/lookout/results.rb
|
466
|
-
- test/unit/lookout/runners/console.rb
|
467
|
-
- test/unit/lookout/runners/trackers/failure.rb
|
468
|
-
- test/unit/lookout/stub/method.rb
|
469
|
-
- test/unit/lookout/stub/methods.rb
|
470
|
-
- test/unit/lookout/ui/console.rb
|
471
|
-
- test/unit/lookout/xml.rb
|
472
|
-
- test/unit/lookout.rb
|
473
1178
|
- README
|
474
1179
|
- Rakefile
|
475
|
-
homepage:
|
1180
|
+
homepage: https://github.com/now/lookout
|
476
1181
|
licenses: []
|
477
1182
|
metadata: {}
|
478
1183
|
post_install_message:
|
@@ -480,21 +1185,19 @@ rdoc_options: []
|
|
480
1185
|
require_paths:
|
481
1186
|
- lib
|
482
1187
|
required_ruby_version: !ruby/object:Gem::Requirement
|
483
|
-
none: false
|
484
1188
|
requirements:
|
485
|
-
- -
|
1189
|
+
- - '>='
|
486
1190
|
- !ruby/object:Gem::Version
|
487
1191
|
version: '0'
|
488
1192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
489
|
-
none: false
|
490
1193
|
requirements:
|
491
|
-
- -
|
1194
|
+
- - '>='
|
492
1195
|
- !ruby/object:Gem::Version
|
493
1196
|
version: '0'
|
494
1197
|
requirements: []
|
495
1198
|
rubyforge_project:
|
496
|
-
rubygems_version:
|
1199
|
+
rubygems_version: 2.0.0
|
497
1200
|
signing_key:
|
498
1201
|
specification_version: 4
|
499
|
-
summary:
|
1202
|
+
summary: focus.
|
500
1203
|
test_files: []
|