shoulda-matchers 3.1.0 → 5.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/{MIT-LICENSE → LICENSE} +1 -1
- data/README.md +407 -232
- data/docs/errors/NonCaseSwappableValueError.md +2 -2
- data/lib/shoulda/matchers/action_controller/callback_matcher.rb +7 -80
- data/lib/shoulda/matchers/action_controller/filter_param_matcher.rb +4 -3
- data/lib/shoulda/matchers/action_controller/flash_store.rb +2 -4
- data/lib/shoulda/matchers/action_controller/permit_matcher.rb +36 -30
- data/lib/shoulda/matchers/action_controller/redirect_to_matcher.rb +8 -10
- data/lib/shoulda/matchers/action_controller/render_template_matcher.rb +7 -9
- data/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb +18 -15
- data/lib/shoulda/matchers/action_controller/rescue_from_matcher.rb +3 -2
- data/lib/shoulda/matchers/action_controller/respond_with_matcher.rb +3 -3
- data/lib/shoulda/matchers/action_controller/route_matcher.rb +88 -29
- data/lib/shoulda/matchers/action_controller/route_params.rb +2 -2
- data/lib/shoulda/matchers/action_controller/set_flash_matcher.rb +4 -4
- data/lib/shoulda/matchers/action_controller/set_session_matcher.rb +3 -3
- data/lib/shoulda/matchers/action_controller/set_session_or_flash_matcher.rb +19 -13
- data/lib/shoulda/matchers/action_controller.rb +2 -0
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_changed_value_error.rb +1 -1
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter.rb +5 -9
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setter_and_validator.rb +2 -2
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters.rb +1 -1
- data/lib/shoulda/matchers/active_model/allow_value_matcher/attribute_setters_and_validators.rb +1 -1
- data/lib/shoulda/matchers/active_model/allow_value_matcher.rb +42 -39
- data/lib/shoulda/matchers/active_model/disallow_value_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_model/have_secure_password_matcher.rb +52 -26
- data/lib/shoulda/matchers/active_model/helpers.rb +2 -2
- data/lib/shoulda/matchers/active_model/numericality_matchers/comparison_matcher.rb +32 -30
- data/lib/shoulda/matchers/active_model/numericality_matchers/numeric_type_matcher.rb +2 -1
- data/lib/shoulda/matchers/active_model/qualifiers/allow_blank.rb +26 -0
- data/lib/shoulda/matchers/active_model/qualifiers/allow_nil.rb +26 -0
- data/lib/shoulda/matchers/active_model/qualifiers/ignoring_interference_by_writer.rb +1 -1
- data/lib/shoulda/matchers/active_model/qualifiers.rb +2 -0
- data/lib/shoulda/matchers/active_model/validate_absence_of_matcher.rb +30 -6
- data/lib/shoulda/matchers/active_model/validate_acceptance_of_matcher.rb +8 -3
- data/lib/shoulda/matchers/active_model/validate_confirmation_of_matcher.rb +31 -16
- data/lib/shoulda/matchers/active_model/validate_exclusion_of_matcher.rb +52 -16
- data/lib/shoulda/matchers/active_model/validate_inclusion_of_matcher.rb +137 -84
- data/lib/shoulda/matchers/active_model/validate_length_of_matcher.rb +159 -46
- data/lib/shoulda/matchers/active_model/validate_numericality_of_matcher.rb +130 -66
- data/lib/shoulda/matchers/active_model/validate_presence_of_matcher.rb +251 -24
- data/lib/shoulda/matchers/active_model/validation_matcher/build_description.rb +12 -9
- data/lib/shoulda/matchers/active_model/validation_matcher.rb +38 -6
- data/lib/shoulda/matchers/active_model/validation_message_finder.rb +2 -4
- data/lib/shoulda/matchers/active_model/validator.rb +4 -9
- data/lib/shoulda/matchers/active_model.rb +3 -5
- data/lib/shoulda/matchers/active_record/accept_nested_attributes_for_matcher.rb +10 -7
- data/lib/shoulda/matchers/active_record/association_matcher.rb +386 -111
- data/lib/shoulda/matchers/active_record/association_matchers/counter_cache_matcher.rb +5 -2
- data/lib/shoulda/matchers/active_record/association_matchers/dependent_matcher.rb +4 -4
- data/lib/shoulda/matchers/active_record/association_matchers/inverse_of_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/association_matchers/join_table_matcher.rb +11 -6
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflection.rb +14 -15
- data/lib/shoulda/matchers/active_record/association_matchers/model_reflector.rb +30 -8
- data/lib/shoulda/matchers/active_record/association_matchers/option_verifier.rb +34 -11
- data/lib/shoulda/matchers/active_record/association_matchers/optional_matcher.rb +69 -0
- data/lib/shoulda/matchers/active_record/association_matchers/order_matcher.rb +1 -1
- data/lib/shoulda/matchers/active_record/association_matchers/required_matcher.rb +74 -0
- data/lib/shoulda/matchers/active_record/association_matchers/source_matcher.rb +3 -2
- data/lib/shoulda/matchers/active_record/association_matchers/through_matcher.rb +7 -5
- data/lib/shoulda/matchers/active_record/define_enum_for_matcher.rb +458 -42
- data/lib/shoulda/matchers/active_record/have_attached_matcher.rb +185 -0
- data/lib/shoulda/matchers/active_record/have_db_column_matcher.rb +63 -23
- data/lib/shoulda/matchers/active_record/have_db_index_matcher.rb +164 -48
- data/lib/shoulda/matchers/active_record/have_implicit_order_column.rb +106 -0
- data/lib/shoulda/matchers/active_record/have_readonly_attribute_matcher.rb +13 -11
- data/lib/shoulda/matchers/active_record/have_rich_text_matcher.rb +83 -0
- data/lib/shoulda/matchers/active_record/have_secure_token_matcher.rb +132 -0
- data/lib/shoulda/matchers/active_record/serialize_matcher.rb +18 -18
- data/lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb +1 -3
- data/lib/shoulda/matchers/active_record/uniqueness/test_models.rb +0 -2
- data/lib/shoulda/matchers/active_record/uniqueness.rb +1 -1
- data/lib/shoulda/matchers/active_record/validate_uniqueness_of_matcher.rb +430 -200
- data/lib/shoulda/matchers/active_record.rb +28 -20
- data/lib/shoulda/matchers/configuration.rb +12 -1
- data/lib/shoulda/matchers/doublespeak/double.rb +1 -1
- data/lib/shoulda/matchers/doublespeak/double_collection.rb +3 -3
- data/lib/shoulda/matchers/doublespeak/double_implementation_registry.rb +8 -5
- data/lib/shoulda/matchers/doublespeak/object_double.rb +6 -2
- data/lib/shoulda/matchers/doublespeak/stub_implementation.rb +1 -5
- data/lib/shoulda/matchers/doublespeak/world.rb +2 -2
- data/lib/shoulda/matchers/doublespeak.rb +2 -1
- data/lib/shoulda/matchers/error.rb +1 -1
- data/lib/shoulda/matchers/independent/delegate_method_matcher.rb +109 -29
- data/lib/shoulda/matchers/independent.rb +2 -2
- data/lib/shoulda/matchers/integrations/configuration.rb +8 -4
- data/lib/shoulda/matchers/integrations/libraries/action_controller.rb +1 -1
- data/lib/shoulda/matchers/integrations/libraries/rails.rb +2 -2
- data/lib/shoulda/matchers/integrations/test_frameworks/active_support_test_case.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_4.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/minitest_5.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/missing_test_framework.rb +1 -1
- data/lib/shoulda/matchers/integrations/test_frameworks/test_unit.rb +1 -1
- data/lib/shoulda/matchers/rails_shim.rb +172 -51
- data/lib/shoulda/matchers/routing.rb +2 -2
- data/lib/shoulda/matchers/util/word_wrap.rb +17 -12
- data/lib/shoulda/matchers/util.rb +39 -5
- data/lib/shoulda/matchers/version.rb +1 -1
- data/lib/shoulda/matchers/warn.rb +4 -3
- data/shoulda-matchers.gemspec +33 -15
- metadata +31 -338
- data/.gitignore +0 -12
- data/.hound.yml +0 -3
- data/.hound_config/ruby.yml +0 -12
- data/.travis.yml +0 -19
- data/.yardopts +0 -10
- data/Appraisals +0 -73
- data/CONTRIBUTING.md +0 -101
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -70
- data/NEWS.md +0 -986
- data/Rakefile +0 -39
- data/custom_plan.rb +0 -88
- data/doc_config/gh-pages/index.html.erb +0 -9
- data/doc_config/yard/setup.rb +0 -22
- data/doc_config/yard/templates/default/fulldoc/html/css/bootstrap.css +0 -5967
- data/doc_config/yard/templates/default/fulldoc/html/css/full_list.css +0 -12
- data/doc_config/yard/templates/default/fulldoc/html/css/global.css +0 -62
- data/doc_config/yard/templates/default/fulldoc/html/css/solarized.css +0 -69
- data/doc_config/yard/templates/default/fulldoc/html/css/style.css +0 -312
- data/doc_config/yard/templates/default/fulldoc/html/full_list.erb +0 -32
- data/doc_config/yard/templates/default/fulldoc/html/full_list_class.erb +0 -1
- data/doc_config/yard/templates/default/fulldoc/html/full_list_method.erb +0 -8
- data/doc_config/yard/templates/default/fulldoc/html/js/app.js +0 -298
- data/doc_config/yard/templates/default/fulldoc/html/js/full_list.js +0 -1
- data/doc_config/yard/templates/default/fulldoc/html/js/jquery.stickyheaders.js +0 -289
- data/doc_config/yard/templates/default/fulldoc/html/js/underscore.min.js +0 -6
- data/doc_config/yard/templates/default/fulldoc/html/setup.rb +0 -8
- data/doc_config/yard/templates/default/layout/html/breadcrumb.erb +0 -14
- data/doc_config/yard/templates/default/layout/html/fonts.erb +0 -1
- data/doc_config/yard/templates/default/layout/html/footer.erb +0 -6
- data/doc_config/yard/templates/default/layout/html/layout.erb +0 -23
- data/doc_config/yard/templates/default/layout/html/search.erb +0 -13
- data/doc_config/yard/templates/default/layout/html/setup.rb +0 -40
- data/doc_config/yard/templates/default/method_details/html/source.erb +0 -10
- data/doc_config/yard/templates/default/module/html/box_info.erb +0 -31
- data/gemfiles/4.0.0.gemfile +0 -38
- data/gemfiles/4.0.0.gemfile.lock +0 -223
- data/gemfiles/4.0.1.gemfile +0 -38
- data/gemfiles/4.0.1.gemfile.lock +0 -225
- data/gemfiles/4.1.gemfile +0 -38
- data/gemfiles/4.1.gemfile.lock +0 -220
- data/gemfiles/4.2.gemfile +0 -38
- data/gemfiles/4.2.gemfile.lock +0 -243
- data/lib/shoulda/matchers/active_model/allow_mass_assignment_of_matcher.rb +0 -159
- data/lib/shoulda/matchers/independent/delegate_method_matcher/stubbed_target.rb +0 -37
- data/script/SUPPORTED_VERSIONS +0 -1
- data/script/install_gems_in_all_appraisals +0 -14
- data/script/run_all_tests +0 -14
- data/script/update_gem_in_all_appraisals +0 -15
- data/script/update_gems_in_all_appraisals +0 -14
- data/spec/acceptance/active_model_integration_spec.rb +0 -23
- data/spec/acceptance/independent_matchers_spec.rb +0 -125
- data/spec/acceptance/multiple_libraries_integration_spec.rb +0 -55
- data/spec/acceptance/rails_integration_spec.rb +0 -156
- data/spec/acceptance_spec_helper.rb +0 -23
- data/spec/doublespeak_spec_helper.rb +0 -2
- data/spec/report_warnings.rb +0 -7
- data/spec/spec_helper.rb +0 -21
- data/spec/support/acceptance/adds_shoulda_matchers_to_project.rb +0 -133
- data/spec/support/acceptance/helpers/active_model_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/array_helpers.rb +0 -13
- data/spec/support/acceptance/helpers/base_helpers.rb +0 -19
- data/spec/support/acceptance/helpers/command_helpers.rb +0 -55
- data/spec/support/acceptance/helpers/file_helpers.rb +0 -19
- data/spec/support/acceptance/helpers/gem_helpers.rb +0 -31
- data/spec/support/acceptance/helpers/minitest_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/n_unit_helpers.rb +0 -25
- data/spec/support/acceptance/helpers/pluralization_helpers.rb +0 -13
- data/spec/support/acceptance/helpers/rails_version_helpers.rb +0 -11
- data/spec/support/acceptance/helpers/rspec_helpers.rb +0 -24
- data/spec/support/acceptance/helpers/ruby_version_helpers.rb +0 -9
- data/spec/support/acceptance/helpers/step_helpers.rb +0 -127
- data/spec/support/acceptance/helpers.rb +0 -31
- data/spec/support/acceptance/matchers/have_output.rb +0 -31
- data/spec/support/acceptance/matchers/indicate_number_of_tests_was_run_matcher.rb +0 -55
- data/spec/support/acceptance/matchers/indicate_that_tests_were_run_matcher.rb +0 -103
- data/spec/support/tests/bundle.rb +0 -94
- data/spec/support/tests/command_runner.rb +0 -230
- data/spec/support/tests/current_bundle.rb +0 -61
- data/spec/support/tests/database.rb +0 -28
- data/spec/support/tests/database_adapters/postgresql.rb +0 -25
- data/spec/support/tests/database_adapters/sqlite3.rb +0 -26
- data/spec/support/tests/database_configuration.rb +0 -33
- data/spec/support/tests/database_configuration_registry.rb +0 -28
- data/spec/support/tests/filesystem.rb +0 -100
- data/spec/support/tests/version.rb +0 -45
- data/spec/support/unit/active_record/create_table.rb +0 -54
- data/spec/support/unit/attribute.rb +0 -47
- data/spec/support/unit/capture.rb +0 -40
- data/spec/support/unit/change_value.rb +0 -111
- data/spec/support/unit/create_model_arguments/basic.rb +0 -135
- data/spec/support/unit/create_model_arguments/has_many.rb +0 -15
- data/spec/support/unit/create_model_arguments/uniqueness_matcher.rb +0 -74
- data/spec/support/unit/helpers/active_model_helpers.rb +0 -27
- data/spec/support/unit/helpers/active_model_versions.rb +0 -28
- data/spec/support/unit/helpers/active_record_versions.rb +0 -24
- data/spec/support/unit/helpers/active_resource_builder.rb +0 -27
- data/spec/support/unit/helpers/allow_value_matcher_helpers.rb +0 -15
- data/spec/support/unit/helpers/class_builder.rb +0 -90
- data/spec/support/unit/helpers/column_type_helpers.rb +0 -26
- data/spec/support/unit/helpers/confirmation_matcher_helpers.rb +0 -17
- data/spec/support/unit/helpers/controller_builder.rb +0 -63
- data/spec/support/unit/helpers/database_helpers.rb +0 -20
- data/spec/support/unit/helpers/i18n_faker.rb +0 -15
- data/spec/support/unit/helpers/mailer_builder.rb +0 -12
- data/spec/support/unit/helpers/model_builder.rb +0 -114
- data/spec/support/unit/helpers/rails_versions.rb +0 -28
- data/spec/support/unit/helpers/validation_matcher_scenario_helpers.rb +0 -44
- data/spec/support/unit/i18n.rb +0 -7
- data/spec/support/unit/load_environment.rb +0 -12
- data/spec/support/unit/matchers/deprecate.rb +0 -60
- data/spec/support/unit/matchers/fail_with_message_including_matcher.rb +0 -51
- data/spec/support/unit/matchers/fail_with_message_matcher.rb +0 -62
- data/spec/support/unit/matchers/print_warning_including.rb +0 -59
- data/spec/support/unit/model_creation_strategies/active_model.rb +0 -111
- data/spec/support/unit/model_creation_strategies/active_record.rb +0 -77
- data/spec/support/unit/model_creators/active_model.rb +0 -39
- data/spec/support/unit/model_creators/active_record/has_and_belongs_to_many.rb +0 -95
- data/spec/support/unit/model_creators/active_record/has_many.rb +0 -67
- data/spec/support/unit/model_creators/active_record/uniqueness_matcher.rb +0 -42
- data/spec/support/unit/model_creators/active_record.rb +0 -43
- data/spec/support/unit/model_creators/basic.rb +0 -97
- data/spec/support/unit/model_creators.rb +0 -19
- data/spec/support/unit/rails_application.rb +0 -126
- data/spec/support/unit/record_builder_with_i18n_validation_message.rb +0 -69
- data/spec/support/unit/record_validating_confirmation_builder.rb +0 -51
- data/spec/support/unit/record_with_different_error_attribute_builder.rb +0 -92
- data/spec/support/unit/shared_examples/ignoring_interference_by_writer.rb +0 -79
- data/spec/support/unit/shared_examples/numerical_submatcher.rb +0 -17
- data/spec/support/unit/shared_examples/set_session_or_flash.rb +0 -360
- data/spec/support/unit/validation_matcher_scenario.rb +0 -62
- data/spec/unit/shoulda/matchers/action_controller/callback_matcher_spec.rb +0 -82
- data/spec/unit/shoulda/matchers/action_controller/filter_param_matcher_spec.rb +0 -28
- data/spec/unit/shoulda/matchers/action_controller/permit_matcher_spec.rb +0 -592
- data/spec/unit/shoulda/matchers/action_controller/redirect_to_matcher_spec.rb +0 -42
- data/spec/unit/shoulda/matchers/action_controller/render_template_matcher_spec.rb +0 -76
- data/spec/unit/shoulda/matchers/action_controller/render_with_layout_matcher_spec.rb +0 -62
- data/spec/unit/shoulda/matchers/action_controller/rescue_from_matcher_spec.rb +0 -90
- data/spec/unit/shoulda/matchers/action_controller/respond_with_matcher_spec.rb +0 -31
- data/spec/unit/shoulda/matchers/action_controller/route_matcher_spec.rb +0 -330
- data/spec/unit/shoulda/matchers/action_controller/route_params_spec.rb +0 -30
- data/spec/unit/shoulda/matchers/action_controller/set_flash_matcher_spec.rb +0 -67
- data/spec/unit/shoulda/matchers/action_controller/set_session_matcher_spec.rb +0 -17
- data/spec/unit/shoulda/matchers/action_controller/set_session_or_flash_matcher_spec.rb +0 -562
- data/spec/unit/shoulda/matchers/active_model/allow_mass_assignment_of_matcher_spec.rb +0 -115
- data/spec/unit/shoulda/matchers/active_model/allow_value_matcher_spec.rb +0 -823
- data/spec/unit/shoulda/matchers/active_model/disallow_value_matcher_spec.rb +0 -86
- data/spec/unit/shoulda/matchers/active_model/have_secure_password_matcher_spec.rb +0 -20
- data/spec/unit/shoulda/matchers/active_model/helpers_spec.rb +0 -162
- data/spec/unit/shoulda/matchers/active_model/validate_absence_of_matcher_spec.rb +0 -266
- data/spec/unit/shoulda/matchers/active_model/validate_acceptance_of_matcher_spec.rb +0 -91
- data/spec/unit/shoulda/matchers/active_model/validate_confirmation_of_matcher_spec.rb +0 -149
- data/spec/unit/shoulda/matchers/active_model/validate_exclusion_of_matcher_spec.rb +0 -207
- data/spec/unit/shoulda/matchers/active_model/validate_inclusion_of_matcher_spec.rb +0 -1015
- data/spec/unit/shoulda/matchers/active_model/validate_length_of_matcher_spec.rb +0 -288
- data/spec/unit/shoulda/matchers/active_model/validate_numericality_of_matcher_spec.rb +0 -1837
- data/spec/unit/shoulda/matchers/active_model/validate_presence_of_matcher_spec.rb +0 -380
- data/spec/unit/shoulda/matchers/active_record/accept_nested_attributes_for_matcher_spec.rb +0 -107
- data/spec/unit/shoulda/matchers/active_record/association_matcher_spec.rb +0 -1242
- data/spec/unit/shoulda/matchers/active_record/association_matchers/model_reflection_spec.rb +0 -251
- data/spec/unit/shoulda/matchers/active_record/define_enum_for_matcher_spec.rb +0 -168
- data/spec/unit/shoulda/matchers/active_record/have_db_column_matcher_spec.rb +0 -111
- data/spec/unit/shoulda/matchers/active_record/have_db_index_matcher_spec.rb +0 -85
- data/spec/unit/shoulda/matchers/active_record/have_readonly_attributes_matcher_spec.rb +0 -41
- data/spec/unit/shoulda/matchers/active_record/serialize_matcher_spec.rb +0 -86
- data/spec/unit/shoulda/matchers/active_record/validate_uniqueness_of_matcher_spec.rb +0 -1418
- data/spec/unit/shoulda/matchers/doublespeak/double_collection_spec.rb +0 -190
- data/spec/unit/shoulda/matchers/doublespeak/double_implementation_registry_spec.rb +0 -21
- data/spec/unit/shoulda/matchers/doublespeak/double_spec.rb +0 -271
- data/spec/unit/shoulda/matchers/doublespeak/object_double_spec.rb +0 -77
- data/spec/unit/shoulda/matchers/doublespeak/proxy_implementation_spec.rb +0 -72
- data/spec/unit/shoulda/matchers/doublespeak/stub_implementation_spec.rb +0 -101
- data/spec/unit/shoulda/matchers/doublespeak/world_spec.rb +0 -80
- data/spec/unit/shoulda/matchers/doublespeak_spec.rb +0 -27
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher/stubbed_target_spec.rb +0 -43
- data/spec/unit/shoulda/matchers/independent/delegate_method_matcher_spec.rb +0 -517
- data/spec/unit/shoulda/matchers/routing/route_matcher_spec.rb +0 -242
- data/spec/unit/shoulda/matchers/util/word_wrap_spec.rb +0 -252
- data/spec/unit_spec_helper.rb +0 -46
- data/spec/warnings_spy/filesystem.rb +0 -45
- data/spec/warnings_spy/partitioner.rb +0 -36
- data/spec/warnings_spy/reader.rb +0 -53
- data/spec/warnings_spy/reporter.rb +0 -88
- data/spec/warnings_spy.rb +0 -64
- data/tasks/documentation.rb +0 -199
- data/zeus.json +0 -11
@@ -1,190 +0,0 @@
|
|
1
|
-
require 'doublespeak_spec_helper'
|
2
|
-
|
3
|
-
module Shoulda::Matchers::Doublespeak
|
4
|
-
describe DoubleCollection do
|
5
|
-
describe '#register_stub' do
|
6
|
-
it 'calls DoubleImplementationRegistry.find correctly' do
|
7
|
-
allow(DoubleImplementationRegistry).to receive(:find)
|
8
|
-
double_collection = described_class.new(build_world, :klass)
|
9
|
-
|
10
|
-
double_collection.register_stub(:a_method)
|
11
|
-
|
12
|
-
expect(DoubleImplementationRegistry).to have_received(:find).with(:stub)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'calls Double.new correctly' do
|
16
|
-
world = build_world
|
17
|
-
allow(DoubleImplementationRegistry).
|
18
|
-
to receive(:find).
|
19
|
-
and_return(:implementation)
|
20
|
-
allow(Double).to receive(:new)
|
21
|
-
double_collection = described_class.new(world, :klass)
|
22
|
-
|
23
|
-
double_collection.register_stub(:a_method)
|
24
|
-
|
25
|
-
expect(Double).
|
26
|
-
to have_received(:new).
|
27
|
-
with(world, :klass, :a_method, :implementation)
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'if a double has already been registered for the method' do
|
31
|
-
it 'does not call Double.new again' do
|
32
|
-
world = build_world
|
33
|
-
allow(DoubleImplementationRegistry).
|
34
|
-
to receive(:find).
|
35
|
-
and_return(:implementation)
|
36
|
-
allow(Double).to receive(:new)
|
37
|
-
double_collection = described_class.new(world, :klass)
|
38
|
-
|
39
|
-
double_collection.register_stub(:a_method)
|
40
|
-
double_collection.register_stub(:a_method)
|
41
|
-
|
42
|
-
expect(Double).to have_received(:new).once
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'returns the same Double' do
|
46
|
-
world = build_world
|
47
|
-
allow(DoubleImplementationRegistry).
|
48
|
-
to receive(:find).
|
49
|
-
and_return(:implementation)
|
50
|
-
allow(Double).to receive(:new)
|
51
|
-
double_collection = described_class.new(world, :klass)
|
52
|
-
|
53
|
-
double1 = double_collection.register_stub(:a_method)
|
54
|
-
double2 = double_collection.register_stub(:a_method)
|
55
|
-
|
56
|
-
expect(double1).to equal(double2)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
describe '#register_proxy' do
|
62
|
-
it 'calls DoubleImplementationRegistry.find correctly' do
|
63
|
-
allow(DoubleImplementationRegistry).to receive(:find)
|
64
|
-
double_collection = described_class.new(build_world, :klass)
|
65
|
-
|
66
|
-
double_collection.register_proxy(:a_method)
|
67
|
-
|
68
|
-
expect(DoubleImplementationRegistry).
|
69
|
-
to have_received(:find).
|
70
|
-
with(:proxy)
|
71
|
-
end
|
72
|
-
|
73
|
-
it 'calls Double.new correctly' do
|
74
|
-
world = build_world
|
75
|
-
allow(DoubleImplementationRegistry).
|
76
|
-
to receive(:find).
|
77
|
-
and_return(:implementation)
|
78
|
-
allow(Double).to receive(:new)
|
79
|
-
double_collection = described_class.new(world, :klass)
|
80
|
-
|
81
|
-
double_collection.register_proxy(:a_method)
|
82
|
-
|
83
|
-
expect(Double).
|
84
|
-
to have_received(:new).
|
85
|
-
with(world, :klass, :a_method, :implementation)
|
86
|
-
end
|
87
|
-
|
88
|
-
context 'if a double has already been registered for the method' do
|
89
|
-
it 'does not call Double.new again' do
|
90
|
-
world = build_world
|
91
|
-
allow(DoubleImplementationRegistry).
|
92
|
-
to receive(:find).
|
93
|
-
and_return(:implementation)
|
94
|
-
allow(Double).to receive(:new)
|
95
|
-
double_collection = described_class.new(world, :klass)
|
96
|
-
|
97
|
-
double_collection.register_proxy(:a_method)
|
98
|
-
double_collection.register_proxy(:a_method)
|
99
|
-
|
100
|
-
expect(Double).to have_received(:new).once
|
101
|
-
end
|
102
|
-
|
103
|
-
it 'returns the same Double' do
|
104
|
-
world = build_world
|
105
|
-
allow(DoubleImplementationRegistry).
|
106
|
-
to receive(:find).
|
107
|
-
and_return(:implementation)
|
108
|
-
allow(Double).to receive(:new)
|
109
|
-
double_collection = described_class.new(world, :klass)
|
110
|
-
|
111
|
-
double1 = double_collection.register_proxy(:a_method)
|
112
|
-
double2 = double_collection.register_proxy(:a_method)
|
113
|
-
|
114
|
-
expect(double1).to equal(double2)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
describe '#activate' do
|
120
|
-
it 'replaces all registered methods with doubles' do
|
121
|
-
klass = create_class(first_method: 1, second_method: 2)
|
122
|
-
double_collection = described_class.new(build_world, klass)
|
123
|
-
double_collection.register_stub(:first_method)
|
124
|
-
double_collection.register_stub(:second_method)
|
125
|
-
|
126
|
-
double_collection.activate
|
127
|
-
|
128
|
-
instance = klass.new
|
129
|
-
expect(instance.first_method).to eq nil
|
130
|
-
expect(instance.second_method).to eq nil
|
131
|
-
end
|
132
|
-
end
|
133
|
-
|
134
|
-
describe '#deactivate' do
|
135
|
-
it 'restores the original methods that were doubled' do
|
136
|
-
klass = create_class(first_method: 1, second_method: 2)
|
137
|
-
double_collection = described_class.new(build_world, klass)
|
138
|
-
double_collection.register_stub(:first_method)
|
139
|
-
double_collection.register_stub(:second_method)
|
140
|
-
|
141
|
-
double_collection.activate
|
142
|
-
double_collection.deactivate
|
143
|
-
|
144
|
-
instance = klass.new
|
145
|
-
expect(instance.first_method).to eq 1
|
146
|
-
expect(instance.second_method).to eq 2
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
describe '#calls_to' do
|
151
|
-
it 'returns all calls to the given method' do
|
152
|
-
klass = create_class(a_method: nil)
|
153
|
-
double_collection = described_class.new(build_world, klass)
|
154
|
-
double_collection.register_stub(:a_method)
|
155
|
-
double_collection.activate
|
156
|
-
|
157
|
-
actual_calls = [
|
158
|
-
{ args: [:some, :args, :here] },
|
159
|
-
{ args: [:some, :args], block: -> { :whatever } }
|
160
|
-
]
|
161
|
-
instance = klass.new
|
162
|
-
instance.a_method(*actual_calls[0][:args])
|
163
|
-
instance.a_method(*actual_calls[1][:args], &actual_calls[1][:block])
|
164
|
-
|
165
|
-
calls = double_collection.calls_to(:a_method)
|
166
|
-
expect(calls[0].args).to eq actual_calls[0][:args]
|
167
|
-
expect(calls[1].args).to eq actual_calls[1][:args]
|
168
|
-
expect(calls[1].block).to eq actual_calls[1][:block]
|
169
|
-
end
|
170
|
-
|
171
|
-
it 'returns an empty array if the method has never been doubled' do
|
172
|
-
klass = create_class
|
173
|
-
double_collection = described_class.new(build_world, klass)
|
174
|
-
expect(double_collection.calls_to(:non_existent_method)).to eq []
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def create_class(methods = {})
|
179
|
-
Class.new.tap do |klass|
|
180
|
-
methods.each do |name, value|
|
181
|
-
klass.__send__(:define_method, name) { |*args| value }
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
def build_world
|
187
|
-
Shoulda::Matchers::Doublespeak::World.new
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'doublespeak_spec_helper'
|
2
|
-
|
3
|
-
module Shoulda::Matchers::Doublespeak
|
4
|
-
describe DoubleImplementationRegistry do
|
5
|
-
describe '.find' do
|
6
|
-
it 'returns an instance of StubImplementation if given :stub' do
|
7
|
-
expect(described_class.find(:stub)).to be_a(StubImplementation)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'returns ProxyImplementation if given :proxy' do
|
11
|
-
expect(described_class.find(:proxy)).to be_a(ProxyImplementation)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'raises an ArgumentError if not given a registered implementation' do
|
15
|
-
expect {
|
16
|
-
expect(described_class.find(:something_else))
|
17
|
-
}.to raise_error(ArgumentError)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,271 +0,0 @@
|
|
1
|
-
require 'doublespeak_spec_helper'
|
2
|
-
|
3
|
-
module Shoulda::Matchers::Doublespeak
|
4
|
-
describe Double do
|
5
|
-
describe 'initializer' do
|
6
|
-
context 'if doubles are currently activated on the world level' do
|
7
|
-
it 'immediately activates the new Double' do
|
8
|
-
world = build_world(doubles_activated?: true)
|
9
|
-
klass = create_class(a_method_name: nil)
|
10
|
-
implementation = build_implementation
|
11
|
-
|
12
|
-
double = described_class.new(world, klass, :a_method_name, implementation)
|
13
|
-
|
14
|
-
expect(double).to be_activated
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe '#to_return' do
|
20
|
-
it 'tells its implementation to call the given block' do
|
21
|
-
sent_block = -> { }
|
22
|
-
actual_block = nil
|
23
|
-
implementation = build_implementation
|
24
|
-
implementation.singleton_class.__send__(:undef_method, :returns)
|
25
|
-
implementation.singleton_class.__send__(:define_method, :returns) do |&block|
|
26
|
-
actual_block = block
|
27
|
-
end
|
28
|
-
double = described_class.new(
|
29
|
-
build_world,
|
30
|
-
:klass,
|
31
|
-
:a_method,
|
32
|
-
implementation
|
33
|
-
)
|
34
|
-
double.to_return(&sent_block)
|
35
|
-
expect(actual_block).to eq sent_block
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'tells its implementation to return the given value' do
|
39
|
-
implementation = build_implementation
|
40
|
-
double = described_class.new(
|
41
|
-
build_world,
|
42
|
-
:klass,
|
43
|
-
:a_method,
|
44
|
-
implementation
|
45
|
-
)
|
46
|
-
double.to_return(:implementation)
|
47
|
-
|
48
|
-
expect(implementation).to have_received(:returns).with(:implementation)
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'prefers a block over a non-block' do
|
52
|
-
sent_block = -> { }
|
53
|
-
actual_block = nil
|
54
|
-
implementation = build_implementation
|
55
|
-
implementation.singleton_class.__send__(:undef_method, :returns)
|
56
|
-
implementation.singleton_class.__send__(:define_method, :returns) do |&block|
|
57
|
-
actual_block = block
|
58
|
-
end
|
59
|
-
double = described_class.new(
|
60
|
-
build_world,
|
61
|
-
:klass,
|
62
|
-
:a_method,
|
63
|
-
implementation
|
64
|
-
)
|
65
|
-
double.to_return(:value, &sent_block)
|
66
|
-
expect(actual_block).to eq sent_block
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe '#activate' do
|
71
|
-
it 'replaces the method with an implementation' do
|
72
|
-
implementation = build_implementation
|
73
|
-
method_name = :a_method
|
74
|
-
klass = create_class(method_name => :some_return_value)
|
75
|
-
instance = klass.new
|
76
|
-
double = described_class.new(
|
77
|
-
build_world,
|
78
|
-
klass,
|
79
|
-
method_name,
|
80
|
-
implementation
|
81
|
-
)
|
82
|
-
args = [:any, :args]
|
83
|
-
block = -> {}
|
84
|
-
call = MethodCall.new(
|
85
|
-
double: double,
|
86
|
-
object: instance,
|
87
|
-
method_name: method_name,
|
88
|
-
args: args,
|
89
|
-
block: block,
|
90
|
-
caller: :some_caller
|
91
|
-
)
|
92
|
-
|
93
|
-
double.activate
|
94
|
-
instance.__send__(method_name, *args, &block)
|
95
|
-
|
96
|
-
expect(implementation).
|
97
|
-
to have_received(:call).
|
98
|
-
with(call)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe '#deactivate' do
|
103
|
-
it 'restores the original method after being doubled' do
|
104
|
-
klass = create_class(a_method: 42)
|
105
|
-
world = build_world(
|
106
|
-
original_method_for: klass.instance_method(:a_method)
|
107
|
-
)
|
108
|
-
instance = klass.new
|
109
|
-
double = described_class.new(
|
110
|
-
world,
|
111
|
-
klass,
|
112
|
-
:a_method,
|
113
|
-
build_implementation
|
114
|
-
)
|
115
|
-
|
116
|
-
double.activate
|
117
|
-
double.deactivate
|
118
|
-
expect(instance.a_method).to eq 42
|
119
|
-
end
|
120
|
-
|
121
|
-
it 'still restores the original method if #activate was called twice' do
|
122
|
-
method_name = :a_method
|
123
|
-
klass = create_class(method_name => 42)
|
124
|
-
world = build_world(
|
125
|
-
original_method_for: klass.instance_method(:a_method)
|
126
|
-
)
|
127
|
-
instance = klass.new
|
128
|
-
double = described_class.new(
|
129
|
-
world,
|
130
|
-
klass,
|
131
|
-
:a_method,
|
132
|
-
build_implementation
|
133
|
-
)
|
134
|
-
|
135
|
-
double.activate
|
136
|
-
double.activate
|
137
|
-
double.deactivate
|
138
|
-
expect(instance.a_method).to eq 42
|
139
|
-
end
|
140
|
-
|
141
|
-
it 'does nothing if the method has not been doubled' do
|
142
|
-
klass = create_class(a_method: 42)
|
143
|
-
instance = klass.new
|
144
|
-
double = described_class.new(
|
145
|
-
build_world,
|
146
|
-
klass,
|
147
|
-
:a_method,
|
148
|
-
build_implementation
|
149
|
-
)
|
150
|
-
|
151
|
-
double.deactivate
|
152
|
-
expect(instance.a_method).to eq 42
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe '#record_call' do
|
157
|
-
it 'adds the given call to the list of calls' do
|
158
|
-
double = described_class.new(
|
159
|
-
build_world,
|
160
|
-
:a_klass,
|
161
|
-
:a_method,
|
162
|
-
:an_implementation
|
163
|
-
)
|
164
|
-
double.record_call(:some_call)
|
165
|
-
expect(double.calls.last).to eq :some_call
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
describe '#call_original_method' do
|
170
|
-
it 'binds the stored method object to the given object and calls it with the given args and block' do
|
171
|
-
expected_args = [:one, :two, :three]
|
172
|
-
expected_block = -> { }
|
173
|
-
actual_args = actual_block = method_called = nil
|
174
|
-
method_name = :a_method
|
175
|
-
klass = create_class
|
176
|
-
klass.__send__(:define_method, method_name) do |*args, &block|
|
177
|
-
actual_args = args
|
178
|
-
actual_block = block
|
179
|
-
method_called = true
|
180
|
-
end
|
181
|
-
world = build_world(
|
182
|
-
original_method_for: klass.instance_method(method_name)
|
183
|
-
)
|
184
|
-
instance = klass.new
|
185
|
-
call = double('call',
|
186
|
-
object: instance,
|
187
|
-
method_name: method_name,
|
188
|
-
args: expected_args,
|
189
|
-
block: expected_block
|
190
|
-
)
|
191
|
-
double = described_class.new(
|
192
|
-
world,
|
193
|
-
klass,
|
194
|
-
method_name,
|
195
|
-
:an_implementation
|
196
|
-
)
|
197
|
-
|
198
|
-
double.activate
|
199
|
-
double.call_original_method(call)
|
200
|
-
|
201
|
-
expect(actual_args).to eq expected_args
|
202
|
-
expect(actual_block).to eq expected_block
|
203
|
-
expect(method_called).to eq true
|
204
|
-
end
|
205
|
-
|
206
|
-
it 'does nothing if no method has been stored' do
|
207
|
-
method_name = :a_method
|
208
|
-
world = build_world(original_method_for: nil)
|
209
|
-
call = double('call', method_name: method_name)
|
210
|
-
double = described_class.new(
|
211
|
-
world,
|
212
|
-
:klass,
|
213
|
-
method_name,
|
214
|
-
:an_implementation
|
215
|
-
)
|
216
|
-
expect { double.call_original_method(call) }.not_to raise_error
|
217
|
-
end
|
218
|
-
|
219
|
-
it 'does not store the original method multiple times when a method is doubled multiple times' do
|
220
|
-
world = Shoulda::Matchers::Doublespeak::World.new
|
221
|
-
klass = create_class(a_method: :some_return_value)
|
222
|
-
method_name = :a_method
|
223
|
-
doubles = 2.times.map do
|
224
|
-
described_class.new(
|
225
|
-
world,
|
226
|
-
klass,
|
227
|
-
method_name,
|
228
|
-
build_implementation
|
229
|
-
)
|
230
|
-
end
|
231
|
-
instance = klass.new
|
232
|
-
|
233
|
-
doubles[0].activate
|
234
|
-
|
235
|
-
was_called = false
|
236
|
-
klass.__send__(:define_method, method_name) do
|
237
|
-
was_called = true
|
238
|
-
end
|
239
|
-
|
240
|
-
doubles[1].activate
|
241
|
-
|
242
|
-
doubles.each(&:deactivate)
|
243
|
-
|
244
|
-
instance.__send__(method_name)
|
245
|
-
|
246
|
-
expect(was_called).to be false
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
def create_class(methods = {})
|
251
|
-
Class.new.tap do |klass|
|
252
|
-
methods.each do |name, value|
|
253
|
-
klass.__send__(:define_method, name) { |*args| value }
|
254
|
-
end
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
def build_implementation
|
259
|
-
double('implementation', returns: nil, call: nil)
|
260
|
-
end
|
261
|
-
|
262
|
-
def build_world(methods = {})
|
263
|
-
defaults = {
|
264
|
-
original_method_for: nil,
|
265
|
-
store_original_method_for: nil,
|
266
|
-
doubles_activated?: nil
|
267
|
-
}
|
268
|
-
double('world', defaults.merge(methods))
|
269
|
-
end
|
270
|
-
end
|
271
|
-
end
|
@@ -1,77 +0,0 @@
|
|
1
|
-
require 'doublespeak_spec_helper'
|
2
|
-
|
3
|
-
module Shoulda::Matchers::Doublespeak
|
4
|
-
describe ObjectDouble do
|
5
|
-
it 'responds to any method' do
|
6
|
-
double = described_class.new
|
7
|
-
|
8
|
-
expect(double.respond_to?(:foo)).to be true
|
9
|
-
expect(double.respond_to?(:bar)).to be true
|
10
|
-
expect(double.respond_to?(:baz)).to be true
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'returns nil from any method call' do
|
14
|
-
double = described_class.new
|
15
|
-
|
16
|
-
expect(double.foo).to be nil
|
17
|
-
expect(double.bar).to be nil
|
18
|
-
expect(double.baz).to be nil
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'records every method call' do
|
22
|
-
double = described_class.new
|
23
|
-
|
24
|
-
block = -> { :some_return_value }
|
25
|
-
double.foo
|
26
|
-
double.bar(42)
|
27
|
-
double.baz(:zing, :zang, &block)
|
28
|
-
|
29
|
-
expect(double.calls.size).to eq 3
|
30
|
-
double.calls[0].tap do |call|
|
31
|
-
expect(call.args).to eq []
|
32
|
-
expect(call.block).to eq nil
|
33
|
-
end
|
34
|
-
double.calls[1].tap do |call|
|
35
|
-
expect(call.args).to eq [42]
|
36
|
-
expect(call.block).to eq nil
|
37
|
-
end
|
38
|
-
double.calls[2].tap do |call|
|
39
|
-
expect(call.args).to eq [:zing, :zang]
|
40
|
-
expect(call.block).to eq block
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#calls_to' do
|
45
|
-
it 'returns all of the invocations of the given method and their arguments/block' do
|
46
|
-
double = described_class.new
|
47
|
-
|
48
|
-
block = -> { :some_return_value }
|
49
|
-
double.foo
|
50
|
-
double.foo(42)
|
51
|
-
double.foo(:zing, :zang, &block)
|
52
|
-
double.some_other_method(:doesnt_matter)
|
53
|
-
|
54
|
-
calls = double.calls_to(:foo)
|
55
|
-
|
56
|
-
expect(calls.size).to eq 3
|
57
|
-
calls[0].tap do |call|
|
58
|
-
expect(call.args).to eq []
|
59
|
-
expect(call.block).to eq nil
|
60
|
-
end
|
61
|
-
calls[1].tap do |call|
|
62
|
-
expect(call.args).to eq [42]
|
63
|
-
expect(call.block).to eq nil
|
64
|
-
end
|
65
|
-
calls[2].tap do |call|
|
66
|
-
expect(call.args).to eq [:zing, :zang]
|
67
|
-
expect(call.block).to eq block
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'returns an empty array if the given method was never called' do
|
72
|
-
double = described_class.new
|
73
|
-
expect(double.calls_to(:unknown_method)).to eq []
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'doublespeak_spec_helper'
|
2
|
-
|
3
|
-
module Shoulda::Matchers::Doublespeak
|
4
|
-
describe ProxyImplementation do
|
5
|
-
describe '#returns' do
|
6
|
-
it 'delegates to its stub_implementation' do
|
7
|
-
stub_implementation = build_stub_implementation
|
8
|
-
implementation = described_class.new(stub_implementation)
|
9
|
-
implementation.returns(:value)
|
10
|
-
|
11
|
-
expect(stub_implementation).to have_received(:returns).with(:value)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
describe '#call' do
|
16
|
-
it 'calls #call_original_method on the double' do
|
17
|
-
stub_implementation = build_stub_implementation
|
18
|
-
double = build_double
|
19
|
-
call = build_call(double: double)
|
20
|
-
allow(double).to receive(:call_original_method)
|
21
|
-
implementation = described_class.new(stub_implementation)
|
22
|
-
|
23
|
-
implementation.call(call)
|
24
|
-
|
25
|
-
expect(double).
|
26
|
-
to have_received(:call_original_method).
|
27
|
-
with(call)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'delegates to its stub_implementation' do
|
31
|
-
stub_implementation = build_stub_implementation
|
32
|
-
double = build_double
|
33
|
-
call2 = build_call
|
34
|
-
call = build_call(double: double, with_return_value: call2)
|
35
|
-
allow(double).to receive(:call_original_method)
|
36
|
-
implementation = described_class.new(stub_implementation)
|
37
|
-
|
38
|
-
implementation.call(call)
|
39
|
-
|
40
|
-
expect(stub_implementation).
|
41
|
-
to have_received(:call).
|
42
|
-
with(call2)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'returns the return value of the original method' do
|
46
|
-
return_value = :some_return_value
|
47
|
-
stub_implementation = build_stub_implementation
|
48
|
-
double = build_double(call_original_method: return_value)
|
49
|
-
call = build_call(double: double)
|
50
|
-
implementation = described_class.new(stub_implementation)
|
51
|
-
|
52
|
-
return_value = implementation.call(call)
|
53
|
-
|
54
|
-
expect(return_value).to be return_value
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def build_stub_implementation
|
59
|
-
double('stub_implementation', returns: nil, call: nil)
|
60
|
-
end
|
61
|
-
|
62
|
-
def build_double(methods = {})
|
63
|
-
defaults = { call_original_method: nil }
|
64
|
-
double('double', defaults.merge(methods))
|
65
|
-
end
|
66
|
-
|
67
|
-
def build_call(methods = {})
|
68
|
-
defaults = { double: build_double, with_return_value: nil }
|
69
|
-
double('call', defaults.merge(methods))
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|