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
@@ -1,11 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout::Mock::Method::Calls
|
4
|
-
autoload :Class, 'lookout/mock/method/calls/class'
|
5
|
-
autoload :Exactly, 'lookout/mock/method/calls/exactly'
|
6
|
-
autoload :Instance, 'lookout/mock/method/calls/instance'
|
7
|
-
autoload :Lower, 'lookout/mock/method/calls/lower'
|
8
|
-
autoload :Upper, 'lookout/mock/method/calls/upper'
|
9
|
-
|
10
|
-
Error = ::Class.new(Lookout::Mock::Error)
|
11
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout::Mock::Method::Calls::Class
|
4
|
-
def format(limit, calls, format = nil)
|
5
|
-
return formats[limit][calls] unless format
|
6
|
-
if limit == -1
|
7
|
-
formats.default = Hash.new([format, [:@method, :@expected, :@calls]])
|
8
|
-
elsif calls == -1
|
9
|
-
formats[limit].default = [format, [:@method, :@calls]]
|
10
|
-
else
|
11
|
-
formats[limit][calls] = [format, [:@method]]
|
12
|
-
end
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def formats
|
19
|
-
@formats ||= Hash.new{ |hash, key| hash[key] = {} }
|
20
|
-
end
|
21
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Mock::Method::Calls::Exactly
|
4
|
-
extend Lookout::Mock::Method::Calls::Class
|
5
|
-
include Lookout::Mock::Method::Calls::Instance
|
6
|
-
|
7
|
-
format 0, 1, 'expected %s not to be called'
|
8
|
-
format 0, 2, 'expected %s not to be called, but was called twice'
|
9
|
-
format 0, -1, 'expected %s not to be called, but was called %d times'
|
10
|
-
format 1, 0, 'expected %s to be called'
|
11
|
-
format 1, 2, 'expected %s to be called once, not twice'
|
12
|
-
format 1, -1, 'expected %s to be called once, not %d times'
|
13
|
-
format 2, 0, 'expected %s to be called twice'
|
14
|
-
format 2, 1, 'expected %s to be called twice, but was only called once'
|
15
|
-
format 2, -1, 'expected %s to be called twice, not %d times'
|
16
|
-
format(-1, -1, 'expected %s to be called %d times, not %d times')
|
17
|
-
|
18
|
-
def initialize(method, limit)
|
19
|
-
raise ArgumentError, 'limit must be >= 0' unless limit >= 0
|
20
|
-
super
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def satisfied?
|
26
|
-
@calls == @limit
|
27
|
-
end
|
28
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Lookout::Mock::Method::Calls::Instance
|
4
|
-
def initialize(method, limit)
|
5
|
-
@method, @limit = method, limit
|
6
|
-
@calls = 0
|
7
|
-
end
|
8
|
-
|
9
|
-
def call
|
10
|
-
@calls += 1
|
11
|
-
self
|
12
|
-
end
|
13
|
-
|
14
|
-
def verify
|
15
|
-
raise Lookout::Mock::Method::Calls::Error, message unless satisfied?
|
16
|
-
self
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def message
|
22
|
-
format, variables = self.class.format(@limit, @calls)
|
23
|
-
format % variables.map{ |v| instance_variable_get(v) }
|
24
|
-
end
|
25
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Mock::Method::Calls::Lower
|
4
|
-
extend Lookout::Mock::Method::Calls::Class
|
5
|
-
include Lookout::Mock::Method::Calls::Instance
|
6
|
-
|
7
|
-
format 1, 0, 'expected %s to be called at least once'
|
8
|
-
format 2, 0, 'expected %s to be called at least twice'
|
9
|
-
format 2, 1, 'expected %s to be called at least twice, but was only called once'
|
10
|
-
format(-1, -1, 'expected %s to be called at least %d times, but was only called %d times')
|
11
|
-
|
12
|
-
def initialize(method, limit)
|
13
|
-
raise ArgumentError, 'limit must be > 0' unless limit > 0
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def satisfied?
|
20
|
-
@calls >= @limit
|
21
|
-
end
|
22
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Mock::Method::Calls::Upper
|
4
|
-
extend Lookout::Mock::Method::Calls::Class
|
5
|
-
include Lookout::Mock::Method::Calls::Instance
|
6
|
-
|
7
|
-
format 1, 2, 'expected %s to be called at most once, but was called twice'
|
8
|
-
format 1, -1, 'expected %s to be called at most once, but was called %d times'
|
9
|
-
format 2, -1, 'expected %s to be called at most twice, but was called %d times'
|
10
|
-
format(-1, -1, 'expected %s to be called at most %d times, but was called %d times')
|
11
|
-
|
12
|
-
def initialize(method, limit)
|
13
|
-
raise ArgumentError, 'limit must be > 0' unless limit > 0
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def satisfied?
|
20
|
-
@calls <= @limit
|
21
|
-
end
|
22
|
-
end
|
data/lib/lookout/mock/methods.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Mock::Methods < Lookout::Stub::Methods
|
4
|
-
def define(object, method, *args, &block)
|
5
|
-
method = Lookout::Mock::Method.new(object, method, *args, &block)
|
6
|
-
raise RuntimeError,
|
7
|
-
'%s: cannot create mock as a mock has already been created: %s' %
|
8
|
-
[method, @methods.first] unless @methods.empty?
|
9
|
-
@methods << method.define
|
10
|
-
method
|
11
|
-
end
|
12
|
-
end
|
data/lib/lookout/mock/object.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Mock::Object
|
4
|
-
def inspect
|
5
|
-
'mock'
|
6
|
-
end
|
7
|
-
|
8
|
-
def method_missing(method, *args, &block)
|
9
|
-
raise Lookout::Mock::Method::Calls::Error,
|
10
|
-
'unexpected call to %s' % Lookout::Mock::Method.new(self, method)
|
11
|
-
end
|
12
|
-
end
|
data/lib/lookout/object.rb
DELETED
data/lib/lookout/output.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'stringio'
|
4
|
-
|
5
|
-
class Lookout::Output < StringIO
|
6
|
-
def initialize(expected)
|
7
|
-
@expected = expected
|
8
|
-
super()
|
9
|
-
end
|
10
|
-
|
11
|
-
attr_reader :expected
|
12
|
-
|
13
|
-
def actual
|
14
|
-
rewind
|
15
|
-
@actual ||= read
|
16
|
-
end
|
17
|
-
|
18
|
-
def inspect
|
19
|
-
'output(%p)' % expected
|
20
|
-
end
|
21
|
-
end
|
data/lib/lookout/rake/tasks.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'rake'
|
4
|
-
require 'rake/tasklib'
|
5
|
-
|
6
|
-
module Lookout module Rake end end
|
7
|
-
|
8
|
-
module Lookout::Rake::Tasks
|
9
|
-
autoload :Gem, 'lookout/rake/tasks/gem'
|
10
|
-
autoload :Tags, 'lookout/rake/tasks/tags'
|
11
|
-
autoload :Test, 'lookout/rake/tasks/test'
|
12
|
-
|
13
|
-
class << self
|
14
|
-
def top_srcdir
|
15
|
-
@top_srcdir ||= Dir.pwd
|
16
|
-
end
|
17
|
-
|
18
|
-
def gemspec
|
19
|
-
@gemspec ||= Dir['%s/*.gemspec' % top_srcdir].first
|
20
|
-
end
|
21
|
-
|
22
|
-
def specification
|
23
|
-
return @specification if defined? @specification
|
24
|
-
return nil unless defined? ::Gem
|
25
|
-
return nil unless gemspec
|
26
|
-
@specification = ::Gem::Specification.load(gemspec)
|
27
|
-
end
|
28
|
-
|
29
|
-
def specification!
|
30
|
-
specification or
|
31
|
-
raise ArgumentError,
|
32
|
-
'gem specification was not given and could not be found in project root: %s' %
|
33
|
-
top_srcdir
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Rake::Tasks::Gem < Rake::TaskLib
|
4
|
-
def initialize(specification = Lookout::Rake::Tasks.specification!)
|
5
|
-
specification or
|
6
|
-
raise ArgumentError,
|
7
|
-
'gem specification was not given and could not be found in project root: %s' %
|
8
|
-
Lookout::Rake::Tasks.top_srcdir
|
9
|
-
@specification = specification
|
10
|
-
yield self if block_given?
|
11
|
-
define
|
12
|
-
end
|
13
|
-
|
14
|
-
def define
|
15
|
-
desc 'Build %s' % specification.file_name
|
16
|
-
task :build => specification.file_name
|
17
|
-
file specification.file_name => [specification.loaded_from] + specification.files do
|
18
|
-
when_writing 'Building %s' % specification.file_name do
|
19
|
-
require 'rubygems' unless defined? Gem
|
20
|
-
require 'rubygems/installer' unless defined? Gem::Builder
|
21
|
-
Gem::Builder.new(specification).build
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
desc 'Check %s' % specification.file_name
|
26
|
-
task :check => :build do
|
27
|
-
require 'rubygems' unless defined? Gem
|
28
|
-
require 'rubygems/installer' unless defined? Gem::Installer
|
29
|
-
checkdir = File.join(Lookout::Rake::Tasks.top_srcdir, specification.full_name)
|
30
|
-
Gem::Installer.new(specification.file_name, :unpack => true).unpack checkdir
|
31
|
-
sh 'rake --rakefile %s/Rakefile -s test' % checkdir
|
32
|
-
rm_r checkdir
|
33
|
-
end
|
34
|
-
|
35
|
-
desc 'Install %s and its dependencies' % specification.file_name
|
36
|
-
task :install do
|
37
|
-
require 'rubygems' unless defined? Gem
|
38
|
-
require 'rubygems/dependency_installer' unless defined? Gem::DependencyInstaller
|
39
|
-
Gem::DependencyInstaller.new.install specification.file_name
|
40
|
-
end
|
41
|
-
|
42
|
-
desc 'Push %s to rubygems.org' % specification.file_name
|
43
|
-
task :push => :check do
|
44
|
-
sh 'gem push -%s-verbose %s' % [verbose ? '' : '-no', specification.file_name]
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
attr_reader :specification
|
49
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Rake::Tasks::Tags < Rake::TaskLib
|
4
|
-
def initialize(specification = Lookout::Rake::Tasks.specification!)
|
5
|
-
@specification = specification
|
6
|
-
yield self if block_given?
|
7
|
-
define
|
8
|
-
end
|
9
|
-
|
10
|
-
def define
|
11
|
-
require 'rbtags/rake/tasks'
|
12
|
-
RbTags::Rake::Tasks::Tags.new specification.require_paths, specification.lib_files.sort
|
13
|
-
end
|
14
|
-
|
15
|
-
attr_reader :specification
|
16
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Rake::Tasks::Test < Rake::TaskLib
|
4
|
-
LoaderPath = File.join(File.dirname(__FILE__), 'test/loader.rb')
|
5
|
-
|
6
|
-
def initialize(specification = Lookout::Rake::Tasks.specification, name = :test)
|
7
|
-
self.specification, @name = specification, name
|
8
|
-
yield self if block_given?
|
9
|
-
define
|
10
|
-
end
|
11
|
-
|
12
|
-
def define
|
13
|
-
desc @name == :test ? 'Run tests' : 'Run tests for %s' % @name
|
14
|
-
task @name do
|
15
|
-
ruby '-w %s -- %s %s' % [options, escape(LoaderPath), arguments]
|
16
|
-
end
|
17
|
-
|
18
|
-
task :default => @name unless Rake::Task.task_defined? :default
|
19
|
-
end
|
20
|
-
|
21
|
-
attr_accessor :requires
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def specification=(specification)
|
26
|
-
@paths, @requires = specification ?
|
27
|
-
[specification.require_paths, [specification.name]] :
|
28
|
-
[['lib'], []]
|
29
|
-
end
|
30
|
-
|
31
|
-
def options
|
32
|
-
@paths.map{ |p| '-I%s' % p }.join(' ')
|
33
|
-
end
|
34
|
-
|
35
|
-
def arguments
|
36
|
-
requires.map{ |r| '-r%s' % r }.push('--').concat(files).join(' ')
|
37
|
-
end
|
38
|
-
|
39
|
-
def files
|
40
|
-
FileList[ENV.fetch('TEST', 'test/unit/**/*.rb')].map{ |f| escape(f) }
|
41
|
-
end
|
42
|
-
|
43
|
-
def escape(path)
|
44
|
-
path.gsub(/([^A-Za-z0-9_\-.,:\/@\n])/n, '\\\\\\1').gsub(/\n/, "'\n'")
|
45
|
-
end
|
46
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
require 'lookout'
|
4
|
-
|
5
|
-
results = Lookout::Results.new
|
6
|
-
line = ENV['LINE'] && ENV['LINE'].to_i
|
7
|
-
runner = Lookout::Runners::Console.new(results,
|
8
|
-
line ?
|
9
|
-
Lookout::Expectations::Line.new(line, results) :
|
10
|
-
Lookout::Expectations.new(results),
|
11
|
-
Lookout::UI::Console.new(results)).install
|
12
|
-
only_load = false
|
13
|
-
ARGV.each do |arg|
|
14
|
-
if not only_load and arg == '--'
|
15
|
-
only_load = true
|
16
|
-
elsif not only_load and arg =~ /\A-r(.*)/
|
17
|
-
require $1
|
18
|
-
else
|
19
|
-
runner.load arg
|
20
|
-
end
|
21
|
-
end
|
22
|
-
runner.exit
|
data/lib/lookout/recorder.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
class Lookout::Recorder < Lookout::Aphonic
|
4
|
-
autoload :Not, 'lookout/recorder/not'
|
5
|
-
autoload :Tape, 'lookout/recorder/tape'
|
6
|
-
|
7
|
-
def initialize(subject)
|
8
|
-
@subject, @negated = subject, false
|
9
|
-
end
|
10
|
-
|
11
|
-
def not
|
12
|
-
@negated = true
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def receive
|
17
|
-
extend Lookout::Recorders::Reception
|
18
|
-
receive!
|
19
|
-
end
|
20
|
-
|
21
|
-
def be
|
22
|
-
extend Lookout::Recorders::State
|
23
|
-
@verb = :be
|
24
|
-
self
|
25
|
-
end
|
26
|
-
|
27
|
-
def have
|
28
|
-
extend Lookout::Recorders::State
|
29
|
-
@verb = :have
|
30
|
-
self
|
31
|
-
end
|
32
|
-
|
33
|
-
def subject!(mocks, stubs)
|
34
|
-
subject
|
35
|
-
end
|
36
|
-
|
37
|
-
attr_reader :subject
|
38
|
-
|
39
|
-
def method_missing(method, *args)
|
40
|
-
return super unless method.to_s =~ /\?$/
|
41
|
-
extend Lookout::Recorders::State
|
42
|
-
@verb = nil
|
43
|
-
method_missing method, *args
|
44
|
-
end
|
45
|
-
end
|