sublimetheme 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +230 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/sublimetheme.rb +6832 -0
- data/lib/sublimetheme/version.rb +3 -0
- data/path/bin/htmldiff +25 -0
- data/path/bin/htmldiff.bat +6 -0
- data/path/bin/ldiff +25 -0
- data/path/bin/ldiff.bat +6 -0
- data/path/bin/rspec +23 -0
- data/path/bin/rspec.bat +6 -0
- data/path/cache/diff-lcs-1.2.5.gem +0 -0
- data/path/cache/rspec-3.3.0.gem +0 -0
- data/path/cache/rspec-core-3.3.2.gem +0 -0
- data/path/cache/rspec-expectations-3.3.1.gem +0 -0
- data/path/cache/rspec-mocks-3.3.2.gem +0 -0
- data/path/cache/rspec-support-3.3.0.gem +0 -0
- data/path/gems/diff-lcs-1.2.5/.autotest +3 -0
- data/path/gems/diff-lcs-1.2.5/.gemtest +0 -0
- data/path/gems/diff-lcs-1.2.5/.hoerc +2 -0
- data/path/gems/diff-lcs-1.2.5/.rspec +2 -0
- data/path/gems/diff-lcs-1.2.5/.travis.yml +22 -0
- data/path/gems/diff-lcs-1.2.5/Contributing.rdoc +64 -0
- data/path/gems/diff-lcs-1.2.5/Gemfile +20 -0
- data/path/gems/diff-lcs-1.2.5/History.rdoc +152 -0
- data/path/gems/diff-lcs-1.2.5/License.rdoc +39 -0
- data/path/gems/diff-lcs-1.2.5/Manifest.txt +38 -0
- data/path/gems/diff-lcs-1.2.5/README.rdoc +85 -0
- data/path/gems/diff-lcs-1.2.5/Rakefile +41 -0
- data/path/gems/diff-lcs-1.2.5/autotest/discover.rb +1 -0
- data/path/gems/diff-lcs-1.2.5/bin/htmldiff +32 -0
- data/path/gems/diff-lcs-1.2.5/bin/ldiff +6 -0
- data/path/gems/diff-lcs-1.2.5/docs/COPYING.txt +339 -0
- data/path/gems/diff-lcs-1.2.5/docs/artistic.txt +127 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff-lcs.rb +3 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs.rb +805 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/array.rb +7 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/block.rb +37 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/callbacks.rb +322 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/change.rb +177 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/htmldiff.rb +149 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/hunk.rb +276 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/internals.rb +301 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/ldiff.rb +195 -0
- data/path/gems/diff-lcs-1.2.5/lib/diff/lcs/string.rb +5 -0
- data/path/gems/diff-lcs-1.2.5/spec/change_spec.rb +65 -0
- data/path/gems/diff-lcs-1.2.5/spec/diff_spec.rb +47 -0
- data/path/gems/diff-lcs-1.2.5/spec/hunk_spec.rb +72 -0
- data/path/gems/diff-lcs-1.2.5/spec/issues_spec.rb +24 -0
- data/path/gems/diff-lcs-1.2.5/spec/lcs_spec.rb +54 -0
- data/path/gems/diff-lcs-1.2.5/spec/patch_spec.rb +414 -0
- data/path/gems/diff-lcs-1.2.5/spec/sdiff_spec.rb +214 -0
- data/path/gems/diff-lcs-1.2.5/spec/spec_helper.rb +290 -0
- data/path/gems/diff-lcs-1.2.5/spec/traverse_balanced_spec.rb +310 -0
- data/path/gems/diff-lcs-1.2.5/spec/traverse_sequences_spec.rb +139 -0
- data/path/gems/rspec-3.3.0/License.txt +24 -0
- data/path/gems/rspec-3.3.0/README.md +34 -0
- data/path/gems/rspec-3.3.0/lib/rspec.rb +3 -0
- data/path/gems/rspec-3.3.0/lib/rspec/version.rb +5 -0
- data/path/gems/rspec-core-3.3.2/.document +5 -0
- data/path/gems/rspec-core-3.3.2/.yardopts +8 -0
- data/path/gems/rspec-core-3.3.2/Changelog.md +1856 -0
- data/path/gems/rspec-core-3.3.2/License.txt +25 -0
- data/path/gems/rspec-core-3.3.2/README.md +369 -0
- data/path/gems/rspec-core-3.3.2/exe/rspec +4 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/autorun.rb +3 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core.rb +181 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/backtrace_formatter.rb +64 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/coordinator.rb +66 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/example_minimizer.rb +130 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/runner.rb +139 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/server.rb +61 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/bisect/subset_enumerator.rb +39 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration.rb +1807 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/configuration_options.rb +191 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/drb.rb +111 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/dsl.rb +96 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/example.rb +573 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_group.rb +796 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/example_status_persister.rb +235 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/filter_manager.rb +231 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/flat_map.rb +20 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters.rb +254 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_formatter.rb +70 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/base_text_formatter.rb +77 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_formatter.rb +68 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/bisect_progress_formatter.rb +115 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/console_codes.rb +65 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/deprecation_formatter.rb +223 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/documentation_formatter.rb +70 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/exception_presenter.rb +393 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/fallback_message_formatter.rb +28 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/helpers.rb +109 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_formatter.rb +151 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/html_printer.rb +415 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/json_formatter.rb +96 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/profile_formatter.rb +68 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/progress_formatter.rb +28 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/protocol.rb +172 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/formatters/snippet_extractor.rb +116 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/hooks.rb +638 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/memoized_helpers.rb +532 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata.rb +490 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/metadata_filter.rb +235 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/minitest_assertions_adapter.rb +31 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/flexmock.rb +31 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/mocha.rb +57 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/null.rb +14 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rr.rb +31 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mocking_adapters/rspec.rb +32 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/mutex.rb +63 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/notifications.rb +498 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/option_parser.rb +301 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/ordering.rb +158 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/pending.rb +165 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/profiler.rb +32 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer.rb +48 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/.rspec +2 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/project_initializer/spec/spec_helper.rb +96 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/rake_task.rb +158 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/reentrant_mutex.rb +52 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/reporter.rb +220 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/ruby_project.rb +53 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/runner.rb +179 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/sandbox.rb +37 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/set.rb +49 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_context.rb +55 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/shared_example_group.rb +210 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/shell_escape.rb +49 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/test_unit_assertions_adapter.rb +30 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/version.rb +9 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/warnings.rb +40 -0
- data/path/gems/rspec-core-3.3.2/lib/rspec/core/world.rb +178 -0
- data/path/gems/rspec-expectations-3.3.1/.document +5 -0
- data/path/gems/rspec-expectations-3.3.1/.yardopts +6 -0
- data/path/gems/rspec-expectations-3.3.1/Changelog.md +953 -0
- data/path/gems/rspec-expectations-3.3.1/License.txt +24 -0
- data/path/gems/rspec-expectations-3.3.1/README.md +289 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations.rb +81 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/configuration.rb +164 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/expectation_target.rb +113 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/fail_with.rb +31 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/failure_aggregator.rb +194 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/handler.rb +170 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/minitest_integration.rb +31 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/syntax.rb +132 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/expectations/version.rb +8 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers.rb +1009 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/aliased_matcher.rb +116 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in.rb +52 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/all.rb +85 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/base_matcher.rb +181 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be.rb +285 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_between.rb +77 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_instance_of.rb +22 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_kind_of.rb +16 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/be_within.rb +72 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/change.rb +337 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/compound.rb +293 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/contain_exactly.rb +253 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/cover.rb +24 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eq.rb +40 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/eql.rb +34 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/equal.rb +81 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/exist.rb +86 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/has.rb +103 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/have_attributes.rb +114 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/include.rb +130 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/match.rb +37 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/operators.rb +128 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/output.rb +200 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/raise_error.rb +216 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/respond_to.rb +90 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/satisfy.rb +37 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/start_or_end_with.rb +94 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/throw_symbol.rb +132 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/built_in/yield.rb +418 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/composable.rb +184 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/dsl.rb +453 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/english_phrasing.rb +42 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/expecteds_for_multiple_diffs.rb +73 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/fail_matchers.rb +42 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/generated_descriptions.rb +42 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_delegator.rb +35 -0
- data/path/gems/rspec-expectations-3.3.1/lib/rspec/matchers/matcher_protocol.rb +99 -0
- data/path/gems/rspec-mocks-3.3.2/.document +5 -0
- data/path/gems/rspec-mocks-3.3.2/.yardopts +6 -0
- data/path/gems/rspec-mocks-3.3.2/Changelog.md +965 -0
- data/path/gems/rspec-mocks-3.3.2/License.txt +24 -0
- data/path/gems/rspec-mocks-3.3.2/README.md +430 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks.rb +126 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance.rb +11 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/chain.rb +110 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/error_generator.rb +31 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expect_chain_chain.rb +35 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/expectation_chain.rb +48 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/message_chains.rb +83 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/proxy.rb +116 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/recorder.rb +264 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain.rb +46 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/any_instance/stub_chain_chain.rb +27 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_list_matcher.rb +100 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/argument_matchers.rb +320 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/configuration.rb +188 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/error_generator.rb +362 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/example_methods.rb +421 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/instance_method_stasher.rb +135 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/marshal_extension.rb +41 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/expectation_customization.rb +20 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/have_received.rb +116 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive.rb +130 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_message_chain.rb +80 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/matchers/receive_messages.rb +75 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_chain.rb +87 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/message_expectation.rb +717 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_double.rb +287 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/method_reference.rb +192 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutate_const.rb +335 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/mutex.rb +73 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/object_reference.rb +149 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/order_group.rb +81 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/proxy.rb +439 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/reentrant_mutex.rb +53 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/space.rb +238 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/standalone.rb +3 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/syntax.rb +325 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/targets.rb +97 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/test_double.rb +170 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_double.rb +129 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_message_expecation.rb +54 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/verifying_proxy.rb +213 -0
- data/path/gems/rspec-mocks-3.3.2/lib/rspec/mocks/version.rb +9 -0
- data/path/gems/rspec-support-3.3.0/Changelog.md +125 -0
- data/path/gems/rspec-support-3.3.0/LICENSE.txt +22 -0
- data/path/gems/rspec-support-3.3.0/README.md +26 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support.rb +111 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/caller_filter.rb +83 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/differ.rb +215 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/directory_maker.rb +63 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/encoded_string.rb +155 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/fuzzy_matcher.rb +48 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/hunk_generator.rb +47 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/matcher_definition.rb +42 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/method_signature_verifier.rb +273 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/object_formatter.rb +93 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/recursive_const_methods.rb +76 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/ruby_features.rb +118 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec.rb +81 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/deprecation_helpers.rb +64 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/formatting_support.rb +9 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/in_sub_process.rb +52 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/library_wide_checks.rb +145 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/shell_out.rb +71 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/stderr_splitter.rb +63 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/string_matcher.rb +46 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_directory.rb +9 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/spec/with_isolated_stderr.rb +13 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/version.rb +7 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/version_checker.rb +53 -0
- data/path/gems/rspec-support-3.3.0/lib/rspec/support/warnings.rb +39 -0
- data/path/specifications/diff-lcs-1.2.5.gemspec +68 -0
- data/path/specifications/rspec-3.3.0.gemspec +42 -0
- data/path/specifications/rspec-core-3.3.2.gemspec +68 -0
- data/path/specifications/rspec-expectations-3.3.1.gemspec +50 -0
- data/path/specifications/rspec-mocks-3.3.2.gemspec +53 -0
- data/path/specifications/rspec-support-3.3.0.gemspec +38 -0
- data/sublimetheme.gemspec +32 -0
- metadata +363 -0
@@ -0,0 +1,213 @@
|
|
1
|
+
RSpec::Support.require_rspec_mocks 'verifying_message_expecation'
|
2
|
+
RSpec::Support.require_rspec_mocks 'method_reference'
|
3
|
+
|
4
|
+
module RSpec
|
5
|
+
module Mocks
|
6
|
+
# @private
|
7
|
+
class CallbackInvocationStrategy
|
8
|
+
def call(doubled_module)
|
9
|
+
RSpec::Mocks.configuration.verifying_double_callbacks.each do |block|
|
10
|
+
block.call doubled_module
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# @private
|
16
|
+
class NoCallbackInvocationStrategy
|
17
|
+
def call(_doubled_module)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# @private
|
22
|
+
module VerifyingProxyMethods
|
23
|
+
def add_stub(method_name, opts={}, &implementation)
|
24
|
+
ensure_implemented(method_name)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_simple_stub(method_name, *args)
|
29
|
+
ensure_implemented(method_name)
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_message_expectation(method_name, opts={}, &block)
|
34
|
+
ensure_implemented(method_name)
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
def ensure_implemented(method_name)
|
39
|
+
return unless method_reference[method_name].unimplemented?
|
40
|
+
|
41
|
+
@error_generator.raise_unimplemented_error(
|
42
|
+
@doubled_module,
|
43
|
+
method_name,
|
44
|
+
@object
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def ensure_publicly_implemented(method_name, _object)
|
49
|
+
ensure_implemented(method_name)
|
50
|
+
visibility = method_reference[method_name].visibility
|
51
|
+
|
52
|
+
return if visibility == :public
|
53
|
+
@error_generator.raise_non_public_error(method_name, visibility)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# A verifying proxy mostly acts like a normal proxy, except that it
|
58
|
+
# contains extra logic to try and determine the validity of any expectation
|
59
|
+
# set on it. This includes whether or not methods have been defined and the
|
60
|
+
# validatiy of arguments on method calls.
|
61
|
+
#
|
62
|
+
# In all other ways this behaves like a normal proxy. It only adds the
|
63
|
+
# verification behaviour to specific methods then delegates to the parent
|
64
|
+
# implementation.
|
65
|
+
#
|
66
|
+
# These checks are only activated if the doubled class has already been
|
67
|
+
# loaded, otherwise they are disabled. This allows for testing in
|
68
|
+
# isolation.
|
69
|
+
#
|
70
|
+
# @private
|
71
|
+
class VerifyingProxy < TestDoubleProxy
|
72
|
+
include VerifyingProxyMethods
|
73
|
+
|
74
|
+
def initialize(object, order_group, doubled_module, method_reference_class)
|
75
|
+
super(object, order_group)
|
76
|
+
@object = object
|
77
|
+
@doubled_module = doubled_module
|
78
|
+
@method_reference_class = method_reference_class
|
79
|
+
|
80
|
+
# A custom method double is required to pass through a way to lookup
|
81
|
+
# methods to determine their parameters. This is only relevant if the doubled
|
82
|
+
# class is loaded.
|
83
|
+
@method_doubles = Hash.new do |h, k|
|
84
|
+
h[k] = VerifyingMethodDouble.new(@object, k, self, method_reference[k])
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def method_reference
|
89
|
+
@method_reference ||= Hash.new do |h, k|
|
90
|
+
h[k] = @method_reference_class.for(@doubled_module, k)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def visibility_for(method_name)
|
95
|
+
method_reference[method_name].visibility
|
96
|
+
end
|
97
|
+
|
98
|
+
def validate_arguments!(method_name, args)
|
99
|
+
@method_doubles[method_name].validate_arguments!(args)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# @private
|
104
|
+
DEFAULT_CALLBACK_INVOCATION_STRATEGY = CallbackInvocationStrategy.new
|
105
|
+
|
106
|
+
# @private
|
107
|
+
class VerifyingPartialDoubleProxy < PartialDoubleProxy
|
108
|
+
include VerifyingProxyMethods
|
109
|
+
|
110
|
+
def initialize(object, expectation_ordering, optional_callback_invocation_strategy=DEFAULT_CALLBACK_INVOCATION_STRATEGY)
|
111
|
+
super(object, expectation_ordering)
|
112
|
+
@doubled_module = DirectObjectReference.new(object)
|
113
|
+
|
114
|
+
# A custom method double is required to pass through a way to lookup
|
115
|
+
# methods to determine their parameters.
|
116
|
+
@method_doubles = Hash.new do |h, k|
|
117
|
+
h[k] = VerifyingExistingMethodDouble.for(object, k, self)
|
118
|
+
end
|
119
|
+
|
120
|
+
optional_callback_invocation_strategy.call(@doubled_module)
|
121
|
+
end
|
122
|
+
|
123
|
+
def method_reference
|
124
|
+
@method_doubles
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# @private
|
129
|
+
class VerifyingPartialClassDoubleProxy < VerifyingPartialDoubleProxy
|
130
|
+
include PartialClassDoubleProxyMethods
|
131
|
+
end
|
132
|
+
|
133
|
+
# @private
|
134
|
+
class VerifyingMethodDouble < MethodDouble
|
135
|
+
def initialize(object, method_name, proxy, method_reference)
|
136
|
+
super(object, method_name, proxy)
|
137
|
+
@method_reference = method_reference
|
138
|
+
end
|
139
|
+
|
140
|
+
def message_expectation_class
|
141
|
+
VerifyingMessageExpectation
|
142
|
+
end
|
143
|
+
|
144
|
+
def add_expectation(*args, &block)
|
145
|
+
# explict params necessary for 1.8.7 see #626
|
146
|
+
super(*args, &block).tap { |x| x.method_reference = @method_reference }
|
147
|
+
end
|
148
|
+
|
149
|
+
def add_stub(*args, &block)
|
150
|
+
# explict params necessary for 1.8.7 see #626
|
151
|
+
super(*args, &block).tap { |x| x.method_reference = @method_reference }
|
152
|
+
end
|
153
|
+
|
154
|
+
def proxy_method_invoked(obj, *args, &block)
|
155
|
+
validate_arguments!(args)
|
156
|
+
super
|
157
|
+
end
|
158
|
+
|
159
|
+
def validate_arguments!(actual_args)
|
160
|
+
@method_reference.with_signature do |signature|
|
161
|
+
verifier = Support::StrictSignatureVerifier.new(signature, actual_args)
|
162
|
+
raise ArgumentError, verifier.error_message unless verifier.valid?
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
# A VerifyingMethodDouble fetches the method to verify against from the
|
168
|
+
# original object, using a MethodReference. This works for pure doubles,
|
169
|
+
# but when the original object is itself the one being modified we need to
|
170
|
+
# collapse the reference and the method double into a single object so that
|
171
|
+
# we can access the original pristine method definition.
|
172
|
+
#
|
173
|
+
# @private
|
174
|
+
class VerifyingExistingMethodDouble < VerifyingMethodDouble
|
175
|
+
def initialize(object, method_name, proxy)
|
176
|
+
super(object, method_name, proxy, self)
|
177
|
+
|
178
|
+
@valid_method = object.respond_to?(method_name, true)
|
179
|
+
|
180
|
+
# Trigger an eager find of the original method since if we find it any
|
181
|
+
# later we end up getting a stubbed method with incorrect arity.
|
182
|
+
save_original_implementation_callable!
|
183
|
+
end
|
184
|
+
|
185
|
+
def with_signature
|
186
|
+
yield Support::MethodSignature.new(original_implementation_callable)
|
187
|
+
end
|
188
|
+
|
189
|
+
def unimplemented?
|
190
|
+
!@valid_method
|
191
|
+
end
|
192
|
+
|
193
|
+
def self.for(object, method_name, proxy)
|
194
|
+
if ClassNewMethodReference.applies_to?(method_name) { object }
|
195
|
+
VerifyingExistingClassNewMethodDouble
|
196
|
+
else
|
197
|
+
self
|
198
|
+
end.new(object, method_name, proxy)
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Used in place of a `VerifyingExistingMethodDouble` for the specific case
|
203
|
+
# of mocking or stubbing a `new` method on a class. In this case, we substitute
|
204
|
+
# the method signature from `#initialize` since new's signature is just `*args`.
|
205
|
+
#
|
206
|
+
# @private
|
207
|
+
class VerifyingExistingClassNewMethodDouble < VerifyingExistingMethodDouble
|
208
|
+
def with_signature
|
209
|
+
yield Support::MethodSignature.new(object.instance_method(:initialize))
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
### 3.3.0 / 2015-06-12
|
2
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.2.2...v3.3.0)
|
3
|
+
|
4
|
+
Enhancements:
|
5
|
+
|
6
|
+
* Improve formatting of arrays and hashes in failure messages so they
|
7
|
+
use our custom formatting of matchers, time objects, etc.
|
8
|
+
(Myron Marston, Nicholas Chmielewski, #205)
|
9
|
+
* Use improved formatting for diffs as well. (Nicholas Chmielewski, #205)
|
10
|
+
|
11
|
+
Bug Fixes:
|
12
|
+
|
13
|
+
* Fix `FuzzyMatcher` so that it checks `expected == actual` rather than
|
14
|
+
`actual == expected`, which avoids errors in situations where the
|
15
|
+
`actual` object's `==` is improperly implemented to assume that only
|
16
|
+
objects of the same type will be given. This allows rspec-mocks'
|
17
|
+
`anything` to match against objects with buggy `==` definitions.
|
18
|
+
(Myron Marston, #193)
|
19
|
+
|
20
|
+
### 3.2.2 / 2015-02-23
|
21
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.2.1...v3.2.2)
|
22
|
+
|
23
|
+
Bug Fixes:
|
24
|
+
|
25
|
+
* Fix an encoding issue with `EncodedString#split` when encountering an
|
26
|
+
invalid byte string. (Benjamin Fleischer, #1760)
|
27
|
+
|
28
|
+
### 3.2.1 / 2015-02-04
|
29
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.2.0...v3.2.1)
|
30
|
+
|
31
|
+
Bug Fixes:
|
32
|
+
|
33
|
+
* Fix `RSpec::CallerFilter` to work on Rubinius 2.2.
|
34
|
+
(Myron Marston, #169)
|
35
|
+
|
36
|
+
### 3.2.0 / 2015-02-03
|
37
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.1.2...v3.2.0)
|
38
|
+
|
39
|
+
Enhancements:
|
40
|
+
|
41
|
+
* Add extra Ruby type detection. (Jon Rowe, #133)
|
42
|
+
* Make differ instance re-usable. (Alexey Fedorov, #160)
|
43
|
+
|
44
|
+
Bug Fixes:
|
45
|
+
|
46
|
+
* Do not consider `[]` and `{}` to match when performing fuzzy matching.
|
47
|
+
(Myron Marston, #157)
|
48
|
+
|
49
|
+
### 3.1.2 / 2014-10-08
|
50
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.1.1...v3.1.2)
|
51
|
+
|
52
|
+
Bug Fixes:
|
53
|
+
|
54
|
+
* Fix method signature to not blow up with a `NoMethodError` on 1.8.7 when
|
55
|
+
verifying against an RSpec matcher. (Myron Marston, #116)
|
56
|
+
|
57
|
+
### 3.1.1 / 2014-09-26
|
58
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.1.0...v3.1.1)
|
59
|
+
|
60
|
+
Bug Fixes:
|
61
|
+
|
62
|
+
* Fix `RSpec::Support::DirectoryMaker` (used by `rspec --init` and
|
63
|
+
`rails generate rspec:install`) so that it detects absolute paths
|
64
|
+
on Windows properly. (Scott Archer, #107, #108, #109) (Jon Rowe, #110)
|
65
|
+
|
66
|
+
### 3.1.0 / 2014-09-04
|
67
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.4...v3.1.0)
|
68
|
+
|
69
|
+
Bug Fixes:
|
70
|
+
|
71
|
+
* Fix `FuzzyMatcher` so that it does not wrongly match a struct against
|
72
|
+
an array. (Myron Marston, #97)
|
73
|
+
* Prevent infinitely recursing `#flatten` methods from causing the differ
|
74
|
+
to hang. (Jon Rowe, #101)
|
75
|
+
|
76
|
+
### 3.0.4 / 2014-08-14
|
77
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.3...v3.0.4)
|
78
|
+
|
79
|
+
Bug Fixes:
|
80
|
+
|
81
|
+
* Fix `FuzzyMatcher` so that it does not silence `ArgumentError` raised
|
82
|
+
from broken implementations of `==`. (Myron Marston, #94)
|
83
|
+
|
84
|
+
### 3.0.3 / 2014-07-21
|
85
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.2...v3.0.3)
|
86
|
+
|
87
|
+
Bug Fixes:
|
88
|
+
|
89
|
+
* Fix regression in `Support#method_handle_for` where proxy objects
|
90
|
+
with method delegated would wrongly not return a method handle.
|
91
|
+
(Jon Rowe, #90)
|
92
|
+
* Properly detect Module#prepend support in Ruby 2.1+ (Ben Langfeld, #91)
|
93
|
+
* Fix `rspec/support/warnings.rb` so it can be loaded and used in
|
94
|
+
isolation. (Myron Marston, #93)
|
95
|
+
|
96
|
+
### 3.0.2 / 2014-06-20
|
97
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.1...v3.0.2)
|
98
|
+
|
99
|
+
* Revert `BlockSignature` change from 3.0.1 because of a ruby bug that
|
100
|
+
caused it to change the block's behavior (https://bugs.ruby-lang.org/issues/9967).
|
101
|
+
(Myron Marston, rspec-mocks#721)
|
102
|
+
|
103
|
+
### 3.0.1 / 2014-06-19
|
104
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.0...v3.0.1)
|
105
|
+
|
106
|
+
* Fix `BlockSignature` so that it correctly differentiates between
|
107
|
+
required and optional block args. (Myron Marston, rspec-mocks#714)
|
108
|
+
|
109
|
+
### 3.0.0 / 2014-06-01
|
110
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.0.rc1...v3.0.0)
|
111
|
+
|
112
|
+
### 3.0.0.rc1 / 2014-05-18
|
113
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.0.beta2...v3.0.0.rc1)
|
114
|
+
|
115
|
+
### 3.0.0.beta2 / 2014-02-17
|
116
|
+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.0.0.beta1...v3.0.0.beta2)
|
117
|
+
|
118
|
+
Bug Fixes:
|
119
|
+
|
120
|
+
* Issue message when :replacement is passed to `RSpec.warn_with`. (Jon Rowe)
|
121
|
+
|
122
|
+
### 3.0.0.beta1 / 2013-11-07
|
123
|
+
[Full Changelog](https://github.com/rspec/rspec-support/compare/0dc12d1bdbbacc757a9989f8c09cd08ef3a4837e...v3.0.0.beta1)
|
124
|
+
|
125
|
+
Initial release.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 David Chelimsky, Myron Marston, Jon Rowe, Sam Phippen, Xavier Shay, Bradley Schaefer
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# RSpec::Support
|
2
|
+
|
3
|
+
`RSpec::Support` provides common functionality to `RSpec::Core`,
|
4
|
+
`RSpec::Expectations` and `RSpec::Mocks`. It is considered
|
5
|
+
suitable for internal use only at this time.
|
6
|
+
|
7
|
+
## Installation / Usage
|
8
|
+
|
9
|
+
Install one or more of the `RSpec` gems.
|
10
|
+
|
11
|
+
Want to run against the `master` branch? You'll need to include the dependent
|
12
|
+
RSpec repos as well. Add the following to your `Gemfile`:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
%w[rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
|
16
|
+
gem lib, :git => "git://github.com/rspec/#{lib}.git", :branch => 'master'
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
## Contributing
|
21
|
+
|
22
|
+
1. Fork it
|
23
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
24
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
25
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
26
|
+
5. Create new Pull Request
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Support
|
3
|
+
# @api private
|
4
|
+
#
|
5
|
+
# Defines a helper method that is optimized to require files from the
|
6
|
+
# named lib. The passed block MUST be `{ |f| require_relative f }`
|
7
|
+
# because for `require_relative` to work properly from within the named
|
8
|
+
# lib the line of code must be IN that lib.
|
9
|
+
#
|
10
|
+
# `require_relative` is preferred when available because it is always O(1),
|
11
|
+
# regardless of the number of dirs in $LOAD_PATH. `require`, on the other
|
12
|
+
# hand, does a linear O(N) search over the dirs in the $LOAD_PATH until
|
13
|
+
# it can resolve the file relative to one of the dirs.
|
14
|
+
def self.define_optimized_require_for_rspec(lib, &require_relative)
|
15
|
+
name = "require_rspec_#{lib}"
|
16
|
+
|
17
|
+
if Kernel.respond_to?(:require_relative)
|
18
|
+
(class << self; self; end).__send__(:define_method, name) do |f|
|
19
|
+
require_relative.call("#{lib}/#{f}")
|
20
|
+
end
|
21
|
+
else
|
22
|
+
(class << self; self; end).__send__(:define_method, name) do |f|
|
23
|
+
require "rspec/#{lib}/#{f}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
define_optimized_require_for_rspec(:support) { |f| require_relative(f) }
|
29
|
+
require_rspec_support "version"
|
30
|
+
require_rspec_support "ruby_features"
|
31
|
+
|
32
|
+
# @api private
|
33
|
+
KERNEL_METHOD_METHOD = ::Kernel.instance_method(:method)
|
34
|
+
|
35
|
+
# @api private
|
36
|
+
#
|
37
|
+
# Used internally to get a method handle for a particular object
|
38
|
+
# and method name.
|
39
|
+
#
|
40
|
+
# Includes handling for a few special cases:
|
41
|
+
#
|
42
|
+
# - Objects that redefine #method (e.g. an HTTPRequest struct)
|
43
|
+
# - BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)
|
44
|
+
# - Objects that undefine method and delegate everything to another
|
45
|
+
# object (e.g. Mongoid association objects)
|
46
|
+
if RubyFeatures.supports_rebinding_module_methods?
|
47
|
+
def self.method_handle_for(object, method_name)
|
48
|
+
KERNEL_METHOD_METHOD.bind(object).call(method_name)
|
49
|
+
rescue NameError => original
|
50
|
+
begin
|
51
|
+
handle = object.method(method_name)
|
52
|
+
raise original unless handle.is_a? Method
|
53
|
+
handle
|
54
|
+
rescue Exception
|
55
|
+
raise original
|
56
|
+
end
|
57
|
+
end
|
58
|
+
else
|
59
|
+
def self.method_handle_for(object, method_name)
|
60
|
+
if ::Kernel === object
|
61
|
+
KERNEL_METHOD_METHOD.bind(object).call(method_name)
|
62
|
+
else
|
63
|
+
object.method(method_name)
|
64
|
+
end
|
65
|
+
rescue NameError => original
|
66
|
+
begin
|
67
|
+
handle = object.method(method_name)
|
68
|
+
raise original unless handle.is_a? Method
|
69
|
+
handle
|
70
|
+
rescue Exception
|
71
|
+
raise original
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# A single thread local variable so we don't excessively pollute that namespace.
|
77
|
+
def self.thread_local_data
|
78
|
+
Thread.current[:__rspec] ||= {}
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.failure_notifier=(callable)
|
82
|
+
thread_local_data[:failure_notifier] = callable
|
83
|
+
end
|
84
|
+
|
85
|
+
# @private
|
86
|
+
DEFAULT_FAILURE_NOTIFIER = lambda { |failure, _opts| raise failure }
|
87
|
+
|
88
|
+
def self.failure_notifier
|
89
|
+
thread_local_data[:failure_notifier] || DEFAULT_FAILURE_NOTIFIER
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.notify_failure(failure, options={})
|
93
|
+
failure_notifier.call(failure, options)
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.with_failure_notifier(callable)
|
97
|
+
orig_notifier = failure_notifier
|
98
|
+
self.failure_notifier = callable
|
99
|
+
yield
|
100
|
+
ensure
|
101
|
+
self.failure_notifier = orig_notifier
|
102
|
+
end
|
103
|
+
|
104
|
+
# The Differ is only needed when a a spec fails with a diffable failure.
|
105
|
+
# In the more common case of all specs passing or the only failures being
|
106
|
+
# non-diffable, we can avoid the extra cost of loading the differ, diff-lcs,
|
107
|
+
# pp, etc by avoiding an unnecessary require. Instead, autoload will take
|
108
|
+
# care of loading the differ on first use.
|
109
|
+
autoload :Differ, "rspec/support/differ"
|
110
|
+
end
|
111
|
+
end
|