mocha 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -1
- data/lib/mocha/mock.rb +1 -0
- data/test/unit/class_method_test.rb +13 -13
- data/test/unit/infinite_range_test.rb +2 -2
- data/test/unit/mock_test.rb +4 -4
- metadata +71 -71
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rake/testtask'
|
|
5
5
|
require 'rake/contrib/sshpublisher'
|
6
6
|
|
7
7
|
module Mocha
|
8
|
-
VERSION = "0.5.
|
8
|
+
VERSION = "0.5.1"
|
9
9
|
end
|
10
10
|
|
11
11
|
desc "Run all tests"
|
@@ -18,6 +18,7 @@ Rake::TestTask.new(:test_unit) do |t|
|
|
18
18
|
t.libs << 'test'
|
19
19
|
t.test_files = FileList['test/unit/**/*_test.rb']
|
20
20
|
t.verbose = true
|
21
|
+
t.warning = true
|
21
22
|
end
|
22
23
|
|
23
24
|
desc "Run integration tests"
|
@@ -25,6 +26,7 @@ Rake::TestTask.new(:test_integration) do |t|
|
|
25
26
|
t.libs << 'test'
|
26
27
|
t.test_files = FileList['test/integration/*_test.rb']
|
27
28
|
t.verbose = true
|
29
|
+
t.warning = true
|
28
30
|
end
|
29
31
|
|
30
32
|
desc "Run acceptance tests"
|
@@ -32,6 +34,7 @@ Rake::TestTask.new(:test_acceptance) do |t|
|
|
32
34
|
t.libs << 'test'
|
33
35
|
t.test_files = FileList['test/acceptance/*_test.rb']
|
34
36
|
t.verbose = true
|
37
|
+
t.warning = true
|
35
38
|
end
|
36
39
|
|
37
40
|
desc 'Generate RDoc'
|
data/lib/mocha/mock.rb
CHANGED
@@ -10,47 +10,47 @@ class ClassMethodTest < Test::Unit::TestCase
|
|
10
10
|
|
11
11
|
def test_should_provide_hidden_version_of_method_name_starting_with_prefix
|
12
12
|
method = ClassMethod.new(nil, :original_method_name)
|
13
|
-
assert_match
|
13
|
+
assert_match(/^__stubba__/, method.hidden_method)
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_should_provide_hidden_version_of_method_name_ending_with_suffix
|
17
17
|
method = ClassMethod.new(nil, :original_method_name)
|
18
|
-
assert_match
|
18
|
+
assert_match(/__stubba__$/, method.hidden_method)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_should_provide_hidden_version_of_method_name_including_original_method_name
|
22
22
|
method = ClassMethod.new(nil, :original_method_name)
|
23
|
-
assert_match
|
23
|
+
assert_match(/original_method_name/, method.hidden_method)
|
24
24
|
end
|
25
25
|
|
26
26
|
def test_should_provide_hidden_version_of_method_name_substituting_question_mark
|
27
27
|
method = ClassMethod.new(nil, :question_mark?)
|
28
|
-
assert_no_match
|
29
|
-
assert_match
|
28
|
+
assert_no_match(/\?/, method.hidden_method)
|
29
|
+
assert_match(/question_mark_substituted_character_63/, method.hidden_method)
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_should_provide_hidden_version_of_method_name_substituting_exclamation_mark
|
33
33
|
method = ClassMethod.new(nil, :exclamation_mark!)
|
34
|
-
assert_no_match
|
35
|
-
assert_match
|
34
|
+
assert_no_match(/!/, method.hidden_method)
|
35
|
+
assert_match(/exclamation_mark_substituted_character_33/, method.hidden_method)
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_should_provide_hidden_version_of_method_name_substituting_equals_sign
|
39
39
|
method = ClassMethod.new(nil, :equals_sign=)
|
40
|
-
assert_no_match
|
41
|
-
assert_match
|
40
|
+
assert_no_match(/\=/, method.hidden_method)
|
41
|
+
assert_match(/equals_sign_substituted_character_61/, method.hidden_method)
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_should_provide_hidden_version_of_method_name_substituting_brackets
|
45
45
|
method = ClassMethod.new(nil, :[])
|
46
|
-
assert_no_match
|
47
|
-
assert_match
|
46
|
+
assert_no_match(/\[\]/, method.hidden_method)
|
47
|
+
assert_match(/substituted_character_91__substituted_character_93/, method.hidden_method)
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_should_provide_hidden_version_of_method_name_substituting_plus_sign
|
51
51
|
method = ClassMethod.new(nil, :+)
|
52
|
-
assert_no_match
|
53
|
-
assert_match
|
52
|
+
assert_no_match(/\+/, method.hidden_method)
|
53
|
+
assert_match(/substituted_character_43/, method.hidden_method)
|
54
54
|
end
|
55
55
|
|
56
56
|
def test_should_hide_original_method
|
@@ -40,8 +40,8 @@ class InfiniteRangeTest < Test::Unit::TestCase
|
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_should_be_same_as_standard_to_string
|
43
|
-
assert_equal
|
44
|
-
assert_equal
|
43
|
+
assert_equal((1..10).to_s, (1..10).mocha_inspect)
|
44
|
+
assert_equal((1...10).to_s, (1...10).mocha_inspect)
|
45
45
|
date_range = Range.new(Date.parse('2006-01-01'), Date.parse('2007-01-01'))
|
46
46
|
assert_equal date_range.to_s, date_range.mocha_inspect
|
47
47
|
end
|
data/test/unit/mock_test.rb
CHANGED
@@ -147,9 +147,9 @@ class MockTest < Test::Unit::TestCase
|
|
147
147
|
error = assert_raise(ExpectationError) do
|
148
148
|
mock.unexpected_method_called(:my_method, :argument1, :argument2)
|
149
149
|
end
|
150
|
-
assert_match
|
151
|
-
assert_match
|
152
|
-
assert_match
|
150
|
+
assert_match(/my_method/, error.message)
|
151
|
+
assert_match(/argument1/, error.message)
|
152
|
+
assert_match(/argument2/, error.message)
|
153
153
|
end
|
154
154
|
|
155
155
|
def test_should_indicate_unexpected_method_called
|
@@ -344,7 +344,7 @@ class MockTest < Test::Unit::TestCase
|
|
344
344
|
begin
|
345
345
|
mock.invoked_method
|
346
346
|
rescue NoMethodError => e
|
347
|
-
assert_match
|
347
|
+
assert_match(/which responds like mocha_inspect/, e.message)
|
348
348
|
end
|
349
349
|
end
|
350
350
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
|
|
3
3
|
specification_version: 1
|
4
4
|
name: mocha
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2007-06-
|
6
|
+
version: 0.5.1
|
7
|
+
date: 2007-06-15 00:00:00 +01:00
|
8
8
|
summary: Mocking and stubbing library
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -29,99 +29,99 @@ post_install_message:
|
|
29
29
|
authors:
|
30
30
|
- James Mead
|
31
31
|
files:
|
32
|
-
- lib/
|
33
|
-
- lib/stubba.rb
|
34
|
-
- lib/mocha.rb
|
35
|
-
- lib/mocha/no_yields.rb
|
36
|
-
- lib/mocha/stub.rb
|
37
|
-
- lib/mocha/setup_and_teardown.rb
|
38
|
-
- lib/mocha/infinite_range.rb
|
39
|
-
- lib/mocha/expectation.rb
|
40
|
-
- lib/mocha/standalone.rb
|
41
|
-
- lib/mocha/central.rb
|
42
|
-
- lib/mocha/inspect.rb
|
43
|
-
- lib/mocha/mock.rb
|
44
|
-
- lib/mocha/parameter_matchers.rb
|
45
|
-
- lib/mocha/yield_parameters.rb
|
46
|
-
- lib/mocha/expectation_error.rb
|
32
|
+
- lib/mocha/any_instance_method.rb
|
47
33
|
- lib/mocha/auto_verify.rb
|
34
|
+
- lib/mocha/central.rb
|
35
|
+
- lib/mocha/class_method.rb
|
48
36
|
- lib/mocha/deprecation.rb
|
49
|
-
- lib/mocha/return_values.rb
|
50
37
|
- lib/mocha/exception_raiser.rb
|
51
|
-
- lib/mocha/
|
38
|
+
- lib/mocha/expectation.rb
|
39
|
+
- lib/mocha/expectation_error.rb
|
40
|
+
- lib/mocha/infinite_range.rb
|
41
|
+
- lib/mocha/inspect.rb
|
52
42
|
- lib/mocha/instance_method.rb
|
53
|
-
- lib/mocha/class_method.rb
|
54
|
-
- lib/mocha/object.rb
|
55
|
-
- lib/mocha/pretty_parameters.rb
|
56
|
-
- lib/mocha/single_yield.rb
|
57
|
-
- lib/mocha/any_instance_method.rb
|
58
|
-
- lib/mocha/test_case_adapter.rb
|
59
43
|
- lib/mocha/is_a.rb
|
60
|
-
- lib/mocha/missing_expectation.rb
|
61
44
|
- lib/mocha/metaclass.rb
|
62
|
-
- lib/mocha/
|
45
|
+
- lib/mocha/missing_expectation.rb
|
46
|
+
- lib/mocha/mock.rb
|
47
|
+
- lib/mocha/multiple_yields.rb
|
48
|
+
- lib/mocha/no_yields.rb
|
49
|
+
- lib/mocha/object.rb
|
50
|
+
- lib/mocha/parameter_matchers/all_of.rb
|
51
|
+
- lib/mocha/parameter_matchers/any_of.rb
|
63
52
|
- lib/mocha/parameter_matchers/anything.rb
|
53
|
+
- lib/mocha/parameter_matchers/has_entry.rb
|
64
54
|
- lib/mocha/parameter_matchers/has_key.rb
|
65
|
-
- lib/mocha/parameter_matchers/includes.rb
|
66
55
|
- lib/mocha/parameter_matchers/has_value.rb
|
67
|
-
- lib/mocha/parameter_matchers/
|
68
|
-
- lib/mocha/parameter_matchers
|
69
|
-
- lib/mocha/
|
70
|
-
-
|
71
|
-
-
|
56
|
+
- lib/mocha/parameter_matchers/includes.rb
|
57
|
+
- lib/mocha/parameter_matchers.rb
|
58
|
+
- lib/mocha/pretty_parameters.rb
|
59
|
+
- lib/mocha/return_values.rb
|
60
|
+
- lib/mocha/setup_and_teardown.rb
|
61
|
+
- lib/mocha/single_return_value.rb
|
62
|
+
- lib/mocha/single_yield.rb
|
63
|
+
- lib/mocha/standalone.rb
|
64
|
+
- lib/mocha/stub.rb
|
65
|
+
- lib/mocha/test_case_adapter.rb
|
66
|
+
- lib/mocha/yield_parameters.rb
|
67
|
+
- lib/mocha.rb
|
68
|
+
- lib/mocha_standalone.rb
|
69
|
+
- lib/stubba.rb
|
70
|
+
- test/acceptance/mocha_acceptance_test.rb
|
71
|
+
- test/acceptance/mocked_methods_dispatch_acceptance_test.rb
|
72
|
+
- test/acceptance/parameter_matcher_acceptance_test.rb
|
73
|
+
- test/acceptance/standalone_acceptance_test.rb
|
74
|
+
- test/acceptance/stubba_acceptance_test.rb
|
72
75
|
- test/active_record_test_case.rb
|
73
76
|
- test/deprecation_disabler.rb
|
74
|
-
- test/
|
77
|
+
- test/execution_point.rb
|
78
|
+
- test/integration/mocha_test_result_integration_test.rb
|
79
|
+
- test/integration/stubba_integration_test.rb
|
80
|
+
- test/integration/stubba_test_result_integration_test.rb
|
75
81
|
- test/method_definer.rb
|
82
|
+
- test/test_helper.rb
|
83
|
+
- test/test_runner.rb
|
84
|
+
- test/unit/any_instance_method_test.rb
|
85
|
+
- test/unit/array_inspect_test.rb
|
86
|
+
- test/unit/auto_verify_test.rb
|
87
|
+
- test/unit/central_test.rb
|
88
|
+
- test/unit/class_method_test.rb
|
76
89
|
- test/unit/date_time_inspect_test.rb
|
77
|
-
- test/unit/infinite_range_test.rb
|
78
|
-
- test/unit/expectation_test.rb
|
79
|
-
- test/unit/setup_and_teardown_test.rb
|
80
90
|
- test/unit/expectation_raiser_test.rb
|
81
|
-
- test/unit/
|
91
|
+
- test/unit/expectation_test.rb
|
92
|
+
- test/unit/hash_inspect_test.rb
|
93
|
+
- test/unit/infinite_range_test.rb
|
94
|
+
- test/unit/metaclass_test.rb
|
95
|
+
- test/unit/missing_expectation_test.rb
|
82
96
|
- test/unit/mock_test.rb
|
83
|
-
- test/unit/yield_parameters_test.rb
|
84
|
-
- test/unit/object_inspect_test.rb
|
85
|
-
- test/unit/string_inspect_test.rb
|
86
|
-
- test/unit/auto_verify_test.rb
|
87
|
-
- test/unit/return_values_test.rb
|
88
|
-
- test/unit/no_yield_test.rb
|
89
|
-
- test/unit/array_inspect_test.rb
|
90
97
|
- test/unit/multiple_yields_test.rb
|
91
|
-
- test/unit/
|
98
|
+
- test/unit/no_yield_test.rb
|
99
|
+
- test/unit/object_inspect_test.rb
|
92
100
|
- test/unit/object_test.rb
|
93
|
-
- test/unit/
|
94
|
-
- test/unit/
|
95
|
-
- test/unit/pretty_parameters_test.rb
|
96
|
-
- test/unit/any_instance_method_test.rb
|
97
|
-
- test/unit/missing_expectation_test.rb
|
98
|
-
- test/unit/metaclass_test.rb
|
99
|
-
- test/unit/single_return_value_test.rb
|
100
|
-
- test/unit/stub_test.rb
|
101
|
-
- test/unit/parameter_matchers/has_value_test.rb
|
101
|
+
- test/unit/parameter_matchers/all_of_test.rb
|
102
|
+
- test/unit/parameter_matchers/any_of_test.rb
|
102
103
|
- test/unit/parameter_matchers/anything_test.rb
|
103
|
-
- test/unit/parameter_matchers/
|
104
|
+
- test/unit/parameter_matchers/has_entry_test.rb
|
104
105
|
- test/unit/parameter_matchers/has_key_test.rb
|
106
|
+
- test/unit/parameter_matchers/has_value_test.rb
|
105
107
|
- test/unit/parameter_matchers/includes_test.rb
|
106
|
-
- test/unit/parameter_matchers/
|
107
|
-
- test/unit/
|
108
|
-
- test/unit/
|
109
|
-
- test/
|
110
|
-
- test/
|
111
|
-
- test/
|
112
|
-
- test/
|
113
|
-
- test/
|
114
|
-
- test/
|
115
|
-
- test/acceptance/mocked_methods_dispatch_acceptance_test.rb
|
116
|
-
- test/acceptance/mocha_acceptance_test.rb
|
117
|
-
- examples/stubba.rb
|
118
|
-
- examples/mocha.rb
|
108
|
+
- test/unit/parameter_matchers/stub_matcher.rb
|
109
|
+
- test/unit/pretty_parameters_test.rb
|
110
|
+
- test/unit/return_values_test.rb
|
111
|
+
- test/unit/setup_and_teardown_test.rb
|
112
|
+
- test/unit/single_return_value_test.rb
|
113
|
+
- test/unit/single_yield_test.rb
|
114
|
+
- test/unit/string_inspect_test.rb
|
115
|
+
- test/unit/stub_test.rb
|
116
|
+
- test/unit/yield_parameters_test.rb
|
119
117
|
- examples/misc.rb
|
118
|
+
- examples/mocha.rb
|
119
|
+
- examples/stubba.rb
|
120
|
+
- COPYING
|
120
121
|
- MIT-LICENSE
|
121
|
-
- RELEASE
|
122
122
|
- Rakefile
|
123
|
-
- COPYING
|
124
123
|
- README
|
124
|
+
- RELEASE
|
125
125
|
test_files: []
|
126
126
|
|
127
127
|
rdoc_options:
|