mocha 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +3 -1
- data/examples/misc.rb +44 -36
- data/examples/stubba.rb +1 -1
- data/lib/mocha/auto_verify.rb +38 -31
- data/lib/mocha/central.rb +1 -1
- data/lib/mocha/class_method.rb +5 -1
- data/lib/mocha/expectation.rb +63 -61
- data/lib/mocha/expectation_error.rb +9 -0
- data/lib/mocha/expectation_list.rb +11 -10
- data/lib/mocha/method_matcher.rb +21 -0
- data/lib/mocha/missing_expectation.rb +5 -15
- data/lib/mocha/mock.rb +28 -26
- data/lib/mocha/parameter_matchers.rb +17 -1
- data/lib/mocha/parameter_matchers/all_of.rb +6 -3
- data/lib/mocha/parameter_matchers/any_of.rb +6 -3
- data/lib/mocha/parameter_matchers/any_parameters.rb +40 -0
- data/lib/mocha/parameter_matchers/anything.rb +5 -2
- data/lib/mocha/parameter_matchers/base.rb +15 -0
- data/lib/mocha/parameter_matchers/equals.rb +42 -0
- data/lib/mocha/parameter_matchers/has_entries.rb +42 -0
- data/lib/mocha/parameter_matchers/has_entry.rb +20 -4
- data/lib/mocha/parameter_matchers/has_key.rb +5 -2
- data/lib/mocha/parameter_matchers/has_value.rb +5 -2
- data/lib/mocha/parameter_matchers/includes.rb +5 -2
- data/lib/mocha/parameter_matchers/instance_of.rb +5 -2
- data/lib/mocha/parameter_matchers/is_a.rb +42 -0
- data/lib/mocha/parameter_matchers/kind_of.rb +5 -2
- data/lib/mocha/parameter_matchers/not.rb +42 -0
- data/lib/mocha/parameter_matchers/object.rb +9 -0
- data/lib/mocha/parameter_matchers/optionally.rb +33 -0
- data/lib/mocha/parameter_matchers/regexp_matches.rb +5 -2
- data/lib/mocha/parameters_matcher.rb +37 -0
- data/lib/mocha/pretty_parameters.rb +1 -1
- data/lib/mocha/return_values.rb +7 -4
- data/lib/mocha/sequence.rb +42 -0
- data/lib/mocha/yield_parameters.rb +3 -3
- data/test/acceptance/expected_invocation_count_acceptance_test.rb +8 -8
- data/test/acceptance/mock_with_initializer_block_acceptance_test.rb +44 -0
- data/test/acceptance/optional_parameters_acceptance_test.rb +63 -0
- data/test/acceptance/parameter_matcher_acceptance_test.rb +38 -2
- data/test/acceptance/partial_mocks_acceptance_test.rb +40 -0
- data/test/acceptance/sequence_acceptance_test.rb +179 -0
- data/test/integration/mocha_test_result_integration_test.rb +3 -3
- data/test/integration/stubba_integration_test.rb +2 -2
- data/test/integration/stubba_test_result_integration_test.rb +2 -2
- data/test/test_runner.rb +2 -2
- data/test/unit/any_instance_method_test.rb +2 -0
- data/test/unit/auto_verify_test.rb +10 -3
- data/test/unit/central_test.rb +1 -1
- data/test/unit/class_method_test.rb +4 -0
- data/test/unit/expectation_error_test.rb +24 -0
- data/test/unit/expectation_list_test.rb +6 -0
- data/test/unit/expectation_test.rb +111 -27
- data/test/unit/method_matcher_test.rb +23 -0
- data/test/unit/missing_expectation_test.rb +24 -27
- data/test/unit/mock_test.rb +29 -22
- data/test/unit/object_inspect_test.rb +4 -2
- data/test/unit/parameter_matchers/all_of_test.rb +2 -2
- data/test/unit/parameter_matchers/any_of_test.rb +2 -2
- data/test/unit/parameter_matchers/anything_test.rb +2 -2
- data/test/unit/parameter_matchers/has_entries_test.rb +30 -0
- data/test/unit/parameter_matchers/has_entry_test.rb +20 -5
- data/test/unit/parameter_matchers/has_key_test.rb +2 -2
- data/test/unit/parameter_matchers/has_value_test.rb +2 -2
- data/test/unit/parameter_matchers/includes_test.rb +2 -2
- data/test/unit/parameter_matchers/instance_of_test.rb +2 -2
- data/test/unit/parameter_matchers/is_a_test.rb +25 -0
- data/test/unit/parameter_matchers/kind_of_test.rb +3 -3
- data/test/unit/parameter_matchers/not_test.rb +26 -0
- data/test/unit/parameter_matchers/regexp_matches_test.rb +2 -2
- data/test/unit/parameter_matchers/stub_matcher.rb +2 -1
- data/test/unit/parameters_matcher_test.rb +121 -0
- data/test/unit/sequence_test.rb +104 -0
- metadata +35 -6
- data/test/unit/pretty_parameters_test.rb +0 -32
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: mocha
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.5.6
|
7
|
+
date: 2007-12-23 00:00:00 +00:00
|
8
8
|
summary: Mocking and stubbing library
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -43,6 +43,7 @@ files:
|
|
43
43
|
- lib/mocha/instance_method.rb
|
44
44
|
- lib/mocha/is_a.rb
|
45
45
|
- lib/mocha/metaclass.rb
|
46
|
+
- lib/mocha/method_matcher.rb
|
46
47
|
- lib/mocha/missing_expectation.rb
|
47
48
|
- lib/mocha/mock.rb
|
48
49
|
- lib/mocha/multiple_yields.rb
|
@@ -50,17 +51,27 @@ files:
|
|
50
51
|
- lib/mocha/object.rb
|
51
52
|
- lib/mocha/parameter_matchers/all_of.rb
|
52
53
|
- lib/mocha/parameter_matchers/any_of.rb
|
54
|
+
- lib/mocha/parameter_matchers/any_parameters.rb
|
53
55
|
- lib/mocha/parameter_matchers/anything.rb
|
56
|
+
- lib/mocha/parameter_matchers/base.rb
|
57
|
+
- lib/mocha/parameter_matchers/equals.rb
|
58
|
+
- lib/mocha/parameter_matchers/has_entries.rb
|
54
59
|
- lib/mocha/parameter_matchers/has_entry.rb
|
55
60
|
- lib/mocha/parameter_matchers/has_key.rb
|
56
61
|
- lib/mocha/parameter_matchers/has_value.rb
|
57
62
|
- lib/mocha/parameter_matchers/includes.rb
|
58
63
|
- lib/mocha/parameter_matchers/instance_of.rb
|
64
|
+
- lib/mocha/parameter_matchers/is_a.rb
|
59
65
|
- lib/mocha/parameter_matchers/kind_of.rb
|
66
|
+
- lib/mocha/parameter_matchers/not.rb
|
67
|
+
- lib/mocha/parameter_matchers/object.rb
|
68
|
+
- lib/mocha/parameter_matchers/optionally.rb
|
60
69
|
- lib/mocha/parameter_matchers/regexp_matches.rb
|
61
70
|
- lib/mocha/parameter_matchers.rb
|
71
|
+
- lib/mocha/parameters_matcher.rb
|
62
72
|
- lib/mocha/pretty_parameters.rb
|
63
73
|
- lib/mocha/return_values.rb
|
74
|
+
- lib/mocha/sequence.rb
|
64
75
|
- lib/mocha/setup_and_teardown.rb
|
65
76
|
- lib/mocha/single_return_value.rb
|
66
77
|
- lib/mocha/single_yield.rb
|
@@ -73,8 +84,12 @@ files:
|
|
73
84
|
- lib/stubba.rb
|
74
85
|
- test/acceptance/expected_invocation_count_acceptance_test.rb
|
75
86
|
- test/acceptance/mocha_acceptance_test.rb
|
87
|
+
- test/acceptance/mock_with_initializer_block_acceptance_test.rb
|
76
88
|
- test/acceptance/mocked_methods_dispatch_acceptance_test.rb
|
89
|
+
- test/acceptance/optional_parameters_acceptance_test.rb
|
77
90
|
- test/acceptance/parameter_matcher_acceptance_test.rb
|
91
|
+
- test/acceptance/partial_mocks_acceptance_test.rb
|
92
|
+
- test/acceptance/sequence_acceptance_test.rb
|
78
93
|
- test/acceptance/standalone_acceptance_test.rb
|
79
94
|
- test/acceptance/stubba_acceptance_test.rb
|
80
95
|
- test/active_record_test_case.rb
|
@@ -92,12 +107,14 @@ files:
|
|
92
107
|
- test/unit/central_test.rb
|
93
108
|
- test/unit/class_method_test.rb
|
94
109
|
- test/unit/date_time_inspect_test.rb
|
110
|
+
- test/unit/expectation_error_test.rb
|
95
111
|
- test/unit/expectation_list_test.rb
|
96
112
|
- test/unit/expectation_raiser_test.rb
|
97
113
|
- test/unit/expectation_test.rb
|
98
114
|
- test/unit/hash_inspect_test.rb
|
99
115
|
- test/unit/infinite_range_test.rb
|
100
116
|
- test/unit/metaclass_test.rb
|
117
|
+
- test/unit/method_matcher_test.rb
|
101
118
|
- test/unit/missing_expectation_test.rb
|
102
119
|
- test/unit/mock_test.rb
|
103
120
|
- test/unit/multiple_yields_test.rb
|
@@ -107,16 +124,20 @@ files:
|
|
107
124
|
- test/unit/parameter_matchers/all_of_test.rb
|
108
125
|
- test/unit/parameter_matchers/any_of_test.rb
|
109
126
|
- test/unit/parameter_matchers/anything_test.rb
|
127
|
+
- test/unit/parameter_matchers/has_entries_test.rb
|
110
128
|
- test/unit/parameter_matchers/has_entry_test.rb
|
111
129
|
- test/unit/parameter_matchers/has_key_test.rb
|
112
130
|
- test/unit/parameter_matchers/has_value_test.rb
|
113
131
|
- test/unit/parameter_matchers/includes_test.rb
|
114
132
|
- test/unit/parameter_matchers/instance_of_test.rb
|
133
|
+
- test/unit/parameter_matchers/is_a_test.rb
|
115
134
|
- test/unit/parameter_matchers/kind_of_test.rb
|
135
|
+
- test/unit/parameter_matchers/not_test.rb
|
116
136
|
- test/unit/parameter_matchers/regexp_matches_test.rb
|
117
137
|
- test/unit/parameter_matchers/stub_matcher.rb
|
118
|
-
- test/unit/
|
138
|
+
- test/unit/parameters_matcher_test.rb
|
119
139
|
- test/unit/return_values_test.rb
|
140
|
+
- test/unit/sequence_test.rb
|
120
141
|
- test/unit/setup_and_teardown_test.rb
|
121
142
|
- test/unit/single_return_value_test.rb
|
122
143
|
- test/unit/single_yield_test.rb
|
@@ -148,5 +169,13 @@ extensions: []
|
|
148
169
|
|
149
170
|
requirements: []
|
150
171
|
|
151
|
-
dependencies:
|
152
|
-
|
172
|
+
dependencies:
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: rake
|
175
|
+
version_requirement:
|
176
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.0.0
|
181
|
+
version:
|
@@ -1,32 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "..", "test_helper")
|
2
|
-
require 'mocha/pretty_parameters'
|
3
|
-
|
4
|
-
class PrettyParametersTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
include Mocha
|
7
|
-
|
8
|
-
def test_should_remove_outer_array_braces
|
9
|
-
params = [1, 2, [3, 4]]
|
10
|
-
parameters = PrettyParameters.new(params)
|
11
|
-
assert_equal '1, 2, [3, 4]', parameters.pretty
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_should_display_numeric_arguments_as_is
|
15
|
-
params = [1, 2, 3]
|
16
|
-
parameters = PrettyParameters.new(params)
|
17
|
-
assert_equal '1, 2, 3', parameters.pretty
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_should_remove_curly_braces_if_hash_is_only_argument
|
21
|
-
params = [{:a => 1, :z => 2}]
|
22
|
-
parameters = PrettyParameters.new(params)
|
23
|
-
assert_match /^:[az] => [12], :[az] => [12]$/, parameters.pretty
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_should_not_remove_curly_braces_if_hash_is_not_the_only_argument
|
27
|
-
params = [1, {:a => 1}]
|
28
|
-
parameters = PrettyParameters.new(params)
|
29
|
-
assert_equal '1, {:a => 1}', parameters.pretty
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|