jferris-mocha 0.9.7.20090911190113 → 0.9.8.20100526112143
Sign up to get free protection for your applications and to get access to all the features.
- data/README +3 -1
- data/RELEASE +7 -0
- data/Rakefile +3 -3
- data/lib/mocha/configuration.rb +29 -10
- data/lib/mocha/expectation.rb +5 -1
- data/lib/mocha/integration/mini_test.rb +27 -2
- data/lib/mocha/integration/mini_test/exception_translation.rb +20 -0
- data/lib/mocha/integration/mini_test/version_13.rb +44 -0
- data/lib/mocha/integration/mini_test/{version_131_and_above.rb → version_140.rb} +7 -12
- data/lib/mocha/integration/mini_test/version_141.rb +56 -0
- data/lib/mocha/integration/mini_test/version_142_and_above.rb +56 -0
- data/lib/mocha/integration/test_unit.rb +20 -7
- data/lib/mocha/integration/test_unit/gem_version_200.rb +3 -0
- data/lib/mocha/integration/test_unit/{gem_version_201_and_above.rb → gem_version_201_to_202.rb} +4 -1
- data/lib/mocha/integration/test_unit/gem_version_203_to_207.rb +52 -0
- data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +3 -0
- data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +3 -0
- data/lib/mocha/mock.rb +0 -1
- data/lib/mocha/module_method.rb +1 -1
- data/lib/mocha/parameter_matchers/base.rb +50 -2
- data/lib/mocha/parameter_matchers/has_key.rb +1 -0
- data/lib/mocha/parameter_matchers/has_value.rb +1 -0
- data/lib/mocha/parameter_matchers/includes.rb +1 -0
- data/lib/mocha/parameter_matchers/regexp_matches.rb +1 -0
- data/test/acceptance/acceptance_test_helper.rb +1 -1
- data/test/acceptance/api_test.rb +1 -1
- data/test/acceptance/bug_18914_test.rb +1 -1
- data/test/acceptance/bug_21465_test.rb +1 -1
- data/test/acceptance/bug_21563_test.rb +1 -1
- data/test/acceptance/expected_invocation_count_test.rb +1 -1
- data/test/acceptance/failure_messages_test.rb +1 -1
- data/test/acceptance/minitest_test.rb +128 -124
- data/test/acceptance/mocha_example_test.rb +1 -1
- data/test/acceptance/mocha_test_result_test.rb +1 -1
- data/test/acceptance/mock_test.rb +1 -1
- data/test/acceptance/mock_with_initializer_block_test.rb +1 -1
- data/test/acceptance/mocked_methods_dispatch_test.rb +1 -1
- data/test/acceptance/optional_parameters_test.rb +1 -1
- data/test/acceptance/parameter_matcher_test.rb +38 -1
- data/test/acceptance/partial_mocks_test.rb +1 -1
- data/test/acceptance/return_value_test.rb +1 -1
- data/test/acceptance/sequence_test.rb +1 -1
- data/test/acceptance/states_test.rb +1 -1
- data/test/acceptance/stub_any_instance_method_test.rb +5 -2
- data/test/acceptance/stub_class_method_test.rb +5 -2
- data/test/acceptance/stub_everything_test.rb +1 -1
- data/test/acceptance/stub_instance_method_test.rb +5 -2
- data/test/acceptance/stub_module_method_test.rb +3 -3
- data/test/acceptance/stub_test.rb +1 -1
- data/test/acceptance/stubba_example_test.rb +1 -1
- data/test/acceptance/stubba_test.rb +1 -1
- data/test/acceptance/stubba_test_result_test.rb +1 -1
- data/test/acceptance/stubbing_error_backtrace_test.rb +1 -1
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +1 -1
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +5 -5
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +5 -5
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +5 -5
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +9 -9
- data/test/acceptance/stubbing_non_public_class_method_test.rb +9 -9
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +9 -9
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +5 -5
- data/test/mini_test_result.rb +74 -0
- data/test/test_helper.rb +1 -0
- data/test/test_runner.rb +25 -11
- data/test/unit/any_instance_method_test.rb +1 -1
- data/test/unit/array_inspect_test.rb +1 -1
- data/test/unit/backtrace_filter_test.rb +1 -1
- data/test/unit/cardinality_test.rb +1 -1
- data/test/unit/central_test.rb +1 -1
- data/test/unit/change_state_side_effect_test.rb +1 -1
- data/test/unit/class_method_test.rb +1 -1
- data/test/unit/configuration_test.rb +38 -0
- data/test/unit/date_time_inspect_test.rb +1 -1
- data/test/unit/exception_raiser_test.rb +1 -1
- data/test/unit/expectation_list_test.rb +1 -1
- data/test/unit/expectation_test.rb +1 -1
- data/test/unit/hash_inspect_test.rb +1 -1
- data/test/unit/in_state_ordering_constraint_test.rb +1 -1
- data/test/unit/metaclass_test.rb +1 -1
- data/test/unit/method_matcher_test.rb +1 -1
- data/test/unit/mock_test.rb +1 -1
- data/test/unit/mockery_test.rb +1 -1
- data/test/unit/multiple_yields_test.rb +1 -1
- data/test/unit/no_yields_test.rb +1 -1
- data/test/unit/object_inspect_test.rb +9 -8
- data/test/unit/object_test.rb +1 -1
- data/test/unit/parameter_matchers/all_of_test.rb +1 -1
- data/test/unit/parameter_matchers/any_of_test.rb +1 -1
- data/test/unit/parameter_matchers/anything_test.rb +1 -1
- data/test/unit/parameter_matchers/equals_test.rb +1 -1
- data/test/unit/parameter_matchers/has_entries_test.rb +1 -1
- data/test/unit/parameter_matchers/has_entry_test.rb +1 -1
- data/test/unit/parameter_matchers/has_key_test.rb +20 -1
- data/test/unit/parameter_matchers/has_value_test.rb +21 -1
- data/test/unit/parameter_matchers/includes_test.rb +21 -2
- data/test/unit/parameter_matchers/instance_of_test.rb +1 -1
- data/test/unit/parameter_matchers/is_a_test.rb +1 -1
- data/test/unit/parameter_matchers/kind_of_test.rb +1 -1
- data/test/unit/parameter_matchers/not_test.rb +1 -1
- data/test/unit/parameter_matchers/regexp_matches_test.rb +22 -1
- data/test/unit/parameter_matchers/responds_with_test.rb +1 -1
- data/test/unit/parameter_matchers/yaml_equivalent_test.rb +1 -1
- data/test/unit/parameters_matcher_test.rb +1 -1
- data/test/unit/return_values_test.rb +1 -1
- data/test/unit/sequence_test.rb +1 -1
- data/test/unit/single_return_value_test.rb +1 -1
- data/test/unit/single_yield_test.rb +1 -1
- data/test/unit/state_machine_test.rb +1 -1
- data/test/unit/string_inspect_test.rb +1 -1
- data/test/unit/yield_parameters_test.rb +1 -1
- metadata +39 -13
data/test/unit/metaclass_test.rb
CHANGED
data/test/unit/mock_test.rb
CHANGED
data/test/unit/mockery_test.rb
CHANGED
data/test/unit/no_yields_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
2
|
require 'mocha/inspect'
|
3
3
|
require 'method_definer'
|
4
4
|
|
@@ -23,15 +23,16 @@ class ObjectInspectTest < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def test_should_use_underscored_id_instead_of_object_id_or_id_so_that_they_can_be_stubbed
|
26
|
+
calls = []
|
26
27
|
object = Object.new
|
27
|
-
object.
|
28
|
-
object.
|
29
|
-
object.replace_instance_method(:
|
30
|
-
|
31
|
-
|
32
|
-
end
|
28
|
+
object.replace_instance_method(:id) { calls << :id; return 1 } if RUBY_VERSION < '1.9'
|
29
|
+
object.replace_instance_method(:object_id) { calls << :object_id; return 1 }
|
30
|
+
object.replace_instance_method(:__id__) { calls << :__id__; return 1 }
|
31
|
+
object.replace_instance_method(:inspect) { "object-description" }
|
32
|
+
|
33
33
|
object.mocha_inspect
|
34
|
-
|
34
|
+
|
35
|
+
assert_equal [:__id__], calls.uniq
|
35
36
|
end
|
36
37
|
|
37
38
|
end
|
data/test/unit/object_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
2
|
|
3
3
|
require 'mocha/parameter_matchers/has_key'
|
4
4
|
require 'mocha/parameter_matchers/object'
|
@@ -33,4 +33,23 @@ class HasKeyTest < Test::Unit::TestCase
|
|
33
33
|
assert !matcher.matches?([{ :key_2 => 2 }])
|
34
34
|
end
|
35
35
|
|
36
|
+
def test_should_not_raise_error_on_empty_arguments
|
37
|
+
matcher = has_key(:key)
|
38
|
+
assert_nothing_raised { matcher.matches?([]) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_should_not_match_on_empty_arguments
|
42
|
+
matcher = has_key(:key)
|
43
|
+
assert !matcher.matches?([])
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_should_not_raise_error_on_argument_that_does_not_respond_to_keys
|
47
|
+
matcher = has_key(:key)
|
48
|
+
assert_nothing_raised { matcher.matches?([:key]) }
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_should_not_match_on_argument_that_does_not_respond_to_keys
|
52
|
+
matcher = has_key(:key)
|
53
|
+
assert !matcher.matches?([:key])
|
54
|
+
end
|
36
55
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
2
|
|
3
3
|
require 'mocha/parameter_matchers/has_value'
|
4
4
|
require 'mocha/parameter_matchers/object'
|
@@ -34,4 +34,24 @@ class HasValueTest < Test::Unit::TestCase
|
|
34
34
|
assert !matcher.matches?([{ :key_2 => 'value_2' }])
|
35
35
|
end
|
36
36
|
|
37
|
+
def test_should_not_raise_error_on_empty_arguments
|
38
|
+
matcher = has_value('value_1')
|
39
|
+
assert_nothing_raised { matcher.matches?([]) }
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_should_not_match_empty_arguments
|
43
|
+
matcher = has_value('value_1')
|
44
|
+
assert !matcher.matches?([])
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_not_raise_error_on_argument_that_does_not_respond_to_values
|
48
|
+
matcher = has_value('value_1')
|
49
|
+
assert_nothing_raised { matcher.matches?(['value_1']) }
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_not_match_on_argument_that_does_not_respond_to_values
|
53
|
+
matcher = has_value('value_1')
|
54
|
+
assert !matcher.matches?(['value_1'])
|
55
|
+
end
|
56
|
+
|
37
57
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
2
|
|
3
3
|
require 'mocha/parameter_matchers/includes'
|
4
4
|
require 'mocha/inspect'
|
@@ -21,5 +21,24 @@ class IncludesTest < Test::Unit::TestCase
|
|
21
21
|
matcher = includes(:x)
|
22
22
|
assert_equal "includes(:x)", matcher.mocha_inspect
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
|
+
def test_should_not_raise_error_on_emtpy_arguments
|
26
|
+
matcher = includes(:x)
|
27
|
+
assert_nothing_raised { matcher.matches?([]) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_should_not_match_on_empty_arguments
|
31
|
+
matcher = includes(:x)
|
32
|
+
assert !matcher.matches?([])
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_should_not_raise_error_on_argument_that_does_not_respond_to_include
|
36
|
+
matcher = includes(:x)
|
37
|
+
assert_nothing_raised { matcher.matches?([:x]) }
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_should_not_match_on_argument_that_does_not_respond_to_include
|
41
|
+
matcher = includes(:x)
|
42
|
+
assert !matcher.matches?([:x])
|
43
|
+
end
|
25
44
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.
|
1
|
+
require File.expand_path('../../../test_helper', __FILE__)
|
2
2
|
|
3
3
|
require 'mocha/parameter_matchers/regexp_matches'
|
4
4
|
require 'mocha/inspect'
|
@@ -22,4 +22,25 @@ class RegexpMatchesTest < Test::Unit::TestCase
|
|
22
22
|
assert_equal "regexp_matches(/oo/)", matcher.mocha_inspect
|
23
23
|
end
|
24
24
|
|
25
|
+
def test_should_not_raise_error_on_empty_arguments
|
26
|
+
matcher = regexp_matches(/oo/)
|
27
|
+
assert_nothing_raised { matcher.matches?([]) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_should_not_match_on_empty_arguments
|
31
|
+
matcher = regexp_matches(/oo/)
|
32
|
+
assert !matcher.matches?([])
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_should_not_raise_error_on_argument_that_does_not_respond_to_equals_tilde
|
36
|
+
object_not_responding_to_equals_tilde = Class.new { undef =~ }.new
|
37
|
+
matcher = regexp_matches(/oo/)
|
38
|
+
assert_nothing_raised { matcher.matches?([object_not_responding_to_equals_tilde]) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_should_not_match_on_argument_that_does_not_respond_to_equals_tilde
|
42
|
+
object_not_responding_to_equals_tilde = Class.new { undef =~ }.new
|
43
|
+
matcher = regexp_matches(/oo/)
|
44
|
+
assert !matcher.matches?([object_not_responding_to_equals_tilde])
|
45
|
+
end
|
25
46
|
end
|
data/test/unit/sequence_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jferris-mocha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 40201052224313
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 9
|
9
|
+
- 8
|
10
|
+
- 20100526112143
|
11
|
+
version: 0.9.8.20100526112143
|
5
12
|
platform: ruby
|
6
13
|
authors:
|
7
14
|
- James Mead
|
@@ -9,20 +16,24 @@ autorequire:
|
|
9
16
|
bindir: bin
|
10
17
|
cert_chain: []
|
11
18
|
|
12
|
-
date:
|
19
|
+
date: 2010-05-26 00:00:00 -04:00
|
13
20
|
default_executable:
|
14
21
|
dependencies:
|
15
22
|
- !ruby/object:Gem::Dependency
|
16
23
|
name: rake
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
20
27
|
requirements:
|
21
28
|
- - ">="
|
22
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
23
33
|
version: "0"
|
24
|
-
|
25
|
-
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
description: " Mocking and stubbing library with JMock/SchMock syntax, which allows mocking and stubbing of methods on real (non-mock) classes.\n"
|
26
37
|
email: mocha-developer@googlegroups.com
|
27
38
|
executables: []
|
28
39
|
|
@@ -50,11 +61,16 @@ files:
|
|
50
61
|
- lib/mocha/inspect.rb
|
51
62
|
- lib/mocha/instance_method.rb
|
52
63
|
- lib/mocha/integration/mini_test/assertion_counter.rb
|
53
|
-
- lib/mocha/integration/mini_test/
|
64
|
+
- lib/mocha/integration/mini_test/exception_translation.rb
|
65
|
+
- lib/mocha/integration/mini_test/version_13.rb
|
66
|
+
- lib/mocha/integration/mini_test/version_140.rb
|
67
|
+
- lib/mocha/integration/mini_test/version_141.rb
|
68
|
+
- lib/mocha/integration/mini_test/version_142_and_above.rb
|
54
69
|
- lib/mocha/integration/mini_test.rb
|
55
70
|
- lib/mocha/integration/test_unit/assertion_counter.rb
|
56
71
|
- lib/mocha/integration/test_unit/gem_version_200.rb
|
57
|
-
- lib/mocha/integration/test_unit/
|
72
|
+
- lib/mocha/integration/test_unit/gem_version_201_to_202.rb
|
73
|
+
- lib/mocha/integration/test_unit/gem_version_203_to_207.rb
|
58
74
|
- lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
|
59
75
|
- lib/mocha/integration/test_unit/ruby_version_186_and_above.rb
|
60
76
|
- lib/mocha/integration/test_unit.rb
|
@@ -148,6 +164,7 @@ files:
|
|
148
164
|
- test/execution_point.rb
|
149
165
|
- test/matcher_helpers.rb
|
150
166
|
- test/method_definer.rb
|
167
|
+
- test/mini_test_result.rb
|
151
168
|
- test/simple_counter.rb
|
152
169
|
- test/test_helper.rb
|
153
170
|
- test/test_runner.rb
|
@@ -159,6 +176,7 @@ files:
|
|
159
176
|
- test/unit/central_test.rb
|
160
177
|
- test/unit/change_state_side_effect_test.rb
|
161
178
|
- test/unit/class_method_test.rb
|
179
|
+
- test/unit/configuration_test.rb
|
162
180
|
- test/unit/date_time_inspect_test.rb
|
163
181
|
- test/unit/exception_raiser_test.rb
|
164
182
|
- test/unit/expectation_list_test.rb
|
@@ -210,6 +228,8 @@ files:
|
|
210
228
|
- RELEASE
|
211
229
|
has_rdoc: true
|
212
230
|
homepage: http://mocha.rubyforge.org
|
231
|
+
licenses: []
|
232
|
+
|
213
233
|
post_install_message:
|
214
234
|
rdoc_options:
|
215
235
|
- --title
|
@@ -220,23 +240,29 @@ rdoc_options:
|
|
220
240
|
require_paths:
|
221
241
|
- lib
|
222
242
|
required_ruby_version: !ruby/object:Gem::Requirement
|
243
|
+
none: false
|
223
244
|
requirements:
|
224
245
|
- - ">="
|
225
246
|
- !ruby/object:Gem::Version
|
247
|
+
hash: 3
|
248
|
+
segments:
|
249
|
+
- 0
|
226
250
|
version: "0"
|
227
|
-
version:
|
228
251
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
252
|
+
none: false
|
229
253
|
requirements:
|
230
254
|
- - ">="
|
231
255
|
- !ruby/object:Gem::Version
|
256
|
+
hash: 3
|
257
|
+
segments:
|
258
|
+
- 0
|
232
259
|
version: "0"
|
233
|
-
version:
|
234
260
|
requirements: []
|
235
261
|
|
236
262
|
rubyforge_project: mocha
|
237
|
-
rubygems_version: 1.
|
263
|
+
rubygems_version: 1.3.7
|
238
264
|
signing_key:
|
239
|
-
specification_version:
|
265
|
+
specification_version: 3
|
240
266
|
summary: Mocking and stubbing library
|
241
267
|
test_files: []
|
242
268
|
|