opal-rspec 0.6.2 → 0.7.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitmodules +5 -5
- data/.travis.yml +47 -19
- data/Appraisals +9 -0
- data/CHANGELOG.md +4 -6
- data/Gemfile +9 -9
- data/README.md +2 -2
- data/Rakefile +4 -182
- data/bin/console +14 -0
- data/{util/create_requires.rb → bin/generate_requires} +20 -10
- data/bin/opal +3 -0
- data/bin/opal-rspec +3 -0
- data/bin/setup +7 -0
- data/config.ru +13 -11
- data/example/Gemfile +5 -1
- data/exe/opal-rspec +78 -0
- data/gemfiles/.bundle/config +2 -0
- data/gemfiles/opal_0.11.gemfile +14 -0
- data/gemfiles/opal_master.gemfile +14 -0
- data/{opal → lib-opal}/opal-rspec.rb +0 -0
- data/lib-opal/opal/rspec.rb +5 -0
- data/{opal → lib-opal}/opal/rspec/async.rb +3 -2
- data/lib-opal/opal/rspec/async/core_ext.rb +23 -0
- data/lib-opal/opal/rspec/async/example.rb +187 -0
- data/{opal → lib-opal}/opal/rspec/async/example_group.rb +1 -1
- data/{opal → lib-opal}/opal/rspec/async/hooks.rb +4 -2
- data/lib-opal/opal/rspec/async/legacy.rb +49 -0
- data/lib-opal/opal/rspec/async/reporter.rb +17 -0
- data/lib-opal/opal/rspec/async/runner.rb +44 -0
- data/lib-opal/opal/rspec/autorun.rb +3 -0
- data/lib-opal/opal/rspec/browser.rb +13 -0
- data/lib-opal/opal/rspec/default_config.rb +12 -0
- data/{opal → lib-opal}/opal/rspec/fixes.rb +0 -0
- data/{opal/opal/rspec/fixes/opal/compatibility.rb → lib-opal/opal/rspec/fixes/opal.rb} +35 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/caller_filter.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/configuration.rb +9 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/example.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/formatters.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/formatters/backtrace_formatter.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/formatters/console_codes.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/formatters/deprecation_formatter.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/formatters/generated_deprecation_message.rb +0 -0
- data/lib-opal/opal/rspec/fixes/rspec/core/formatters/json_formatter.rb +15 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/formatters/loader.rb +6 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/metadata.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/notifications.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/notifications/examples_notification.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/notifications/failed_example_notification.rb +0 -0
- data/lib-opal/opal/rspec/fixes/rspec/core/notifications/summary_notification.rb +21 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/ordering.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/ordering/random.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/core/warnings.rb +10 -1
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/example_groups.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/expectations.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/expectations/fail_with.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/matchers.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/matchers/built_in.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/matchers/built_in/all.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/matchers/built_in/compound.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/matchers/built_in/start_and_end_with.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/matchers/built_in/yield.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/matchers/pretty.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/mocks.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/mocks/error_generator.rb +0 -0
- data/lib-opal/opal/rspec/fixes/rspec/mocks/space.rb +41 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/mocks/test_double.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/mocks/verifying_double.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/support.rb +1 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/support/encoded_string.rb +0 -0
- data/lib-opal/opal/rspec/fixes/rspec/support/formatter_support.rb +34 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/support/recursive_const_methods.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/support/spec.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/support/spec/stderr_splitter.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/fixes/rspec/support/warnings.rb +0 -2
- data/{opal → lib-opal}/opal/rspec/formatter/browser_formatter.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/formatter/document_io.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/formatter/element.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/formatter/html_printer.rb +0 -0
- data/{opal → lib-opal}/opal/rspec/formatter/noop_flush_string_io.rb +2 -0
- data/{opal → lib-opal}/opal/rspec/pre_require_fixes.rb +1 -1
- data/{opal → lib-opal}/opal/rspec/requires.rb +5 -2
- data/lib-opal/opal/rspec/spec_opts.rb.erb +1 -0
- data/{opal → lib-opal}/opal/rspec/sprockets_runner.rb.erb +0 -0
- data/lib/opal/rspec.rb +37 -28
- data/lib/opal/rspec/cached_environment.rb +7 -4
- data/lib/opal/rspec/locator.rb +38 -0
- data/lib/opal/rspec/rake_task.rb +12 -130
- data/lib/opal/rspec/runner.rb +136 -0
- data/lib/opal/rspec/sprockets_environment.rb +5 -3
- data/lib/opal/rspec/version.rb +1 -1
- data/opal-rspec.gemspec +32 -20
- data/rspec-core/spec/files_to_exclude.txt +12 -0
- data/rspec-core/spec/filters.rb +211 -0
- data/rspec-core/spec/fixes/missing_constants.rb +34 -0
- data/{spec/rspec/core → rspec-core/spec/fixes}/sandboxing.rb +0 -0
- data/rspec-core/spec/fixes/shared_examples.rb +6 -0
- data/rspec-core/spec/requires.rb +41 -0
- data/{spec/rspec/expectations/spec_files_exclude.txt → rspec-expectations/spec/files_to_exclude.txt} +0 -0
- data/rspec-expectations/spec/filters.rb +188 -0
- data/{spec/rspec/expectations/fixes/not_compatible.rb → rspec-expectations/spec/fixes/missing_constants.rb} +4 -0
- data/rspec-expectations/spec/fixes/shared_examples.rb +15 -0
- data/rspec-expectations/spec/requires.rb +32 -0
- data/{spec/rspec/mocks/spec_files_exclude.txt → rspec-mocks/spec/files_to_exclude.txt} +0 -0
- data/rspec-mocks/spec/filters.rb +98 -0
- data/rspec-mocks/spec/fixes/shared_examples.rb +6 -0
- data/rspec-mocks/spec/requires.rb +22 -0
- data/{spec/rspec/support/spec_files_exclude.txt → rspec-support/spec/files_to_exclude.txt} +0 -0
- data/rspec-support/spec/filters.rb +17 -0
- data/{spec/rspec/mocks → rspec-support/spec}/fixes/missing_constants.rb +0 -0
- data/{spec/rspec/core → rspec-support/spec}/fixes/shared_examples.rb +1 -0
- data/{spec/rspec/core/require_specs.rb → rspec-support/spec/requires.rb} +14 -8
- data/spec-opal-passing/spec_helper.rb +3 -0
- data/spec-opal-passing/tautology_spec.rb +21 -0
- data/{spec/rspec/core/opal_alternates/rspec → spec-opal-rspec}/core/example_group_spec.rb +0 -0
- data/{spec/rspec/core/opal_alternates/rspec → spec-opal-rspec}/core/failed_example_notification_spec.rb +0 -0
- data/{spec/rspec/core/opal_alternates/rspec → spec-opal-rspec}/core/hooks_spec.rb +0 -0
- data/{spec/rspec/core/opal_alternates/rspec → spec-opal-rspec}/core/memoized_helpers_spec.rb +3 -3
- data/{spec/rspec/core/opal_alternates/rspec → spec-opal-rspec}/core/metadata_spec.rb +0 -0
- data/{spec/rspec/expectations/opal_alternates → spec-opal-rspec/expectations}/be_instance_of_spec.rb +0 -0
- data/{spec/rspec/expectations/opal_alternates → spec-opal-rspec/expectations}/dsl_spec.rb +0 -0
- data/{spec/rspec/expectations/opal_alternates → spec-opal-rspec/expectations}/expectation_target_spec.rb +0 -0
- data/{spec/rspec/expectations/opal_alternates → spec-opal-rspec/expectations}/yield_spec.rb +0 -0
- data/{spec/opal → spec-opal}/after_hooks_spec.rb +0 -0
- data/{spec/opal → spec-opal}/around_hooks_spec.rb +0 -89
- data/{spec/opal → spec-opal}/async_spec.rb +1 -53
- data/{spec/opal → spec-opal}/before_hooks_spec.rb +0 -0
- data/{spec/mri/unit/opal/rspec/opal/browser_formatter_spec.rb → spec-opal/browser-formatter/opal_browser_formatter_spec.rb} +1 -1
- data/{spec/opal → spec-opal}/example_spec.rb +0 -0
- data/spec-opal/legacy_async_spec.rb +189 -0
- data/{spec/opal → spec-opal}/matchers_spec.rb +0 -0
- data/{spec/opal → spec-opal}/mock_spec.rb +0 -0
- data/{spec → spec-opal}/other/color_on_by_default_spec.rb +0 -0
- data/{spec → spec-opal}/other/dummy_spec.rb +0 -0
- data/{spec → spec-opal}/other/formatter_dependency.rb +0 -0
- data/{spec → spec-opal}/other/ignored_spec.opal +0 -0
- data/{spec → spec-opal}/other/test_formatter.rb +0 -0
- data/{spec/opal → spec-opal}/should_syntax_spec.rb +0 -0
- data/{spec/opal → spec-opal}/skip_pending_spec.rb +0 -0
- data/{spec/opal → spec-opal}/spec_helper.rb +4 -0
- data/{spec/mri/integration/rack → spec-opal}/sprockets_runner_js_errors.rb.erb +5 -7
- data/{spec/opal → spec-opal}/subject_spec.rb +0 -0
- data/{rspec-core/spec/rspec/core/resources/a_bar.rb → stubs/cgi/escape.rb} +0 -0
- data/{rspec-core/spec/rspec/core/resources/a_foo.rb → stubs/cgi/util.rb} +0 -0
- data/{rspec-core/spec/rspec/core/resources/acceptance/bar.rb → stubs/diff/lcs.rb} +0 -0
- data/{rspec-core/spec/rspec/core/resources/acceptance/foo_spec.rb → stubs/diff/lcs/assertions.rb} +0 -0
- data/{rspec-core/spec/support/fake_minitest/minitest.rb → stubs/diff/lcs/block.rb} +0 -0
- data/stubs/diff/lcs/callbacks.rb +0 -0
- data/stubs/diff/lcs/change.rb +0 -0
- data/stubs/diff/lcs/hunk.rb +0 -0
- data/stubs/diff/lcs/internals.rb +0 -0
- data/stubs/drb/drb.rb +0 -0
- data/stubs/minitest.rb +0 -0
- data/stubs/minitest/assertions.rb +0 -0
- data/stubs/minitest/unit.rb +0 -0
- data/stubs/mutex_m.rb +0 -0
- data/stubs/optparse.rb +0 -0
- data/stubs/prettyprint.rb +0 -0
- data/stubs/rubygems/bundler_version_finder.rb +0 -0
- data/stubs/rubygems/util.rb +0 -0
- data/stubs/shellwords.rb +0 -0
- data/stubs/socket.rb +0 -0
- data/stubs/tempfile.rb +0 -0
- data/stubs/test/unit/assertions.rb +0 -0
- data/stubs/uri.rb +0 -0
- data/tasks/building.rake +50 -0
- data/tasks/testing.rake +73 -0
- metadata +203 -651
- data/lib/opal/rspec/post_rack_locator.rb +0 -20
- data/lib/opal/rspec/pre_rack_locator.rb +0 -32
- data/opal/opal/rspec.rb +0 -23
- data/opal/opal/rspec/async/async_example.rb +0 -96
- data/opal/opal/rspec/async/legacy.rb +0 -49
- data/opal/opal/rspec/async/reporter.rb +0 -9
- data/opal/opal/rspec/fixes/opal.rb +0 -1
- data/opal/opal/rspec/fixes/rspec/core/formatters/json_formatter.rb +0 -10
- data/opal/opal/rspec/fixes/rspec/core/notifications/summary_notification.rb +0 -25
- data/opal/opal/rspec/fixes/rspec/mocks/space.rb +0 -37
- data/opal/opal/rspec/formatter/opal_closed_tty_io.rb +0 -27
- data/opal/opal/rspec/runner.rb +0 -91
- data/opal/opal/rspec/spec_opts.rb.erb +0 -27
- data/rspec-core/benchmarks/call_v_yield.rb +0 -81
- data/rspec-core/benchmarks/check_inclusion.rb +0 -125
- data/rspec-core/benchmarks/define_method_v_attr_reader_v_def.rb +0 -81
- data/rspec-core/benchmarks/eager_vs_lazy_metadata.rb +0 -126
- data/rspec-core/benchmarks/eager_vs_lazy_metadata/define_examples.rb +0 -22
- data/rspec-core/benchmarks/filter_object.rb +0 -35
- data/rspec-core/benchmarks/index_v_take_while.rb +0 -47
- data/rspec-core/benchmarks/map_then_flatten_vs_flat_map_benchmarks.rb +0 -94
- data/rspec-core/benchmarks/require_relative_v_require.rb +0 -75
- data/rspec-core/benchmarks/respond_to_v_defined.rb +0 -72
- data/rspec-core/benchmarks/several_regexps_v_one_big_one.rb +0 -86
- data/rspec-core/benchmarks/sort_by_v_shuffle.rb +0 -83
- data/rspec-core/benchmarks/to_proc_v_not_to_proc.rb +0 -539
- data/rspec-core/features/step_definitions/additional_cli_steps.rb +0 -126
- data/rspec-core/features/step_definitions/core_standalone_steps.rb +0 -12
- data/rspec-core/features/support/env.rb +0 -21
- data/rspec-core/features/support/require_expect_syntax_in_aruba_specs.rb +0 -29
- data/rspec-core/features/support/rubinius.rb +0 -6
- data/rspec-core/lib/rspec/autorun.rb +0 -2
- data/rspec-core/lib/rspec/core.rb +0 -169
- data/rspec-core/lib/rspec/core/backport_random.rb +0 -336
- data/rspec-core/lib/rspec/core/backtrace_formatter.rb +0 -66
- data/rspec-core/lib/rspec/core/configuration.rb +0 -1440
- data/rspec-core/lib/rspec/core/configuration_options.rb +0 -173
- data/rspec-core/lib/rspec/core/drb.rb +0 -111
- data/rspec-core/lib/rspec/core/dsl.rb +0 -93
- data/rspec-core/lib/rspec/core/example.rb +0 -502
- data/rspec-core/lib/rspec/core/example_group.rb +0 -606
- data/rspec-core/lib/rspec/core/filter_manager.rb +0 -259
- data/rspec-core/lib/rspec/core/flat_map.rb +0 -18
- data/rspec-core/lib/rspec/core/formatters.rb +0 -240
- data/rspec-core/lib/rspec/core/formatters/base_formatter.rb +0 -67
- data/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb +0 -76
- data/rspec-core/lib/rspec/core/formatters/console_codes.rb +0 -64
- data/rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb +0 -222
- data/rspec-core/lib/rspec/core/formatters/documentation_formatter.rb +0 -68
- data/rspec-core/lib/rspec/core/formatters/helpers.rb +0 -87
- data/rspec-core/lib/rspec/core/formatters/html_formatter.rb +0 -149
- data/rspec-core/lib/rspec/core/formatters/html_printer.rb +0 -403
- data/rspec-core/lib/rspec/core/formatters/json_formatter.rb +0 -94
- data/rspec-core/lib/rspec/core/formatters/profile_formatter.rb +0 -65
- data/rspec-core/lib/rspec/core/formatters/progress_formatter.rb +0 -28
- data/rspec-core/lib/rspec/core/formatters/protocol.rb +0 -163
- data/rspec-core/lib/rspec/core/formatters/snippet_extractor.rb +0 -104
- data/rspec-core/lib/rspec/core/hooks.rb +0 -591
- data/rspec-core/lib/rspec/core/memoized_helpers.rb +0 -472
- data/rspec-core/lib/rspec/core/metadata.rb +0 -437
- data/rspec-core/lib/rspec/core/metadata_filter.rb +0 -95
- data/rspec-core/lib/rspec/core/minitest_assertions_adapter.rb +0 -28
- data/rspec-core/lib/rspec/core/mocking_adapters/flexmock.rb +0 -31
- data/rspec-core/lib/rspec/core/mocking_adapters/mocha.rb +0 -57
- data/rspec-core/lib/rspec/core/mocking_adapters/null.rb +0 -14
- data/rspec-core/lib/rspec/core/mocking_adapters/rr.rb +0 -31
- data/rspec-core/lib/rspec/core/mocking_adapters/rspec.rb +0 -32
- data/rspec-core/lib/rspec/core/notifications.rb +0 -542
- data/rspec-core/lib/rspec/core/option_parser.rb +0 -222
- data/rspec-core/lib/rspec/core/ordering.rb +0 -155
- data/rspec-core/lib/rspec/core/pending.rb +0 -163
- data/rspec-core/lib/rspec/core/project_initializer.rb +0 -48
- data/rspec-core/lib/rspec/core/project_initializer/spec/spec_helper.rb +0 -89
- data/rspec-core/lib/rspec/core/rake_task.rb +0 -187
- data/rspec-core/lib/rspec/core/reporter.rb +0 -149
- data/rspec-core/lib/rspec/core/ruby_project.rb +0 -45
- data/rspec-core/lib/rspec/core/runner.rb +0 -158
- data/rspec-core/lib/rspec/core/shared_context.rb +0 -55
- data/rspec-core/lib/rspec/core/shared_example_group.rb +0 -182
- data/rspec-core/lib/rspec/core/test_unit_assertions_adapter.rb +0 -30
- data/rspec-core/lib/rspec/core/version.rb +0 -9
- data/rspec-core/lib/rspec/core/warnings.rb +0 -40
- data/rspec-core/lib/rspec/core/world.rb +0 -183
- data/rspec-core/spec/command_line/order_spec.rb +0 -213
- data/rspec-core/spec/rspec/core/backtrace_formatter_spec.rb +0 -306
- data/rspec-core/spec/rspec/core/configuration_options_spec.rb +0 -425
- data/rspec-core/spec/rspec/core/configuration_spec.rb +0 -1963
- data/rspec-core/spec/rspec/core/drb_spec.rb +0 -278
- data/rspec-core/spec/rspec/core/dsl_spec.rb +0 -85
- data/rspec-core/spec/rspec/core/example_execution_result_spec.rb +0 -142
- data/rspec-core/spec/rspec/core/example_group_constants_spec.rb +0 -16
- data/rspec-core/spec/rspec/core/example_group_spec.rb +0 -1621
- data/rspec-core/spec/rspec/core/example_spec.rb +0 -662
- data/rspec-core/spec/rspec/core/failed_example_notification_spec.rb +0 -25
- data/rspec-core/spec/rspec/core/filter_manager_spec.rb +0 -299
- data/rspec-core/spec/rspec/core/formatters/base_text_formatter_spec.rb +0 -182
- data/rspec-core/spec/rspec/core/formatters/console_codes_spec.rb +0 -65
- data/rspec-core/spec/rspec/core/formatters/deprecation_formatter_spec.rb +0 -225
- data/rspec-core/spec/rspec/core/formatters/documentation_formatter_spec.rb +0 -111
- data/rspec-core/spec/rspec/core/formatters/helpers_spec.rb +0 -104
- data/rspec-core/spec/rspec/core/formatters/html_formatter_spec.rb +0 -111
- data/rspec-core/spec/rspec/core/formatters/json_formatter_spec.rb +0 -183
- data/rspec-core/spec/rspec/core/formatters/profile_formatter_spec.rb +0 -99
- data/rspec-core/spec/rspec/core/formatters/progress_formatter_spec.rb +0 -55
- data/rspec-core/spec/rspec/core/formatters/snippet_extractor_spec.rb +0 -26
- data/rspec-core/spec/rspec/core/formatters_spec.rb +0 -160
- data/rspec-core/spec/rspec/core/hooks_filtering_spec.rb +0 -227
- data/rspec-core/spec/rspec/core/hooks_spec.rb +0 -447
- data/rspec-core/spec/rspec/core/memoized_helpers_spec.rb +0 -537
- data/rspec-core/spec/rspec/core/metadata_filter_spec.rb +0 -181
- data/rspec-core/spec/rspec/core/metadata_spec.rb +0 -642
- data/rspec-core/spec/rspec/core/notifications_spec.rb +0 -92
- data/rspec-core/spec/rspec/core/option_parser_spec.rb +0 -270
- data/rspec-core/spec/rspec/core/ordering_spec.rb +0 -102
- data/rspec-core/spec/rspec/core/pending_example_spec.rb +0 -221
- data/rspec-core/spec/rspec/core/pending_spec.rb +0 -8
- data/rspec-core/spec/rspec/core/project_initializer_spec.rb +0 -123
- data/rspec-core/spec/rspec/core/rake_task_spec.rb +0 -351
- data/rspec-core/spec/rspec/core/random_spec.rb +0 -47
- data/rspec-core/spec/rspec/core/reporter_spec.rb +0 -198
- data/rspec-core/spec/rspec/core/resources/a_spec.rb +0 -1
- data/rspec-core/spec/rspec/core/resources/custom_example_group_runner.rb +0 -14
- data/rspec-core/spec/rspec/core/resources/formatter_specs.rb +0 -58
- data/rspec-core/spec/rspec/core/resources/utf8_encoded.rb +0 -9
- data/rspec-core/spec/rspec/core/rspec_matchers_spec.rb +0 -45
- data/rspec-core/spec/rspec/core/ruby_project_spec.rb +0 -26
- data/rspec-core/spec/rspec/core/runner_spec.rb +0 -309
- data/rspec-core/spec/rspec/core/shared_context_spec.rb +0 -102
- data/rspec-core/spec/rspec/core/shared_example_group_spec.rb +0 -268
- data/rspec-core/spec/rspec/core/warnings_spec.rb +0 -72
- data/rspec-core/spec/rspec/core/world_spec.rb +0 -142
- data/rspec-core/spec/rspec/core_spec.rb +0 -103
- data/rspec-core/spec/spec_helper.rb +0 -89
- data/rspec-core/spec/support/config_options_helper.rb +0 -13
- data/rspec-core/spec/support/fake_minitest/minitest/minitest_assertions.rb +0 -4
- data/rspec-core/spec/support/fake_minitest/test/unit/assertions.rb +0 -6
- data/rspec-core/spec/support/formatter_support.rb +0 -263
- data/rspec-core/spec/support/helper_methods.rb +0 -26
- data/rspec-core/spec/support/isolated_home_directory.rb +0 -16
- data/rspec-core/spec/support/matchers.rb +0 -103
- data/rspec-core/spec/support/mathn_integration_support.rb +0 -12
- data/rspec-core/spec/support/sandboxing.rb +0 -50
- data/rspec-core/spec/support/shared_example_groups.rb +0 -43
- data/rspec-core/spec/support/spec_files.rb +0 -44
- data/rspec-expectations/benchmarks/2.x_vs_3.x_matcher_dsl_implementation.rb +0 -253
- data/rspec-expectations/benchmarks/autoload_v_require.rb +0 -25
- data/rspec-expectations/benchmarks/cloning_matchers.rb +0 -19
- data/rspec-expectations/benchmarks/default_messages_as_methods_v_blocks.rb +0 -27
- data/rspec-expectations/benchmarks/example_spec.rb +0 -9
- data/rspec-expectations/benchmarks/include_v_superclass.rb +0 -39
- data/rspec-expectations/benchmarks/match_array/failing_with_distinct_items.rb +0 -147
- data/rspec-expectations/benchmarks/match_array/failing_with_duplicate_items.rb +0 -122
- data/rspec-expectations/benchmarks/match_array/passing_with_distinct_items.rb +0 -154
- data/rspec-expectations/benchmarks/match_array/passing_with_duplicate_items.rb +0 -132
- data/rspec-expectations/benchmarks/match_array/rubyprof/passing_with_distinct_items.rb +0 -9
- data/rspec-expectations/benchmarks/matcher_dsl_vs_classes.rb +0 -180
- data/rspec-expectations/benchmarks/method_to_proc.rb +0 -72
- data/rspec-expectations/benchmarks/set_vs_array_include.rb +0 -68
- data/rspec-expectations/features/step_definitions/additional_cli_steps.rb +0 -22
- data/rspec-expectations/features/support/disallow_certain_apis.rb +0 -34
- data/rspec-expectations/features/support/env.rb +0 -21
- data/rspec-expectations/features/support/rubinius.rb +0 -6
- data/rspec-expectations/lib/rspec/expectations.rb +0 -68
- data/rspec-expectations/lib/rspec/expectations/configuration.rb +0 -147
- data/rspec-expectations/lib/rspec/expectations/expectation_target.rb +0 -119
- data/rspec-expectations/lib/rspec/expectations/fail_with.rb +0 -34
- data/rspec-expectations/lib/rspec/expectations/handler.rb +0 -167
- data/rspec-expectations/lib/rspec/expectations/minitest_integration.rb +0 -17
- data/rspec-expectations/lib/rspec/expectations/syntax.rb +0 -132
- data/rspec-expectations/lib/rspec/expectations/version.rb +0 -8
- data/rspec-expectations/lib/rspec/matchers.rb +0 -967
- data/rspec-expectations/lib/rspec/matchers/aliased_matcher.rb +0 -116
- data/rspec-expectations/lib/rspec/matchers/built_in.rb +0 -52
- data/rspec-expectations/lib/rspec/matchers/built_in/all.rb +0 -85
- data/rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb +0 -132
- data/rspec-expectations/lib/rspec/matchers/built_in/be.rb +0 -277
- data/rspec-expectations/lib/rspec/matchers/built_in/be_between.rb +0 -77
- data/rspec-expectations/lib/rspec/matchers/built_in/be_instance_of.rb +0 -22
- data/rspec-expectations/lib/rspec/matchers/built_in/be_kind_of.rb +0 -16
- data/rspec-expectations/lib/rspec/matchers/built_in/be_within.rb +0 -72
- data/rspec-expectations/lib/rspec/matchers/built_in/change.rb +0 -337
- data/rspec-expectations/lib/rspec/matchers/built_in/compound.rb +0 -258
- data/rspec-expectations/lib/rspec/matchers/built_in/contain_exactly.rb +0 -249
- data/rspec-expectations/lib/rspec/matchers/built_in/cover.rb +0 -24
- data/rspec-expectations/lib/rspec/matchers/built_in/eq.rb +0 -75
- data/rspec-expectations/lib/rspec/matchers/built_in/eql.rb +0 -34
- data/rspec-expectations/lib/rspec/matchers/built_in/equal.rb +0 -81
- data/rspec-expectations/lib/rspec/matchers/built_in/exist.rb +0 -86
- data/rspec-expectations/lib/rspec/matchers/built_in/has.rb +0 -101
- data/rspec-expectations/lib/rspec/matchers/built_in/have_attributes.rb +0 -84
- data/rspec-expectations/lib/rspec/matchers/built_in/include.rb +0 -105
- data/rspec-expectations/lib/rspec/matchers/built_in/match.rb +0 -29
- data/rspec-expectations/lib/rspec/matchers/built_in/operators.rb +0 -119
- data/rspec-expectations/lib/rspec/matchers/built_in/output.rb +0 -152
- data/rspec-expectations/lib/rspec/matchers/built_in/raise_error.rb +0 -174
- data/rspec-expectations/lib/rspec/matchers/built_in/respond_to.rb +0 -91
- data/rspec-expectations/lib/rspec/matchers/built_in/satisfy.rb +0 -39
- data/rspec-expectations/lib/rspec/matchers/built_in/start_and_end_with.rb +0 -82
- data/rspec-expectations/lib/rspec/matchers/built_in/throw_symbol.rb +0 -132
- data/rspec-expectations/lib/rspec/matchers/built_in/yield.rb +0 -420
- data/rspec-expectations/lib/rspec/matchers/composable.rb +0 -183
- data/rspec-expectations/lib/rspec/matchers/dsl.rb +0 -391
- data/rspec-expectations/lib/rspec/matchers/generated_descriptions.rb +0 -42
- data/rspec-expectations/lib/rspec/matchers/matcher_delegator.rb +0 -33
- data/rspec-expectations/lib/rspec/matchers/matcher_protocol.rb +0 -99
- data/rspec-expectations/lib/rspec/matchers/pretty.rb +0 -77
- data/rspec-expectations/spec/rspec/expectations/configuration_spec.rb +0 -226
- data/rspec-expectations/spec/rspec/expectations/expectation_target_spec.rb +0 -147
- data/rspec-expectations/spec/rspec/expectations/extensions/kernel_spec.rb +0 -69
- data/rspec-expectations/spec/rspec/expectations/fail_with_spec.rb +0 -73
- data/rspec-expectations/spec/rspec/expectations/handler_spec.rb +0 -200
- data/rspec-expectations/spec/rspec/expectations/minitest_integration_spec.rb +0 -25
- data/rspec-expectations/spec/rspec/expectations/syntax_spec.rb +0 -93
- data/rspec-expectations/spec/rspec/expectations_spec.rb +0 -15
- data/rspec-expectations/spec/rspec/matchers/aliased_matcher_spec.rb +0 -113
- data/rspec-expectations/spec/rspec/matchers/aliases_spec.rb +0 -455
- data/rspec-expectations/spec/rspec/matchers/built_in/all_spec.rb +0 -212
- data/rspec-expectations/spec/rspec/matchers/built_in/base_matcher_spec.rb +0 -140
- data/rspec-expectations/spec/rspec/matchers/built_in/be_between_spec.rb +0 -157
- data/rspec-expectations/spec/rspec/matchers/built_in/be_instance_of_spec.rb +0 -61
- data/rspec-expectations/spec/rspec/matchers/built_in/be_kind_of_spec.rb +0 -39
- data/rspec-expectations/spec/rspec/matchers/built_in/be_spec.rb +0 -685
- data/rspec-expectations/spec/rspec/matchers/built_in/be_within_spec.rb +0 -139
- data/rspec-expectations/spec/rspec/matchers/built_in/change_spec.rb +0 -829
- data/rspec-expectations/spec/rspec/matchers/built_in/compound_spec.rb +0 -537
- data/rspec-expectations/spec/rspec/matchers/built_in/contain_exactly_spec.rb +0 -556
- data/rspec-expectations/spec/rspec/matchers/built_in/cover_spec.rb +0 -67
- data/rspec-expectations/spec/rspec/matchers/built_in/eq_spec.rb +0 -176
- data/rspec-expectations/spec/rspec/matchers/built_in/eql_spec.rb +0 -39
- data/rspec-expectations/spec/rspec/matchers/built_in/equal_spec.rb +0 -130
- data/rspec-expectations/spec/rspec/matchers/built_in/exist_spec.rb +0 -139
- data/rspec-expectations/spec/rspec/matchers/built_in/has_spec.rb +0 -179
- data/rspec-expectations/spec/rspec/matchers/built_in/have_attributes_spec.rb +0 -177
- data/rspec-expectations/spec/rspec/matchers/built_in/include_spec.rb +0 -587
- data/rspec-expectations/spec/rspec/matchers/built_in/match_spec.rb +0 -100
- data/rspec-expectations/spec/rspec/matchers/built_in/operators_spec.rb +0 -250
- data/rspec-expectations/spec/rspec/matchers/built_in/output_spec.rb +0 -168
- data/rspec-expectations/spec/rspec/matchers/built_in/raise_error_spec.rb +0 -446
- data/rspec-expectations/spec/rspec/matchers/built_in/respond_to_spec.rb +0 -290
- data/rspec-expectations/spec/rspec/matchers/built_in/satisfy_spec.rb +0 -42
- data/rspec-expectations/spec/rspec/matchers/built_in/start_and_end_with_spec.rb +0 -347
- data/rspec-expectations/spec/rspec/matchers/built_in/throw_symbol_spec.rb +0 -133
- data/rspec-expectations/spec/rspec/matchers/built_in/yield_spec.rb +0 -643
- data/rspec-expectations/spec/rspec/matchers/composable_spec.rb +0 -77
- data/rspec-expectations/spec/rspec/matchers/define_negated_matcher_spec.rb +0 -199
- data/rspec-expectations/spec/rspec/matchers/description_generation_spec.rb +0 -189
- data/rspec-expectations/spec/rspec/matchers/dsl_spec.rb +0 -1036
- data/rspec-expectations/spec/rspec/matchers/legacy_spec.rb +0 -104
- data/rspec-expectations/spec/rspec/matchers_spec.rb +0 -108
- data/rspec-expectations/spec/spec_helper.rb +0 -94
- data/rspec-expectations/spec/support/matchers.rb +0 -54
- data/rspec-expectations/spec/support/shared_examples.rb +0 -101
- data/rspec-mocks/benchmarks/double_creation.rb +0 -66
- data/rspec-mocks/benchmarks/each_value_v_values_each.rb +0 -58
- data/rspec-mocks/benchmarks/find_original_method_early.rb +0 -64
- data/rspec-mocks/benchmarks/method_defined_at_any_visibility.rb +0 -101
- data/rspec-mocks/benchmarks/thread_safety.rb +0 -24
- data/rspec-mocks/benchmarks/transfer_nested_constants.rb +0 -77
- data/rspec-mocks/features/step_definitions/additional_cli_steps.rb +0 -21
- data/rspec-mocks/features/support/disallow_certain_apis.rb +0 -24
- data/rspec-mocks/features/support/env.rb +0 -22
- data/rspec-mocks/features/support/rubinius.rb +0 -6
- data/rspec-mocks/lib/rspec/mocks.rb +0 -126
- data/rspec-mocks/lib/rspec/mocks/any_instance.rb +0 -10
- data/rspec-mocks/lib/rspec/mocks/any_instance/chain.rb +0 -109
- data/rspec-mocks/lib/rspec/mocks/any_instance/expect_chain_chain.rb +0 -35
- data/rspec-mocks/lib/rspec/mocks/any_instance/expectation_chain.rb +0 -48
- data/rspec-mocks/lib/rspec/mocks/any_instance/message_chains.rb +0 -85
- data/rspec-mocks/lib/rspec/mocks/any_instance/proxy.rb +0 -116
- data/rspec-mocks/lib/rspec/mocks/any_instance/recorder.rb +0 -267
- data/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb +0 -45
- data/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain_chain.rb +0 -27
- data/rspec-mocks/lib/rspec/mocks/argument_list_matcher.rb +0 -72
- data/rspec-mocks/lib/rspec/mocks/argument_matchers.rb +0 -282
- data/rspec-mocks/lib/rspec/mocks/configuration.rb +0 -157
- data/rspec-mocks/lib/rspec/mocks/error_generator.rb +0 -253
- data/rspec-mocks/lib/rspec/mocks/example_methods.rb +0 -379
- data/rspec-mocks/lib/rspec/mocks/instance_method_stasher.rb +0 -135
- data/rspec-mocks/lib/rspec/mocks/marshal_extension.rb +0 -41
- data/rspec-mocks/lib/rspec/mocks/matchers/expectation_customization.rb +0 -20
- data/rspec-mocks/lib/rspec/mocks/matchers/have_received.rb +0 -121
- data/rspec-mocks/lib/rspec/mocks/matchers/receive.rb +0 -106
- data/rspec-mocks/lib/rspec/mocks/matchers/receive_message_chain.rb +0 -66
- data/rspec-mocks/lib/rspec/mocks/matchers/receive_messages.rb +0 -71
- data/rspec-mocks/lib/rspec/mocks/message_chain.rb +0 -91
- data/rspec-mocks/lib/rspec/mocks/message_expectation.rb +0 -694
- data/rspec-mocks/lib/rspec/mocks/method_double.rb +0 -260
- data/rspec-mocks/lib/rspec/mocks/method_reference.rb +0 -155
- data/rspec-mocks/lib/rspec/mocks/mutate_const.rb +0 -324
- data/rspec-mocks/lib/rspec/mocks/object_reference.rb +0 -91
- data/rspec-mocks/lib/rspec/mocks/order_group.rb +0 -81
- data/rspec-mocks/lib/rspec/mocks/proxy.rb +0 -431
- data/rspec-mocks/lib/rspec/mocks/space.rb +0 -221
- data/rspec-mocks/lib/rspec/mocks/standalone.rb +0 -3
- data/rspec-mocks/lib/rspec/mocks/syntax.rb +0 -329
- data/rspec-mocks/lib/rspec/mocks/targets.rb +0 -97
- data/rspec-mocks/lib/rspec/mocks/test_double.rb +0 -135
- data/rspec-mocks/lib/rspec/mocks/verifying_double.rb +0 -127
- data/rspec-mocks/lib/rspec/mocks/verifying_message_expecation.rb +0 -62
- data/rspec-mocks/lib/rspec/mocks/verifying_proxy.rb +0 -171
- data/rspec-mocks/lib/rspec/mocks/version.rb +0 -9
- data/rspec-mocks/spec/rspec/mocks/and_call_original_spec.rb +0 -267
- data/rspec-mocks/spec/rspec/mocks/and_return_spec.rb +0 -21
- data/rspec-mocks/spec/rspec/mocks/and_wrap_original_spec.rb +0 -63
- data/rspec-mocks/spec/rspec/mocks/and_yield_spec.rb +0 -161
- data/rspec-mocks/spec/rspec/mocks/any_instance/message_chains_spec.rb +0 -39
- data/rspec-mocks/spec/rspec/mocks/any_instance_spec.rb +0 -1242
- data/rspec-mocks/spec/rspec/mocks/argument_matchers_spec.rb +0 -336
- data/rspec-mocks/spec/rspec/mocks/array_including_matcher_spec.rb +0 -39
- data/rspec-mocks/spec/rspec/mocks/at_least_spec.rb +0 -147
- data/rspec-mocks/spec/rspec/mocks/at_most_spec.rb +0 -113
- data/rspec-mocks/spec/rspec/mocks/before_all_spec.rb +0 -75
- data/rspec-mocks/spec/rspec/mocks/block_return_value_spec.rb +0 -68
- data/rspec-mocks/spec/rspec/mocks/combining_implementation_instructions_spec.rb +0 -196
- data/rspec-mocks/spec/rspec/mocks/configuration_spec.rb +0 -175
- data/rspec-mocks/spec/rspec/mocks/double_spec.rb +0 -830
- data/rspec-mocks/spec/rspec/mocks/example_methods_spec.rb +0 -11
- data/rspec-mocks/spec/rspec/mocks/expiration_spec.rb +0 -90
- data/rspec-mocks/spec/rspec/mocks/hash_excluding_matcher_spec.rb +0 -65
- data/rspec-mocks/spec/rspec/mocks/hash_including_matcher_spec.rb +0 -92
- data/rspec-mocks/spec/rspec/mocks/instance_method_stasher_spec.rb +0 -72
- data/rspec-mocks/spec/rspec/mocks/marshal_extension_spec.rb +0 -67
- data/rspec-mocks/spec/rspec/mocks/matchers/have_received_spec.rb +0 -513
- data/rspec-mocks/spec/rspec/mocks/matchers/receive_message_chain_spec.rb +0 -227
- data/rspec-mocks/spec/rspec/mocks/matchers/receive_messages_spec.rb +0 -148
- data/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb +0 -525
- data/rspec-mocks/spec/rspec/mocks/methods_spec.rb +0 -24
- data/rspec-mocks/spec/rspec/mocks/mock_expectation_error_spec.rb +0 -20
- data/rspec-mocks/spec/rspec/mocks/mock_ordering_spec.rb +0 -112
- data/rspec-mocks/spec/rspec/mocks/multiple_return_value_spec.rb +0 -130
- data/rspec-mocks/spec/rspec/mocks/mutate_const_spec.rb +0 -561
- data/rspec-mocks/spec/rspec/mocks/nil_expectation_warning_spec.rb +0 -52
- data/rspec-mocks/spec/rspec/mocks/null_object_double_spec.rb +0 -135
- data/rspec-mocks/spec/rspec/mocks/once_counts_spec.rb +0 -50
- data/rspec-mocks/spec/rspec/mocks/order_group_spec.rb +0 -26
- data/rspec-mocks/spec/rspec/mocks/partial_double_spec.rb +0 -379
- data/rspec-mocks/spec/rspec/mocks/partial_double_using_mocks_directly_spec.rb +0 -83
- data/rspec-mocks/spec/rspec/mocks/precise_counts_spec.rb +0 -66
- data/rspec-mocks/spec/rspec/mocks/serialization_spec.rb +0 -89
- data/rspec-mocks/spec/rspec/mocks/should_syntax_spec.rb +0 -539
- data/rspec-mocks/spec/rspec/mocks/space_spec.rb +0 -242
- data/rspec-mocks/spec/rspec/mocks/spy_spec.rb +0 -127
- data/rspec-mocks/spec/rspec/mocks/stash_spec.rb +0 -43
- data/rspec-mocks/spec/rspec/mocks/stub_chain_spec.rb +0 -166
- data/rspec-mocks/spec/rspec/mocks/stub_implementation_spec.rb +0 -98
- data/rspec-mocks/spec/rspec/mocks/stub_spec.rb +0 -520
- data/rspec-mocks/spec/rspec/mocks/stubbed_message_expectations_spec.rb +0 -56
- data/rspec-mocks/spec/rspec/mocks/syntax_agnostic_message_matchers_spec.rb +0 -99
- data/rspec-mocks/spec/rspec/mocks/syntax_spec.rb +0 -7
- data/rspec-mocks/spec/rspec/mocks/test_double_spec.rb +0 -53
- data/rspec-mocks/spec/rspec/mocks/thrice_counts_spec.rb +0 -72
- data/rspec-mocks/spec/rspec/mocks/to_ary_spec.rb +0 -52
- data/rspec-mocks/spec/rspec/mocks/twice_counts_spec.rb +0 -64
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/class_double_with_class_loaded_spec.rb +0 -118
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/class_double_with_class_not_loaded_spec.rb +0 -58
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/construction_spec.rb +0 -54
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/expected_arg_verification_spec.rb +0 -81
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/instance_double_with_class_loaded_spec.rb +0 -195
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/instance_double_with_class_not_loaded_spec.rb +0 -57
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/method_visibility_spec.rb +0 -129
- data/rspec-mocks/spec/rspec/mocks/verifying_doubles/object_double_spec.rb +0 -68
- data/rspec-mocks/spec/rspec/mocks_spec.rb +0 -199
- data/rspec-mocks/spec/spec_helper.rb +0 -131
- data/rspec-mocks/spec/support/before_all_shared_example_group.rb +0 -16
- data/rspec-mocks/spec/support/doubled_classes.rb +0 -74
- data/rspec-mocks/spec/support/matchers.rb +0 -15
- data/rspec-support/benchmarks/caller.rb +0 -81
- data/rspec-support/lib/rspec/support.rb +0 -76
- data/rspec-support/lib/rspec/support/caller_filter.rb +0 -63
- data/rspec-support/lib/rspec/support/differ.rb +0 -214
- data/rspec-support/lib/rspec/support/directory_maker.rb +0 -61
- data/rspec-support/lib/rspec/support/encoded_string.rb +0 -69
- data/rspec-support/lib/rspec/support/fuzzy_matcher.rb +0 -48
- data/rspec-support/lib/rspec/support/hunk_generator.rb +0 -47
- data/rspec-support/lib/rspec/support/matcher_definition.rb +0 -31
- data/rspec-support/lib/rspec/support/method_signature_verifier.rb +0 -272
- data/rspec-support/lib/rspec/support/os.rb +0 -18
- data/rspec-support/lib/rspec/support/recursive_const_methods.rb +0 -76
- data/rspec-support/lib/rspec/support/ruby_features.rb +0 -45
- data/rspec-support/lib/rspec/support/spec.rb +0 -72
- data/rspec-support/lib/rspec/support/spec/deprecation_helpers.rb +0 -60
- data/rspec-support/lib/rspec/support/spec/formatting_support.rb +0 -9
- data/rspec-support/lib/rspec/support/spec/in_sub_process.rb +0 -43
- data/rspec-support/lib/rspec/support/spec/prevent_load_time_warnings.rb +0 -44
- data/rspec-support/lib/rspec/support/spec/shell_out.rb +0 -69
- data/rspec-support/lib/rspec/support/spec/stderr_splitter.rb +0 -52
- data/rspec-support/lib/rspec/support/spec/with_isolated_directory.rb +0 -9
- data/rspec-support/lib/rspec/support/spec/with_isolated_stderr.rb +0 -13
- data/rspec-support/lib/rspec/support/version.rb +0 -7
- data/rspec-support/lib/rspec/support/version_checker.rb +0 -53
- data/rspec-support/lib/rspec/support/warnings.rb +0 -39
- data/rspec-support/spec/rspec/support/caller_filter_spec.rb +0 -66
- data/rspec-support/spec/rspec/support/differ_spec.rb +0 -322
- data/rspec-support/spec/rspec/support/directory_maker_spec.rb +0 -58
- data/rspec-support/spec/rspec/support/encoded_string_spec.rb +0 -86
- data/rspec-support/spec/rspec/support/fuzzy_matcher_spec.rb +0 -179
- data/rspec-support/spec/rspec/support/method_signature_verifier_spec.rb +0 -357
- data/rspec-support/spec/rspec/support/os_spec.rb +0 -36
- data/rspec-support/spec/rspec/support/recursive_const_methods_spec.rb +0 -49
- data/rspec-support/spec/rspec/support/spec/in_sub_process_spec.rb +0 -36
- data/rspec-support/spec/rspec/support/spec/prevent_load_time_warnings_spec.rb +0 -10
- data/rspec-support/spec/rspec/support/spec/shell_out_spec.rb +0 -44
- data/rspec-support/spec/rspec/support/spec/stderr_splitter_spec.rb +0 -60
- data/rspec-support/spec/rspec/support/spec/with_isolated_std_err_spec.rb +0 -21
- data/rspec-support/spec/rspec/support/version_checker_spec.rb +0 -29
- data/rspec-support/spec/rspec/support/warnings_spec.rb +0 -66
- data/rspec-support/spec/rspec/support_spec.rb +0 -119
- data/rspec-support/spec/spec_helper.rb +0 -2
- data/rspec/lib/rspec.rb +0 -3
- data/rspec/lib/rspec/version.rb +0 -5
- data/spec/mri/integration/browser_spec.rb +0 -21
- data/spec/mri/integration/spec_opts_spec.rb +0 -81
- data/spec/mri/spec_helper.rb +0 -2
- data/spec/mri/support/capybara.rb +0 -14
- data/spec/mri/unit/opal/rspec/browser_formatter_spec.rb +0 -26
- data/spec/mri/unit/opal/rspec/cached_environment_spec.rb +0 -85
- data/spec/mri/unit/opal/rspec/rack/config.ru +0 -12
- data/spec/mri/unit/opal/rspec/rake_task_spec.rb +0 -320
- data/spec/mri/unit/opal/rspec/sprockets_environment_spec.rb +0 -55
- data/spec/mri/unit/opal/rspec/temp_dir_helper.rb +0 -19
- data/spec/opal/expected_failures.txt +0 -40
- data/spec/rspec/core/config.rb +0 -5
- data/spec/rspec/core/config.ru +0 -4
- data/spec/rspec/core/core_spec_loader.rb +0 -46
- data/spec/rspec/core/filter/core/async/example_group.txt +0 -13
- data/spec/rspec/core/filter/core/async/hooks.rb +0 -11
- data/spec/rspec/core/filter/core/async/memoized_helpers.txt +0 -3
- data/spec/rspec/core/filter/core/async/metadata.rb +0 -4
- data/spec/rspec/core/filter/core/bugs/filter_manager.txt +0 -4
- data/spec/rspec/core/filter/core/bugs/formatters.txt +0 -4
- data/spec/rspec/core/filter/core/bugs/memoized_helpers.rb +0 -5
- data/spec/rspec/core/filter/core/bugs/metadata.txt +0 -5
- data/spec/rspec/core/filter/core/bugs/sandbox/subject_issue_test.rb +0 -328
- data/spec/rspec/core/filter/core/bugs/warnings_deprecations.txt +0 -3
- data/spec/rspec/core/filter/core/unsupported/core.txt +0 -5
- data/spec/rspec/core/filter/core/unsupported/example.txt +0 -7
- data/spec/rspec/core/filter/core/unsupported/example_group.txt +0 -13
- data/spec/rspec/core/filter/core/unsupported/filter_manager.txt +0 -7
- data/spec/rspec/core/filter/core/unsupported/formatters.txt +0 -27
- data/spec/rspec/core/filter/core/unsupported/hooks.txt +0 -2
- data/spec/rspec/core/filter/core/unsupported/memoized_helpers.txt +0 -6
- data/spec/rspec/core/filter/core/unsupported/metadata.txt +0 -14
- data/spec/rspec/core/filter/core/unsupported/notifications.txt +0 -8
- data/spec/rspec/core/filter/core/unsupported/world.txt +0 -3
- data/spec/rspec/core/fixes/missing_constants.rb +0 -20
- data/spec/rspec/core/spec_files_exclude.txt +0 -41
- data/spec/rspec/expectations/config.rb +0 -21
- data/spec/rspec/expectations/config.ru +0 -4
- data/spec/rspec/expectations/expectation_spec_loader.rb +0 -110
- data/spec/rspec/expectations/filter/bugs/aliased_matcher.txt +0 -2
- data/spec/rspec/expectations/filter/bugs/base_matcher.txt +0 -2
- data/spec/rspec/expectations/filter/bugs/be_spec.txt +0 -2
- data/spec/rspec/expectations/filter/bugs/configuration.txt +0 -5
- data/spec/rspec/expectations/filter/bugs/contain_exactly.rb +0 -8
- data/spec/rspec/expectations/filter/bugs/define_negated_matcher.rb +0 -8
- data/spec/rspec/expectations/filter/bugs/dsl.rb +0 -15
- data/spec/rspec/expectations/filter/bugs/equal.txt +0 -3
- data/spec/rspec/expectations/filter/bugs/expectation_target.rb +0 -4
- data/spec/rspec/expectations/filter/bugs/expectations.rb +0 -4
- data/spec/rspec/expectations/filter/bugs/operators.txt +0 -2
- data/spec/rspec/expectations/filter/bugs/raise_error.txt +0 -2
- data/spec/rspec/expectations/filter/bugs/respond_to.rb +0 -7
- data/spec/rspec/expectations/filter/bugs/sandbox/undef.rb +0 -20
- data/spec/rspec/expectations/filter/unsupported/aliases.txt +0 -5
- data/spec/rspec/expectations/filter/unsupported/be.txt +0 -2
- data/spec/rspec/expectations/filter/unsupported/be_instance_of.txt +0 -3
- data/spec/rspec/expectations/filter/unsupported/change.txt +0 -2
- data/spec/rspec/expectations/filter/unsupported/configuration.txt +0 -2
- data/spec/rspec/expectations/filter/unsupported/contain_exactly.txt +0 -2
- data/spec/rspec/expectations/filter/unsupported/description_generation.txt +0 -6
- data/spec/rspec/expectations/filter/unsupported/dsl.rb +0 -10
- data/spec/rspec/expectations/filter/unsupported/eq.txt +0 -10
- data/spec/rspec/expectations/filter/unsupported/equal.txt +0 -3
- data/spec/rspec/expectations/filter/unsupported/expectation_target.txt +0 -2
- data/spec/rspec/expectations/filter/unsupported/expectations.txt +0 -8
- data/spec/rspec/expectations/filter/unsupported/has.txt +0 -2
- data/spec/rspec/expectations/filter/unsupported/include.txt +0 -3
- data/spec/rspec/expectations/filter/unsupported/match.txt +0 -2
- data/spec/rspec/expectations/filter/unsupported/matchers.txt +0 -11
- data/spec/rspec/expectations/filter/unsupported/output.txt +0 -14
- data/spec/rspec/expectations/filter/unsupported/raise_error.txt +0 -3
- data/spec/rspec/expectations/filter/unsupported/syntax.txt +0 -3
- data/spec/rspec/expectations/filter/unsupported/yield.txt +0 -2
- data/spec/rspec/expectations/fixes/example_patches.rb +0 -15
- data/spec/rspec/expectations/fixes/missing_constants.rb +0 -12
- data/spec/rspec/expectations/require_specs.rb +0 -15
- data/spec/rspec/expectations/shared_examples.rb +0 -47
- data/spec/rspec/expectations/spec_helper_opal.rb +0 -13
- data/spec/rspec/filter_processor.rb +0 -93
- data/spec/rspec/mocks/config.ru +0 -4
- data/spec/rspec/mocks/filter/bugs/and_call_original.rb +0 -11
- data/spec/rspec/mocks/filter/bugs/and_wrap_original.txt +0 -2
- data/spec/rspec/mocks/filter/bugs/and_yield.rb +0 -4
- data/spec/rspec/mocks/filter/bugs/any_instance.rb +0 -18
- data/spec/rspec/mocks/filter/bugs/configuration.txt +0 -2
- data/spec/rspec/mocks/filter/bugs/expiration.txt +0 -2
- data/spec/rspec/mocks/filter/bugs/instance_method_stasher.txt +0 -2
- data/spec/rspec/mocks/filter/bugs/mocks.txt +0 -6
- data/spec/rspec/mocks/filter/bugs/mutate_const.txt +0 -2
- data/spec/rspec/mocks/filter/bugs/partial_double.rb +0 -7
- data/spec/rspec/mocks/filter/bugs/receive.rb +0 -7
- data/spec/rspec/mocks/filter/bugs/should_syntax.txt +0 -5
- data/spec/rspec/mocks/filter/bugs/space.txt +0 -2
- data/spec/rspec/mocks/filter/bugs/spy.txt +0 -5
- data/spec/rspec/mocks/filter/bugs/stub_implementation.rb +0 -5
- data/spec/rspec/mocks/filter/unsupported/and_call_original.rb +0 -7
- data/spec/rspec/mocks/filter/unsupported/and_return.rb +0 -4
- data/spec/rspec/mocks/filter/unsupported/any_instance.rb +0 -6
- data/spec/rspec/mocks/filter/unsupported/argument_matchers.rb +0 -7
- data/spec/rspec/mocks/filter/unsupported/combining_implementation_instructions.rb +0 -4
- data/spec/rspec/mocks/filter/unsupported/double.rb +0 -13
- data/spec/rspec/mocks/filter/unsupported/have_received.txt +0 -2
- data/spec/rspec/mocks/filter/unsupported/instance_double_with_class_loaded.rb +0 -10
- data/spec/rspec/mocks/filter/unsupported/mocks.rb +0 -8
- data/spec/rspec/mocks/filter/unsupported/nil_expectation_warning.rb +0 -4
- data/spec/rspec/mocks/filter/unsupported/partial_double.rb +0 -4
- data/spec/rspec/mocks/filter/unsupported/receive.txt +0 -13
- data/spec/rspec/mocks/filter/unsupported/receive_messages.txt +0 -2
- data/spec/rspec/mocks/filter/unsupported/should_syntax.txt +0 -1
- data/spec/rspec/mocks/filter/unsupported/space.rb +0 -7
- data/spec/rspec/mocks/fixes/doubled_classes.rb +0 -76
- data/spec/rspec/mocks/mocks_spec_loader.rb +0 -91
- data/spec/rspec/mocks/require_specs.rb +0 -14
- data/spec/rspec/mocks/spec_helper_opal.rb +0 -131
- data/spec/rspec/opal_rspec_spec_loader.rb +0 -371
- data/spec/rspec/shared/opal/fixes/deprecation_helpers.rb +0 -31
- data/spec/rspec/shared/opal/fixes/rspec_helpers.rb +0 -6
- data/spec/rspec/shared/opal/separator_formatter.rb +0 -14
- data/spec/rspec/support/config.rb +0 -5
- data/spec/rspec/support/config.ru +0 -4
- data/spec/rspec/support/filter/bugs/recursive_const_methods.txt +0 -3
- data/spec/rspec/support/filter/bugs/sandbox/basic_object.rb +0 -30
- data/spec/rspec/support/filter/bugs/stderr_splitter_spec.txt +0 -2
- data/spec/rspec/support/filter/bugs/support.txt +0 -2
- data/spec/rspec/support/filter/unsupported/fuzzy_matcher.rb +0 -4
- data/spec/rspec/support/filter/unsupported/support.rb +0 -4
- data/spec/rspec/support/filter/unsupported/warnings.txt +0 -6
- data/spec/rspec/support/fixes/missing_constants.rb +0 -3
- data/spec/rspec/support/require_specs.rb +0 -14
- data/spec/rspec/support/spec_helper.rb +0 -27
- data/spec/rspec/support/support_spec_loader.rb +0 -38
@@ -1,179 +0,0 @@
|
|
1
|
-
RSpec.describe "expect(...).to have_sym(*args)" do
|
2
|
-
it_behaves_like "an RSpec matcher", :valid_value => { :a => 1 },
|
3
|
-
:invalid_value => {} do
|
4
|
-
let(:matcher) { have_key(:a) }
|
5
|
-
end
|
6
|
-
|
7
|
-
it "passes if #has_sym?(*args) returns true" do
|
8
|
-
expect({:a => "A"}).to have_key(:a)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "fails if #has_sym?(*args) returns false" do
|
12
|
-
expect {
|
13
|
-
expect({:b => "B"}).to have_key(:a)
|
14
|
-
}.to fail_with("expected #has_key?(:a) to return true, got false")
|
15
|
-
end
|
16
|
-
|
17
|
-
obj_with_block_method = Object.new
|
18
|
-
def obj_with_block_method.has_some_stuff?; yield; end
|
19
|
-
|
20
|
-
it 'forwards the given `{ }` block on to the `has_xyz?` method' do
|
21
|
-
expect(obj_with_block_method).to have_some_stuff { true }
|
22
|
-
expect(obj_with_block_method).to_not have_some_stuff { false }
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'forwards the given `do..end` block on to the `has_xyz?` method' do
|
26
|
-
expect(obj_with_block_method).to have_some_stuff do
|
27
|
-
true
|
28
|
-
end
|
29
|
-
|
30
|
-
expect(obj_with_block_method).to_not have_some_stuff do
|
31
|
-
false
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
it 'favors a curly brace block over a do...end one since it binds to the matcher method' do
|
36
|
-
expect(obj_with_block_method).to have_some_stuff { true } do
|
37
|
-
false
|
38
|
-
end
|
39
|
-
|
40
|
-
expect(obj_with_block_method).not_to have_some_stuff { false } do
|
41
|
-
true
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'does not include any args in the failure message if no args were given to the matcher' do
|
46
|
-
o = Object.new
|
47
|
-
def o.has_some_stuff?; false; end
|
48
|
-
expect {
|
49
|
-
expect(o).to have_some_stuff
|
50
|
-
}.to fail_with("expected #has_some_stuff? to return true, got false")
|
51
|
-
end
|
52
|
-
|
53
|
-
it 'includes multiple args in the failure message if multiple args were given to the matcher' do
|
54
|
-
o = Object.new
|
55
|
-
def o.has_some_stuff?(*_); false; end
|
56
|
-
expect {
|
57
|
-
expect(o).to have_some_stuff(:a, 7, "foo")
|
58
|
-
}.to fail_with('expected #has_some_stuff?(:a, 7, "foo") to return true, got false')
|
59
|
-
end
|
60
|
-
|
61
|
-
it "fails if #has_sym?(*args) returns nil" do
|
62
|
-
klass = Class.new do
|
63
|
-
def has_foo?
|
64
|
-
end
|
65
|
-
end
|
66
|
-
expect {
|
67
|
-
expect(klass.new).to have_foo
|
68
|
-
}.to fail_with(/expected #has_foo.* to return true, got false/)
|
69
|
-
end
|
70
|
-
|
71
|
-
it 'fails if #has_sym?(*args) is private' do
|
72
|
-
klass = Class.new do
|
73
|
-
private
|
74
|
-
def has_foo?
|
75
|
-
true
|
76
|
-
end
|
77
|
-
end
|
78
|
-
expect { expect(klass.new).to have_foo }.to fail_with(/private/)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "fails if target does not respond to #has_sym?" do
|
82
|
-
expect {
|
83
|
-
expect(Object.new).to have_key(:a)
|
84
|
-
}.to fail_matching('to respond to `has_key?`')
|
85
|
-
end
|
86
|
-
|
87
|
-
it "reraises an exception thrown in #has_sym?(*args)" do
|
88
|
-
o = Object.new
|
89
|
-
def o.has_sym?(*args)
|
90
|
-
raise "Funky exception"
|
91
|
-
end
|
92
|
-
expect {
|
93
|
-
expect(o).to have_sym(:foo)
|
94
|
-
}.to raise_error("Funky exception")
|
95
|
-
end
|
96
|
-
|
97
|
-
it 'allows composable aliases to be defined' do
|
98
|
-
RSpec::Matchers.alias_matcher :an_object_having_sym, :have_sym
|
99
|
-
o = Object.new
|
100
|
-
def o.has_sym?(sym); sym == :foo; end
|
101
|
-
|
102
|
-
expect(o).to an_object_having_sym(:foo)
|
103
|
-
expect(o).not_to an_object_having_sym(:bar)
|
104
|
-
|
105
|
-
expect(an_object_having_sym(:foo).description).to eq("an object having sym :foo")
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'composes gracefully' do
|
109
|
-
RSpec::Matchers.alias_matcher :an_object_having_foo, :have_foo
|
110
|
-
|
111
|
-
expect([
|
112
|
-
double,
|
113
|
-
double(:has_foo? => false),
|
114
|
-
double(:has_foo? => true),
|
115
|
-
]).to include an_object_having_foo
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
RSpec.describe "expect(...).not_to have_sym(*args)" do
|
120
|
-
it "passes if #has_sym?(*args) returns false" do
|
121
|
-
expect({:a => "A"}).not_to have_key(:b)
|
122
|
-
end
|
123
|
-
|
124
|
-
it "passes if #has_sym?(*args) returns nil" do
|
125
|
-
klass = Class.new do
|
126
|
-
def has_foo?
|
127
|
-
end
|
128
|
-
end
|
129
|
-
expect(klass.new).not_to have_foo
|
130
|
-
end
|
131
|
-
|
132
|
-
it "fails if #has_sym?(*args) returns true" do
|
133
|
-
expect {
|
134
|
-
expect({:a => "A"}).not_to have_key(:a)
|
135
|
-
}.to fail_with("expected #has_key?(:a) to return false, got true")
|
136
|
-
end
|
137
|
-
|
138
|
-
it "fails if target does not respond to #has_sym?" do
|
139
|
-
expect {
|
140
|
-
expect(Object.new).not_to have_key(:a)
|
141
|
-
}.to fail_matching('to respond to `has_key?`')
|
142
|
-
end
|
143
|
-
|
144
|
-
it "reraises an exception thrown in #has_sym?(*args)" do
|
145
|
-
o = Object.new
|
146
|
-
def o.has_sym?(*args)
|
147
|
-
raise "Funky exception"
|
148
|
-
end
|
149
|
-
expect {
|
150
|
-
expect(o).not_to have_sym(:foo)
|
151
|
-
}.to raise_error("Funky exception")
|
152
|
-
end
|
153
|
-
|
154
|
-
it 'does not include any args in the failure message if no args were given to the matcher' do
|
155
|
-
o = Object.new
|
156
|
-
def o.has_some_stuff?; true; end
|
157
|
-
expect {
|
158
|
-
expect(o).not_to have_some_stuff
|
159
|
-
}.to fail_with("expected #has_some_stuff? to return false, got true")
|
160
|
-
end
|
161
|
-
|
162
|
-
it 'includes multiple args in the failure message if multiple args were given to the matcher' do
|
163
|
-
o = Object.new
|
164
|
-
def o.has_some_stuff?(*_); true; end
|
165
|
-
expect {
|
166
|
-
expect(o).not_to have_some_stuff(:a, 7, "foo")
|
167
|
-
}.to fail_with('expected #has_some_stuff?(:a, 7, "foo") to return false, got true')
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
RSpec.describe "has" do
|
172
|
-
it "works when the target implements #send" do
|
173
|
-
o = {:a => "A"}
|
174
|
-
def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
|
175
|
-
expect {
|
176
|
-
expect(o).to have_key(:a)
|
177
|
-
}.not_to raise_error
|
178
|
-
end
|
179
|
-
end
|
@@ -1,177 +0,0 @@
|
|
1
|
-
RSpec.describe "#have_attributes matcher" do
|
2
|
-
|
3
|
-
Person = Struct.new(:name, :age)
|
4
|
-
|
5
|
-
class Person
|
6
|
-
def parent(parent_name)
|
7
|
-
@parent = parent_name
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:wrong_name) { "Wrong Name" }
|
12
|
-
let(:wrong_age) { 11 }
|
13
|
-
|
14
|
-
let(:correct_name) { "Correct name" }
|
15
|
-
let(:correct_age) { 33 }
|
16
|
-
|
17
|
-
let(:person) { Person.new(correct_name, correct_age) }
|
18
|
-
|
19
|
-
it "is not diffable" do
|
20
|
-
expect(have_attributes(:age => correct_age)).to_not be_diffable
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "expect(...).to have_attributes(with_one_attribute)" do
|
24
|
-
|
25
|
-
it_behaves_like "an RSpec matcher", :valid_value => Person.new("Correct name", 33), :invalid_value => Person.new("Wrong Name", 11) do
|
26
|
-
let(:matcher) { have_attributes(:name => "Correct name") }
|
27
|
-
end
|
28
|
-
|
29
|
-
it "passes if target has the provided attributes" do
|
30
|
-
expect(person).to have_attributes(:name => correct_name)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "fails if target does not have any of the expected attributes" do
|
34
|
-
expect {
|
35
|
-
expect(person).to have_attributes(:name => wrong_name)
|
36
|
-
}.to fail_matching(%r|expected #{object_inspect person} to have attributes #{hash_inspect :name => wrong_name}|)
|
37
|
-
end
|
38
|
-
|
39
|
-
it "fails if target does not responds to any of the attributes" do
|
40
|
-
expect {
|
41
|
-
expect(person).to have_attributes(:color => 'red')
|
42
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :color")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "fails if target responds to the attribute but requires arguments" do
|
46
|
-
expect {
|
47
|
-
expect(person).to have_attributes(:parent => 'Billy')
|
48
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :parent with 0 arguments")
|
49
|
-
end
|
50
|
-
|
51
|
-
describe "expect(...).to have_attributes(key => matcher)" do
|
52
|
-
|
53
|
-
it "passes when the matchers match" do
|
54
|
-
expect(person).to have_attributes(:age => (a_value > 30))
|
55
|
-
end
|
56
|
-
|
57
|
-
it 'provides a description' do
|
58
|
-
description = have_attributes(:age => (a_value > 30)).description
|
59
|
-
expect(description).to eq("have attributes {:age => (a value > 30)}")
|
60
|
-
end
|
61
|
-
|
62
|
-
it "fails with a clear message when the matcher does not match" do
|
63
|
-
expect {
|
64
|
-
expect(person).to have_attributes(:age => (a_value < 10))
|
65
|
-
}.to fail_matching("expected #{object_inspect person} to have attributes {:age => (a value < 10)}")
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
describe "expect(...).to_not have_attributes(with_one_attribute)" do
|
71
|
-
|
72
|
-
it "passes if target does not have any of the expected attributes" do
|
73
|
-
expect(person).to_not have_attributes(:age => wrong_age)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "fails if target has all of the expected attributes" do
|
77
|
-
expect {
|
78
|
-
expect(person).to_not have_attributes(:age => correct_age)
|
79
|
-
}.to fail_matching(%r|expected #{object_inspect person} not to have attributes #{hash_inspect :age => correct_age}|)
|
80
|
-
end
|
81
|
-
|
82
|
-
it "fails if target does not responds to any of the attributes" do
|
83
|
-
expect {
|
84
|
-
expect(person).to_not have_attributes(:color => 'red')
|
85
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :color")
|
86
|
-
end
|
87
|
-
|
88
|
-
it "fails if target responds to the attribute but requires arguments" do
|
89
|
-
expect {
|
90
|
-
expect(person).to_not have_attributes(:parent => 'Billy')
|
91
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :parent with 0 arguments")
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "expect(...).to have_attributes(with_multiple_attributes)" do
|
96
|
-
|
97
|
-
it_behaves_like "an RSpec matcher", :valid_value => Person.new("Correct name", 33), :invalid_value => Person.new("Wrong Name", 11) do
|
98
|
-
let(:matcher) { have_attributes(:name => "Correct name", :age => 33) }
|
99
|
-
end
|
100
|
-
|
101
|
-
it "passes if target has the provided attributes" do
|
102
|
-
expect(person).to have_attributes(:name => correct_name, :age => correct_age)
|
103
|
-
end
|
104
|
-
|
105
|
-
it "fails if target does not have any of the expected attributes" do
|
106
|
-
expect {
|
107
|
-
expect(person).to have_attributes(:name => correct_name, :age => wrong_age)
|
108
|
-
}.to fail_matching(%r|expected #{object_inspect person} to have attributes #{hash_inspect :name => correct_name, :age => wrong_age}|)
|
109
|
-
end
|
110
|
-
|
111
|
-
it "fails if target does not responds to any of the attributes" do
|
112
|
-
expect {
|
113
|
-
expect(person).to have_attributes(:name => correct_name, :color => 'red')
|
114
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :color")
|
115
|
-
end
|
116
|
-
|
117
|
-
it "fails if target responds to the attribute but requires arguments" do
|
118
|
-
expect {
|
119
|
-
expect(person).to have_attributes(:name => correct_name, :parent => 'Billy')
|
120
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :parent with 0 arguments")
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
|
-
describe "expect(...).to_not have_attributes(with_multiple_attributes)" do
|
125
|
-
|
126
|
-
it "passes if target has none of the expected attributes" do
|
127
|
-
expect(person).to_not have_attributes(:name => wrong_name, :age => wrong_age)
|
128
|
-
end
|
129
|
-
|
130
|
-
it "fails if target has any of the expected attributes" do
|
131
|
-
expect {
|
132
|
-
expect(person).to_not have_attributes(:name => wrong_name, :age => correct_age)
|
133
|
-
}.to fail_matching(%r|expected #{object_inspect person} not to have attributes #{hash_inspect :name => wrong_name, :age => correct_age}|)
|
134
|
-
end
|
135
|
-
|
136
|
-
it "fails if target has all of the expected attributes" do
|
137
|
-
expect {
|
138
|
-
expect(person).to_not have_attributes(:name => correct_name, :age => correct_age)
|
139
|
-
}.to fail_matching(%r|expected #{object_inspect person} not to have attributes #{hash_inspect :name => correct_name, :age => correct_age}|)
|
140
|
-
end
|
141
|
-
|
142
|
-
it "fails if target does not responds to any of the attributes" do
|
143
|
-
expect {
|
144
|
-
expect(person).to_not have_attributes(:name => correct_name, :color => 'red')
|
145
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :color")
|
146
|
-
end
|
147
|
-
|
148
|
-
it "fails if target responds to the attribute but requires arguments" do
|
149
|
-
expect {
|
150
|
-
expect(person).to_not have_attributes(:name => correct_name, :parent => 'Billy')
|
151
|
-
}.to fail_matching("expected #{object_inspect person} to respond to :parent with 0 arguments")
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
|
156
|
-
include RSpec::Matchers::Pretty
|
157
|
-
# We have to use Hash#inspect in examples that have multi-entry
|
158
|
-
# hashes because the #inspect output on 1.8.7 is non-deterministic
|
159
|
-
# due to the fact that hashes are not ordered. So we can't simply
|
160
|
-
# put a literal string for what we expect because it varies.
|
161
|
-
if RUBY_VERSION.to_f == 1.8
|
162
|
-
def hash_inspect(hash)
|
163
|
-
/\{(#{hash.map { |key,value| "#{key.inspect} => #{value.inspect}.*" }.join "|" }){#{hash.size}}\}/
|
164
|
-
end
|
165
|
-
else
|
166
|
-
def hash_inspect(hash)
|
167
|
-
improve_hash_formatting hash.inspect
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
include RSpec::Matchers::Composable
|
172
|
-
# a helper for failure message assertion
|
173
|
-
def object_inspect(object)
|
174
|
-
surface_descriptions_in object.inspect
|
175
|
-
end
|
176
|
-
|
177
|
-
end
|
@@ -1,587 +0,0 @@
|
|
1
|
-
require 'uri'
|
2
|
-
|
3
|
-
RSpec.describe "#include matcher" do
|
4
|
-
it "is diffable" do
|
5
|
-
expect(include("a")).to be_diffable
|
6
|
-
end
|
7
|
-
|
8
|
-
describe "expect(...).to include(with_one_arg)" do
|
9
|
-
it_behaves_like "an RSpec matcher", :valid_value => [1, 2], :invalid_value => [1] do
|
10
|
-
let(:matcher) { include(2) }
|
11
|
-
end
|
12
|
-
|
13
|
-
context "for an object that does not respond to `include?`" do
|
14
|
-
it 'fails gracefully' do
|
15
|
-
expect {
|
16
|
-
expect(5).to include(1)
|
17
|
-
}.to fail_matching("expected 5 to include 1, but it does not respond to `include?`")
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context "for an arbitrary object that responds to `include?`" do
|
22
|
-
it 'delegates to `include?`' do
|
23
|
-
container = double("Container")
|
24
|
-
allow(container).to receive(:include?) { |arg| arg == :stuff }
|
25
|
-
|
26
|
-
expect(container).to include(:stuff)
|
27
|
-
|
28
|
-
expect {
|
29
|
-
expect(container).to include(:space)
|
30
|
-
}.to fail_matching("to include :space")
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
context "for a string target" do
|
35
|
-
it "passes if target includes expected" do
|
36
|
-
expect("abc").to include("a")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "fails if target does not include expected" do
|
40
|
-
expect {
|
41
|
-
expect("abc").to include("d")
|
42
|
-
}.to fail_matching("expected \"abc\" to include \"d\"")
|
43
|
-
end
|
44
|
-
|
45
|
-
it "includes a diff when actual is multiline" do
|
46
|
-
expect {
|
47
|
-
expect("abc\ndef").to include("g")
|
48
|
-
}.to fail_matching("expected \"abc\\ndef\" to include \"g\"\nDiff")
|
49
|
-
end
|
50
|
-
|
51
|
-
it "includes a diff when actual is multiline and there are multiple expecteds" do
|
52
|
-
expect {
|
53
|
-
expect("abc\ndef").to include("g", "h")
|
54
|
-
}.to fail_matching("expected \"abc\\ndef\" to include \"g\" and \"h\"\nDiff")
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
context "for an array target" do
|
59
|
-
it "passes if target includes expected" do
|
60
|
-
expect([1,2,3]).to include(3)
|
61
|
-
end
|
62
|
-
|
63
|
-
it "fails if target does not include expected" do
|
64
|
-
expect {
|
65
|
-
expect([1,2,3]).to include(4)
|
66
|
-
}.to fail_matching("expected [1, 2, 3] to include 4")
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'fails when given differing null doubles' do
|
70
|
-
dbl_1 = double.as_null_object
|
71
|
-
dbl_2 = double.as_null_object
|
72
|
-
|
73
|
-
expect {
|
74
|
-
expect([dbl_1]).to include(dbl_2)
|
75
|
-
}.to fail_matching("expected [#{dbl_1.inspect}] to include")
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'passes when given the same null double' do
|
79
|
-
dbl = double.as_null_object
|
80
|
-
expect([dbl]).to include(dbl)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
context "for a hash target" do
|
85
|
-
it 'passes if target has the expected as a key' do
|
86
|
-
expect({:key => 'value'}).to include(:key)
|
87
|
-
end
|
88
|
-
|
89
|
-
it "fails if target does not include expected" do
|
90
|
-
expect {
|
91
|
-
expect({:key => 'value'}).to include(:other)
|
92
|
-
}.to fail_matching(%Q|expected {:key => "value"} to include :other|)
|
93
|
-
end
|
94
|
-
|
95
|
-
it "fails if target doesn't have a key and we expect nil" do
|
96
|
-
expect {
|
97
|
-
expect({}).to include(:something => nil)
|
98
|
-
}.to fail_matching(%Q|expected {} to include {:something => nil}|)
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'works even when an entry in the hash overrides #send' do
|
102
|
-
hash = { :key => 'value' }
|
103
|
-
def hash.send; :sent; end
|
104
|
-
expect(hash).to include(hash)
|
105
|
-
end
|
106
|
-
|
107
|
-
context 'that overrides #send' do
|
108
|
-
it 'still works' do
|
109
|
-
array = [1, 2]
|
110
|
-
def array.send; :sent; end
|
111
|
-
|
112
|
-
expect(array).to include(*array)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
describe "expect(...).to include(with, multiple, args)" do
|
119
|
-
it "has a description" do
|
120
|
-
matcher = include("a")
|
121
|
-
expect(matcher.description).to eq("include \"a\"")
|
122
|
-
end
|
123
|
-
context "for a string target" do
|
124
|
-
it "passes if target includes all items" do
|
125
|
-
expect("a string").to include("str", "a")
|
126
|
-
end
|
127
|
-
|
128
|
-
it "fails if target does not include any one of the items" do
|
129
|
-
expect {
|
130
|
-
expect("a string").to include("str", "a", "foo")
|
131
|
-
}.to fail_matching(%Q{expected "a string" to include "str", "a", and "foo"})
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
context "for an array target" do
|
136
|
-
it "passes if target includes all items" do
|
137
|
-
expect([1,2,3]).to include(1,2,3)
|
138
|
-
end
|
139
|
-
|
140
|
-
it "fails if target does not include any one of the items" do
|
141
|
-
expect {
|
142
|
-
expect([1,2,3]).to include(1,2,4)
|
143
|
-
}.to fail_matching("expected [1, 2, 3] to include 1, 2, and 4")
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
context "for a hash target" do
|
148
|
-
it 'passes if target includes all items as keys' do
|
149
|
-
expect({:key => 'value', :other => 'value'}).to include(:key, :other)
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'fails if target is missing any item as a key' do
|
153
|
-
expect {
|
154
|
-
expect({:key => 'value'}).to include(:key, :other)
|
155
|
-
}.to fail_matching(%Q|expected {:key => "value"} to include :key and :other|)
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
describe "expect(...).not_to include(expected)" do
|
161
|
-
context "for an object that does not respond to `include?`" do
|
162
|
-
it 'fails gracefully' do
|
163
|
-
expect {
|
164
|
-
expect(5).not_to include(1)
|
165
|
-
}.to fail_matching("expected 5 not to include 1, but it does not respond to `include?`")
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
context "for an arbitrary object that responds to `include?`" do
|
170
|
-
it 'delegates to `include?`' do
|
171
|
-
container = double("Container")
|
172
|
-
allow(container).to receive(:include?) { |arg| arg == :stuff }
|
173
|
-
|
174
|
-
expect(container).not_to include(:space)
|
175
|
-
|
176
|
-
expect {
|
177
|
-
expect(container).not_to include(:stuff)
|
178
|
-
}.to fail_matching("not to include :stuff")
|
179
|
-
end
|
180
|
-
end
|
181
|
-
|
182
|
-
context "for a string target" do
|
183
|
-
it "passes if target does not include expected" do
|
184
|
-
expect("abc").not_to include("d")
|
185
|
-
end
|
186
|
-
|
187
|
-
it "fails if target includes expected" do
|
188
|
-
expect {
|
189
|
-
expect("abc").not_to include("c")
|
190
|
-
}.to fail_with("expected \"abc\" not to include \"c\"")
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
context "for an array target" do
|
195
|
-
it "passes if target does not include expected" do
|
196
|
-
expect([1,2,3]).not_to include(4)
|
197
|
-
end
|
198
|
-
|
199
|
-
it "fails if target includes expected" do
|
200
|
-
expect {
|
201
|
-
expect([1,2,3]).not_to include(3)
|
202
|
-
}.to fail_with("expected [1, 2, 3] not to include 3")
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'passes when given differing null doubles' do
|
206
|
-
expect([double.as_null_object]).not_to include(double.as_null_object)
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'fails when given the same null double' do
|
210
|
-
dbl = double.as_null_object
|
211
|
-
|
212
|
-
expect {
|
213
|
-
expect([dbl]).not_to include(dbl)
|
214
|
-
}.to fail_matching("expected [#{dbl.inspect}] not to include")
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
context "for a hash target" do
|
219
|
-
it 'passes if target does not have the expected as a key' do
|
220
|
-
expect({:other => 'value'}).not_to include(:key)
|
221
|
-
end
|
222
|
-
|
223
|
-
it "fails if target includes expected key" do
|
224
|
-
expect {
|
225
|
-
expect({:key => 'value'}).not_to include(:key)
|
226
|
-
}.to fail_matching(%Q|expected {:key => "value"} not to include :key|)
|
227
|
-
end
|
228
|
-
end
|
229
|
-
|
230
|
-
end
|
231
|
-
|
232
|
-
describe "expect(...).not_to include(with, multiple, args)" do
|
233
|
-
context "for a string target" do
|
234
|
-
it "passes if the target does not include any of the expected" do
|
235
|
-
expect("abc").not_to include("d", "e", "f")
|
236
|
-
end
|
237
|
-
|
238
|
-
it "fails if the target includes all of the expected" do
|
239
|
-
expect {
|
240
|
-
expect("abc").not_to include("c", "a")
|
241
|
-
}.to fail_with('expected "abc" not to include "c" and "a"')
|
242
|
-
end
|
243
|
-
|
244
|
-
it "fails if the target includes some (but not all) of the expected" do
|
245
|
-
expect {
|
246
|
-
expect("abc").not_to include("d", "a")
|
247
|
-
}.to fail_with(%q{expected "abc" not to include "d" and "a"})
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
context "for a hash target" do
|
252
|
-
it "passes if it does not include any of the expected keys" do
|
253
|
-
expect({ :a => 1, :b => 2 }).not_to include(:c, :d)
|
254
|
-
end
|
255
|
-
|
256
|
-
it "fails if the target includes all of the expected keys" do
|
257
|
-
expect {
|
258
|
-
expect({ :a => 1, :b => 2 }).not_to include(:a, :b)
|
259
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 2} not to include :a and :b|)
|
260
|
-
end
|
261
|
-
|
262
|
-
it "fails if the target includes some (but not all) of the expected keys" do
|
263
|
-
expect {
|
264
|
-
expect({ :a => 1, :b => 2 }).not_to include(:d, :b)
|
265
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 2} not to include :d and :b|)
|
266
|
-
end
|
267
|
-
end
|
268
|
-
|
269
|
-
context "for an array target" do
|
270
|
-
it "passes if the target does not include any of the expected" do
|
271
|
-
expect([1, 2, 3]).not_to include(4, 5, 6)
|
272
|
-
end
|
273
|
-
|
274
|
-
it "fails if the target includes all of the expected" do
|
275
|
-
expect {
|
276
|
-
expect([1, 2, 3]).not_to include(3, 1)
|
277
|
-
}.to fail_with(%q{expected [1, 2, 3] not to include 3 and 1})
|
278
|
-
end
|
279
|
-
|
280
|
-
it "fails if the target includes some (but not all) of the expected" do
|
281
|
-
expect {
|
282
|
-
expect([1, 2, 3]).not_to include(4, 1)
|
283
|
-
}.to fail_with(%q{expected [1, 2, 3] not to include 4 and 1})
|
284
|
-
end
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
describe "expect(...).to include(:key => value)" do
|
289
|
-
context 'for a hash target' do
|
290
|
-
it "passes if target includes the key/value pair" do
|
291
|
-
expect({:key => 'value'}).to include(:key => 'value')
|
292
|
-
end
|
293
|
-
|
294
|
-
it "passes if target includes the key/value pair among others" do
|
295
|
-
expect({:key => 'value', :other => 'different'}).to include(:key => 'value')
|
296
|
-
end
|
297
|
-
|
298
|
-
it "fails if target has a different value for key" do
|
299
|
-
expect {
|
300
|
-
expect({:key => 'different'}).to include(:key => 'value')
|
301
|
-
}.to fail_matching(%Q|expected {:key => "different"} to include {:key => "value"}|)
|
302
|
-
end
|
303
|
-
|
304
|
-
it "fails if target has a different key" do
|
305
|
-
expect {
|
306
|
-
expect({:other => 'value'}).to include(:key => 'value')
|
307
|
-
}.to fail_matching(%Q|expected {:other => "value"} to include {:key => "value"}|)
|
308
|
-
end
|
309
|
-
end
|
310
|
-
|
311
|
-
context 'for a non-hash target' do
|
312
|
-
it "fails if the target does not contain the given hash" do
|
313
|
-
expect {
|
314
|
-
expect(['a', 'b']).to include(:key => 'value')
|
315
|
-
}.to fail_matching(%q|expected ["a", "b"] to include {:key => "value"}|)
|
316
|
-
end
|
317
|
-
|
318
|
-
it "passes if the target contains the given hash" do
|
319
|
-
expect(['a', { :key => 'value' } ]).to include(:key => 'value')
|
320
|
-
end
|
321
|
-
end
|
322
|
-
end
|
323
|
-
|
324
|
-
describe "expect(...).not_to include(:key => value)" do
|
325
|
-
context 'for a hash target' do
|
326
|
-
it "fails if target includes the key/value pair" do
|
327
|
-
expect {
|
328
|
-
expect({:key => 'value'}).not_to include(:key => 'value')
|
329
|
-
}.to fail_matching(%Q|expected {:key => "value"} not to include {:key => "value"}|)
|
330
|
-
end
|
331
|
-
|
332
|
-
it "fails if target includes the key/value pair among others" do
|
333
|
-
expect {
|
334
|
-
expect({:key => 'value', :other => 'different'}).not_to include(:key => 'value')
|
335
|
-
}.to fail_matching(%r|expected #{hash_inspect :key => "value", :other => "different"} not to include \{:key => "value"\}|)
|
336
|
-
end
|
337
|
-
|
338
|
-
it "passes if target has a different value for key" do
|
339
|
-
expect({:key => 'different'}).not_to include(:key => 'value')
|
340
|
-
end
|
341
|
-
|
342
|
-
it "passes if target has a different key" do
|
343
|
-
expect({:other => 'value'}).not_to include(:key => 'value')
|
344
|
-
end
|
345
|
-
end
|
346
|
-
|
347
|
-
context "for a non-hash target" do
|
348
|
-
it "passes if the target does not contain the given hash" do
|
349
|
-
expect(['a', 'b']).not_to include(:key => 'value')
|
350
|
-
end
|
351
|
-
|
352
|
-
it "fails if the target contains the given hash" do
|
353
|
-
expect {
|
354
|
-
expect(['a', { :key => 'value' } ]).not_to include(:key => 'value')
|
355
|
-
}.to fail_matching(%Q|expected ["a", {:key => "value"}] not to include {:key => "value"}|)
|
356
|
-
end
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
describe "expect(...).to include(:key1 => value1, :key2 => value2)" do
|
361
|
-
context 'for a hash target' do
|
362
|
-
it "passes if target includes the key/value pairs" do
|
363
|
-
expect({:a => 1, :b => 2}).to include(:b => 2, :a => 1)
|
364
|
-
end
|
365
|
-
|
366
|
-
it "passes if target includes the key/value pairs among others" do
|
367
|
-
expect({:a => 1, :c => 3, :b => 2}).to include(:b => 2, :a => 1)
|
368
|
-
end
|
369
|
-
|
370
|
-
it "fails if target has a different value for one of the keys" do
|
371
|
-
expect {
|
372
|
-
expect({:a => 1, :b => 2}).to include(:a => 2, :b => 2)
|
373
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 2} to include #{hash_inspect :a => 2, :b => 2}|)
|
374
|
-
end
|
375
|
-
|
376
|
-
it "fails if target has a different value for both of the keys" do
|
377
|
-
expect {
|
378
|
-
expect({:a => 1, :b => 1}).to include(:a => 2, :b => 2)
|
379
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 1} to include #{hash_inspect :a => 2, :b => 2}|)
|
380
|
-
end
|
381
|
-
|
382
|
-
it "fails if target lacks one of the keys" do
|
383
|
-
expect {
|
384
|
-
expect({:a => 1, :b => 1}).to include(:a => 1, :c => 1)
|
385
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 1} to include #{hash_inspect :a => 1, :c => 1}|)
|
386
|
-
end
|
387
|
-
|
388
|
-
it "fails if target lacks both of the keys" do
|
389
|
-
expect {
|
390
|
-
expect({:a => 1, :b => 1}).to include(:c => 1, :d => 1)
|
391
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 1} to include #{hash_inspect :c => 1, :d => 1}|)
|
392
|
-
end
|
393
|
-
end
|
394
|
-
|
395
|
-
context 'for a non-hash target' do
|
396
|
-
it "fails if the target does not contain the given hash" do
|
397
|
-
expect {
|
398
|
-
expect(['a', 'b']).to include(:a => 1, :b => 1)
|
399
|
-
}.to fail_matching(%r|expected \["a", "b"\] to include #{hash_inspect :a => 1, :b => 1}|)
|
400
|
-
end
|
401
|
-
|
402
|
-
it "passes if the target contains the given hash" do
|
403
|
-
expect(['a', { :a => 1, :b => 2 } ]).to include(:a => 1, :b => 2)
|
404
|
-
end
|
405
|
-
end
|
406
|
-
end
|
407
|
-
|
408
|
-
describe "expect(...).not_to include(:key1 => value1, :key2 => value2)" do
|
409
|
-
context 'for a hash target' do
|
410
|
-
it "fails if target includes the key/value pairs" do
|
411
|
-
expect {
|
412
|
-
expect({:a => 1, :b => 2}).not_to include(:a => 1, :b => 2)
|
413
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 2} not to include #{hash_inspect :a => 1, :b => 2}|)
|
414
|
-
end
|
415
|
-
|
416
|
-
it "fails if target includes the key/value pairs among others" do
|
417
|
-
hash = {:a => 1, :b => 2, :c => 3}
|
418
|
-
expect {
|
419
|
-
expect(hash).not_to include(:a => 1, :b => 2)
|
420
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 2, :c => 3} not to include #{hash_inspect :a => 1, :b => 2}|)
|
421
|
-
end
|
422
|
-
|
423
|
-
it "fails if target has a different value for one of the keys" do
|
424
|
-
expect {
|
425
|
-
expect({:a => 1, :b => 2}).not_to include(:a => 2, :b => 2)
|
426
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 2} not to include #{hash_inspect :a => 2, :b => 2}|)
|
427
|
-
end
|
428
|
-
|
429
|
-
it "passes if target has a different value for both of the keys" do
|
430
|
-
expect({:a => 1, :b => 1}).not_to include(:a => 2, :b => 2)
|
431
|
-
end
|
432
|
-
|
433
|
-
it "fails if target lacks one of the keys" do
|
434
|
-
expect {
|
435
|
-
expect({:a => 1, :b => 1}).not_to include(:a => 1, :c => 1)
|
436
|
-
}.to fail_matching(%r|expected #{hash_inspect :a => 1, :b => 1} not to include #{hash_inspect :a => 1, :c => 1}|)
|
437
|
-
end
|
438
|
-
|
439
|
-
it "passes if target lacks both of the keys" do
|
440
|
-
expect({:a => 1, :b => 1}).not_to include(:c => 1, :d => 1)
|
441
|
-
end
|
442
|
-
end
|
443
|
-
|
444
|
-
context 'for a non-hash target' do
|
445
|
-
it "passes if the target does not contain the given hash" do
|
446
|
-
expect(['a', 'b']).not_to include(:a => 1, :b => 1)
|
447
|
-
end
|
448
|
-
|
449
|
-
it "fails if the target contains the given hash" do
|
450
|
-
expect {
|
451
|
-
expect(['a', { :a => 1, :b => 2 } ]).not_to include(:a => 1, :b => 2)
|
452
|
-
}.to fail_matching(%r|expected \["a", #{hash_inspect :a => 1, :b => 2}\] not to include #{hash_inspect :a => 1, :b => 2}|)
|
453
|
-
end
|
454
|
-
end
|
455
|
-
end
|
456
|
-
|
457
|
-
describe "Composing matchers with `include`" do
|
458
|
-
RSpec::Matchers.define :a_string_containing do |expected|
|
459
|
-
match do |actual|
|
460
|
-
actual.include?(expected)
|
461
|
-
end
|
462
|
-
|
463
|
-
description do
|
464
|
-
"a string containing '#{expected}'"
|
465
|
-
end
|
466
|
-
end
|
467
|
-
|
468
|
-
describe "expect(array).to include(matcher)" do
|
469
|
-
it "passes when the matcher matches one of the values" do
|
470
|
-
expect([10, 20, 30]).to include( a_value_within(5).of(24) )
|
471
|
-
end
|
472
|
-
|
473
|
-
it 'provides a description' do
|
474
|
-
description = include( a_value_within(5).of(24) ).description
|
475
|
-
expect(description).to eq("include (a value within 5 of 24)")
|
476
|
-
end
|
477
|
-
|
478
|
-
it 'fails with a clear message when the matcher matches none of the values' do
|
479
|
-
expect {
|
480
|
-
expect([10, 30]).to include( a_value_within(5).of(24) )
|
481
|
-
}.to fail_with("expected [10, 30] to include (a value within 5 of 24)")
|
482
|
-
end
|
483
|
-
|
484
|
-
it 'works with comparison matchers' do
|
485
|
-
expect {
|
486
|
-
expect([100, 200]).to include(a_value < 90)
|
487
|
-
}.to fail_with("expected [100, 200] to include (a value < 90)")
|
488
|
-
|
489
|
-
expect([100, 200]).to include(a_value > 150)
|
490
|
-
end
|
491
|
-
|
492
|
-
it 'does not treat an object that only implements #matches? as a matcher' do
|
493
|
-
domain = Struct.new(:domain) do
|
494
|
-
def matches?(url)
|
495
|
-
URI(url).host == self.domain
|
496
|
-
end
|
497
|
-
end
|
498
|
-
|
499
|
-
expect([domain.new("rspec.info")]).to include(domain.new("rspec.info"))
|
500
|
-
|
501
|
-
expect {
|
502
|
-
expect([domain.new("rspec.info")]).to include(domain.new("foo.com"))
|
503
|
-
}.to fail_matching("expected [#{domain.new("rspec.info").inspect}] to include")
|
504
|
-
end
|
505
|
-
end
|
506
|
-
|
507
|
-
describe "expect(array).to include(multiple, matcher, arguments)" do
|
508
|
-
it "passes if target includes items satisfying all matchers" do
|
509
|
-
expect(['foo', 'bar', 'baz']).to include(a_string_containing("ar"), a_string_containing('oo'))
|
510
|
-
end
|
511
|
-
|
512
|
-
it "fails if target does not include an item satisfying any one of the items" do
|
513
|
-
expect {
|
514
|
-
expect(['foo', 'bar', 'baz']).to include(a_string_containing("ar"), a_string_containing("abc"))
|
515
|
-
}.to fail_matching(%Q|expected #{['foo', 'bar', 'baz'].inspect} to include (a string containing 'ar') and (a string containing 'abc')|)
|
516
|
-
end
|
517
|
-
end
|
518
|
-
|
519
|
-
describe "expect(hash).to include(key => matcher)" do
|
520
|
-
it "passes when the matcher matches" do
|
521
|
-
expect(:a => 12).to include(:a => a_value_within(3).of(10))
|
522
|
-
end
|
523
|
-
|
524
|
-
it 'provides a description' do
|
525
|
-
description = include(:a => a_value_within(3).of(10)).description
|
526
|
-
expect(description).to eq("include {:a => (a value within 3 of 10)}")
|
527
|
-
end
|
528
|
-
|
529
|
-
it "fails with a clear message when the matcher does not match" do
|
530
|
-
expect {
|
531
|
-
expect(:a => 15).to include(:a => a_value_within(3).of(10))
|
532
|
-
}.to fail_matching("expected {:a => 15} to include {:a => (a value within 3 of 10)}")
|
533
|
-
end
|
534
|
-
end
|
535
|
-
|
536
|
-
describe "expect(hash).to include(key_matcher)" do
|
537
|
-
it "passes when the matcher matches a key", :if => (RUBY_VERSION.to_f > 1.8) do
|
538
|
-
expect(:drink => "water", :food => "bread").to include(a_string_matching(/foo/))
|
539
|
-
end
|
540
|
-
|
541
|
-
it 'provides a description' do
|
542
|
-
description = include(a_string_matching(/foo/)).description
|
543
|
-
expect(description).to eq("include (a string matching /foo/)")
|
544
|
-
end
|
545
|
-
|
546
|
-
it 'fails with a clear message when the matcher does not match', :if => (RUBY_VERSION.to_f > 1.8) do
|
547
|
-
expect {
|
548
|
-
expect(:drink => "water", :food => "bread").to include(a_string_matching(/bar/))
|
549
|
-
}.to fail_matching('expected {:drink => "water", :food => "bread"} to include (a string matching /bar/)')
|
550
|
-
end
|
551
|
-
end
|
552
|
-
|
553
|
-
describe "expect(array).not_to include(multiple, matcher, arguments)" do
|
554
|
-
it "passes if none of the target values satisfies any of the matchers" do
|
555
|
-
expect(['foo', 'bar', 'baz']).not_to include(a_string_containing("gh"), a_string_containing('de'))
|
556
|
-
end
|
557
|
-
|
558
|
-
it 'fails if all of the matchers are satisfied by one of the target values' do
|
559
|
-
expect {
|
560
|
-
expect(['foo', 'bar', 'baz']).not_to include(a_string_containing("ar"), a_string_containing('az'))
|
561
|
-
}.to fail_matching(%Q|expected #{['foo', 'bar', 'baz'].inspect} not to include (a string containing 'ar') and (a string containing 'az')|)
|
562
|
-
end
|
563
|
-
|
564
|
-
it 'fails if the some (but not all) of the matchers are satisifed' do
|
565
|
-
expect {
|
566
|
-
expect(['foo', 'bar', 'baz']).not_to include(a_string_containing("ar"), a_string_containing('bz'))
|
567
|
-
}.to fail_matching(%Q|expected #{['foo', 'bar', 'baz'].inspect} not to include (a string containing 'ar') and (a string containing 'bz')|)
|
568
|
-
end
|
569
|
-
end
|
570
|
-
end
|
571
|
-
|
572
|
-
include RSpec::Matchers::Pretty
|
573
|
-
# We have to use Hash#inspect in examples that have multi-entry
|
574
|
-
# hashes because the #inspect output on 1.8.7 is non-deterministic
|
575
|
-
# due to the fact that hashes are not ordered. So we can't simply
|
576
|
-
# put a literal string for what we expect because it varies.
|
577
|
-
if RUBY_VERSION.to_f == 1.8
|
578
|
-
def hash_inspect(hash)
|
579
|
-
/\{(#{hash.map { |key,value| "#{key.inspect} => #{value.inspect}.*" }.join "|" }){#{hash.size}}\}/
|
580
|
-
end
|
581
|
-
else
|
582
|
-
def hash_inspect(hash)
|
583
|
-
improve_hash_formatting hash.inspect
|
584
|
-
end
|
585
|
-
end
|
586
|
-
end
|
587
|
-
|