mocha 0.10.5 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/FUNDING.yml +1 -0
- data/.rubocop.yml +61 -0
- data/.rubocop_todo.yml +27 -0
- data/.yardopts +24 -0
- data/CONTRIBUTING.md +7 -0
- data/COPYING.md +3 -0
- data/Gemfile +2 -2
- data/{MIT-LICENSE.rdoc → MIT-LICENSE.md} +1 -1
- data/README.md +363 -0
- data/{RELEASE.rdoc → RELEASE.md} +436 -35
- data/Rakefile +87 -87
- data/gemfiles/Gemfile.minitest.latest +2 -2
- data/gemfiles/Gemfile.test-unit.latest +6 -2
- data/init.rb +1 -3
- data/lib/mocha/any_instance_method.rb +12 -45
- data/lib/mocha/api.rb +199 -131
- data/lib/mocha/argument_iterator.rb +6 -10
- data/lib/mocha/backtrace_filter.rb +1 -5
- data/lib/mocha/block_matcher.rb +31 -0
- data/lib/mocha/cardinality.rb +77 -66
- data/lib/mocha/central.rb +27 -18
- data/lib/mocha/change_state_side_effect.rb +3 -7
- data/lib/mocha/class_methods.rb +62 -0
- data/lib/mocha/configuration.rb +399 -46
- data/lib/mocha/debug.rb +12 -0
- data/lib/mocha/deprecation.rb +11 -12
- data/lib/mocha/detection/mini_test.rb +23 -0
- data/lib/mocha/detection/test_unit.rb +27 -0
- data/lib/mocha/error_with_filtered_backtrace.rb +13 -0
- data/lib/mocha/exception_raiser.rb +8 -10
- data/lib/mocha/expectation.rb +290 -151
- data/lib/mocha/expectation_error.rb +6 -13
- data/lib/mocha/expectation_error_factory.rb +35 -0
- data/lib/mocha/expectation_list.rb +22 -22
- data/lib/mocha/hooks.rb +42 -0
- data/lib/mocha/in_state_ordering_constraint.rb +3 -7
- data/lib/mocha/inspect.rb +35 -43
- data/lib/mocha/instance_method.rb +12 -21
- data/lib/mocha/integration/assertion_counter.rb +13 -0
- data/lib/mocha/integration/mini_test/adapter.rb +52 -0
- data/lib/mocha/integration/mini_test/exception_translation.rb +1 -7
- data/lib/mocha/integration/mini_test/nothing.rb +19 -0
- data/lib/mocha/integration/mini_test/version_13.rb +35 -25
- data/lib/mocha/integration/mini_test/version_140.rb +35 -26
- data/lib/mocha/integration/mini_test/version_141.rb +43 -34
- data/lib/mocha/integration/mini_test/version_142_to_172.rb +44 -35
- data/lib/mocha/integration/mini_test/version_200.rb +45 -36
- data/lib/mocha/integration/mini_test/version_201_to_222.rb +44 -35
- data/lib/mocha/integration/mini_test/version_2110_to_2111.rb +70 -0
- data/lib/mocha/integration/mini_test/version_2112_to_320.rb +73 -0
- data/lib/mocha/integration/mini_test/version_230_to_2101.rb +68 -0
- data/lib/mocha/integration/mini_test.rb +51 -49
- data/lib/mocha/integration/monkey_patcher.rb +24 -0
- data/lib/mocha/integration/test_unit/adapter.rb +50 -0
- data/lib/mocha/integration/test_unit/gem_version_200.rb +39 -29
- data/lib/mocha/integration/test_unit/gem_version_201_to_202.rb +39 -29
- data/lib/mocha/integration/test_unit/gem_version_203_to_220.rb +39 -29
- data/lib/mocha/integration/test_unit/gem_version_230_to_250.rb +68 -0
- data/lib/mocha/integration/test_unit/nothing.rb +19 -0
- data/lib/mocha/integration/test_unit/ruby_version_185_and_below.rb +39 -29
- data/lib/mocha/integration/test_unit/ruby_version_186_and_above.rb +40 -30
- data/lib/mocha/integration/test_unit.rb +45 -51
- data/lib/mocha/integration.rb +6 -33
- data/lib/mocha/invocation.rb +77 -0
- data/lib/mocha/is_a.rb +0 -2
- data/lib/mocha/logger.rb +2 -6
- data/lib/mocha/macos_version.rb +5 -0
- data/lib/mocha/method_matcher.rb +6 -10
- data/lib/mocha/minitest.rb +8 -0
- data/lib/mocha/mock.rb +266 -79
- data/lib/mocha/mockery.rb +104 -106
- data/lib/mocha/names.rb +10 -20
- data/lib/mocha/not_initialized_error.rb +7 -0
- data/lib/mocha/object_methods.rb +169 -0
- data/lib/mocha/parameter_matchers/all_of.rb +18 -14
- data/lib/mocha/parameter_matchers/any_of.rb +19 -14
- data/lib/mocha/parameter_matchers/any_parameters.rb +14 -13
- data/lib/mocha/parameter_matchers/anything.rb +17 -14
- data/lib/mocha/parameter_matchers/base.rb +33 -31
- data/lib/mocha/parameter_matchers/equals.rb +18 -13
- data/lib/mocha/parameter_matchers/equivalent_uri.rb +58 -0
- data/lib/mocha/parameter_matchers/has_entries.rb +19 -14
- data/lib/mocha/parameter_matchers/has_entry.rb +58 -26
- data/lib/mocha/parameter_matchers/has_key.rb +18 -13
- data/lib/mocha/parameter_matchers/has_keys.rb +53 -0
- data/lib/mocha/parameter_matchers/has_value.rb +18 -13
- data/lib/mocha/parameter_matchers/includes.rb +80 -19
- data/lib/mocha/parameter_matchers/instance_methods.rb +18 -0
- data/lib/mocha/parameter_matchers/instance_of.rb +18 -13
- data/lib/mocha/parameter_matchers/is_a.rb +20 -14
- data/lib/mocha/parameter_matchers/kind_of.rb +20 -13
- data/lib/mocha/parameter_matchers/not.rb +19 -14
- data/lib/mocha/parameter_matchers/optionally.rb +23 -17
- data/lib/mocha/parameter_matchers/regexp_matches.rb +16 -12
- data/lib/mocha/parameter_matchers/responds_with.rb +17 -11
- data/lib/mocha/parameter_matchers/yaml_equivalent.rb +15 -9
- data/lib/mocha/parameter_matchers.rb +4 -5
- data/lib/mocha/parameters_matcher.rb +11 -14
- data/lib/mocha/raised_exception.rb +11 -0
- data/lib/mocha/receivers.rb +45 -0
- data/lib/mocha/return_values.rb +11 -15
- data/lib/mocha/ruby_version.rb +4 -0
- data/lib/mocha/sequence.rb +21 -17
- data/lib/mocha/setup.rb +14 -0
- data/lib/mocha/single_return_value.rb +5 -8
- data/lib/mocha/singleton_class.rb +9 -0
- data/lib/mocha/state_machine.rb +69 -67
- data/lib/mocha/stubbed_method.rb +125 -0
- data/lib/mocha/stubbing_error.rb +6 -14
- data/lib/mocha/test_unit.rb +8 -0
- data/lib/mocha/thrower.rb +6 -8
- data/lib/mocha/thrown_object.rb +12 -0
- data/lib/mocha/version.rb +1 -1
- data/lib/mocha/yield_parameters.rb +12 -22
- data/lib/mocha.rb +8 -3
- data/mocha.gemspec +43 -34
- data/yard-templates/default/layout/html/google_analytics.erb +8 -0
- data/yard-templates/default/layout/html/setup.rb +5 -0
- metadata +123 -268
- data/COPYING.rdoc +0 -3
- data/README.rdoc +0 -54
- data/examples/misc.rb +0 -43
- data/examples/mocha.rb +0 -25
- data/examples/stubba.rb +0 -64
- data/gemfiles/Gemfile.minitest.1.3.0 +0 -7
- data/gemfiles/Gemfile.minitest.1.4.0 +0 -7
- data/gemfiles/Gemfile.minitest.1.4.1 +0 -7
- data/gemfiles/Gemfile.minitest.1.4.2 +0 -7
- data/gemfiles/Gemfile.minitest.2.0.0 +0 -7
- data/gemfiles/Gemfile.minitest.2.0.1 +0 -7
- data/gemfiles/Gemfile.minitest.2.3.0 +0 -7
- data/gemfiles/Gemfile.test-unit.2.0.0 +0 -8
- data/gemfiles/Gemfile.test-unit.2.0.1 +0 -7
- data/gemfiles/Gemfile.test-unit.2.0.3 +0 -7
- data/lib/mocha/class_method.rb +0 -98
- data/lib/mocha/integration/mini_test/assertion_counter.rb +0 -23
- data/lib/mocha/integration/mini_test/version_230_to_262.rb +0 -59
- data/lib/mocha/integration/test_unit/assertion_counter.rb +0 -23
- data/lib/mocha/integration/test_unit/gem_version_230_to_240.rb +0 -58
- data/lib/mocha/module_method.rb +0 -16
- data/lib/mocha/multiple_yields.rb +0 -20
- data/lib/mocha/no_yields.rb +0 -11
- data/lib/mocha/object.rb +0 -223
- data/lib/mocha/options.rb +0 -1
- data/lib/mocha/parameter_matchers/object.rb +0 -15
- data/lib/mocha/parameter_matchers/query_string.rb +0 -47
- data/lib/mocha/pretty_parameters.rb +0 -28
- data/lib/mocha/single_yield.rb +0 -18
- data/lib/mocha/standalone.rb +0 -1
- data/lib/mocha/unexpected_invocation.rb +0 -18
- data/lib/mocha_standalone.rb +0 -2
- data/lib/stubba.rb +0 -4
- data/test/acceptance/acceptance_test_helper.rb +0 -41
- data/test/acceptance/api_test.rb +0 -139
- data/test/acceptance/bug_18914_test.rb +0 -43
- data/test/acceptance/bug_21465_test.rb +0 -34
- data/test/acceptance/bug_21563_test.rb +0 -25
- data/test/acceptance/exception_rescue_test.rb +0 -55
- data/test/acceptance/expectations_on_multiple_methods_test.rb +0 -55
- data/test/acceptance/expected_invocation_count_test.rb +0 -232
- data/test/acceptance/failure_messages_test.rb +0 -64
- data/test/acceptance/issue_65_test.rb +0 -63
- data/test/acceptance/issue_70_test.rb +0 -55
- data/test/acceptance/minitest_test.rb +0 -162
- data/test/acceptance/mocha_example_test.rb +0 -98
- data/test/acceptance/mocha_test_result_test.rb +0 -84
- data/test/acceptance/mock_test.rb +0 -100
- data/test/acceptance/mock_with_initializer_block_test.rb +0 -51
- data/test/acceptance/mocked_methods_dispatch_test.rb +0 -78
- data/test/acceptance/multiple_expectations_failure_message_test.rb +0 -68
- data/test/acceptance/optional_parameters_test.rb +0 -70
- data/test/acceptance/parameter_matcher_test.rb +0 -300
- data/test/acceptance/partial_mocks_test.rb +0 -47
- data/test/acceptance/raise_exception_test.rb +0 -39
- data/test/acceptance/return_value_test.rb +0 -52
- data/test/acceptance/sequence_test.rb +0 -192
- data/test/acceptance/states_test.rb +0 -70
- data/test/acceptance/stub_any_instance_method_test.rb +0 -198
- data/test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb +0 -106
- data/test/acceptance/stub_class_method_defined_on_class_test.rb +0 -72
- data/test/acceptance/stub_class_method_defined_on_module_test.rb +0 -75
- data/test/acceptance/stub_class_method_defined_on_superclass_test.rb +0 -75
- data/test/acceptance/stub_everything_test.rb +0 -56
- data/test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb +0 -93
- data/test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb +0 -69
- data/test/acceptance/stub_instance_method_defined_on_class_test.rb +0 -66
- data/test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb +0 -75
- data/test/acceptance/stub_instance_method_defined_on_module_test.rb +0 -75
- data/test/acceptance/stub_instance_method_defined_on_object_class_test.rb +0 -75
- data/test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb +0 -70
- data/test/acceptance/stub_instance_method_defined_on_superclass_test.rb +0 -72
- data/test/acceptance/stub_module_method_test.rb +0 -163
- data/test/acceptance/stub_test.rb +0 -52
- data/test/acceptance/stubba_example_test.rb +0 -102
- data/test/acceptance/stubba_test.rb +0 -15
- data/test/acceptance/stubba_test_result_test.rb +0 -66
- data/test/acceptance/stubbing_error_backtrace_test.rb +0 -64
- data/test/acceptance/stubbing_method_unnecessarily_test.rb +0 -65
- data/test/acceptance/stubbing_non_existent_any_instance_method_test.rb +0 -130
- data/test/acceptance/stubbing_non_existent_class_method_test.rb +0 -157
- data/test/acceptance/stubbing_non_existent_instance_method_test.rb +0 -147
- data/test/acceptance/stubbing_non_public_any_instance_method_test.rb +0 -130
- data/test/acceptance/stubbing_non_public_class_method_test.rb +0 -163
- data/test/acceptance/stubbing_non_public_instance_method_test.rb +0 -143
- data/test/acceptance/stubbing_on_non_mock_object_test.rb +0 -64
- data/test/acceptance/throw_test.rb +0 -45
- data/test/acceptance/unstubbing_test.rb +0 -151
- data/test/deprecation_disabler.rb +0 -15
- data/test/execution_point.rb +0 -36
- data/test/method_definer.rb +0 -24
- data/test/mini_test_result.rb +0 -83
- data/test/simple_counter.rb +0 -13
- data/test/test_helper.rb +0 -11
- data/test/test_runner.rb +0 -50
- data/test/unit/any_instance_method_test.rb +0 -136
- data/test/unit/array_inspect_test.rb +0 -16
- data/test/unit/backtrace_filter_test.rb +0 -19
- data/test/unit/cardinality_test.rb +0 -56
- data/test/unit/central_test.rb +0 -100
- data/test/unit/change_state_side_effect_test.rb +0 -41
- data/test/unit/class_method_test.rb +0 -260
- data/test/unit/configuration_test.rb +0 -38
- data/test/unit/date_time_inspect_test.rb +0 -21
- data/test/unit/exception_raiser_test.rb +0 -42
- data/test/unit/expectation_list_test.rb +0 -71
- data/test/unit/expectation_test.rb +0 -480
- data/test/unit/hash_inspect_test.rb +0 -16
- data/test/unit/in_state_ordering_constraint_test.rb +0 -43
- data/test/unit/method_matcher_test.rb +0 -23
- data/test/unit/mock_test.rb +0 -312
- data/test/unit/mockery_test.rb +0 -150
- data/test/unit/multiple_yields_test.rb +0 -18
- data/test/unit/no_yields_test.rb +0 -18
- data/test/unit/object_inspect_test.rb +0 -38
- data/test/unit/object_test.rb +0 -87
- data/test/unit/parameter_matchers/all_of_test.rb +0 -26
- data/test/unit/parameter_matchers/any_of_test.rb +0 -26
- data/test/unit/parameter_matchers/anything_test.rb +0 -21
- data/test/unit/parameter_matchers/equals_test.rb +0 -25
- data/test/unit/parameter_matchers/has_entries_test.rb +0 -51
- data/test/unit/parameter_matchers/has_entry_test.rb +0 -96
- data/test/unit/parameter_matchers/has_key_test.rb +0 -55
- data/test/unit/parameter_matchers/has_value_test.rb +0 -57
- data/test/unit/parameter_matchers/includes_test.rb +0 -44
- data/test/unit/parameter_matchers/instance_of_test.rb +0 -25
- data/test/unit/parameter_matchers/is_a_test.rb +0 -25
- data/test/unit/parameter_matchers/kind_of_test.rb +0 -25
- data/test/unit/parameter_matchers/not_test.rb +0 -26
- data/test/unit/parameter_matchers/regexp_matches_test.rb +0 -46
- data/test/unit/parameter_matchers/responds_with_test.rb +0 -25
- data/test/unit/parameter_matchers/stub_matcher.rb +0 -27
- data/test/unit/parameter_matchers/yaml_equivalent_test.rb +0 -25
- data/test/unit/parameters_matcher_test.rb +0 -121
- data/test/unit/return_values_test.rb +0 -63
- data/test/unit/sequence_test.rb +0 -104
- data/test/unit/single_return_value_test.rb +0 -14
- data/test/unit/single_yield_test.rb +0 -18
- data/test/unit/state_machine_test.rb +0 -98
- data/test/unit/string_inspect_test.rb +0 -11
- data/test/unit/thrower_test.rb +0 -20
- data/test/unit/yield_parameters_test.rb +0 -93
data/lib/mocha.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
1
|
require 'mocha/version'
|
2
|
-
require '
|
3
|
-
require 'mocha/
|
4
|
-
|
2
|
+
require 'mocha/ruby_version'
|
3
|
+
require 'mocha/deprecation'
|
4
|
+
|
5
|
+
if Mocha::PRE_RUBY_V19
|
6
|
+
Mocha::Deprecation.warning(
|
7
|
+
'Versions of Ruby earlier than v1.9 will not be supported in future versions of Mocha.'
|
8
|
+
)
|
9
|
+
end
|
data/mocha.gemspec
CHANGED
@@ -1,46 +1,55 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
lib = File.expand_path('../lib/', __FILE__)
|
3
2
|
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require 'mocha/version'
|
5
4
|
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
5
|
+
Gem::Specification.new do |s| # rubocop:disable Metrics/BlockLength
|
6
|
+
s.name = 'mocha'
|
8
7
|
s.version = Mocha::VERSION
|
8
|
+
s.licenses = ['MIT', 'BSD-2-Clause']
|
9
|
+
s.required_ruby_version = '>= 1.8.7'
|
9
10
|
|
10
|
-
s.
|
11
|
-
s.
|
12
|
-
s.
|
13
|
-
s.email = "mocha-developer@googlegroups.com"
|
14
|
-
s.extra_rdoc_files = ["README.rdoc", "COPYING.rdoc"]
|
11
|
+
s.authors = ['James Mead']
|
12
|
+
s.description = 'Mocking and stubbing library with JMock/SchMock syntax, which allows mocking and stubbing of methods on real (non-mock) classes.'
|
13
|
+
s.email = 'mocha-developer@googlegroups.com'
|
15
14
|
|
16
|
-
s.files =
|
17
|
-
|
18
|
-
|
19
|
-
s.
|
20
|
-
s.
|
21
|
-
s.rubyforge_project = "mocha"
|
22
|
-
s.summary = "Mocking and stubbing library"
|
15
|
+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
16
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(docs|test)/}) }
|
17
|
+
end
|
18
|
+
s.files.delete('.circleci/config.yml')
|
19
|
+
s.files.delete('.gitignore')
|
23
20
|
|
24
|
-
s.
|
25
|
-
|
26
|
-
|
27
|
-
s.specification_version = 3
|
21
|
+
s.homepage = 'https://mocha.jamesmead.org'
|
22
|
+
s.require_paths = ['lib']
|
23
|
+
s.summary = 'Mocking and stubbing library'
|
28
24
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
else
|
35
|
-
s.add_dependency("rake", ">= 0")
|
36
|
-
s.add_dependency("introspection", "~> 0.0.1")
|
37
|
-
s.add_dependency("rdoc", "~> 3.1")
|
38
|
-
s.add_dependency("coderay", "~> 0.1")
|
25
|
+
unless s.respond_to?(:add_development_dependency)
|
26
|
+
class << s
|
27
|
+
def add_development_dependency(*args)
|
28
|
+
add_dependency(*args)
|
29
|
+
end
|
39
30
|
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if RUBY_VERSION < '1.9.3'
|
34
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
35
|
+
elsif RUBY_VERSION < '2'
|
36
|
+
s.add_development_dependency 'rake', '~> 12.2.1'
|
37
|
+
elsif RUBY_VERSION < '2.2'
|
38
|
+
s.add_development_dependency 'rake', '~> 12.3.3'
|
40
39
|
else
|
41
|
-
s.
|
42
|
-
|
43
|
-
|
44
|
-
|
40
|
+
s.add_development_dependency 'rake'
|
41
|
+
end
|
42
|
+
|
43
|
+
s.add_development_dependency('introspection', '~> 0.0.1')
|
44
|
+
if RUBY_VERSION >= '2.2.0'
|
45
|
+
# No test libraries in standard library
|
46
|
+
s.add_development_dependency('minitest')
|
47
|
+
end
|
48
|
+
if RUBY_VERSION >= '2.2.0'
|
49
|
+
s.add_development_dependency('rubocop', '<= 0.58.2')
|
50
|
+
end
|
51
|
+
if ENV['MOCHA_GENERATE_DOCS']
|
52
|
+
s.add_development_dependency('redcarpet')
|
53
|
+
s.add_development_dependency('yard')
|
45
54
|
end
|
46
55
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=<%= ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID'] %>"></script>
|
2
|
+
<script>
|
3
|
+
window.dataLayer = window.dataLayer || [];
|
4
|
+
function gtag(){dataLayer.push(arguments);}
|
5
|
+
gtag('js', new Date());
|
6
|
+
|
7
|
+
gtag('config', '<%= ENV['GOOGLE_ANALYTICS_WEB_PROPERTY_ID'] %>');
|
8
|
+
</script>
|
metadata
CHANGED
@@ -1,130 +1,91 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mocha
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 10
|
9
|
-
- 5
|
10
|
-
version: 0.10.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.13.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- James Mead
|
14
|
-
autorequire:
|
8
|
+
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 29
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 0
|
32
|
-
- 1
|
33
|
-
version: 0.0.1
|
34
|
-
type: :runtime
|
35
|
-
name: metaclass
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
prerelease: false
|
39
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
11
|
+
date: 2021-06-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
42
17
|
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
48
20
|
type: :development
|
49
|
-
name: rake
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
21
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: introspection
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
63
33
|
version: 0.0.1
|
64
34
|
type: :development
|
65
|
-
name: introspection
|
66
|
-
version_requirements: *id003
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
35
|
prerelease: false
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.0.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
79
48
|
type: :development
|
80
|
-
name: rdoc
|
81
|
-
version_requirements: *id004
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
49
|
prerelease: false
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "<="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.58.2
|
94
62
|
type: :development
|
95
|
-
|
96
|
-
version_requirements:
|
97
|
-
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "<="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.58.2
|
69
|
+
description: Mocking and stubbing library with JMock/SchMock syntax, which allows
|
70
|
+
mocking and stubbing of methods on real (non-mock) classes.
|
98
71
|
email: mocha-developer@googlegroups.com
|
99
72
|
executables: []
|
100
|
-
|
101
73
|
extensions: []
|
102
|
-
|
103
|
-
|
104
|
-
-
|
105
|
-
-
|
106
|
-
|
107
|
-
- .
|
108
|
-
-
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gemtest"
|
77
|
+
- ".github/FUNDING.yml"
|
78
|
+
- ".rubocop.yml"
|
79
|
+
- ".rubocop_todo.yml"
|
80
|
+
- ".yardopts"
|
81
|
+
- CONTRIBUTING.md
|
82
|
+
- COPYING.md
|
109
83
|
- Gemfile
|
110
|
-
- MIT-LICENSE.
|
111
|
-
- README.
|
112
|
-
- RELEASE.
|
84
|
+
- MIT-LICENSE.md
|
85
|
+
- README.md
|
86
|
+
- RELEASE.md
|
113
87
|
- Rakefile
|
114
|
-
- examples/misc.rb
|
115
|
-
- examples/mocha.rb
|
116
|
-
- examples/stubba.rb
|
117
|
-
- gemfiles/Gemfile.minitest.1.3.0
|
118
|
-
- gemfiles/Gemfile.minitest.1.4.0
|
119
|
-
- gemfiles/Gemfile.minitest.1.4.1
|
120
|
-
- gemfiles/Gemfile.minitest.1.4.2
|
121
|
-
- gemfiles/Gemfile.minitest.2.0.0
|
122
|
-
- gemfiles/Gemfile.minitest.2.0.1
|
123
|
-
- gemfiles/Gemfile.minitest.2.3.0
|
124
88
|
- gemfiles/Gemfile.minitest.latest
|
125
|
-
- gemfiles/Gemfile.test-unit.2.0.0
|
126
|
-
- gemfiles/Gemfile.test-unit.2.0.1
|
127
|
-
- gemfiles/Gemfile.test-unit.2.0.3
|
128
89
|
- gemfiles/Gemfile.test-unit.latest
|
129
90
|
- init.rb
|
130
91
|
- lib/mocha.rb
|
@@ -132,49 +93,62 @@ files:
|
|
132
93
|
- lib/mocha/api.rb
|
133
94
|
- lib/mocha/argument_iterator.rb
|
134
95
|
- lib/mocha/backtrace_filter.rb
|
96
|
+
- lib/mocha/block_matcher.rb
|
135
97
|
- lib/mocha/cardinality.rb
|
136
98
|
- lib/mocha/central.rb
|
137
99
|
- lib/mocha/change_state_side_effect.rb
|
138
|
-
- lib/mocha/
|
100
|
+
- lib/mocha/class_methods.rb
|
139
101
|
- lib/mocha/configuration.rb
|
102
|
+
- lib/mocha/debug.rb
|
140
103
|
- lib/mocha/deprecation.rb
|
104
|
+
- lib/mocha/detection/mini_test.rb
|
105
|
+
- lib/mocha/detection/test_unit.rb
|
106
|
+
- lib/mocha/error_with_filtered_backtrace.rb
|
141
107
|
- lib/mocha/exception_raiser.rb
|
142
108
|
- lib/mocha/expectation.rb
|
143
109
|
- lib/mocha/expectation_error.rb
|
110
|
+
- lib/mocha/expectation_error_factory.rb
|
144
111
|
- lib/mocha/expectation_list.rb
|
112
|
+
- lib/mocha/hooks.rb
|
145
113
|
- lib/mocha/in_state_ordering_constraint.rb
|
146
114
|
- lib/mocha/inspect.rb
|
147
115
|
- lib/mocha/instance_method.rb
|
148
116
|
- lib/mocha/integration.rb
|
117
|
+
- lib/mocha/integration/assertion_counter.rb
|
149
118
|
- lib/mocha/integration/mini_test.rb
|
150
|
-
- lib/mocha/integration/mini_test/
|
119
|
+
- lib/mocha/integration/mini_test/adapter.rb
|
151
120
|
- lib/mocha/integration/mini_test/exception_translation.rb
|
121
|
+
- lib/mocha/integration/mini_test/nothing.rb
|
152
122
|
- lib/mocha/integration/mini_test/version_13.rb
|
153
123
|
- lib/mocha/integration/mini_test/version_140.rb
|
154
124
|
- lib/mocha/integration/mini_test/version_141.rb
|
155
125
|
- lib/mocha/integration/mini_test/version_142_to_172.rb
|
156
126
|
- lib/mocha/integration/mini_test/version_200.rb
|
157
127
|
- lib/mocha/integration/mini_test/version_201_to_222.rb
|
158
|
-
- lib/mocha/integration/mini_test/
|
128
|
+
- lib/mocha/integration/mini_test/version_2110_to_2111.rb
|
129
|
+
- lib/mocha/integration/mini_test/version_2112_to_320.rb
|
130
|
+
- lib/mocha/integration/mini_test/version_230_to_2101.rb
|
131
|
+
- lib/mocha/integration/monkey_patcher.rb
|
159
132
|
- lib/mocha/integration/test_unit.rb
|
160
|
-
- lib/mocha/integration/test_unit/
|
133
|
+
- lib/mocha/integration/test_unit/adapter.rb
|
161
134
|
- lib/mocha/integration/test_unit/gem_version_200.rb
|
162
135
|
- lib/mocha/integration/test_unit/gem_version_201_to_202.rb
|
163
136
|
- lib/mocha/integration/test_unit/gem_version_203_to_220.rb
|
164
|
-
- lib/mocha/integration/test_unit/
|
137
|
+
- lib/mocha/integration/test_unit/gem_version_230_to_250.rb
|
138
|
+
- lib/mocha/integration/test_unit/nothing.rb
|
165
139
|
- lib/mocha/integration/test_unit/ruby_version_185_and_below.rb
|
166
140
|
- lib/mocha/integration/test_unit/ruby_version_186_and_above.rb
|
141
|
+
- lib/mocha/invocation.rb
|
167
142
|
- lib/mocha/is_a.rb
|
168
143
|
- lib/mocha/logger.rb
|
144
|
+
- lib/mocha/macos_version.rb
|
169
145
|
- lib/mocha/method_matcher.rb
|
146
|
+
- lib/mocha/minitest.rb
|
170
147
|
- lib/mocha/mock.rb
|
171
148
|
- lib/mocha/mockery.rb
|
172
|
-
- lib/mocha/module_method.rb
|
173
|
-
- lib/mocha/multiple_yields.rb
|
174
149
|
- lib/mocha/names.rb
|
175
|
-
- lib/mocha/
|
176
|
-
- lib/mocha/
|
177
|
-
- lib/mocha/options.rb
|
150
|
+
- lib/mocha/not_initialized_error.rb
|
151
|
+
- lib/mocha/object_methods.rb
|
178
152
|
- lib/mocha/parameter_matchers.rb
|
179
153
|
- lib/mocha/parameter_matchers/all_of.rb
|
180
154
|
- lib/mocha/parameter_matchers/any_of.rb
|
@@ -182,183 +156,64 @@ files:
|
|
182
156
|
- lib/mocha/parameter_matchers/anything.rb
|
183
157
|
- lib/mocha/parameter_matchers/base.rb
|
184
158
|
- lib/mocha/parameter_matchers/equals.rb
|
159
|
+
- lib/mocha/parameter_matchers/equivalent_uri.rb
|
185
160
|
- lib/mocha/parameter_matchers/has_entries.rb
|
186
161
|
- lib/mocha/parameter_matchers/has_entry.rb
|
187
162
|
- lib/mocha/parameter_matchers/has_key.rb
|
163
|
+
- lib/mocha/parameter_matchers/has_keys.rb
|
188
164
|
- lib/mocha/parameter_matchers/has_value.rb
|
189
165
|
- lib/mocha/parameter_matchers/includes.rb
|
166
|
+
- lib/mocha/parameter_matchers/instance_methods.rb
|
190
167
|
- lib/mocha/parameter_matchers/instance_of.rb
|
191
168
|
- lib/mocha/parameter_matchers/is_a.rb
|
192
169
|
- lib/mocha/parameter_matchers/kind_of.rb
|
193
170
|
- lib/mocha/parameter_matchers/not.rb
|
194
|
-
- lib/mocha/parameter_matchers/object.rb
|
195
171
|
- lib/mocha/parameter_matchers/optionally.rb
|
196
|
-
- lib/mocha/parameter_matchers/query_string.rb
|
197
172
|
- lib/mocha/parameter_matchers/regexp_matches.rb
|
198
173
|
- lib/mocha/parameter_matchers/responds_with.rb
|
199
174
|
- lib/mocha/parameter_matchers/yaml_equivalent.rb
|
200
175
|
- lib/mocha/parameters_matcher.rb
|
201
|
-
- lib/mocha/
|
176
|
+
- lib/mocha/raised_exception.rb
|
177
|
+
- lib/mocha/receivers.rb
|
202
178
|
- lib/mocha/return_values.rb
|
179
|
+
- lib/mocha/ruby_version.rb
|
203
180
|
- lib/mocha/sequence.rb
|
181
|
+
- lib/mocha/setup.rb
|
204
182
|
- lib/mocha/single_return_value.rb
|
205
|
-
- lib/mocha/
|
206
|
-
- lib/mocha/standalone.rb
|
183
|
+
- lib/mocha/singleton_class.rb
|
207
184
|
- lib/mocha/state_machine.rb
|
185
|
+
- lib/mocha/stubbed_method.rb
|
208
186
|
- lib/mocha/stubbing_error.rb
|
187
|
+
- lib/mocha/test_unit.rb
|
209
188
|
- lib/mocha/thrower.rb
|
210
|
-
- lib/mocha/
|
189
|
+
- lib/mocha/thrown_object.rb
|
211
190
|
- lib/mocha/version.rb
|
212
191
|
- lib/mocha/yield_parameters.rb
|
213
|
-
- lib/mocha_standalone.rb
|
214
|
-
- lib/stubba.rb
|
215
192
|
- mocha.gemspec
|
216
|
-
-
|
217
|
-
-
|
218
|
-
|
219
|
-
|
220
|
-
-
|
221
|
-
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
- test/acceptance/issue_70_test.rb
|
227
|
-
- test/acceptance/minitest_test.rb
|
228
|
-
- test/acceptance/mocha_example_test.rb
|
229
|
-
- test/acceptance/mocha_test_result_test.rb
|
230
|
-
- test/acceptance/mock_test.rb
|
231
|
-
- test/acceptance/mock_with_initializer_block_test.rb
|
232
|
-
- test/acceptance/mocked_methods_dispatch_test.rb
|
233
|
-
- test/acceptance/multiple_expectations_failure_message_test.rb
|
234
|
-
- test/acceptance/optional_parameters_test.rb
|
235
|
-
- test/acceptance/parameter_matcher_test.rb
|
236
|
-
- test/acceptance/partial_mocks_test.rb
|
237
|
-
- test/acceptance/raise_exception_test.rb
|
238
|
-
- test/acceptance/return_value_test.rb
|
239
|
-
- test/acceptance/sequence_test.rb
|
240
|
-
- test/acceptance/states_test.rb
|
241
|
-
- test/acceptance/stub_any_instance_method_test.rb
|
242
|
-
- test/acceptance/stub_class_method_defined_on_active_record_association_proxy_test.rb
|
243
|
-
- test/acceptance/stub_class_method_defined_on_class_test.rb
|
244
|
-
- test/acceptance/stub_class_method_defined_on_module_test.rb
|
245
|
-
- test/acceptance/stub_class_method_defined_on_superclass_test.rb
|
246
|
-
- test/acceptance/stub_everything_test.rb
|
247
|
-
- test/acceptance/stub_instance_method_defined_on_active_record_association_proxy_test.rb
|
248
|
-
- test/acceptance/stub_instance_method_defined_on_class_and_aliased_test.rb
|
249
|
-
- test/acceptance/stub_instance_method_defined_on_class_test.rb
|
250
|
-
- test/acceptance/stub_instance_method_defined_on_kernel_module_test.rb
|
251
|
-
- test/acceptance/stub_instance_method_defined_on_module_test.rb
|
252
|
-
- test/acceptance/stub_instance_method_defined_on_object_class_test.rb
|
253
|
-
- test/acceptance/stub_instance_method_defined_on_singleton_class_test.rb
|
254
|
-
- test/acceptance/stub_instance_method_defined_on_superclass_test.rb
|
255
|
-
- test/acceptance/stub_module_method_test.rb
|
256
|
-
- test/acceptance/stub_test.rb
|
257
|
-
- test/acceptance/stubba_example_test.rb
|
258
|
-
- test/acceptance/stubba_test.rb
|
259
|
-
- test/acceptance/stubba_test_result_test.rb
|
260
|
-
- test/acceptance/stubbing_error_backtrace_test.rb
|
261
|
-
- test/acceptance/stubbing_method_unnecessarily_test.rb
|
262
|
-
- test/acceptance/stubbing_non_existent_any_instance_method_test.rb
|
263
|
-
- test/acceptance/stubbing_non_existent_class_method_test.rb
|
264
|
-
- test/acceptance/stubbing_non_existent_instance_method_test.rb
|
265
|
-
- test/acceptance/stubbing_non_public_any_instance_method_test.rb
|
266
|
-
- test/acceptance/stubbing_non_public_class_method_test.rb
|
267
|
-
- test/acceptance/stubbing_non_public_instance_method_test.rb
|
268
|
-
- test/acceptance/stubbing_on_non_mock_object_test.rb
|
269
|
-
- test/acceptance/throw_test.rb
|
270
|
-
- test/acceptance/unstubbing_test.rb
|
271
|
-
- test/deprecation_disabler.rb
|
272
|
-
- test/execution_point.rb
|
273
|
-
- test/method_definer.rb
|
274
|
-
- test/mini_test_result.rb
|
275
|
-
- test/simple_counter.rb
|
276
|
-
- test/test_helper.rb
|
277
|
-
- test/test_runner.rb
|
278
|
-
- test/unit/any_instance_method_test.rb
|
279
|
-
- test/unit/array_inspect_test.rb
|
280
|
-
- test/unit/backtrace_filter_test.rb
|
281
|
-
- test/unit/cardinality_test.rb
|
282
|
-
- test/unit/central_test.rb
|
283
|
-
- test/unit/change_state_side_effect_test.rb
|
284
|
-
- test/unit/class_method_test.rb
|
285
|
-
- test/unit/configuration_test.rb
|
286
|
-
- test/unit/date_time_inspect_test.rb
|
287
|
-
- test/unit/exception_raiser_test.rb
|
288
|
-
- test/unit/expectation_list_test.rb
|
289
|
-
- test/unit/expectation_test.rb
|
290
|
-
- test/unit/hash_inspect_test.rb
|
291
|
-
- test/unit/in_state_ordering_constraint_test.rb
|
292
|
-
- test/unit/method_matcher_test.rb
|
293
|
-
- test/unit/mock_test.rb
|
294
|
-
- test/unit/mockery_test.rb
|
295
|
-
- test/unit/multiple_yields_test.rb
|
296
|
-
- test/unit/no_yields_test.rb
|
297
|
-
- test/unit/object_inspect_test.rb
|
298
|
-
- test/unit/object_test.rb
|
299
|
-
- test/unit/parameter_matchers/all_of_test.rb
|
300
|
-
- test/unit/parameter_matchers/any_of_test.rb
|
301
|
-
- test/unit/parameter_matchers/anything_test.rb
|
302
|
-
- test/unit/parameter_matchers/equals_test.rb
|
303
|
-
- test/unit/parameter_matchers/has_entries_test.rb
|
304
|
-
- test/unit/parameter_matchers/has_entry_test.rb
|
305
|
-
- test/unit/parameter_matchers/has_key_test.rb
|
306
|
-
- test/unit/parameter_matchers/has_value_test.rb
|
307
|
-
- test/unit/parameter_matchers/includes_test.rb
|
308
|
-
- test/unit/parameter_matchers/instance_of_test.rb
|
309
|
-
- test/unit/parameter_matchers/is_a_test.rb
|
310
|
-
- test/unit/parameter_matchers/kind_of_test.rb
|
311
|
-
- test/unit/parameter_matchers/not_test.rb
|
312
|
-
- test/unit/parameter_matchers/regexp_matches_test.rb
|
313
|
-
- test/unit/parameter_matchers/responds_with_test.rb
|
314
|
-
- test/unit/parameter_matchers/stub_matcher.rb
|
315
|
-
- test/unit/parameter_matchers/yaml_equivalent_test.rb
|
316
|
-
- test/unit/parameters_matcher_test.rb
|
317
|
-
- test/unit/return_values_test.rb
|
318
|
-
- test/unit/sequence_test.rb
|
319
|
-
- test/unit/single_return_value_test.rb
|
320
|
-
- test/unit/single_yield_test.rb
|
321
|
-
- test/unit/state_machine_test.rb
|
322
|
-
- test/unit/string_inspect_test.rb
|
323
|
-
- test/unit/thrower_test.rb
|
324
|
-
- test/unit/yield_parameters_test.rb
|
325
|
-
has_rdoc: true
|
326
|
-
homepage: http://mocha.rubyforge.org
|
327
|
-
licenses: []
|
328
|
-
|
329
|
-
post_install_message:
|
330
|
-
rdoc_options:
|
331
|
-
- --title
|
332
|
-
- Mocha
|
333
|
-
- --main
|
334
|
-
- README.rdoc
|
335
|
-
- --line-numbers
|
336
|
-
require_paths:
|
193
|
+
- yard-templates/default/layout/html/google_analytics.erb
|
194
|
+
- yard-templates/default/layout/html/setup.rb
|
195
|
+
homepage: https://mocha.jamesmead.org
|
196
|
+
licenses:
|
197
|
+
- MIT
|
198
|
+
- BSD-2-Clause
|
199
|
+
metadata: {}
|
200
|
+
post_install_message:
|
201
|
+
rdoc_options: []
|
202
|
+
require_paths:
|
337
203
|
- lib
|
338
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
339
|
-
|
340
|
-
requirements:
|
204
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
341
206
|
- - ">="
|
342
|
-
- !ruby/object:Gem::Version
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
version: "0"
|
347
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
348
|
-
none: false
|
349
|
-
requirements:
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 1.8.7
|
209
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
350
211
|
- - ">="
|
351
|
-
- !ruby/object:Gem::Version
|
352
|
-
|
353
|
-
segments:
|
354
|
-
- 0
|
355
|
-
version: "0"
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
356
214
|
requirements: []
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
signing_key:
|
361
|
-
specification_version: 3
|
215
|
+
rubygems_version: 3.0.3
|
216
|
+
signing_key:
|
217
|
+
specification_version: 4
|
362
218
|
summary: Mocking and stubbing library
|
363
219
|
test_files: []
|
364
|
-
|
data/COPYING.rdoc
DELETED
data/README.rdoc
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
= Mocha {<img src="https://secure.travis-ci.org/floehopper/mocha.png" />}[http://travis-ci.org/floehopper/mocha]
|
2
|
-
|
3
|
-
Mocha is a library for mocking and stubbing using a syntax like that of {JMock}[http://www.jmock.org].
|
4
|
-
|
5
|
-
It can be used with many testing frameworks e.g. {Test::Unit}[http://www.ruby-doc.org/core/classes/Test/Unit.html], {RSpec}[http://rspec.info/], {test/spec}[http://chneukirchen.org/repos/testspec/README], {expectations}[http://expectations.rubyforge.org/], {Dust}[http://dust.rubyforge.org/], {MiniTest}[http://rubyforge.org/projects/bfts] and even {JtestR}[http://jtestr.codehaus.org/].
|
6
|
-
|
7
|
-
Mocha provides a unified, simple and readable syntax for both traditional mocking and partial mocking.
|
8
|
-
|
9
|
-
Mocha was harvested from projects at {Reevoo}[http://www.reevoo.com/] by me ({James}[http://jamesmead.org/]) and my (then) colleagues {Ben}[http://www.techbelly.com/], {Chris}[http://chrisroos.co.uk/] and {Paul}[http://po-ru.com/].
|
10
|
-
|
11
|
-
== Installation
|
12
|
-
|
13
|
-
Install the latest version of the gem with the following command...
|
14
|
-
|
15
|
-
$ gem install mocha
|
16
|
-
|
17
|
-
Note that if you are intending to use Mocha with Test::Unit or MiniTest, you should only load Mocha *after* loading the relevant test library...
|
18
|
-
|
19
|
-
require "test/unit"
|
20
|
-
require "mocha"
|
21
|
-
|
22
|
-
If you're using Bundler, ensure the correct load order by not auto-requiring Mocha in the Gemfile and then later load it once you know the test library has been loaded...
|
23
|
-
|
24
|
-
# Gemfile
|
25
|
-
gem "mocha", :require => false
|
26
|
-
|
27
|
-
# Elsewhere after Bundler has loaded gems
|
28
|
-
require "test/unit"
|
29
|
-
require "mocha"
|
30
|
-
|
31
|
-
Or install the {Rails}[http://www.rubyonrails.org/] plugin...
|
32
|
-
|
33
|
-
$ script/plugin install git://github.com/floehopper/mocha.git
|
34
|
-
|
35
|
-
Note that versions 0.9.6 & 0.9.7 of the Rails plugin were broken. As of version 0.9.8, you need to explicitly load Mocha after the test framework e.g. by adding "require 'mocha'" at the bottom of test/test_helper.rb.
|
36
|
-
|
37
|
-
== Examples
|
38
|
-
|
39
|
-
* Quick Start - {Usage Examples}[http://mocha.rubyforge.org/examples/misc.html]
|
40
|
-
* Traditional mocking - {Star Trek Example}[http://mocha.rubyforge.org/examples/mocha.html]
|
41
|
-
* Setting expectations on real classes - {Order Example}[http://mocha.rubyforge.org/examples/stubba.html]
|
42
|
-
* More examples on {James Mead's Blog}[http://jamesmead.org/blog/]
|
43
|
-
* {Mailing List Archives}[http://groups.google.com/group/mocha-developer]
|
44
|
-
|
45
|
-
== Links
|
46
|
-
|
47
|
-
* {Source code}[http://github.com/floehopper/mocha]
|
48
|
-
* {Bug reports}[http://github.com/floehopper/mocha/issues]
|
49
|
-
|
50
|
-
== License
|
51
|
-
|
52
|
-
Copyright Revieworld Ltd. 2006
|
53
|
-
|
54
|
-
You may use, copy and redistribute this library under the same terms as {Ruby itself}[http://www.ruby-lang.org/en/LICENSE.txt] or under the {MIT license}[http://mocha.rubyforge.org/files/MIT-LICENSE.html].
|