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,425 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'ostruct'
|
3
|
-
require 'rspec/core/drb'
|
4
|
-
|
5
|
-
RSpec.describe RSpec::Core::ConfigurationOptions, :isolated_directory => true, :isolated_home => true do
|
6
|
-
include ConfigOptionsHelper
|
7
|
-
|
8
|
-
it "warns when HOME env var is not set", :unless => (RUBY_PLATFORM == 'java') do
|
9
|
-
without_env_vars 'HOME' do
|
10
|
-
expect_warning_with_call_site(__FILE__, __LINE__ + 1)
|
11
|
-
RSpec::Core::ConfigurationOptions.new([]).options
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
it "does not mutate the provided args array" do
|
16
|
-
args = ['-e', 'some spec']
|
17
|
-
RSpec::Core::ConfigurationOptions.new(args).options
|
18
|
-
expect(args).to eq(['-e', 'some spec'])
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "#configure" do
|
22
|
-
let(:config) { RSpec::Core::Configuration.new }
|
23
|
-
|
24
|
-
it "configures deprecation_stream before loading requires (since required files may issue deprecations)" do
|
25
|
-
opts = config_options_object(*%w[--deprecation-out path/to/log --require foo])
|
26
|
-
config = instance_double(RSpec::Core::Configuration).as_null_object
|
27
|
-
|
28
|
-
opts.configure(config)
|
29
|
-
|
30
|
-
expect(config).to have_received(:force).with(:deprecation_stream => "path/to/log").ordered
|
31
|
-
expect(config).to have_received(:requires=).ordered
|
32
|
-
end
|
33
|
-
|
34
|
-
it "configures deprecation_stream before configuring filter_manager" do
|
35
|
-
opts = config_options_object(*%w[--deprecation-out path/to/log --tag foo])
|
36
|
-
filter_manager = instance_double(RSpec::Core::FilterManager).as_null_object
|
37
|
-
config = instance_double(RSpec::Core::Configuration, :filter_manager => filter_manager).as_null_object
|
38
|
-
|
39
|
-
opts.configure(config)
|
40
|
-
|
41
|
-
expect(config).to have_received(:force).with(:deprecation_stream => "path/to/log").ordered
|
42
|
-
expect(filter_manager).to have_received(:include).with(:foo => true).ordered
|
43
|
-
end
|
44
|
-
|
45
|
-
it "configures deprecation_stream before configuring formatters" do
|
46
|
-
opts = config_options_object(*%w[--deprecation-out path/to/log --format doc])
|
47
|
-
config = instance_double(RSpec::Core::Configuration).as_null_object
|
48
|
-
|
49
|
-
opts.configure(config)
|
50
|
-
|
51
|
-
expect(config).to have_received(:force).with(:deprecation_stream => "path/to/log").ordered
|
52
|
-
expect(config).to have_received(:add_formatter).ordered
|
53
|
-
end
|
54
|
-
|
55
|
-
it "sends libs before requires" do
|
56
|
-
opts = config_options_object(*%w[--require a/path -I a/lib])
|
57
|
-
config = double("config").as_null_object
|
58
|
-
expect(config).to receive(:libs=).ordered
|
59
|
-
expect(config).to receive(:requires=).ordered
|
60
|
-
opts.configure(config)
|
61
|
-
end
|
62
|
-
|
63
|
-
it "loads requires before loading specs" do
|
64
|
-
opts = config_options_object(*%w[-rspec_helper])
|
65
|
-
config = RSpec::Core::Configuration.new
|
66
|
-
expect(config).to receive(:requires=).ordered
|
67
|
-
expect(config).to receive(:get_files_to_run).ordered
|
68
|
-
opts.configure(config)
|
69
|
-
config.files_to_run
|
70
|
-
end
|
71
|
-
|
72
|
-
it "sets up load path and requires before formatter" do
|
73
|
-
opts = config_options_object(*%w[--require a/path -f a/formatter])
|
74
|
-
config = double("config").as_null_object
|
75
|
-
expect(config).to receive(:requires=).ordered
|
76
|
-
expect(config).to receive(:add_formatter).ordered
|
77
|
-
opts.configure(config)
|
78
|
-
end
|
79
|
-
|
80
|
-
it "sets default_path before loading specs" do
|
81
|
-
opts = config_options_object(*%w[--default-path spec])
|
82
|
-
config = RSpec::Core::Configuration.new
|
83
|
-
expect(config).to receive(:force).with(:default_path => 'spec').ordered
|
84
|
-
expect(config).to receive(:get_files_to_run).ordered
|
85
|
-
opts.configure(config)
|
86
|
-
config.files_to_run
|
87
|
-
end
|
88
|
-
|
89
|
-
it "sets `files_or_directories_to_run` before `requires` so users can check `files_to_run` in a spec_helper loaded by `--require`" do
|
90
|
-
opts = config_options_object(*%w[--require spec_helper])
|
91
|
-
config = RSpec::Core::Configuration.new
|
92
|
-
expect(config).to receive(:files_or_directories_to_run=).ordered
|
93
|
-
expect(config).to receive(:requires=).ordered
|
94
|
-
opts.configure(config)
|
95
|
-
end
|
96
|
-
|
97
|
-
it "sets default_path before `files_or_directories_to_run` since it relies on it" do
|
98
|
-
opts = config_options_object(*%w[--default-path spec])
|
99
|
-
config = RSpec::Core::Configuration.new
|
100
|
-
expect(config).to receive(:force).with(:default_path => 'spec').ordered
|
101
|
-
expect(config).to receive(:files_or_directories_to_run=).ordered
|
102
|
-
opts.configure(config)
|
103
|
-
end
|
104
|
-
|
105
|
-
{ "pattern" => :pattern, "exclude-pattern" => :exclude_pattern }.each do |flag, attr|
|
106
|
-
it "sets #{attr} before `requires` so users can check `files_to_run` in a `spec_helper` loaded by `--require`" do
|
107
|
-
opts = config_options_object(*%W[--require spec_helpe --#{flag} **/*.spec])
|
108
|
-
config = RSpec::Core::Configuration.new
|
109
|
-
expect(config).to receive(:force).with(attr => '**/*.spec').ordered
|
110
|
-
expect(config).to receive(:requires=).ordered
|
111
|
-
opts.configure(config)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
it "assigns inclusion_filter" do
|
116
|
-
opts = config_options_object(*%w[--tag awesome])
|
117
|
-
opts.configure(config)
|
118
|
-
expect(config.inclusion_filter.rules).to have_key(:awesome)
|
119
|
-
end
|
120
|
-
|
121
|
-
it "merges the :exclusion_filter option with the default exclusion_filter" do
|
122
|
-
opts = config_options_object(*%w[--tag ~slow])
|
123
|
-
opts.configure(config)
|
124
|
-
expect(config.exclusion_filter.rules).to have_key(:slow)
|
125
|
-
end
|
126
|
-
|
127
|
-
it "forces color" do
|
128
|
-
opts = config_options_object(*%w[--color])
|
129
|
-
config = RSpec::Core::Configuration.new
|
130
|
-
expect(config).to receive(:force).with(:color => true)
|
131
|
-
opts.configure(config)
|
132
|
-
end
|
133
|
-
|
134
|
-
[
|
135
|
-
["--failure-exit-code", "3", :failure_exit_code, 3 ],
|
136
|
-
["--pattern", "foo/bar", :pattern, "foo/bar"],
|
137
|
-
["--failure-exit-code", "37", :failure_exit_code, 37],
|
138
|
-
["--default-path", "behavior", :default_path, "behavior"],
|
139
|
-
["--order", "rand", :order, "rand"],
|
140
|
-
["--seed", "37", :order, "rand:37"],
|
141
|
-
["--drb-port", "37", :drb_port, 37]
|
142
|
-
].each do |cli_option, cli_value, config_key, config_value|
|
143
|
-
it "forces #{config_key}" do
|
144
|
-
opts = config_options_object(cli_option, cli_value)
|
145
|
-
config = RSpec::Core::Configuration.new
|
146
|
-
expect(config).to receive(:force) do |pair|
|
147
|
-
expect(pair.keys.first).to eq(config_key)
|
148
|
-
expect(pair.values.first).to eq(config_value)
|
149
|
-
end
|
150
|
-
opts.configure(config)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
it "merges --require specified by multiple configuration sources" do
|
155
|
-
with_env_vars 'SPEC_OPTS' => "--require file_from_env" do
|
156
|
-
opts = config_options_object(*%w[--require file_from_opts])
|
157
|
-
expect(config).to receive(:require).with("file_from_opts")
|
158
|
-
expect(config).to receive(:require).with("file_from_env")
|
159
|
-
opts.configure(config)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
it "merges --I specified by multiple configuration sources" do
|
164
|
-
with_env_vars 'SPEC_OPTS' => "-I dir_from_env" do
|
165
|
-
opts = config_options_object(*%w[-I dir_from_opts])
|
166
|
-
expect(config).to receive(:libs=).with(["dir_from_opts", "dir_from_env"])
|
167
|
-
opts.configure(config)
|
168
|
-
end
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
describe "-c, --color, and --colour" do
|
173
|
-
it "sets :color => true" do
|
174
|
-
expect(parse_options('-c')).to include(:color => true)
|
175
|
-
expect(parse_options('--color')).to include(:color => true)
|
176
|
-
expect(parse_options('--colour')).to include(:color => true)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
describe "--no-color" do
|
181
|
-
it "sets :color => false" do
|
182
|
-
expect(parse_options('--no-color')).to include(:color => false)
|
183
|
-
end
|
184
|
-
|
185
|
-
it "overrides previous :color => true" do
|
186
|
-
expect(parse_options('--color', '--no-color')).to include(:color => false)
|
187
|
-
end
|
188
|
-
|
189
|
-
it "gets overriden by a subsequent :color => true" do
|
190
|
-
expect(parse_options('--no-color', '--color')).to include(:color => true)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe "-I" do
|
195
|
-
example "adds to :libs" do
|
196
|
-
expect(parse_options('-I', 'a_dir')).to include(:libs => ['a_dir'])
|
197
|
-
end
|
198
|
-
example "can be used more than once" do
|
199
|
-
expect(parse_options('-I', 'dir_1', '-I', 'dir_2')).to include(:libs => ['dir_1','dir_2'])
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
describe '--require' do
|
204
|
-
example "requires files" do
|
205
|
-
expect(parse_options('--require', 'a/path')).to include(:requires => ['a/path'])
|
206
|
-
end
|
207
|
-
example "can be used more than once" do
|
208
|
-
expect(parse_options('--require', 'path/1', '--require', 'path/2')).to include(:requires => ['path/1','path/2'])
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
describe "--format, -f" do
|
213
|
-
it "sets :formatter" do
|
214
|
-
[['--format', 'd'], ['-f', 'd'], '-fd'].each do |args|
|
215
|
-
expect(parse_options(*args)).to include(:formatters => [['d']])
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
example "can accept a class name" do
|
220
|
-
expect(parse_options('-fSome::Formatter::Class')).to include(:formatters => [['Some::Formatter::Class']])
|
221
|
-
end
|
222
|
-
end
|
223
|
-
|
224
|
-
describe "--profile, -p" do
|
225
|
-
it "sets :profile_examples" do
|
226
|
-
expect(parse_options('-p')).to include(:profile_examples => true)
|
227
|
-
expect(parse_options('--profile')).to include(:profile_examples => true)
|
228
|
-
expect(parse_options('-p', '4')).to include(:profile_examples => 4)
|
229
|
-
expect(parse_options('--profile', '3')).to include(:profile_examples => 3)
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
describe "--no-profile" do
|
234
|
-
it "sets :profile_examples to false" do
|
235
|
-
expect(parse_options('--no-profile')).to include(:profile_examples => false)
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
describe "--example" do
|
240
|
-
it "sets :full_description" do
|
241
|
-
expect(parse_options('--example','foo')).to include(:full_description => [/foo/])
|
242
|
-
expect(parse_options('-e','bar')).to include(:full_description => [/bar/])
|
243
|
-
end
|
244
|
-
end
|
245
|
-
|
246
|
-
describe "--backtrace, -b" do
|
247
|
-
it "sets full_backtrace on config" do
|
248
|
-
expect(parse_options("--backtrace")).to include(:full_backtrace => true)
|
249
|
-
expect(parse_options("-b")).to include(:full_backtrace => true)
|
250
|
-
end
|
251
|
-
end
|
252
|
-
|
253
|
-
describe "--fail-fast" do
|
254
|
-
it "defaults to false" do
|
255
|
-
expect(parse_options[:fail_fast]).to be_falsey
|
256
|
-
end
|
257
|
-
|
258
|
-
it "sets fail_fast on config" do
|
259
|
-
expect(parse_options("--fail-fast")[:fail_fast]).to be_truthy
|
260
|
-
end
|
261
|
-
|
262
|
-
it "sets fail_fast on config" do
|
263
|
-
expect(parse_options("--no-fail-fast")[:fail_fast]).to be_falsey
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
describe "--failure-exit-code" do
|
268
|
-
it "sets :failure_exit_code" do
|
269
|
-
expect(parse_options('--failure-exit-code', '0')).to include(:failure_exit_code => 0)
|
270
|
-
expect(parse_options('--failure-exit-code', '1')).to include(:failure_exit_code => 1)
|
271
|
-
expect(parse_options('--failure-exit-code', '2')).to include(:failure_exit_code => 2)
|
272
|
-
end
|
273
|
-
|
274
|
-
it "overrides previous :failure_exit_code" do
|
275
|
-
expect(parse_options('--failure-exit-code', '2', '--failure-exit-code', '3')).to include(:failure_exit_code => 3)
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
describe "--dry-run" do
|
280
|
-
it "defaults to false" do
|
281
|
-
expect(parse_options[:dry_run]).to be_falsey
|
282
|
-
end
|
283
|
-
|
284
|
-
it "sets dry_run on config" do
|
285
|
-
expect(parse_options("--dry-run")[:dry_run]).to be_truthy
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
describe "--options" do
|
290
|
-
it "sets :custom_options_file" do
|
291
|
-
expect(parse_options(*%w[-O my.opts])).to include(:custom_options_file => "my.opts")
|
292
|
-
expect(parse_options(*%w[--options my.opts])).to include(:custom_options_file => "my.opts")
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
describe "--no-drb" do
|
297
|
-
it "disables drb" do
|
298
|
-
expect(parse_options("--no-drb")).to include(:drb => false)
|
299
|
-
end
|
300
|
-
|
301
|
-
it "overrides a previous drb => true" do
|
302
|
-
expect(parse_options("--drb", "--no-drb")).to include(:drb => false)
|
303
|
-
end
|
304
|
-
|
305
|
-
it "gets overriden by a subsquent drb => true" do
|
306
|
-
expect(parse_options("--no-drb", "--drb")).to include(:drb => true)
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
describe "files_or_directories_to_run" do
|
311
|
-
it "parses files from '-c file.rb dir/file.rb'" do
|
312
|
-
expect(parse_options("-c", "file.rb", "dir/file.rb")).to include(
|
313
|
-
:files_or_directories_to_run => ["file.rb", "dir/file.rb"]
|
314
|
-
)
|
315
|
-
end
|
316
|
-
|
317
|
-
it "parses dir from 'dir'" do
|
318
|
-
expect(parse_options("dir")).to include(:files_or_directories_to_run => ["dir"])
|
319
|
-
end
|
320
|
-
|
321
|
-
it "parses dir and files from 'spec/file1_spec.rb, spec/file2_spec.rb'" do
|
322
|
-
expect(parse_options("dir", "spec/file1_spec.rb", "spec/file2_spec.rb")).to include(
|
323
|
-
:files_or_directories_to_run => ["dir", "spec/file1_spec.rb", "spec/file2_spec.rb"]
|
324
|
-
)
|
325
|
-
end
|
326
|
-
|
327
|
-
it "parses file names that look like `default-path` option" do
|
328
|
-
expect(parse_options("spec/default_path_spec.rb")).to include(
|
329
|
-
:files_or_directories_to_run => ["spec/default_path_spec.rb"]
|
330
|
-
)
|
331
|
-
end
|
332
|
-
|
333
|
-
it "provides no files or directories if spec directory does not exist" do
|
334
|
-
allow(FileTest).to receive(:directory?).with("spec").and_return false
|
335
|
-
expect(parse_options()).to include(:files_or_directories_to_run => [])
|
336
|
-
end
|
337
|
-
end
|
338
|
-
|
339
|
-
describe "default_path" do
|
340
|
-
it "gets set before files_or_directories_to_run" do
|
341
|
-
config = RSpec::Core::Configuration.new
|
342
|
-
expect(config).to receive(:force).with(:default_path => 'foo').ordered
|
343
|
-
expect(config).to receive(:get_files_to_run).ordered
|
344
|
-
opts = config_options_object("--default-path", "foo")
|
345
|
-
opts.configure(config)
|
346
|
-
config.files_to_run
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
describe "sources: ~/.rspec, ./.rspec, ./.rspec-local, custom, CLI, and SPEC_OPTS" do
|
351
|
-
it "merges global, local, SPEC_OPTS, and CLI" do
|
352
|
-
File.open("./.rspec", "w") {|f| f << "--require some_file"}
|
353
|
-
File.open("./.rspec-local", "w") {|f| f << "--format global"}
|
354
|
-
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--color"}
|
355
|
-
with_env_vars 'SPEC_OPTS' => "--example 'foo bar'" do
|
356
|
-
options = parse_options("--drb")
|
357
|
-
expect(options[:color]).to be_truthy
|
358
|
-
expect(options[:requires]).to eq(["some_file"])
|
359
|
-
expect(options[:full_description]).to eq([/foo\ bar/])
|
360
|
-
expect(options[:drb]).to be_truthy
|
361
|
-
expect(options[:formatters]).to eq([['global']])
|
362
|
-
end
|
363
|
-
end
|
364
|
-
|
365
|
-
it "prefers SPEC_OPTS over CLI" do
|
366
|
-
with_env_vars 'SPEC_OPTS' => "--format spec_opts" do
|
367
|
-
expect(parse_options("--format", "cli")[:formatters]).to eq([['spec_opts']])
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
|
-
it "prefers CLI over file options" do
|
372
|
-
File.open("./.rspec", "w") {|f| f << "--format project"}
|
373
|
-
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
|
374
|
-
expect(parse_options("--format", "cli")[:formatters]).to eq([['cli']])
|
375
|
-
end
|
376
|
-
|
377
|
-
it "prefers CLI over file options for filter inclusion" do
|
378
|
-
File.open("./.rspec", "w") {|f| f << "--tag ~slow"}
|
379
|
-
opts = config_options_object("--tag", "slow")
|
380
|
-
config = RSpec::Core::Configuration.new
|
381
|
-
opts.configure(config)
|
382
|
-
expect(config.inclusion_filter.rules).to have_key(:slow)
|
383
|
-
expect(config.exclusion_filter.rules).not_to have_key(:slow)
|
384
|
-
end
|
385
|
-
|
386
|
-
it "prefers project file options over global file options" do
|
387
|
-
File.open("./.rspec", "w") {|f| f << "--format project"}
|
388
|
-
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
|
389
|
-
expect(parse_options[:formatters]).to eq([['project']])
|
390
|
-
end
|
391
|
-
|
392
|
-
it "prefers local file options over project file options" do
|
393
|
-
File.open("./.rspec-local", "w") {|f| f << "--format local"}
|
394
|
-
File.open("./.rspec", "w") {|f| f << "--format global"}
|
395
|
-
expect(parse_options[:formatters]).to eq([['local']])
|
396
|
-
end
|
397
|
-
|
398
|
-
it "parses options file correctly if erb code has trimming options" do
|
399
|
-
File.open("./.rspec", "w") do |f|
|
400
|
-
f << "<% if true -%>\n"
|
401
|
-
f << "--format local\n"
|
402
|
-
f << "<%- end %>\n"
|
403
|
-
end
|
404
|
-
|
405
|
-
expect(parse_options[:formatters]).to eq([['local']])
|
406
|
-
end
|
407
|
-
|
408
|
-
context "with custom options file" do
|
409
|
-
it "ignores project and global options files" do
|
410
|
-
File.open("./.rspec", "w") {|f| f << "--format project"}
|
411
|
-
File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
|
412
|
-
File.open("./custom.opts", "w") {|f| f << "--color"}
|
413
|
-
options = parse_options("-O", "./custom.opts")
|
414
|
-
expect(options[:format]).to be_nil
|
415
|
-
expect(options[:color]).to be_truthy
|
416
|
-
end
|
417
|
-
|
418
|
-
it "parses -e 'full spec description'" do
|
419
|
-
File.open("./custom.opts", "w") {|f| f << "-e 'The quick brown fox jumps over the lazy dog'"}
|
420
|
-
options = parse_options("-O", "./custom.opts")
|
421
|
-
expect(options[:full_description]).to eq([/The\ quick\ brown\ fox\ jumps\ over\ the\ lazy\ dog/])
|
422
|
-
end
|
423
|
-
end
|
424
|
-
end
|
425
|
-
end
|
@@ -1,1963 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'tmpdir'
|
3
|
-
require 'rspec/support/spec/in_sub_process'
|
4
|
-
|
5
|
-
module RSpec::Core
|
6
|
-
|
7
|
-
RSpec.describe Configuration do
|
8
|
-
include RSpec::Support::InSubProcess
|
9
|
-
|
10
|
-
let(:config) { Configuration.new }
|
11
|
-
let(:exclusion_filter) { config.exclusion_filter.rules }
|
12
|
-
let(:inclusion_filter) { config.inclusion_filter.rules }
|
13
|
-
|
14
|
-
shared_examples_for "warning of deprecated `:example_group` during filtering configuration" do |method, *args|
|
15
|
-
it "issues a deprecation warning when filtering by `:example_group`" do
|
16
|
-
args << { :example_group => { :file_location => /spec\/unit/ } }
|
17
|
-
expect_deprecation_with_call_site(__FILE__, __LINE__ + 1, /:example_group/)
|
18
|
-
config.__send__(method, *args)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#deprecation_stream' do
|
23
|
-
it 'defaults to standard error' do
|
24
|
-
expect($rspec_core_without_stderr_monkey_patch.deprecation_stream).to eq STDERR
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'is configurable' do
|
28
|
-
io = double 'deprecation io'
|
29
|
-
config.deprecation_stream = io
|
30
|
-
expect(config.deprecation_stream).to eq io
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'when the reporter has already been initialized' do
|
34
|
-
before do
|
35
|
-
config.reporter
|
36
|
-
allow(config).to receive(:warn)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'prints a notice indicating the reconfigured output_stream will be ignored' do
|
40
|
-
config.deprecation_stream = double("IO")
|
41
|
-
expect(config).to have_received(:warn).with(/deprecation_stream.*#{__FILE__}:#{__LINE__ - 1}/)
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'does not change the value of `deprecation_stream`' do
|
45
|
-
value = config.deprecation_stream
|
46
|
-
config.deprecation_stream = double("IO")
|
47
|
-
expect(config.deprecation_stream).to equal(value)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'does not print a warning if set to the value it already has' do
|
51
|
-
config.deprecation_stream = config.deprecation_stream
|
52
|
-
expect(config).not_to have_received(:warn)
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe "#output_stream" do
|
58
|
-
it 'defaults to standard output' do
|
59
|
-
expect(config.output_stream).to eq $stdout
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'is configurable' do
|
63
|
-
io = double 'output io'
|
64
|
-
config.output_stream = io
|
65
|
-
expect(config.output_stream).to eq io
|
66
|
-
end
|
67
|
-
|
68
|
-
context 'when the reporter has already been initialized' do
|
69
|
-
before do
|
70
|
-
config.reporter
|
71
|
-
allow(config).to receive(:warn)
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'prints a notice indicating the reconfigured output_stream will be ignored' do
|
75
|
-
config.output_stream = StringIO.new
|
76
|
-
expect(config).to have_received(:warn).with(/output_stream.*#{__FILE__}:#{__LINE__ - 1}/)
|
77
|
-
end
|
78
|
-
|
79
|
-
it 'does not change the value of `output_stream`' do
|
80
|
-
config.output_stream = StringIO.new
|
81
|
-
expect(config.output_stream).to eq($stdout)
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'does not print a warning if set to the value it already has' do
|
85
|
-
config.output_stream = config.output_stream
|
86
|
-
expect(config).not_to have_received(:warn)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
describe "#requires=" do
|
92
|
-
def absolute_path_to(dir)
|
93
|
-
File.expand_path("../../../../#{dir}", __FILE__)
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'adds `lib` to the load path' do
|
97
|
-
lib_dir = absolute_path_to("lib")
|
98
|
-
$LOAD_PATH.delete(lib_dir)
|
99
|
-
|
100
|
-
expect($LOAD_PATH).not_to include(lib_dir)
|
101
|
-
config.requires = []
|
102
|
-
expect($LOAD_PATH).to include(lib_dir)
|
103
|
-
end
|
104
|
-
|
105
|
-
it 'adds the configured `default_path` to the load path' do
|
106
|
-
config.default_path = 'features'
|
107
|
-
foo_dir = absolute_path_to("features")
|
108
|
-
|
109
|
-
expect($LOAD_PATH).not_to include(foo_dir)
|
110
|
-
config.requires = []
|
111
|
-
expect($LOAD_PATH).to include(foo_dir)
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'stores the required files' do
|
115
|
-
expect(config).to receive(:require).with('a/path')
|
116
|
-
config.requires = ['a/path']
|
117
|
-
expect(config.requires).to eq ['a/path']
|
118
|
-
end
|
119
|
-
|
120
|
-
context "when `default_path` refers to a file rather than a directory" do
|
121
|
-
it 'does not add it to the load path' do
|
122
|
-
config.default_path = 'Rakefile'
|
123
|
-
config.requires = []
|
124
|
-
expect($LOAD_PATH).not_to include(match(/Rakefile/))
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe "#load_spec_files" do
|
130
|
-
it "loads files using load" do
|
131
|
-
config.files_to_run = ["foo.bar", "blah_spec.rb"]
|
132
|
-
expect(config).to receive(:load).twice
|
133
|
-
config.load_spec_files
|
134
|
-
end
|
135
|
-
|
136
|
-
it "loads each file once, even if duplicated in list" do
|
137
|
-
config.files_to_run = ["a_spec.rb", "a_spec.rb"]
|
138
|
-
expect(config).to receive(:load).once
|
139
|
-
config.load_spec_files
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
describe "#mock_framework" do
|
144
|
-
it "defaults to :rspec" do
|
145
|
-
expect(RSpec::Support).to receive(:require_rspec_core).with('mocking_adapters/rspec')
|
146
|
-
expect(config.mock_framework).to eq(MockingAdapters::RSpec)
|
147
|
-
end
|
148
|
-
|
149
|
-
context "when rspec-mocks is not installed" do
|
150
|
-
it 'gracefully falls back to :nothing' do
|
151
|
-
allow(RSpec::Support).to receive(:require_rspec_core).and_call_original
|
152
|
-
allow(RSpec::Support).to receive(:require_rspec_core).with('mocking_adapters/rspec').and_raise(LoadError)
|
153
|
-
|
154
|
-
expect(config.mock_framework).to eq(MockingAdapters::Null)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
describe "#mock_framework="do
|
160
|
-
it "delegates to mock_with" do
|
161
|
-
expect(config).to receive(:mock_with).with(:rspec)
|
162
|
-
config.mock_framework = :rspec
|
163
|
-
end
|
164
|
-
end
|
165
|
-
|
166
|
-
shared_examples "a configurable framework adapter" do |m|
|
167
|
-
it "yields a config object if the framework_module supports it" do
|
168
|
-
custom_config = Struct.new(:custom_setting).new
|
169
|
-
mod = Module.new
|
170
|
-
allow(mod).to receive_messages(:configuration => custom_config)
|
171
|
-
|
172
|
-
config.send m, mod do |mod_config|
|
173
|
-
mod_config.custom_setting = true
|
174
|
-
end
|
175
|
-
|
176
|
-
expect(custom_config.custom_setting).to be_truthy
|
177
|
-
end
|
178
|
-
|
179
|
-
it "raises if framework module doesn't support configuration" do
|
180
|
-
mod = Module.new
|
181
|
-
|
182
|
-
expect {
|
183
|
-
config.send m, mod do |mod_config|
|
184
|
-
end
|
185
|
-
}.to raise_error(/must respond to `configuration`/)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
describe "#mock_with" do
|
190
|
-
before { allow(config).to receive(:require) }
|
191
|
-
|
192
|
-
it_behaves_like "a configurable framework adapter", :mock_with
|
193
|
-
|
194
|
-
it "allows rspec-mocks to be configured with a provided block" do
|
195
|
-
mod = Module.new
|
196
|
-
|
197
|
-
expect(RSpec::Mocks.configuration).to receive(:add_stub_and_should_receive_to).with(mod)
|
198
|
-
|
199
|
-
config.mock_with :rspec do |c|
|
200
|
-
c.add_stub_and_should_receive_to mod
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
context "with a module" do
|
205
|
-
it "sets the mock_framework_adapter to that module" do
|
206
|
-
mod = Module.new
|
207
|
-
config.mock_with mod
|
208
|
-
expect(config.mock_framework).to eq(mod)
|
209
|
-
end
|
210
|
-
end
|
211
|
-
|
212
|
-
it 'uses the named adapter' do
|
213
|
-
expect(RSpec::Support).to receive(:require_rspec_core).with('mocking_adapters/mocha')
|
214
|
-
stub_const("RSpec::Core::MockingAdapters::Mocha", Module.new)
|
215
|
-
config.mock_with :mocha
|
216
|
-
end
|
217
|
-
|
218
|
-
it "uses the null adapter when given :nothing" do
|
219
|
-
expect(RSpec::Support).to receive(:require_rspec_core).with('mocking_adapters/null').and_call_original
|
220
|
-
config.mock_with :nothing
|
221
|
-
end
|
222
|
-
|
223
|
-
it "raises an error when given an unknown key" do
|
224
|
-
expect {
|
225
|
-
config.mock_with :crazy_new_mocking_framework_ive_not_yet_heard_of
|
226
|
-
}.to raise_error(ArgumentError, /unknown mocking framework/i)
|
227
|
-
end
|
228
|
-
|
229
|
-
it "raises an error when given another type of object" do
|
230
|
-
expect {
|
231
|
-
config.mock_with Object.new
|
232
|
-
}.to raise_error(ArgumentError, /unknown mocking framework/i)
|
233
|
-
end
|
234
|
-
|
235
|
-
context 'when there are already some example groups defined' do
|
236
|
-
before { allow(RSpec::Support).to receive(:require_rspec_core) }
|
237
|
-
|
238
|
-
it 'raises an error since this setting must be applied before any groups are defined' do
|
239
|
-
allow(RSpec.world).to receive(:example_groups).and_return([double.as_null_object])
|
240
|
-
mocha = stub_const("RSpec::Core::MockingAdapters::Mocha", Module.new)
|
241
|
-
allow(mocha).to receive_messages(:framework_name => :mocha)
|
242
|
-
|
243
|
-
expect {
|
244
|
-
config.mock_with :mocha
|
245
|
-
}.to raise_error(/must be configured before any example groups are defined/)
|
246
|
-
end
|
247
|
-
|
248
|
-
it 'does not raise an error if the default `mock_with :rspec` is re-configured' do
|
249
|
-
config.mock_framework # called by RSpec when configuring the first example group
|
250
|
-
allow(RSpec.world).to receive(:example_groups).and_return([double.as_null_object])
|
251
|
-
config.mock_with :rspec
|
252
|
-
end
|
253
|
-
|
254
|
-
it 'does not raise an error if re-setting the same config' do
|
255
|
-
mocha = stub_const("RSpec::Core::MockingAdapters::Mocha", Module.new)
|
256
|
-
allow(mocha).to receive_messages(:framework_name => :mocha)
|
257
|
-
|
258
|
-
groups = []
|
259
|
-
allow(RSpec.world).to receive_messages(:example_groups => groups)
|
260
|
-
config.mock_with :mocha
|
261
|
-
groups << double.as_null_object
|
262
|
-
config.mock_with :mocha
|
263
|
-
end
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
describe "#expectation_frameworks" do
|
268
|
-
it "defaults to :rspec" do
|
269
|
-
expect(config).to receive(:require).with('rspec/expectations')
|
270
|
-
expect(config.expectation_frameworks).to eq([RSpec::Matchers])
|
271
|
-
end
|
272
|
-
|
273
|
-
context "when rspec-expectations is not installed" do
|
274
|
-
def an_anonymous_module
|
275
|
-
name = RUBY_VERSION.to_f < 1.9 ? '' : nil
|
276
|
-
an_object_having_attributes(:class => Module, :name => name)
|
277
|
-
end
|
278
|
-
|
279
|
-
it 'gracefully falls back to an anonymous module' do
|
280
|
-
allow(config).to receive(:require).with('rspec/expectations').and_raise(LoadError)
|
281
|
-
expect(config.expectation_frameworks).to match([an_anonymous_module])
|
282
|
-
end
|
283
|
-
end
|
284
|
-
end
|
285
|
-
|
286
|
-
describe "#expectation_framework=" do
|
287
|
-
it "delegates to expect_with" do
|
288
|
-
expect(config).to receive(:expect_with).with(:rspec)
|
289
|
-
config.expectation_framework = :rspec
|
290
|
-
end
|
291
|
-
end
|
292
|
-
|
293
|
-
def stub_expectation_adapters
|
294
|
-
stub_const("Test::Unit::Assertions", Module.new)
|
295
|
-
stub_const("Minitest::Assertions", Module.new)
|
296
|
-
stub_const("RSpec::Core::TestUnitAssertionsAdapter", Module.new)
|
297
|
-
stub_const("RSpec::Core::MinitestAssertionsAdapter", Module.new)
|
298
|
-
allow(config).to receive(:require)
|
299
|
-
end
|
300
|
-
|
301
|
-
describe "#expect_with" do
|
302
|
-
before do
|
303
|
-
stub_expectation_adapters
|
304
|
-
end
|
305
|
-
|
306
|
-
it_behaves_like "a configurable framework adapter", :expect_with
|
307
|
-
|
308
|
-
context "with :rspec" do
|
309
|
-
it "requires rspec/expectations" do
|
310
|
-
expect(config).to receive(:require).with('rspec/expectations')
|
311
|
-
config.expect_with :rspec
|
312
|
-
end
|
313
|
-
|
314
|
-
it "sets the expectation framework to ::RSpec::Matchers" do
|
315
|
-
config.expect_with :rspec
|
316
|
-
expect(config.expectation_frameworks).to eq [::RSpec::Matchers]
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
context "with :test_unit" do
|
321
|
-
it "requires rspec/core/test_unit_assertions_adapter" do
|
322
|
-
expect(config).to receive(:require).
|
323
|
-
with('rspec/core/test_unit_assertions_adapter')
|
324
|
-
config.expect_with :test_unit
|
325
|
-
end
|
326
|
-
|
327
|
-
it "sets the expectation framework to ::Test::Unit::Assertions" do
|
328
|
-
config.expect_with :test_unit
|
329
|
-
expect(config.expectation_frameworks).to eq [
|
330
|
-
::RSpec::Core::TestUnitAssertionsAdapter
|
331
|
-
]
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
|
-
context "with :minitest" do
|
336
|
-
it "requires rspec/core/minitest_assertions_adapter" do
|
337
|
-
expect(config).to receive(:require).
|
338
|
-
with('rspec/core/minitest_assertions_adapter')
|
339
|
-
config.expect_with :minitest
|
340
|
-
end
|
341
|
-
|
342
|
-
it "sets the expectation framework to ::Minitest::Assertions" do
|
343
|
-
config.expect_with :minitest
|
344
|
-
expect(config.expectation_frameworks).to eq [
|
345
|
-
::RSpec::Core::MinitestAssertionsAdapter
|
346
|
-
]
|
347
|
-
end
|
348
|
-
end
|
349
|
-
|
350
|
-
it "supports multiple calls" do
|
351
|
-
config.expect_with :rspec
|
352
|
-
config.expect_with :minitest
|
353
|
-
expect(config.expectation_frameworks).to eq [
|
354
|
-
RSpec::Matchers,
|
355
|
-
RSpec::Core::MinitestAssertionsAdapter
|
356
|
-
]
|
357
|
-
end
|
358
|
-
|
359
|
-
it "raises if block given with multiple args" do
|
360
|
-
expect {
|
361
|
-
config.expect_with :rspec, :minitest do |mod_config|
|
362
|
-
end
|
363
|
-
}.to raise_error(/expect_with only accepts/)
|
364
|
-
end
|
365
|
-
|
366
|
-
it "raises ArgumentError if framework is not supported" do
|
367
|
-
expect do
|
368
|
-
config.expect_with :not_supported
|
369
|
-
end.to raise_error(ArgumentError)
|
370
|
-
end
|
371
|
-
|
372
|
-
context 'when there are already some example groups defined' do
|
373
|
-
it 'raises an error since this setting must be applied before any groups are defined' do
|
374
|
-
allow(RSpec.world).to receive(:example_groups).and_return([double.as_null_object])
|
375
|
-
expect {
|
376
|
-
config.expect_with :rspec
|
377
|
-
}.to raise_error(/must be configured before any example groups are defined/)
|
378
|
-
end
|
379
|
-
|
380
|
-
it 'does not raise an error if the default `expect_with :rspec` is re-configured' do
|
381
|
-
config.expectation_frameworks # called by RSpec when configuring the first example group
|
382
|
-
allow(RSpec.world).to receive(:example_groups).and_return([double.as_null_object])
|
383
|
-
config.expect_with :rspec
|
384
|
-
end
|
385
|
-
|
386
|
-
it 'does not raise an error if re-setting the same config' do
|
387
|
-
groups = []
|
388
|
-
allow(RSpec.world).to receive_messages(:example_groups => groups)
|
389
|
-
config.expect_with :minitest
|
390
|
-
groups << double.as_null_object
|
391
|
-
config.expect_with :minitest
|
392
|
-
end
|
393
|
-
end
|
394
|
-
end
|
395
|
-
|
396
|
-
describe "#expecting_with_rspec?" do
|
397
|
-
before do
|
398
|
-
stub_expectation_adapters
|
399
|
-
end
|
400
|
-
|
401
|
-
it "returns false by default" do
|
402
|
-
expect(config).not_to be_expecting_with_rspec
|
403
|
-
end
|
404
|
-
|
405
|
-
it "returns true when `expect_with :rspec` has been configured" do
|
406
|
-
config.expect_with :rspec
|
407
|
-
expect(config).to be_expecting_with_rspec
|
408
|
-
end
|
409
|
-
|
410
|
-
it "returns true when `expect_with :rspec, :minitest` has been configured" do
|
411
|
-
config.expect_with :rspec, :minitest
|
412
|
-
expect(config).to be_expecting_with_rspec
|
413
|
-
end
|
414
|
-
|
415
|
-
it "returns true when `expect_with :minitest, :rspec` has been configured" do
|
416
|
-
config.expect_with :minitest, :rspec
|
417
|
-
expect(config).to be_expecting_with_rspec
|
418
|
-
end
|
419
|
-
|
420
|
-
it "returns false when `expect_with :minitest` has been configured" do
|
421
|
-
config.expect_with :minitest
|
422
|
-
expect(config).not_to be_expecting_with_rspec
|
423
|
-
end
|
424
|
-
end
|
425
|
-
|
426
|
-
describe "#files_to_run" do
|
427
|
-
it "loads files not following pattern if named explicitly" do
|
428
|
-
assign_files_or_directories_to_run "spec/rspec/core/resources/a_bar.rb"
|
429
|
-
expect(config.files_to_run).to contain_files("spec/rspec/core/resources/a_bar.rb")
|
430
|
-
end
|
431
|
-
|
432
|
-
it "prevents repetition of dir when start of the pattern" do
|
433
|
-
config.pattern = "spec/**/a_spec.rb"
|
434
|
-
assign_files_or_directories_to_run "spec"
|
435
|
-
expect(config.files_to_run).to contain_files("spec/rspec/core/resources/a_spec.rb")
|
436
|
-
end
|
437
|
-
|
438
|
-
it "does not prevent repetition of dir when later of the pattern" do
|
439
|
-
config.pattern = "rspec/**/a_spec.rb"
|
440
|
-
assign_files_or_directories_to_run "spec"
|
441
|
-
expect(config.files_to_run).to contain_files("spec/rspec/core/resources/a_spec.rb")
|
442
|
-
end
|
443
|
-
|
444
|
-
it "supports patterns starting with ./" do
|
445
|
-
config.pattern = "./spec/**/a_spec.rb"
|
446
|
-
assign_files_or_directories_to_run "spec"
|
447
|
-
expect(config.files_to_run).to contain_files("./spec/rspec/core/resources/a_spec.rb")
|
448
|
-
end
|
449
|
-
|
450
|
-
it "supports absolute path patterns" do
|
451
|
-
dir = File.expand_path("../resources", __FILE__)
|
452
|
-
config.pattern = File.join(dir, "**/*_spec.rb")
|
453
|
-
assign_files_or_directories_to_run "spec"
|
454
|
-
|
455
|
-
expect(config.files_to_run).to contain_files(
|
456
|
-
"./spec/rspec/core/resources/acceptance/foo_spec.rb",
|
457
|
-
"./spec/rspec/core/resources/a_spec.rb"
|
458
|
-
)
|
459
|
-
end
|
460
|
-
|
461
|
-
it "supports relative path patterns for an alternate directory from `spec`" do
|
462
|
-
Dir.chdir("./spec/rspec/core") do
|
463
|
-
config.pattern = "resources/**/*_spec.rb"
|
464
|
-
assign_files_or_directories_to_run "spec" # default dir
|
465
|
-
|
466
|
-
expect(config.files_to_run).to contain_files(
|
467
|
-
"resources/acceptance/foo_spec.rb",
|
468
|
-
"resources/a_spec.rb"
|
469
|
-
)
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
473
|
-
it "does not attempt to treat the pattern relative to `.` if it uses `**` in the first path segment as that would cause it load specs from vendored gems" do
|
474
|
-
Dir.chdir("./spec/rspec/core") do
|
475
|
-
config.pattern = "**/*_spec.rb"
|
476
|
-
assign_files_or_directories_to_run "spec" # default dir
|
477
|
-
|
478
|
-
expect(config.files_to_run).to contain_files()
|
479
|
-
end
|
480
|
-
end
|
481
|
-
|
482
|
-
it 'reloads when `files_or_directories_to_run` is reassigned' do
|
483
|
-
config.pattern = "spec/**/a_spec.rb"
|
484
|
-
config.files_or_directories_to_run = "empty_dir"
|
485
|
-
|
486
|
-
expect {
|
487
|
-
config.files_or_directories_to_run = "spec"
|
488
|
-
}.to change { config.files_to_run }.
|
489
|
-
to(a_file_collection("spec/rspec/core/resources/a_spec.rb"))
|
490
|
-
end
|
491
|
-
|
492
|
-
it 'attempts to load the provided file names' do
|
493
|
-
assign_files_or_directories_to_run "path/to/some/file.rb"
|
494
|
-
expect(config.files_to_run).to eq(["path/to/some/file.rb"])
|
495
|
-
end
|
496
|
-
|
497
|
-
it 'does not attempt to load a file at the `default_path`' do
|
498
|
-
config.default_path = "path/to/dir"
|
499
|
-
assign_files_or_directories_to_run "path/to/dir"
|
500
|
-
expect(config.files_to_run).to eq([])
|
501
|
-
end
|
502
|
-
|
503
|
-
context "with <path>:<line_number>" do
|
504
|
-
it "overrides inclusion filters set on config" do
|
505
|
-
config.filter_run_including :foo => :bar
|
506
|
-
assign_files_or_directories_to_run "path/to/file.rb:37"
|
507
|
-
expect(inclusion_filter.size).to eq(1)
|
508
|
-
expect(inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
|
509
|
-
expect(inclusion_filter[:locations].values.first).to eq([37])
|
510
|
-
end
|
511
|
-
|
512
|
-
it "overrides inclusion filters set before config" do
|
513
|
-
config.force(:inclusion_filter => {:foo => :bar})
|
514
|
-
assign_files_or_directories_to_run "path/to/file.rb:37"
|
515
|
-
expect(inclusion_filter.size).to eq(1)
|
516
|
-
expect(inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
|
517
|
-
expect(inclusion_filter[:locations].values.first).to eq([37])
|
518
|
-
end
|
519
|
-
|
520
|
-
it "clears exclusion filters set on config" do
|
521
|
-
config.exclusion_filter = { :foo => :bar }
|
522
|
-
assign_files_or_directories_to_run "path/to/file.rb:37"
|
523
|
-
expect(exclusion_filter).to be_empty,
|
524
|
-
"expected exclusion filter to be empty:\n#{exclusion_filter}"
|
525
|
-
end
|
526
|
-
|
527
|
-
it "clears exclusion filters set before config" do
|
528
|
-
config.force(:exclusion_filter => { :foo => :bar })
|
529
|
-
assign_files_or_directories_to_run "path/to/file.rb:37"
|
530
|
-
expect(config.exclusion_filter).to be_empty,
|
531
|
-
"expected exclusion filter to be empty:\n#{config.exclusion_filter}"
|
532
|
-
end
|
533
|
-
end
|
534
|
-
|
535
|
-
context "with default pattern" do
|
536
|
-
it "loads files named _spec.rb" do
|
537
|
-
assign_files_or_directories_to_run "spec/rspec/core/resources"
|
538
|
-
expect(config.files_to_run).to contain_files("spec/rspec/core/resources/a_spec.rb", "spec/rspec/core/resources/acceptance/foo_spec.rb")
|
539
|
-
end
|
540
|
-
|
541
|
-
it "loads files in Windows", :if => RSpec.world.windows_os? do
|
542
|
-
assign_files_or_directories_to_run "C:\\path\\to\\project\\spec\\sub\\foo_spec.rb"
|
543
|
-
expect(config.files_to_run).to contain_files("C:/path/to/project/spec/sub/foo_spec.rb")
|
544
|
-
end
|
545
|
-
|
546
|
-
it "loads files in Windows when directory is specified", :if => RSpec.world.windows_os? do
|
547
|
-
assign_files_or_directories_to_run "spec\\rspec\\core\\resources"
|
548
|
-
expect(config.files_to_run).to contain_files("spec/rspec/core/resources/a_spec.rb")
|
549
|
-
end
|
550
|
-
|
551
|
-
it_behaves_like "handling symlinked directories when loading spec files" do
|
552
|
-
def loaded_files
|
553
|
-
assign_files_or_directories_to_run "spec"
|
554
|
-
config.files_to_run
|
555
|
-
end
|
556
|
-
end
|
557
|
-
end
|
558
|
-
|
559
|
-
context "with default default_path" do
|
560
|
-
it "loads files in the default path when run by rspec" do
|
561
|
-
allow(config).to receive(:command) { 'rspec' }
|
562
|
-
assign_files_or_directories_to_run []
|
563
|
-
expect(config.files_to_run).not_to be_empty
|
564
|
-
end
|
565
|
-
|
566
|
-
it "loads files in the default path when run with DRB (e.g., spork)" do
|
567
|
-
allow(config).to receive(:command) { 'spork' }
|
568
|
-
allow(RSpec::Core::Runner).to receive(:running_in_drb?) { true }
|
569
|
-
assign_files_or_directories_to_run []
|
570
|
-
expect(config.files_to_run).not_to be_empty
|
571
|
-
end
|
572
|
-
|
573
|
-
it "does not load files in the default path when run by ruby" do
|
574
|
-
allow(config).to receive(:command) { 'ruby' }
|
575
|
-
assign_files_or_directories_to_run []
|
576
|
-
expect(config.files_to_run).to be_empty
|
577
|
-
end
|
578
|
-
end
|
579
|
-
|
580
|
-
def specify_consistent_ordering_of_files_to_run
|
581
|
-
allow(File).to receive(:directory?).with('a') { true }
|
582
|
-
allow(File).to receive(:directory?).with('.') { true }
|
583
|
-
globbed_files = nil
|
584
|
-
allow(Dir).to receive(:[]).with(/^\{?a/) { globbed_files }
|
585
|
-
allow(Dir).to receive(:[]).with(/^\{?\./) { [] }
|
586
|
-
|
587
|
-
orderings = [
|
588
|
-
%w[ a/1.rb a/2.rb a/3.rb ],
|
589
|
-
%w[ a/2.rb a/1.rb a/3.rb ],
|
590
|
-
%w[ a/3.rb a/2.rb a/1.rb ]
|
591
|
-
].map do |files|
|
592
|
-
globbed_files = files
|
593
|
-
yield
|
594
|
-
config.files_to_run
|
595
|
-
end
|
596
|
-
|
597
|
-
expect(orderings.uniq.size).to eq(1)
|
598
|
-
end
|
599
|
-
|
600
|
-
context 'when the given directories match the pattern' do
|
601
|
-
it 'orders the files in a consistent ordering, regardless of the underlying OS ordering' do
|
602
|
-
specify_consistent_ordering_of_files_to_run do
|
603
|
-
config.pattern = 'a/*.rb'
|
604
|
-
assign_files_or_directories_to_run 'a'
|
605
|
-
end
|
606
|
-
end
|
607
|
-
end
|
608
|
-
|
609
|
-
context 'when the pattern is given relative to the given directories' do
|
610
|
-
it 'orders the files in a consistent ordering, regardless of the underlying OS ordering' do
|
611
|
-
specify_consistent_ordering_of_files_to_run do
|
612
|
-
config.pattern = '*.rb'
|
613
|
-
assign_files_or_directories_to_run 'a'
|
614
|
-
end
|
615
|
-
end
|
616
|
-
end
|
617
|
-
|
618
|
-
context 'when given multiple file paths' do
|
619
|
-
it 'orders the files in a consistent ordering, regardless of the given order' do
|
620
|
-
allow(File).to receive(:directory?) { false } # fake it into thinking these a full file paths
|
621
|
-
|
622
|
-
files = ['a/b/c_spec.rb', 'c/b/a_spec.rb']
|
623
|
-
assign_files_or_directories_to_run(*files)
|
624
|
-
ordering_1 = config.files_to_run
|
625
|
-
|
626
|
-
assign_files_or_directories_to_run(*files.reverse)
|
627
|
-
ordering_2 = config.files_to_run
|
628
|
-
|
629
|
-
expect(ordering_1).to eq(ordering_2)
|
630
|
-
end
|
631
|
-
end
|
632
|
-
end
|
633
|
-
|
634
|
-
describe "#pattern" do
|
635
|
-
context "with single pattern" do
|
636
|
-
before { config.pattern = "**/*_foo.rb" }
|
637
|
-
|
638
|
-
it "loads all explicitly specified files, even those that do not match the pattern" do
|
639
|
-
file_1 = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
640
|
-
file_2 = File.expand_path(File.dirname(__FILE__) + "/resources/a_bar.rb")
|
641
|
-
|
642
|
-
assign_files_or_directories_to_run file_1, file_2
|
643
|
-
expect(config.files_to_run).to contain_exactly(file_1, file_2)
|
644
|
-
end
|
645
|
-
|
646
|
-
it "loads files in directories following pattern" do
|
647
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
648
|
-
assign_files_or_directories_to_run dir
|
649
|
-
expect(config.files_to_run).to include("#{dir}/a_foo.rb")
|
650
|
-
end
|
651
|
-
|
652
|
-
it "does not load files in directories not following pattern" do
|
653
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
654
|
-
assign_files_or_directories_to_run dir
|
655
|
-
expect(config.files_to_run).not_to include("#{dir}/a_bar.rb")
|
656
|
-
end
|
657
|
-
|
658
|
-
it "ignores pattern if files are specified" do
|
659
|
-
files = [
|
660
|
-
File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb"),
|
661
|
-
File.expand_path(File.dirname(__FILE__) + "/resources/a_spec.rb")
|
662
|
-
]
|
663
|
-
assign_files_or_directories_to_run(files)
|
664
|
-
expect(config.files_to_run).to match_array(files)
|
665
|
-
end
|
666
|
-
end
|
667
|
-
|
668
|
-
context "with multiple patterns" do
|
669
|
-
it "supports comma separated values" do
|
670
|
-
config.pattern = "**/*_foo.rb,**/*_bar.rb"
|
671
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
672
|
-
assign_files_or_directories_to_run dir
|
673
|
-
expect(config.files_to_run).to include("#{dir}/a_foo.rb")
|
674
|
-
expect(config.files_to_run).to include("#{dir}/a_bar.rb")
|
675
|
-
end
|
676
|
-
|
677
|
-
it "supports comma separated values with spaces" do
|
678
|
-
config.pattern = "**/*_foo.rb, **/*_bar.rb"
|
679
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
680
|
-
assign_files_or_directories_to_run dir
|
681
|
-
expect(config.files_to_run).to include("#{dir}/a_foo.rb")
|
682
|
-
expect(config.files_to_run).to include("#{dir}/a_bar.rb")
|
683
|
-
end
|
684
|
-
|
685
|
-
it "supports curly braces glob syntax" do
|
686
|
-
config.pattern = "**/*_{foo,bar}.rb"
|
687
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
688
|
-
assign_files_or_directories_to_run dir
|
689
|
-
expect(config.files_to_run).to include("#{dir}/a_foo.rb")
|
690
|
-
expect(config.files_to_run).to include("#{dir}/a_bar.rb")
|
691
|
-
end
|
692
|
-
end
|
693
|
-
|
694
|
-
context "after files have already been loaded" do
|
695
|
-
it 'warns that it will have no effect' do
|
696
|
-
expect_warning_with_call_site(__FILE__, __LINE__ + 2, /has no effect/)
|
697
|
-
config.load_spec_files
|
698
|
-
config.pattern = "rspec/**/*.spec"
|
699
|
-
end
|
700
|
-
|
701
|
-
it 'does not warn if reset is called after load_spec_files' do
|
702
|
-
config.load_spec_files
|
703
|
-
config.reset
|
704
|
-
expect(RSpec).to_not receive(:warning)
|
705
|
-
config.pattern = "rspec/**/*.spec"
|
706
|
-
end
|
707
|
-
end
|
708
|
-
|
709
|
-
context "after `files_to_run` has been accessed but before files have been loaded" do
|
710
|
-
it 'still takes affect' do
|
711
|
-
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
712
|
-
assign_files_or_directories_to_run File.dirname(file)
|
713
|
-
expect(config.files_to_run).not_to include(file)
|
714
|
-
config.pattern = "**/*_foo.rb"
|
715
|
-
expect(config.files_to_run).to include(file)
|
716
|
-
end
|
717
|
-
end
|
718
|
-
end
|
719
|
-
|
720
|
-
describe "#exclude_pattern" do
|
721
|
-
context "with single pattern" do
|
722
|
-
before { config.exclude_pattern = "**/*_foo.rb" }
|
723
|
-
|
724
|
-
it "does not load files in directories following exclude pattern" do
|
725
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
726
|
-
assign_files_or_directories_to_run dir
|
727
|
-
expect(config.files_to_run).not_to include("#{dir}/a_foo.rb")
|
728
|
-
end
|
729
|
-
|
730
|
-
it "loads files in directories not following exclude pattern" do
|
731
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
732
|
-
assign_files_or_directories_to_run dir
|
733
|
-
expect(config.files_to_run).to include("#{dir}/a_spec.rb")
|
734
|
-
end
|
735
|
-
|
736
|
-
it "ignores exclude_pattern if files are specified" do
|
737
|
-
files = [
|
738
|
-
File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb"),
|
739
|
-
File.expand_path(File.dirname(__FILE__) + "/resources/a_spec.rb")
|
740
|
-
]
|
741
|
-
assign_files_or_directories_to_run(files)
|
742
|
-
expect(config.files_to_run).to match_array(files)
|
743
|
-
end
|
744
|
-
end
|
745
|
-
|
746
|
-
context "with multiple patterns" do
|
747
|
-
it "supports comma separated values" do
|
748
|
-
config.exclude_pattern = "**/*_foo.rb,**/*_bar.rb"
|
749
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
750
|
-
assign_files_or_directories_to_run dir
|
751
|
-
expect(config.files_to_run).not_to include("#{dir}/a_foo.rb")
|
752
|
-
expect(config.files_to_run).not_to include("#{dir}/a_bar.rb")
|
753
|
-
end
|
754
|
-
|
755
|
-
it "supports comma separated values with spaces" do
|
756
|
-
config.exclude_pattern = "**/*_foo.rb, **/*_bar.rb"
|
757
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
758
|
-
assign_files_or_directories_to_run dir
|
759
|
-
expect(config.files_to_run).not_to include("#{dir}/a_foo.rb")
|
760
|
-
expect(config.files_to_run).not_to include("#{dir}/a_bar.rb")
|
761
|
-
end
|
762
|
-
|
763
|
-
it "supports curly braces glob syntax" do
|
764
|
-
config.exclude_pattern = "**/*_{foo,bar}.rb"
|
765
|
-
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
766
|
-
assign_files_or_directories_to_run dir
|
767
|
-
expect(config.files_to_run).not_to include("#{dir}/a_foo.rb")
|
768
|
-
expect(config.files_to_run).not_to include("#{dir}/a_bar.rb")
|
769
|
-
end
|
770
|
-
end
|
771
|
-
|
772
|
-
context "after files have already been loaded" do
|
773
|
-
it 'warns that it will have no effect' do
|
774
|
-
expect_warning_with_call_site(__FILE__, __LINE__ + 2, /has no effect/)
|
775
|
-
config.load_spec_files
|
776
|
-
config.exclude_pattern = "rspec/**/*.spec"
|
777
|
-
end
|
778
|
-
|
779
|
-
it 'does not warn if reset is called after load_spec_files' do
|
780
|
-
config.load_spec_files
|
781
|
-
config.reset
|
782
|
-
expect(RSpec).to_not receive(:warning)
|
783
|
-
config.exclude_pattern = "rspec/**/*.spec"
|
784
|
-
end
|
785
|
-
end
|
786
|
-
|
787
|
-
context "after `files_to_run` has been accessed but before files have been loaded" do
|
788
|
-
it 'still takes affect' do
|
789
|
-
config.pattern = "**/*.rb"
|
790
|
-
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
791
|
-
assign_files_or_directories_to_run File.dirname(file)
|
792
|
-
expect(config.files_to_run).to include(file)
|
793
|
-
config.exclude_pattern = "**/*_foo.rb"
|
794
|
-
expect(config.files_to_run).not_to include(file)
|
795
|
-
end
|
796
|
-
end
|
797
|
-
end
|
798
|
-
|
799
|
-
describe "path with line number" do
|
800
|
-
it "assigns the line number as a location filter" do
|
801
|
-
assign_files_or_directories_to_run "path/to/a_spec.rb:37"
|
802
|
-
expect(inclusion_filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
|
803
|
-
end
|
804
|
-
end
|
805
|
-
|
806
|
-
context "with full_description set" do
|
807
|
-
it "overrides filters" do
|
808
|
-
config.filter_run :focused => true
|
809
|
-
config.full_description = "foo"
|
810
|
-
expect(inclusion_filter).not_to have_key(:focused)
|
811
|
-
end
|
812
|
-
|
813
|
-
it 'is possible to access the full description regular expression' do
|
814
|
-
config.full_description = "foo"
|
815
|
-
expect(config.full_description).to eq(/foo/)
|
816
|
-
end
|
817
|
-
end
|
818
|
-
|
819
|
-
context "without full_description having been set" do
|
820
|
-
it 'returns nil from #full_description' do
|
821
|
-
expect(config.full_description).to eq nil
|
822
|
-
end
|
823
|
-
end
|
824
|
-
|
825
|
-
context "with line number" do
|
826
|
-
it "assigns the file and line number as a location filter" do
|
827
|
-
assign_files_or_directories_to_run "path/to/a_spec.rb:37"
|
828
|
-
expect(inclusion_filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
|
829
|
-
end
|
830
|
-
|
831
|
-
it "assigns multiple files with line numbers as location filters" do
|
832
|
-
assign_files_or_directories_to_run "path/to/a_spec.rb:37", "other_spec.rb:44"
|
833
|
-
expect(inclusion_filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37],
|
834
|
-
File.expand_path("other_spec.rb") => [44]}})
|
835
|
-
end
|
836
|
-
|
837
|
-
it "assigns files with multiple line numbers as location filters" do
|
838
|
-
assign_files_or_directories_to_run "path/to/a_spec.rb:37", "path/to/a_spec.rb:44"
|
839
|
-
expect(inclusion_filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37, 44]}})
|
840
|
-
end
|
841
|
-
end
|
842
|
-
|
843
|
-
context "with multiple line numbers" do
|
844
|
-
it "assigns the file and line numbers as a location filter" do
|
845
|
-
assign_files_or_directories_to_run "path/to/a_spec.rb:1:3:5:7"
|
846
|
-
expect(inclusion_filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [1,3,5,7]}})
|
847
|
-
end
|
848
|
-
end
|
849
|
-
|
850
|
-
it "assigns the example name as the filter on description" do
|
851
|
-
config.full_description = "foo"
|
852
|
-
expect(inclusion_filter).to eq({:full_description => /foo/})
|
853
|
-
end
|
854
|
-
|
855
|
-
it "assigns the example names as the filter on description if description is an array" do
|
856
|
-
config.full_description = [ "foo", "bar" ]
|
857
|
-
expect(inclusion_filter).to eq({:full_description => Regexp.union(/foo/, /bar/)})
|
858
|
-
end
|
859
|
-
|
860
|
-
it 'is possible to access the full description regular expression' do
|
861
|
-
config.full_description = "foo","bar"
|
862
|
-
expect(config.full_description).to eq Regexp.union(/foo/,/bar/)
|
863
|
-
end
|
864
|
-
|
865
|
-
describe "#default_path" do
|
866
|
-
it 'defaults to "spec"' do
|
867
|
-
expect(config.default_path).to eq('spec')
|
868
|
-
end
|
869
|
-
end
|
870
|
-
|
871
|
-
describe "#include" do
|
872
|
-
include_examples "warning of deprecated `:example_group` during filtering configuration", :include, Enumerable
|
873
|
-
|
874
|
-
module InstanceLevelMethods
|
875
|
-
def you_call_this_a_blt?
|
876
|
-
"egad man, where's the mayo?!?!?"
|
877
|
-
end
|
878
|
-
end
|
879
|
-
|
880
|
-
it_behaves_like "metadata hash builder" do
|
881
|
-
def metadata_hash(*args)
|
882
|
-
config.include(InstanceLevelMethods, *args)
|
883
|
-
config.include_or_extend_modules.last.last
|
884
|
-
end
|
885
|
-
end
|
886
|
-
|
887
|
-
context "with no filter" do
|
888
|
-
it "includes the given module into each example group" do
|
889
|
-
RSpec.configure do |c|
|
890
|
-
c.include(InstanceLevelMethods)
|
891
|
-
end
|
892
|
-
|
893
|
-
group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
|
894
|
-
expect(group).not_to respond_to(:you_call_this_a_blt?)
|
895
|
-
expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
|
896
|
-
end
|
897
|
-
end
|
898
|
-
|
899
|
-
context "with a filter" do
|
900
|
-
it "includes the given module into each matching example group" do
|
901
|
-
RSpec.configure do |c|
|
902
|
-
c.include(InstanceLevelMethods, :magic_key => :include)
|
903
|
-
end
|
904
|
-
|
905
|
-
group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
|
906
|
-
expect(group).not_to respond_to(:you_call_this_a_blt?)
|
907
|
-
expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
|
908
|
-
end
|
909
|
-
end
|
910
|
-
|
911
|
-
end
|
912
|
-
|
913
|
-
describe "#extend" do
|
914
|
-
include_examples "warning of deprecated `:example_group` during filtering configuration", :extend, Enumerable
|
915
|
-
|
916
|
-
module ThatThingISentYou
|
917
|
-
def that_thing
|
918
|
-
end
|
919
|
-
end
|
920
|
-
|
921
|
-
it_behaves_like "metadata hash builder" do
|
922
|
-
def metadata_hash(*args)
|
923
|
-
config.extend(ThatThingISentYou, *args)
|
924
|
-
config.include_or_extend_modules.last.last
|
925
|
-
end
|
926
|
-
end
|
927
|
-
|
928
|
-
it "extends the given module into each matching example group" do
|
929
|
-
RSpec.configure do |c|
|
930
|
-
c.extend(ThatThingISentYou, :magic_key => :extend)
|
931
|
-
end
|
932
|
-
|
933
|
-
group = ExampleGroup.describe(ThatThingISentYou, :magic_key => :extend) { }
|
934
|
-
expect(group).to respond_to(:that_thing)
|
935
|
-
end
|
936
|
-
|
937
|
-
end
|
938
|
-
|
939
|
-
describe "#run_all_when_everything_filtered?" do
|
940
|
-
|
941
|
-
it "defaults to false" do
|
942
|
-
expect(config.run_all_when_everything_filtered?).to be_falsey
|
943
|
-
end
|
944
|
-
|
945
|
-
it "can be queried with question method" do
|
946
|
-
config.run_all_when_everything_filtered = true
|
947
|
-
expect(config.run_all_when_everything_filtered?).to be_truthy
|
948
|
-
end
|
949
|
-
end
|
950
|
-
|
951
|
-
describe "#color=" do
|
952
|
-
context "given true" do
|
953
|
-
before { config.color = true }
|
954
|
-
|
955
|
-
context "with config.tty? and output.tty?" do
|
956
|
-
it "sets color_enabled?" do
|
957
|
-
output = StringIO.new
|
958
|
-
config.output_stream = output
|
959
|
-
|
960
|
-
config.tty = true
|
961
|
-
allow(config.output_stream).to receive_messages :tty? => true
|
962
|
-
|
963
|
-
expect(config.color_enabled?).to be_truthy
|
964
|
-
expect(config.color_enabled?(output)).to be_truthy
|
965
|
-
end
|
966
|
-
end
|
967
|
-
|
968
|
-
context "with config.tty? and !output.tty?" do
|
969
|
-
it "sets color_enabled?" do
|
970
|
-
output = StringIO.new
|
971
|
-
config.output_stream = output
|
972
|
-
|
973
|
-
config.tty = true
|
974
|
-
allow(config.output_stream).to receive_messages :tty? => false
|
975
|
-
|
976
|
-
expect(config.color_enabled?).to be_truthy
|
977
|
-
expect(config.color_enabled?(output)).to be_truthy
|
978
|
-
end
|
979
|
-
end
|
980
|
-
|
981
|
-
context "with config.tty? and !output.tty?" do
|
982
|
-
it "does not set color_enabled?" do
|
983
|
-
output = StringIO.new
|
984
|
-
config.output_stream = output
|
985
|
-
|
986
|
-
config.tty = false
|
987
|
-
allow(config.output_stream).to receive_messages :tty? => true
|
988
|
-
|
989
|
-
expect(config.color_enabled?).to be_truthy
|
990
|
-
expect(config.color_enabled?(output)).to be_truthy
|
991
|
-
end
|
992
|
-
end
|
993
|
-
|
994
|
-
context "with !config.tty? and !output.tty?" do
|
995
|
-
it "does not set color_enabled?" do
|
996
|
-
output = StringIO.new
|
997
|
-
config.output_stream = output
|
998
|
-
|
999
|
-
config.tty = false
|
1000
|
-
allow(config.output_stream).to receive_messages :tty? => false
|
1001
|
-
|
1002
|
-
expect(config.color_enabled?).to be_falsey
|
1003
|
-
expect(config.color_enabled?(output)).to be_falsey
|
1004
|
-
end
|
1005
|
-
end
|
1006
|
-
|
1007
|
-
context "on windows" do
|
1008
|
-
before do
|
1009
|
-
@original_host = RbConfig::CONFIG['host_os']
|
1010
|
-
RbConfig::CONFIG['host_os'] = 'mingw'
|
1011
|
-
allow(config).to receive(:require)
|
1012
|
-
end
|
1013
|
-
|
1014
|
-
after do
|
1015
|
-
RbConfig::CONFIG['host_os'] = @original_host
|
1016
|
-
end
|
1017
|
-
|
1018
|
-
context "with ANSICON available" do
|
1019
|
-
around(:each) { |e| with_env_vars('ANSICON' => 'ANSICON', &e) }
|
1020
|
-
|
1021
|
-
it "enables colors" do
|
1022
|
-
config.output_stream = StringIO.new
|
1023
|
-
allow(config.output_stream).to receive_messages :tty? => true
|
1024
|
-
config.color = true
|
1025
|
-
expect(config.color).to be_truthy
|
1026
|
-
end
|
1027
|
-
|
1028
|
-
it "leaves output stream intact" do
|
1029
|
-
config.output_stream = $stdout
|
1030
|
-
allow(config).to receive(:require) do |what|
|
1031
|
-
config.output_stream = 'foo' if what =~ /Win32/
|
1032
|
-
end
|
1033
|
-
config.color = true
|
1034
|
-
expect(config.output_stream).to eq($stdout)
|
1035
|
-
end
|
1036
|
-
end
|
1037
|
-
|
1038
|
-
context "with ANSICON NOT available" do
|
1039
|
-
before do
|
1040
|
-
allow_warning
|
1041
|
-
end
|
1042
|
-
|
1043
|
-
it "warns to install ANSICON" do
|
1044
|
-
allow(config).to receive(:require) { raise LoadError }
|
1045
|
-
expect_warning_with_call_site(__FILE__, __LINE__ + 1, /You must use ANSICON/)
|
1046
|
-
config.color = true
|
1047
|
-
end
|
1048
|
-
|
1049
|
-
it "sets color to false" do
|
1050
|
-
allow(config).to receive(:require) { raise LoadError }
|
1051
|
-
config.color = true
|
1052
|
-
expect(config.color).to be_falsey
|
1053
|
-
end
|
1054
|
-
end
|
1055
|
-
end
|
1056
|
-
end
|
1057
|
-
|
1058
|
-
it "prefers incoming cli_args" do
|
1059
|
-
config.output_stream = StringIO.new
|
1060
|
-
allow(config.output_stream).to receive_messages :tty? => true
|
1061
|
-
config.force :color => true
|
1062
|
-
config.color = false
|
1063
|
-
expect(config.color).to be_truthy
|
1064
|
-
end
|
1065
|
-
end
|
1066
|
-
|
1067
|
-
%w[formatter= add_formatter].each do |config_method|
|
1068
|
-
describe "##{config_method}" do
|
1069
|
-
it "delegates to formatters#add" do
|
1070
|
-
expect(config.formatter_loader).to receive(:add).with('these','options')
|
1071
|
-
config.send(config_method,'these','options')
|
1072
|
-
end
|
1073
|
-
end
|
1074
|
-
end
|
1075
|
-
|
1076
|
-
describe "#formatters" do
|
1077
|
-
it "returns a dup of the formatter_loader formatters" do
|
1078
|
-
config.add_formatter 'doc'
|
1079
|
-
config.formatters.clear
|
1080
|
-
expect(config.formatters).to_not eq []
|
1081
|
-
end
|
1082
|
-
end
|
1083
|
-
|
1084
|
-
describe "#default_formatter" do
|
1085
|
-
it 'defaults to `progress`' do
|
1086
|
-
expect(config.default_formatter).to eq('progress')
|
1087
|
-
end
|
1088
|
-
|
1089
|
-
it 'remembers changes' do
|
1090
|
-
config.default_formatter = 'doc'
|
1091
|
-
expect(config.default_formatter).to eq('doc')
|
1092
|
-
end
|
1093
|
-
|
1094
|
-
context 'when another formatter has been set' do
|
1095
|
-
it 'does not get used' do
|
1096
|
-
config.default_formatter = 'doc'
|
1097
|
-
config.add_formatter 'progress'
|
1098
|
-
|
1099
|
-
expect(used_formatters).to include(an_instance_of Formatters::ProgressFormatter)
|
1100
|
-
expect(used_formatters).not_to include(an_instance_of Formatters::DocumentationFormatter)
|
1101
|
-
end
|
1102
|
-
end
|
1103
|
-
|
1104
|
-
context 'when no other formatter has been set' do
|
1105
|
-
it 'gets used' do
|
1106
|
-
config.default_formatter = 'doc'
|
1107
|
-
|
1108
|
-
expect(used_formatters).not_to include(an_instance_of Formatters::ProgressFormatter)
|
1109
|
-
expect(used_formatters).to include(an_instance_of Formatters::DocumentationFormatter)
|
1110
|
-
end
|
1111
|
-
end
|
1112
|
-
|
1113
|
-
context 'using a legacy formatter as default' do
|
1114
|
-
# Generating warnings during formatter initialisation triggers the
|
1115
|
-
# ProxyReporter code path.
|
1116
|
-
it 'remembers changes' do
|
1117
|
-
legacy_formatter = Class.new
|
1118
|
-
|
1119
|
-
config = RSpec.configuration
|
1120
|
-
config.default_formatter = legacy_formatter
|
1121
|
-
config.reporter
|
1122
|
-
expect(config.default_formatter).to eq(legacy_formatter)
|
1123
|
-
end
|
1124
|
-
end
|
1125
|
-
|
1126
|
-
def used_formatters
|
1127
|
-
config.reporter # to force freezing of formatters
|
1128
|
-
config.formatters
|
1129
|
-
end
|
1130
|
-
end
|
1131
|
-
|
1132
|
-
describe "#filter_run_including" do
|
1133
|
-
it_behaves_like "metadata hash builder" do
|
1134
|
-
def metadata_hash(*args)
|
1135
|
-
config.filter_run_including(*args)
|
1136
|
-
config.inclusion_filter.rules
|
1137
|
-
end
|
1138
|
-
end
|
1139
|
-
|
1140
|
-
include_examples "warning of deprecated `:example_group` during filtering configuration", :filter_run_including
|
1141
|
-
|
1142
|
-
it "sets the filter with a hash" do
|
1143
|
-
config.filter_run_including :foo => true
|
1144
|
-
expect(inclusion_filter).to eq( {:foo => true} )
|
1145
|
-
end
|
1146
|
-
|
1147
|
-
it "sets the filter with a symbol" do
|
1148
|
-
config.filter_run_including :foo
|
1149
|
-
expect(inclusion_filter).to eq( {:foo => true} )
|
1150
|
-
end
|
1151
|
-
|
1152
|
-
it "merges with existing filters" do
|
1153
|
-
config.filter_run_including :foo => true
|
1154
|
-
config.filter_run_including :bar => false
|
1155
|
-
expect(inclusion_filter).to eq( {:foo => true, :bar => false} )
|
1156
|
-
end
|
1157
|
-
end
|
1158
|
-
|
1159
|
-
describe "#filter_run_excluding" do
|
1160
|
-
it_behaves_like "metadata hash builder" do
|
1161
|
-
def metadata_hash(*args)
|
1162
|
-
config.filter_run_excluding(*args)
|
1163
|
-
config.exclusion_filter.rules
|
1164
|
-
end
|
1165
|
-
end
|
1166
|
-
|
1167
|
-
include_examples "warning of deprecated `:example_group` during filtering configuration", :filter_run_excluding
|
1168
|
-
|
1169
|
-
it "sets the filter" do
|
1170
|
-
config.filter_run_excluding :foo => true
|
1171
|
-
expect(exclusion_filter).to eq( {:foo => true} )
|
1172
|
-
end
|
1173
|
-
|
1174
|
-
it "sets the filter using a symbol" do
|
1175
|
-
config.filter_run_excluding :foo
|
1176
|
-
expect(exclusion_filter).to eq( {:foo => true} )
|
1177
|
-
end
|
1178
|
-
|
1179
|
-
it "merges with existing filters" do
|
1180
|
-
config.filter_run_excluding :foo => true
|
1181
|
-
config.filter_run_excluding :bar => false
|
1182
|
-
expect(exclusion_filter).to eq( {:foo => true, :bar => false} )
|
1183
|
-
end
|
1184
|
-
end
|
1185
|
-
|
1186
|
-
shared_examples_for "a spec filter" do |type|
|
1187
|
-
describe "##{type}" do
|
1188
|
-
it "returns {} even if set to nil" do
|
1189
|
-
config.send("#{type}=", nil)
|
1190
|
-
expect(send(type)).to eq({})
|
1191
|
-
end
|
1192
|
-
end
|
1193
|
-
|
1194
|
-
describe "##{type}=" do
|
1195
|
-
it "treats symbols as hash keys with true values when told to" do
|
1196
|
-
config.send("#{type}=", :foo)
|
1197
|
-
expect(send(type)).to eq( {:foo => true} )
|
1198
|
-
end
|
1199
|
-
|
1200
|
-
it "overrides any #{type} set on the command line or in configuration files" do
|
1201
|
-
config.force(type => { :foo => :bar })
|
1202
|
-
config.send("#{type}=", {:want => :this})
|
1203
|
-
expect(send(type)).to eq( {:want => :this} )
|
1204
|
-
end
|
1205
|
-
|
1206
|
-
include_examples "warning of deprecated `:example_group` during filtering configuration", :"#{type}="
|
1207
|
-
end
|
1208
|
-
end
|
1209
|
-
it_behaves_like "a spec filter", :inclusion_filter
|
1210
|
-
it_behaves_like "a spec filter", :exclusion_filter
|
1211
|
-
|
1212
|
-
describe "#treat_symbols_as_metadata_keys_with_true_values=" do
|
1213
|
-
it 'is deprecated' do
|
1214
|
-
expect_deprecation_with_call_site(__FILE__, __LINE__ + 1)
|
1215
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
1216
|
-
end
|
1217
|
-
end
|
1218
|
-
|
1219
|
-
describe "#full_backtrace=" do
|
1220
|
-
it "doesn't impact other instances of config" do
|
1221
|
-
config_1 = Configuration.new
|
1222
|
-
config_2 = Configuration.new
|
1223
|
-
|
1224
|
-
config_1.full_backtrace = true
|
1225
|
-
expect(config_2.full_backtrace?).to be_falsey
|
1226
|
-
end
|
1227
|
-
end
|
1228
|
-
|
1229
|
-
describe "#backtrace_exclusion_patterns=" do
|
1230
|
-
it "actually receives the new filter values" do
|
1231
|
-
config = Configuration.new
|
1232
|
-
config.backtrace_exclusion_patterns = [/.*/]
|
1233
|
-
expect(config.backtrace_formatter.exclude? "this").to be_truthy
|
1234
|
-
end
|
1235
|
-
end
|
1236
|
-
|
1237
|
-
describe 'full_backtrace' do
|
1238
|
-
it 'returns true when backtrace patterns is empty' do
|
1239
|
-
config.backtrace_exclusion_patterns = []
|
1240
|
-
expect(config.full_backtrace?).to eq true
|
1241
|
-
end
|
1242
|
-
|
1243
|
-
it 'returns false when backtrace patterns isnt empty' do
|
1244
|
-
config.backtrace_exclusion_patterns = [:lib]
|
1245
|
-
expect(config.full_backtrace?).to eq false
|
1246
|
-
end
|
1247
|
-
end
|
1248
|
-
|
1249
|
-
describe "#backtrace_exclusion_patterns" do
|
1250
|
-
it "can be appended to" do
|
1251
|
-
config = Configuration.new
|
1252
|
-
config.backtrace_exclusion_patterns << /.*/
|
1253
|
-
expect(config.backtrace_formatter.exclude? "this").to be_truthy
|
1254
|
-
end
|
1255
|
-
end
|
1256
|
-
|
1257
|
-
describe "#filter_gems_from_backtrace" do
|
1258
|
-
def exclude?(line)
|
1259
|
-
config.backtrace_formatter.exclude?(line)
|
1260
|
-
end
|
1261
|
-
|
1262
|
-
it 'filters the named gems from the backtrace' do
|
1263
|
-
line_1 = "/Users/myron/.gem/ruby/2.1.1/gems/foo-1.6.3.1/foo.rb:13"
|
1264
|
-
line_2 = "/Users/myron/.gem/ruby/2.1.1/gems/bar-1.6.3.1/bar.rb:13"
|
1265
|
-
|
1266
|
-
expect {
|
1267
|
-
config.filter_gems_from_backtrace "foo", "bar"
|
1268
|
-
}.to change { exclude?(line_1) }.from(false).to(true).
|
1269
|
-
and change { exclude?(line_2) }.from(false).to(true)
|
1270
|
-
end
|
1271
|
-
end
|
1272
|
-
|
1273
|
-
describe "#libs=" do
|
1274
|
-
it "adds directories to the LOAD_PATH" do
|
1275
|
-
expect($LOAD_PATH).to receive(:unshift).with("a/dir")
|
1276
|
-
config.libs = ["a/dir"]
|
1277
|
-
end
|
1278
|
-
end
|
1279
|
-
|
1280
|
-
describe "libs" do
|
1281
|
-
it 'records paths added to the load path' do
|
1282
|
-
config.libs = ["a/dir"]
|
1283
|
-
expect(config.libs).to eq ["a/dir"]
|
1284
|
-
end
|
1285
|
-
end
|
1286
|
-
|
1287
|
-
describe "#define_derived_metadata" do
|
1288
|
-
include_examples "warning of deprecated `:example_group` during filtering configuration", :define_derived_metadata
|
1289
|
-
|
1290
|
-
it 'allows the provided block to mutate example group metadata' do
|
1291
|
-
RSpec.configuration.define_derived_metadata do |metadata|
|
1292
|
-
metadata[:reverse_description] = metadata[:description].reverse
|
1293
|
-
end
|
1294
|
-
|
1295
|
-
group = RSpec.describe("My group")
|
1296
|
-
expect(group.metadata).to include(:description => "My group", :reverse_description => "puorg yM")
|
1297
|
-
end
|
1298
|
-
|
1299
|
-
it 'allows the provided block to mutate example metadata' do
|
1300
|
-
RSpec.configuration.define_derived_metadata do |metadata|
|
1301
|
-
metadata[:reverse_description] = metadata[:description].reverse
|
1302
|
-
end
|
1303
|
-
|
1304
|
-
ex = RSpec.describe("My group").example("foo")
|
1305
|
-
expect(ex.metadata).to include(:description => "foo", :reverse_description => "oof")
|
1306
|
-
end
|
1307
|
-
|
1308
|
-
it 'allows multiple configured blocks to be applied, in order of definition' do
|
1309
|
-
RSpec.configure do |c|
|
1310
|
-
c.define_derived_metadata { |m| m[:b1_desc] = m[:description] + " (block 1)" }
|
1311
|
-
c.define_derived_metadata { |m| m[:b2_desc] = m[:b1_desc] + " (block 2)" }
|
1312
|
-
end
|
1313
|
-
|
1314
|
-
group = RSpec.describe("bar")
|
1315
|
-
expect(group.metadata).to include(:b1_desc => "bar (block 1)", :b2_desc => "bar (block 1) (block 2)")
|
1316
|
-
end
|
1317
|
-
|
1318
|
-
it "derives metadata before the group or example blocks are eval'd so their logic can depend on the derived metadata" do
|
1319
|
-
RSpec.configure do |c|
|
1320
|
-
c.define_derived_metadata(:foo) do |metadata|
|
1321
|
-
metadata[:bar] = "bar"
|
1322
|
-
end
|
1323
|
-
end
|
1324
|
-
|
1325
|
-
group_bar_value = example_bar_value = nil
|
1326
|
-
|
1327
|
-
RSpec.describe "Group", :foo do
|
1328
|
-
group_bar_value = metadata[:bar]
|
1329
|
-
example_bar_value = example("ex", :foo).metadata[:bar]
|
1330
|
-
end
|
1331
|
-
|
1332
|
-
expect(group_bar_value).to eq("bar")
|
1333
|
-
expect(example_bar_value).to eq("bar")
|
1334
|
-
end
|
1335
|
-
|
1336
|
-
context "when passed a metadata filter" do
|
1337
|
-
it 'only applies to the groups and examples that match that filter' do
|
1338
|
-
RSpec.configure do |c|
|
1339
|
-
c.define_derived_metadata(:apply => true) do |metadata|
|
1340
|
-
metadata[:reverse_description] = metadata[:description].reverse
|
1341
|
-
end
|
1342
|
-
end
|
1343
|
-
|
1344
|
-
g1 = RSpec.describe("G1", :apply)
|
1345
|
-
g2 = RSpec.describe("G2")
|
1346
|
-
e1 = g1.example("E1")
|
1347
|
-
e2 = g2.example("E2", :apply)
|
1348
|
-
e3 = g2.example("E3")
|
1349
|
-
|
1350
|
-
expect(g1.metadata).to include(:reverse_description => "1G")
|
1351
|
-
expect(g2.metadata).not_to include(:reverse_description)
|
1352
|
-
|
1353
|
-
expect(e1.metadata).to include(:reverse_description => "1E")
|
1354
|
-
expect(e2.metadata).to include(:reverse_description => "2E")
|
1355
|
-
expect(e3.metadata).not_to include(:reverse_description)
|
1356
|
-
end
|
1357
|
-
|
1358
|
-
it 'applies if any of multiple filters apply (to align with module inclusion semantics)' do
|
1359
|
-
RSpec.configure do |c|
|
1360
|
-
c.define_derived_metadata(:a => 1, :b => 2) do |metadata|
|
1361
|
-
metadata[:reverse_description] = metadata[:description].reverse
|
1362
|
-
end
|
1363
|
-
end
|
1364
|
-
|
1365
|
-
g1 = RSpec.describe("G1", :a => 1)
|
1366
|
-
g2 = RSpec.describe("G2", :b => 2)
|
1367
|
-
g3 = RSpec.describe("G3", :c => 3)
|
1368
|
-
|
1369
|
-
expect(g1.metadata).to include(:reverse_description => "1G")
|
1370
|
-
expect(g2.metadata).to include(:reverse_description => "2G")
|
1371
|
-
expect(g3.metadata).not_to include(:reverse_description)
|
1372
|
-
end
|
1373
|
-
|
1374
|
-
it 'allows a metadata filter to be passed as a raw symbol' do
|
1375
|
-
RSpec.configure do |c|
|
1376
|
-
c.define_derived_metadata(:apply) do |metadata|
|
1377
|
-
metadata[:reverse_description] = metadata[:description].reverse
|
1378
|
-
end
|
1379
|
-
end
|
1380
|
-
|
1381
|
-
g1 = RSpec.describe("G1", :apply)
|
1382
|
-
g2 = RSpec.describe("G2")
|
1383
|
-
|
1384
|
-
expect(g1.metadata).to include(:reverse_description => "1G")
|
1385
|
-
expect(g2.metadata).not_to include(:reverse_description)
|
1386
|
-
end
|
1387
|
-
end
|
1388
|
-
end
|
1389
|
-
|
1390
|
-
describe "#add_setting" do
|
1391
|
-
describe "with no modifiers" do
|
1392
|
-
context "with no additional options" do
|
1393
|
-
before do
|
1394
|
-
config.add_setting :custom_option
|
1395
|
-
end
|
1396
|
-
|
1397
|
-
it "defaults to nil" do
|
1398
|
-
expect(config.custom_option).to be_nil
|
1399
|
-
end
|
1400
|
-
|
1401
|
-
it "adds a predicate" do
|
1402
|
-
expect(config.custom_option?).to be_falsey
|
1403
|
-
end
|
1404
|
-
|
1405
|
-
it "can be overridden" do
|
1406
|
-
config.custom_option = "a value"
|
1407
|
-
expect(config.custom_option).to eq("a value")
|
1408
|
-
end
|
1409
|
-
end
|
1410
|
-
|
1411
|
-
context "with :default => 'a value'" do
|
1412
|
-
before do
|
1413
|
-
config.add_setting :custom_option, :default => 'a value'
|
1414
|
-
end
|
1415
|
-
|
1416
|
-
it "defaults to 'a value'" do
|
1417
|
-
expect(config.custom_option).to eq("a value")
|
1418
|
-
end
|
1419
|
-
|
1420
|
-
it "returns true for the predicate" do
|
1421
|
-
expect(config.custom_option?).to be_truthy
|
1422
|
-
end
|
1423
|
-
|
1424
|
-
it "can be overridden with a truthy value" do
|
1425
|
-
config.custom_option = "a new value"
|
1426
|
-
expect(config.custom_option).to eq("a new value")
|
1427
|
-
end
|
1428
|
-
|
1429
|
-
it "can be overridden with nil" do
|
1430
|
-
config.custom_option = nil
|
1431
|
-
expect(config.custom_option).to eq(nil)
|
1432
|
-
end
|
1433
|
-
|
1434
|
-
it "can be overridden with false" do
|
1435
|
-
config.custom_option = false
|
1436
|
-
expect(config.custom_option).to eq(false)
|
1437
|
-
end
|
1438
|
-
end
|
1439
|
-
end
|
1440
|
-
|
1441
|
-
context "with :alias_with => " do
|
1442
|
-
before do
|
1443
|
-
config.add_setting :custom_option, :alias_with => :another_custom_option
|
1444
|
-
end
|
1445
|
-
|
1446
|
-
it "delegates the getter to the other option" do
|
1447
|
-
config.another_custom_option = "this value"
|
1448
|
-
expect(config.custom_option).to eq("this value")
|
1449
|
-
end
|
1450
|
-
|
1451
|
-
it "delegates the setter to the other option" do
|
1452
|
-
config.custom_option = "this value"
|
1453
|
-
expect(config.another_custom_option).to eq("this value")
|
1454
|
-
end
|
1455
|
-
|
1456
|
-
it "delegates the predicate to the other option" do
|
1457
|
-
config.custom_option = true
|
1458
|
-
expect(config.another_custom_option?).to be_truthy
|
1459
|
-
end
|
1460
|
-
end
|
1461
|
-
end
|
1462
|
-
|
1463
|
-
describe "#configure_group" do
|
1464
|
-
it "extends with 'extend'" do
|
1465
|
-
mod = Module.new
|
1466
|
-
group = ExampleGroup.describe("group", :foo => :bar)
|
1467
|
-
|
1468
|
-
config.extend(mod, :foo => :bar)
|
1469
|
-
config.configure_group(group)
|
1470
|
-
expect(group).to be_a(mod)
|
1471
|
-
end
|
1472
|
-
|
1473
|
-
it "extends with 'module'" do
|
1474
|
-
mod = Module.new
|
1475
|
-
group = ExampleGroup.describe("group", :foo => :bar)
|
1476
|
-
|
1477
|
-
config.include(mod, :foo => :bar)
|
1478
|
-
config.configure_group(group)
|
1479
|
-
expect(group.included_modules).to include(mod)
|
1480
|
-
end
|
1481
|
-
|
1482
|
-
it "requires only one matching filter" do
|
1483
|
-
mod = Module.new
|
1484
|
-
group = ExampleGroup.describe("group", :foo => :bar)
|
1485
|
-
|
1486
|
-
config.include(mod, :foo => :bar, :baz => :bam)
|
1487
|
-
config.configure_group(group)
|
1488
|
-
expect(group.included_modules).to include(mod)
|
1489
|
-
end
|
1490
|
-
|
1491
|
-
it "includes each one before deciding whether to include the next" do
|
1492
|
-
mod1 = Module.new do
|
1493
|
-
def self.included(host)
|
1494
|
-
host.metadata[:foo] = :bar
|
1495
|
-
end
|
1496
|
-
end
|
1497
|
-
mod2 = Module.new
|
1498
|
-
|
1499
|
-
group = ExampleGroup.describe("group")
|
1500
|
-
|
1501
|
-
config.include(mod1)
|
1502
|
-
config.include(mod2, :foo => :bar)
|
1503
|
-
config.configure_group(group)
|
1504
|
-
expect(group.included_modules).to include(mod1)
|
1505
|
-
expect(group.included_modules).to include(mod2)
|
1506
|
-
end
|
1507
|
-
|
1508
|
-
module IncludeOrExtendMeOnce
|
1509
|
-
def self.included(host)
|
1510
|
-
raise "included again" if host.instance_methods.include?(:foobar)
|
1511
|
-
host.class_exec { def foobar; end }
|
1512
|
-
end
|
1513
|
-
|
1514
|
-
def self.extended(host)
|
1515
|
-
raise "extended again" if host.respond_to?(:foobar)
|
1516
|
-
def host.foobar; end
|
1517
|
-
end
|
1518
|
-
end
|
1519
|
-
|
1520
|
-
it "doesn't include a module when already included in ancestor" do
|
1521
|
-
config.include(IncludeOrExtendMeOnce, :foo => :bar)
|
1522
|
-
|
1523
|
-
group = ExampleGroup.describe("group", :foo => :bar)
|
1524
|
-
child = group.describe("child")
|
1525
|
-
|
1526
|
-
config.configure_group(group)
|
1527
|
-
config.configure_group(child)
|
1528
|
-
end
|
1529
|
-
|
1530
|
-
it "doesn't extend when ancestor is already extended with same module" do
|
1531
|
-
config.extend(IncludeOrExtendMeOnce, :foo => :bar)
|
1532
|
-
|
1533
|
-
group = ExampleGroup.describe("group", :foo => :bar)
|
1534
|
-
child = group.describe("child")
|
1535
|
-
|
1536
|
-
config.configure_group(group)
|
1537
|
-
config.configure_group(child)
|
1538
|
-
end
|
1539
|
-
end
|
1540
|
-
|
1541
|
-
describe "#alias_example_group_to" do
|
1542
|
-
after do
|
1543
|
-
RSpec::Core::DSL.example_group_aliases.delete(:my_group_method)
|
1544
|
-
|
1545
|
-
RSpec.module_exec do
|
1546
|
-
class << self
|
1547
|
-
undef :my_group_method if method_defined? :my_group_method
|
1548
|
-
end
|
1549
|
-
end
|
1550
|
-
|
1551
|
-
RSpec::Core::ExampleGroup.module_exec do
|
1552
|
-
class << self
|
1553
|
-
undef :my_group_method if method_defined? :my_group_method
|
1554
|
-
end
|
1555
|
-
end
|
1556
|
-
end
|
1557
|
-
|
1558
|
-
it_behaves_like "metadata hash builder" do
|
1559
|
-
def metadata_hash(*args)
|
1560
|
-
config.alias_example_group_to :my_group_method, *args
|
1561
|
-
group = ExampleGroup.my_group_method("a group")
|
1562
|
-
group.metadata
|
1563
|
-
end
|
1564
|
-
end
|
1565
|
-
|
1566
|
-
it "allows adding additional metadata" do
|
1567
|
-
config.alias_example_group_to :my_group_method, { :some => "thing" }
|
1568
|
-
group = ExampleGroup.my_group_method("a group", :another => "thing")
|
1569
|
-
expect(group.metadata).to include(:some => "thing", :another => "thing")
|
1570
|
-
end
|
1571
|
-
|
1572
|
-
it "passes `nil` as the description arg when no args are given" do
|
1573
|
-
config.alias_example_group_to :my_group_method, { :some => "thing" }
|
1574
|
-
group = ExampleGroup.my_group_method
|
1575
|
-
|
1576
|
-
expect(group.metadata).to include(
|
1577
|
-
:description_args => [nil],
|
1578
|
-
:description => "",
|
1579
|
-
:some => "thing"
|
1580
|
-
)
|
1581
|
-
end
|
1582
|
-
|
1583
|
-
context 'when the aliased method is used' do
|
1584
|
-
it_behaves_like "metadata hash builder" do
|
1585
|
-
def metadata_hash(*args)
|
1586
|
-
config.alias_example_group_to :my_group_method
|
1587
|
-
group = ExampleGroup.my_group_method("a group", *args)
|
1588
|
-
group.metadata
|
1589
|
-
end
|
1590
|
-
end
|
1591
|
-
end
|
1592
|
-
end
|
1593
|
-
|
1594
|
-
describe "#alias_example_to" do
|
1595
|
-
it_behaves_like "metadata hash builder" do
|
1596
|
-
after do
|
1597
|
-
RSpec::Core::ExampleGroup.module_exec do
|
1598
|
-
class << self
|
1599
|
-
undef :my_example_method if method_defined? :my_example_method
|
1600
|
-
end
|
1601
|
-
end
|
1602
|
-
end
|
1603
|
-
def metadata_hash(*args)
|
1604
|
-
config.alias_example_to :my_example_method, *args
|
1605
|
-
group = ExampleGroup.describe("group")
|
1606
|
-
example = group.my_example_method("description")
|
1607
|
-
example.metadata
|
1608
|
-
end
|
1609
|
-
end
|
1610
|
-
end
|
1611
|
-
|
1612
|
-
describe "#reset" do
|
1613
|
-
it "clears the reporter" do
|
1614
|
-
expect(config.reporter).not_to be_nil
|
1615
|
-
config.reset
|
1616
|
-
expect(config.instance_variable_get("@reporter")).to be_nil
|
1617
|
-
end
|
1618
|
-
|
1619
|
-
it "clears the formatters" do
|
1620
|
-
config.add_formatter "doc"
|
1621
|
-
config.reset
|
1622
|
-
expect(config.formatters).to be_empty
|
1623
|
-
end
|
1624
|
-
end
|
1625
|
-
|
1626
|
-
describe "#force" do
|
1627
|
-
context "for ordering options" do
|
1628
|
-
let(:list) { [1, 2, 3, 4] }
|
1629
|
-
let(:ordering_strategy) { config.ordering_registry.fetch(:global) }
|
1630
|
-
let(:rng) { RSpec::Core::RandomNumberGenerator.new config.seed }
|
1631
|
-
let(:shuffled) { Ordering::Random.new(config).shuffle list, rng }
|
1632
|
-
|
1633
|
-
specify "CLI `--order defined` takes precedence over `config.order = rand`" do
|
1634
|
-
config.force :order => "defined"
|
1635
|
-
config.order = "rand"
|
1636
|
-
|
1637
|
-
expect(ordering_strategy.order(list)).to eq([1, 2, 3, 4])
|
1638
|
-
end
|
1639
|
-
|
1640
|
-
specify "CLI `--order rand:37` takes precedence over `config.order = defined`" do
|
1641
|
-
config.force :order => "rand:37"
|
1642
|
-
config.order = "defined"
|
1643
|
-
|
1644
|
-
expect(ordering_strategy.order(list)).to eq(shuffled)
|
1645
|
-
end
|
1646
|
-
|
1647
|
-
specify "CLI `--seed 37` forces order and seed" do
|
1648
|
-
config.force :seed => 37
|
1649
|
-
config.order = "defined"
|
1650
|
-
config.seed = 145
|
1651
|
-
|
1652
|
-
expect(ordering_strategy.order(list)).to eq(shuffled)
|
1653
|
-
expect(config.seed).to eq(37)
|
1654
|
-
end
|
1655
|
-
|
1656
|
-
specify "CLI `--order defined` takes precedence over `config.register_ordering(:global)`" do
|
1657
|
-
config.force :order => "defined"
|
1658
|
-
config.register_ordering(:global, &:reverse)
|
1659
|
-
expect(ordering_strategy.order(list)).to eq([1, 2, 3, 4])
|
1660
|
-
end
|
1661
|
-
end
|
1662
|
-
|
1663
|
-
it "forces 'false' value" do
|
1664
|
-
config.add_setting :custom_option
|
1665
|
-
config.custom_option = true
|
1666
|
-
expect(config.custom_option?).to be_truthy
|
1667
|
-
config.force :custom_option => false
|
1668
|
-
expect(config.custom_option?).to be_falsey
|
1669
|
-
config.custom_option = true
|
1670
|
-
expect(config.custom_option?).to be_falsey
|
1671
|
-
end
|
1672
|
-
end
|
1673
|
-
|
1674
|
-
describe '#seed' do
|
1675
|
-
it 'returns the seed as an int' do
|
1676
|
-
config.seed = '123'
|
1677
|
-
expect(config.seed).to eq(123)
|
1678
|
-
end
|
1679
|
-
end
|
1680
|
-
|
1681
|
-
describe "#seed_used?" do
|
1682
|
-
def use_seed_on(registry)
|
1683
|
-
registry.fetch(:random).order([1, 2])
|
1684
|
-
end
|
1685
|
-
|
1686
|
-
it 'returns false if neither ordering registry used the seed' do
|
1687
|
-
expect(config.seed_used?).to be false
|
1688
|
-
end
|
1689
|
-
|
1690
|
-
it 'returns true if the ordering registry used the seed' do
|
1691
|
-
use_seed_on(config.ordering_registry)
|
1692
|
-
expect(config.seed_used?).to be true
|
1693
|
-
end
|
1694
|
-
end
|
1695
|
-
|
1696
|
-
describe '#order=' do
|
1697
|
-
context 'given "random"' do
|
1698
|
-
before do
|
1699
|
-
config.seed = 7654
|
1700
|
-
config.order = 'random'
|
1701
|
-
end
|
1702
|
-
|
1703
|
-
it 'does not change the seed' do
|
1704
|
-
expect(config.seed).to eq(7654)
|
1705
|
-
end
|
1706
|
-
|
1707
|
-
it 'sets up random ordering' do
|
1708
|
-
allow(RSpec).to receive_messages(:configuration => config)
|
1709
|
-
global_ordering = config.ordering_registry.fetch(:global)
|
1710
|
-
expect(global_ordering).to be_an_instance_of(Ordering::Random)
|
1711
|
-
end
|
1712
|
-
end
|
1713
|
-
|
1714
|
-
context 'given "random:123"' do
|
1715
|
-
before { config.order = 'random:123' }
|
1716
|
-
|
1717
|
-
it 'sets seed to 123' do
|
1718
|
-
expect(config.seed).to eq(123)
|
1719
|
-
end
|
1720
|
-
|
1721
|
-
it 'sets up random ordering' do
|
1722
|
-
allow(RSpec).to receive_messages(:configuration => config)
|
1723
|
-
global_ordering = config.ordering_registry.fetch(:global)
|
1724
|
-
expect(global_ordering).to be_an_instance_of(Ordering::Random)
|
1725
|
-
end
|
1726
|
-
end
|
1727
|
-
|
1728
|
-
context 'given "defined"' do
|
1729
|
-
before do
|
1730
|
-
config.order = 'rand:123'
|
1731
|
-
config.order = 'defined'
|
1732
|
-
end
|
1733
|
-
|
1734
|
-
it "does not change the seed" do
|
1735
|
-
expect(config.seed).to eq(123)
|
1736
|
-
end
|
1737
|
-
|
1738
|
-
it 'clears the random ordering' do
|
1739
|
-
allow(RSpec).to receive_messages(:configuration => config)
|
1740
|
-
list = [1, 2, 3, 4]
|
1741
|
-
ordering_strategy = config.ordering_registry.fetch(:global)
|
1742
|
-
expect(ordering_strategy.order(list)).to eq([1, 2, 3, 4])
|
1743
|
-
end
|
1744
|
-
end
|
1745
|
-
end
|
1746
|
-
|
1747
|
-
describe "#register_ordering" do
|
1748
|
-
def register_reverse_ordering
|
1749
|
-
config.register_ordering(:reverse, &:reverse)
|
1750
|
-
end
|
1751
|
-
|
1752
|
-
it 'stores the ordering for later use' do
|
1753
|
-
register_reverse_ordering
|
1754
|
-
|
1755
|
-
list = [1, 2, 3]
|
1756
|
-
strategy = config.ordering_registry.fetch(:reverse)
|
1757
|
-
expect(strategy).to be_a(Ordering::Custom)
|
1758
|
-
expect(strategy.order(list)).to eq([3, 2, 1])
|
1759
|
-
end
|
1760
|
-
|
1761
|
-
it 'can register an ordering object' do
|
1762
|
-
strategy = Object.new
|
1763
|
-
def strategy.order(list)
|
1764
|
-
list.reverse
|
1765
|
-
end
|
1766
|
-
|
1767
|
-
config.register_ordering(:reverse, strategy)
|
1768
|
-
list = [1, 2, 3]
|
1769
|
-
fetched = config.ordering_registry.fetch(:reverse)
|
1770
|
-
expect(fetched).to be(strategy)
|
1771
|
-
expect(fetched.order(list)).to eq([3, 2, 1])
|
1772
|
-
end
|
1773
|
-
end
|
1774
|
-
|
1775
|
-
describe '#warnings' do
|
1776
|
-
around do |example|
|
1777
|
-
original_setting = $VERBOSE
|
1778
|
-
example.run
|
1779
|
-
$VERBOSE = original_setting
|
1780
|
-
end
|
1781
|
-
|
1782
|
-
it "sets verbose to true when true" do
|
1783
|
-
config.warnings = true
|
1784
|
-
expect($VERBOSE).to eq true
|
1785
|
-
end
|
1786
|
-
|
1787
|
-
it "sets verbose to false when true" do
|
1788
|
-
config.warnings = false
|
1789
|
-
expect($VERBOSE).to eq false
|
1790
|
-
end
|
1791
|
-
|
1792
|
-
it 'returns the verbosity setting' do
|
1793
|
-
config.warnings = true
|
1794
|
-
expect(config.warnings?).to eq true
|
1795
|
-
|
1796
|
-
config.warnings = false
|
1797
|
-
expect(config.warnings?).to eq false
|
1798
|
-
end
|
1799
|
-
|
1800
|
-
it 'is loaded from config by #force' do
|
1801
|
-
config.force :warnings => true
|
1802
|
-
expect($VERBOSE).to eq true
|
1803
|
-
end
|
1804
|
-
end
|
1805
|
-
|
1806
|
-
describe "#raise_errors_for_deprecations!" do
|
1807
|
-
it 'causes deprecations to raise errors rather than printing to the deprecation stream' do
|
1808
|
-
config.deprecation_stream = stream = StringIO.new
|
1809
|
-
config.raise_errors_for_deprecations!
|
1810
|
-
|
1811
|
-
expect {
|
1812
|
-
config.reporter.deprecation(:deprecated => "foo", :call_site => "foo.rb:1")
|
1813
|
-
}.to raise_error(RSpec::Core::DeprecationError, /foo is deprecated/)
|
1814
|
-
|
1815
|
-
expect(stream.string).to eq("")
|
1816
|
-
end
|
1817
|
-
end
|
1818
|
-
|
1819
|
-
describe "#expose_current_running_example_as" do
|
1820
|
-
before { stub_const(Configuration::ExposeCurrentExample.name, Module.new) }
|
1821
|
-
|
1822
|
-
it 'exposes the current example via the named method' do
|
1823
|
-
RSpec.configuration.expose_current_running_example_as :the_example
|
1824
|
-
RSpec.configuration.expose_current_running_example_as :another_example_helper
|
1825
|
-
|
1826
|
-
value_1 = value_2 = nil
|
1827
|
-
|
1828
|
-
ExampleGroup.describe "Group" do
|
1829
|
-
it "works" do
|
1830
|
-
value_1 = the_example
|
1831
|
-
value_2 = another_example_helper
|
1832
|
-
end
|
1833
|
-
end.run
|
1834
|
-
|
1835
|
-
expect(value_1).to be_an(RSpec::Core::Example)
|
1836
|
-
expect(value_1.description).to eq("works")
|
1837
|
-
expect(value_2).to be(value_1)
|
1838
|
-
end
|
1839
|
-
end
|
1840
|
-
|
1841
|
-
describe '#disable_monkey_patching!' do
|
1842
|
-
let!(:config) { RSpec.configuration }
|
1843
|
-
let!(:expectations) { RSpec::Expectations }
|
1844
|
-
let!(:mocks) { RSpec::Mocks }
|
1845
|
-
|
1846
|
-
def in_fully_monkey_patched_rspec_environment
|
1847
|
-
in_sub_process do
|
1848
|
-
config.expose_dsl_globally = true
|
1849
|
-
mocks.configuration.syntax = [:expect, :should]
|
1850
|
-
mocks.configuration.patch_marshal_to_support_partial_doubles = true
|
1851
|
-
expectations.configuration.syntax = [:expect, :should]
|
1852
|
-
|
1853
|
-
yield
|
1854
|
-
end
|
1855
|
-
end
|
1856
|
-
|
1857
|
-
it 'stops exposing the DSL methods globally' do
|
1858
|
-
in_fully_monkey_patched_rspec_environment do
|
1859
|
-
mod = Module.new
|
1860
|
-
expect {
|
1861
|
-
config.disable_monkey_patching!
|
1862
|
-
}.to change { mod.respond_to?(:describe) }.from(true).to(false)
|
1863
|
-
end
|
1864
|
-
end
|
1865
|
-
|
1866
|
-
it 'stops using should syntax for expectations' do
|
1867
|
-
in_fully_monkey_patched_rspec_environment do
|
1868
|
-
obj = Object.new
|
1869
|
-
config.expect_with :rspec
|
1870
|
-
expect {
|
1871
|
-
config.disable_monkey_patching!
|
1872
|
-
}.to change { obj.respond_to?(:should) }.from(true).to(false)
|
1873
|
-
end
|
1874
|
-
end
|
1875
|
-
|
1876
|
-
it 'stops using should syntax for mocks' do
|
1877
|
-
in_fully_monkey_patched_rspec_environment do
|
1878
|
-
obj = Object.new
|
1879
|
-
config.mock_with :rspec
|
1880
|
-
expect {
|
1881
|
-
config.disable_monkey_patching!
|
1882
|
-
}.to change { obj.respond_to?(:should_receive) }.from(true).to(false)
|
1883
|
-
end
|
1884
|
-
end
|
1885
|
-
|
1886
|
-
it 'stops patching of Marshal' do
|
1887
|
-
in_fully_monkey_patched_rspec_environment do
|
1888
|
-
expect {
|
1889
|
-
config.disable_monkey_patching!
|
1890
|
-
}.to change { Marshal.respond_to?(:dump_with_rspec_mocks) }.from(true).to(false)
|
1891
|
-
end
|
1892
|
-
end
|
1893
|
-
|
1894
|
-
context 'when user did not configure mock framework' do
|
1895
|
-
def emulate_not_configured_mock_framework
|
1896
|
-
in_fully_monkey_patched_rspec_environment do
|
1897
|
-
allow(config).to receive(:rspec_mocks_loaded?).and_return(false, true)
|
1898
|
-
config.instance_variable_set :@mock_framework, nil
|
1899
|
-
ExampleGroup.send :remove_class_variable, :@@example_groups_configured
|
1900
|
-
|
1901
|
-
yield
|
1902
|
-
end
|
1903
|
-
end
|
1904
|
-
|
1905
|
-
it 'disables monkey patching after example groups being configured' do
|
1906
|
-
emulate_not_configured_mock_framework do
|
1907
|
-
obj = Object.new
|
1908
|
-
config.disable_monkey_patching!
|
1909
|
-
|
1910
|
-
expect {
|
1911
|
-
ExampleGroup.ensure_example_groups_are_configured
|
1912
|
-
}.to change { obj.respond_to?(:should_receive) }.from(true).to(false)
|
1913
|
-
end
|
1914
|
-
end
|
1915
|
-
end
|
1916
|
-
|
1917
|
-
context 'when user did not configure expectation framework' do
|
1918
|
-
def emulate_not_configured_expectation_framework
|
1919
|
-
in_fully_monkey_patched_rspec_environment do
|
1920
|
-
allow(config).to receive(:rspec_expectations_loaded?).and_return(false, true)
|
1921
|
-
config.instance_variable_set :@expectation_frameworks, []
|
1922
|
-
ExampleGroup.send :remove_class_variable, :@@example_groups_configured
|
1923
|
-
|
1924
|
-
yield
|
1925
|
-
end
|
1926
|
-
end
|
1927
|
-
|
1928
|
-
it 'disables monkey patching after example groups being configured' do
|
1929
|
-
emulate_not_configured_expectation_framework do
|
1930
|
-
obj = Object.new
|
1931
|
-
config.disable_monkey_patching!
|
1932
|
-
|
1933
|
-
expect {
|
1934
|
-
ExampleGroup.ensure_example_groups_are_configured
|
1935
|
-
}.to change { obj.respond_to?(:should) }.from(true).to(false)
|
1936
|
-
end
|
1937
|
-
end
|
1938
|
-
end
|
1939
|
-
end
|
1940
|
-
|
1941
|
-
describe 'recording spec start time (for measuring load)' do
|
1942
|
-
it 'returns a time' do
|
1943
|
-
expect(config.start_time).to be_an_instance_of ::Time
|
1944
|
-
end
|
1945
|
-
|
1946
|
-
it 'is configurable' do
|
1947
|
-
config.start_time = 42
|
1948
|
-
expect(config.start_time).to eq 42
|
1949
|
-
end
|
1950
|
-
end
|
1951
|
-
|
1952
|
-
describe "hooks" do
|
1953
|
-
include_examples "warning of deprecated `:example_group` during filtering configuration", :before, :each
|
1954
|
-
end
|
1955
|
-
|
1956
|
-
# assigns files_or_directories_to_run and triggers post-processing
|
1957
|
-
# via `files_to_run`.
|
1958
|
-
def assign_files_or_directories_to_run(*value)
|
1959
|
-
config.files_or_directories_to_run = value
|
1960
|
-
config.files_to_run
|
1961
|
-
end
|
1962
|
-
end
|
1963
|
-
end
|