[DRE-commits] [ruby-rspec] 01/19: Merge branches 'multideb/ruby-rspec/upstream', 'multideb/ruby-rspec/master', 'multideb/ruby-rspec-core/master', 'multideb/ruby-rspec-expectations/master' and 'multideb/ruby-rspec-mocks/master' into multideb/master

Jérémy Bobbio lunar at alioth.debian.org
Sun Oct 20 17:01:12 UTC 2013


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/multideb
in repository ruby-rspec.

commit aca86541c5f470d44a5fd9b8406376492117dfa8
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Sat Oct 19 18:43:08 2013 +0200

    Merge branches 'multideb/ruby-rspec/upstream', 'multideb/ruby-rspec/master', 'multideb/ruby-rspec-core/master', 'multideb/ruby-rspec-expectations/master' and 'multideb/ruby-rspec-mocks/master' into multideb/master
    
    Create ruby-rspec, ruby-rspec-core, ruby-rspec-expectations and
    ruby-rspec-mocks from the same source package in order to avoid the painful
    circular build dependencies needed to run the tests.
    
    Closes: #677955
---
 debian/control                                     |   44 +-
 debian/copyright                                   |    4 +-
 debian/patches/disable-autotest-in-tests.patch     |   16 +
 debian/patches/fix-commandline-test.patch          |   33 +
 debian/patches/remove-aruba-stuff-in-tests.patch   |   32 +
 .../patches/remove-rubygems-stuff-in-tests.patch   |   13 +
 debian/patches/ruby_test_bin.patch                 |   18 +
 debian/patches/series                              |    5 +
 debian/require-rubygems.overrides                  |    1 +
 debian/rspec.1.pod                                 |  161 ++
 debian/ruby-rspec-core.docs                        |    2 +
 debian/ruby-rspec-core.install                     |    1 +
 debian/ruby-rspec-core.manpages                    |    1 +
 debian/ruby-tests.rb                               |    9 +
 debian/rules                                       |   18 +
 debian/source/local-options                        |    1 +
 rspec-core/Changelog.md                            |  881 +++++++++++
 License.txt => rspec-core/License.txt              |    0
 rspec-core/README.md                               |  261 ++++
 rspec-core/exe/autospec                            |   13 +
 rspec-core/exe/rspec                               |   25 +
 rspec-core/features/Autotest.md                    |   38 +
 rspec-core/features/README.md                      |   17 +
 rspec-core/features/Upgrade.md                     |  364 +++++
 rspec-core/features/command_line/README.md         |   28 +
 .../command_line/example_name_option.feature       |   97 ++
 .../features/command_line/exit_status.feature      |   82 +
 .../features/command_line/format_option.feature    |   75 +
 rspec-core/features/command_line/init.feature      |   18 +
 .../line_number_appended_to_path.feature           |  140 ++
 .../command_line/line_number_option.feature        |   58 +
 rspec-core/features/command_line/order.feature     |   29 +
 .../features/command_line/pattern_option.feature   |   49 +
 rspec-core/features/command_line/rake_task.feature |  122 ++
 .../features/command_line/require_option.feature   |   43 +
 rspec-core/features/command_line/ruby.feature      |   22 +
 rspec-core/features/command_line/tag.feature       |   98 ++
 .../features/command_line/warnings_option.feature  |   29 +
 .../configuration/alias_example_to.feature         |   48 +
 .../configuration/backtrace_clean_patterns.feature |  102 ++
 .../features/configuration/custom_settings.feature |   84 ++
 .../features/configuration/default_path.feature    |   38 +
 .../configuration/deprecation_stream.feature       |   58 +
 .../features/configuration/fail_fast.feature       |   77 +
 .../configuration/failure_exit_code.feature        |   36 +
 .../features/configuration/order_and_seed.feature  |    3 +
 .../features/configuration/output_stream.feature   |   24 +
 rspec-core/features/configuration/pattern.feature  |   38 +
 rspec-core/features/configuration/profile.feature  |  220 +++
 .../configuration/read_options_from_file.feature   |   90 ++
 .../run_all_when_everything_filtered.feature       |   76 +
 .../show_failures_in_pending_blocks.feature        |   61 +
 ...mbols_as_metadata_keys_with_true_values.feature |   52 +
 .../example_groups/basic_structure.feature         |   55 +
 .../features/example_groups/shared_context.feature |   74 +
 .../example_groups/shared_examples.feature         |  294 ++++
 .../configure_expectation_framework.feature        |  102 ++
 .../features/filtering/exclusion_filters.feature   |  138 ++
 .../features/filtering/if_and_unless.feature       |  168 +++
 .../features/filtering/inclusion_filters.feature   |  105 ++
 .../formatters/configurable_colors.feature         |   31 +
 .../features/formatters/custom_formatter.feature   |   36 +
 .../features/formatters/json_formatter.feature     |   30 +
 .../features/formatters/text_formatter.feature     |   46 +
 .../helper_methods/arbitrary_methods.feature       |   40 +
 rspec-core/features/helper_methods/let.feature     |   50 +
 rspec-core/features/helper_methods/modules.feature |  149 ++
 rspec-core/features/hooks/around_hooks.feature     |  343 +++++
 .../features/hooks/before_and_after_hooks.feature  |  427 ++++++
 rspec-core/features/hooks/filtering.feature        |  234 +++
 .../features/metadata/current_example.feature      |   17 +
 .../features/metadata/described_class.feature      |   17 +
 rspec-core/features/metadata/user_defined.feature  |  113 ++
 .../use_any_framework.feature                      |  106 ++
 .../use_flexmock.feature                           |   96 ++
 .../mock_framework_integration/use_mocha.feature   |   97 ++
 .../mock_framework_integration/use_rr.feature      |   98 ++
 .../mock_framework_integration/use_rspec.feature   |   97 ++
 .../features/pending/pending_examples.feature      |  229 +++
 .../spec_files/arbitrary_file_suffix.feature       |   13 +
 .../step_definitions/additional_cli_steps.rb       |   49 +
 .../features/subject/attribute_of_subject.feature  |  124 ++
 .../features/subject/explicit_subject.feature      |  101 ++
 .../features/subject/implicit_receiver.feature     |   29 +
 .../features/subject/implicit_subject.feature      |   63 +
 rspec-core/features/support/env.rb                 |   14 +
 rspec-core/features/support/rubinius.rb            |    6 +
 rspec-core/lib/autotest/discover.rb                |    1 +
 rspec-core/lib/autotest/rspec2.rb                  |   73 +
 rspec-core/lib/rspec/autorun.rb                    |    2 +
 rspec-core/lib/rspec/core.rb                       |  169 +++
 rspec-core/lib/rspec/core/backtrace_cleaner.rb     |   46 +
 .../lib/rspec/core/backward_compatibility.rb       |   55 +
 rspec-core/lib/rspec/core/command_line.rb          |   36 +
 rspec-core/lib/rspec/core/configuration.rb         | 1174 +++++++++++++++
 rspec-core/lib/rspec/core/configuration_options.rb |  156 ++
 rspec-core/lib/rspec/core/deprecation.rb           |   31 +
 rspec-core/lib/rspec/core/drb_command_line.rb      |   26 +
 rspec-core/lib/rspec/core/drb_options.rb           |   87 ++
 rspec-core/lib/rspec/core/dsl.rb                   |   26 +
 rspec-core/lib/rspec/core/example.rb               |  331 +++++
 rspec-core/lib/rspec/core/example_group.rb         |  479 ++++++
 .../core/extensions/instance_eval_with_args.rb     |   44 +
 rspec-core/lib/rspec/core/extensions/kernel.rb     |    9 +
 .../rspec/core/extensions/module_eval_with_args.rb |   38 +
 rspec-core/lib/rspec/core/extensions/ordered.rb    |   27 +
 rspec-core/lib/rspec/core/filter_manager.rb        |  203 +++
 rspec-core/lib/rspec/core/formatters.rb            |   55 +
 .../lib/rspec/core/formatters/base_formatter.rb    |  246 +++
 .../rspec/core/formatters/base_text_formatter.rb   |  329 +++++
 .../rspec/core/formatters/deprecation_formatter.rb |   39 +
 .../core/formatters/documentation_formatter.rb     |   67 +
 rspec-core/lib/rspec/core/formatters/helpers.rb    |  110 ++
 .../lib/rspec/core/formatters/html_formatter.rb    |  155 ++
 .../lib/rspec/core/formatters/html_printer.rb      |  408 +++++
 .../lib/rspec/core/formatters/json_formatter.rb    |   70 +
 .../rspec/core/formatters/progress_formatter.rb    |   32 +
 .../lib/rspec/core/formatters/snippet_extractor.rb |   92 ++
 .../rspec/core/formatters/text_mate_formatter.rb   |   34 +
 rspec-core/lib/rspec/core/hooks.rb                 |  519 +++++++
 rspec-core/lib/rspec/core/memoized_helpers.rb      |  514 +++++++
 rspec-core/lib/rspec/core/metadata.rb              |  299 ++++
 rspec-core/lib/rspec/core/metadata_hash_builder.rb |   97 ++
 .../rspec/core/mocking/with_absolutely_nothing.rb  |   11 +
 rspec-core/lib/rspec/core/mocking/with_flexmock.rb |   27 +
 rspec-core/lib/rspec/core/mocking/with_mocha.rb    |   52 +
 rspec-core/lib/rspec/core/mocking/with_rr.rb       |   27 +
 rspec-core/lib/rspec/core/mocking/with_rspec.rb    |   27 +
 rspec-core/lib/rspec/core/option_parser.rb         |  219 +++
 rspec-core/lib/rspec/core/pending.rb               |  109 ++
 rspec-core/lib/rspec/core/project_initializer.rb   |   86 ++
 rspec-core/lib/rspec/core/rake_task.rb             |  206 +++
 rspec-core/lib/rspec/core/reporter.rb              |  132 ++
 rspec-core/lib/rspec/core/ruby_project.rb          |   44 +
 rspec-core/lib/rspec/core/runner.rb                |   87 ++
 rspec-core/lib/rspec/core/shared_context.rb        |   55 +
 rspec-core/lib/rspec/core/shared_example_group.rb  |  185 +++
 .../rspec/core/shared_example_group/collection.rb  |   43 +
 rspec-core/lib/rspec/core/version.rb               |    8 +
 rspec-core/lib/rspec/core/world.rb                 |  127 ++
 rspec-core/metadata.yml                            |  547 +++++++
 rspec-core/spec/autotest/discover_spec.rb          |   19 +
 rspec-core/spec/autotest/failed_results_re_spec.rb |   45 +
 rspec-core/spec/autotest/rspec_spec.rb             |  133 ++
 rspec-core/spec/command_line/order_spec.rb         |  204 +++
 .../spec/rspec/core/backtrace_cleaner_spec.rb      |   68 +
 rspec-core/spec/rspec/core/command_line_spec.rb    |  108 ++
 .../spec/rspec/core/configuration_options_spec.rb  |  417 ++++++
 rspec-core/spec/rspec/core/configuration_spec.rb   | 1561 ++++++++++++++++++++
 rspec-core/spec/rspec/core/deprecation_spec.rb     |   46 +
 rspec-core/spec/rspec/core/deprecations_spec.rb    |   73 +
 .../spec/rspec/core/drb_command_line_spec.rb       |  102 ++
 rspec-core/spec/rspec/core/drb_options_spec.rb     |  193 +++
 rspec-core/spec/rspec/core/dsl_spec.rb             |   25 +
 rspec-core/spec/rspec/core/example_group_spec.rb   | 1187 +++++++++++++++
 rspec-core/spec/rspec/core/example_spec.rb         |  439 ++++++
 rspec-core/spec/rspec/core/filter_manager_spec.rb  |  246 +++
 .../rspec/core/formatters/base_formatter_spec.rb   |  108 ++
 .../core/formatters/base_text_formatter_spec.rb    |  494 +++++++
 .../core/formatters/deprecation_formatter_spec.rb  |   96 ++
 .../formatters/documentation_formatter_spec.rb     |   88 ++
 .../spec/rspec/core/formatters/helpers_spec.rb     |   94 ++
 .../formatters/html_formatted-1.8.7-jruby.html     |  404 +++++
 .../core/formatters/html_formatted-1.8.7-rbx.html  |  477 ++++++
 .../core/formatters/html_formatted-1.8.7.html      |  414 ++++++
 .../core/formatters/html_formatted-1.9.2.html      |  425 ++++++
 .../formatters/html_formatted-1.9.3-jruby.html     |  404 +++++
 .../core/formatters/html_formatted-1.9.3-rbx.html  |  477 ++++++
 .../core/formatters/html_formatted-1.9.3.html      |  425 ++++++
 .../core/formatters/html_formatted-2.0.0.html      |  425 ++++++
 .../rspec/core/formatters/html_formatter_spec.rb   |   95 ++
 .../rspec/core/formatters/json_formatter_spec.rb   |  115 ++
 .../core/formatters/progress_formatter_spec.rb     |   30 +
 .../core/formatters/snippet_extractor_spec.rb      |   26 +
 .../text_mate_formatted-1.8.7-jruby.html           |  395 +++++
 .../formatters/text_mate_formatted-1.8.7-rbx.html  |  477 ++++++
 .../core/formatters/text_mate_formatted-1.8.7.html |  414 ++++++
 .../core/formatters/text_mate_formatted-1.9.2.html |  425 ++++++
 .../text_mate_formatted-1.9.3-jruby.html           |  404 +++++
 .../formatters/text_mate_formatted-1.9.3-rbx.html  |  477 ++++++
 .../core/formatters/text_mate_formatted-1.9.3.html |  425 ++++++
 .../core/formatters/text_mate_formatted-2.0.0.html |  425 ++++++
 .../core/formatters/text_mate_formatter_spec.rb    |   96 ++
 rspec-core/spec/rspec/core/hooks_filtering_spec.rb |  227 +++
 rspec-core/spec/rspec/core/hooks_spec.rb           |  267 ++++
 .../spec/rspec/core/kernel_extensions_spec.rb      |    9 +
 .../spec/rspec/core/memoized_helpers_spec.rb       |  688 +++++++++
 rspec-core/spec/rspec/core/metadata_spec.rb        |  491 ++++++
 rspec-core/spec/rspec/core/option_parser_spec.rb   |  242 +++
 rspec-core/spec/rspec/core/pending_example_spec.rb |  220 +++
 .../spec/rspec/core/project_initializer_spec.rb    |  130 ++
 rspec-core/spec/rspec/core/rake_task_spec.rb       |  181 +++
 rspec-core/spec/rspec/core/reporter_spec.rb        |  141 ++
 rspec-core/spec/rspec/core/resources/a_spec.rb     |    1 +
 .../core/resources/custom_example_group_runner.rb  |   14 +
 .../spec/rspec/core/resources/formatter_specs.rb   |   60 +
 .../spec/rspec/core/resources/utf8_encoded.rb      |    8 +
 rspec-core/spec/rspec/core/rspec_matchers_spec.rb  |   45 +
 rspec-core/spec/rspec/core/ruby_project_spec.rb    |   26 +
 rspec-core/spec/rspec/core/runner_spec.rb          |   82 +
 rspec-core/spec/rspec/core/shared_context_spec.rb  |  114 ++
 .../core/shared_example_group/collection_spec.rb   |   70 +
 .../spec/rspec/core/shared_example_group_spec.rb   |  120 ++
 rspec-core/spec/rspec/core/world_spec.rb           |  142 ++
 rspec-core/spec/rspec/core_spec.rb                 |   74 +
 rspec-core/spec/spec_helper.rb                     |  132 ++
 rspec-core/spec/support/config_options_helper.rb   |   15 +
 rspec-core/spec/support/helper_methods.rb          |   36 +
 .../spec/support/isolate_load_path_mutation.rb     |    6 +
 rspec-core/spec/support/isolated_directory.rb      |   10 +
 rspec-core/spec/support/isolated_home_directory.rb |   16 +
 rspec-core/spec/support/matchers.rb                |   65 +
 rspec-core/spec/support/sandboxed_mock_space.rb    |  100 ++
 rspec-core/spec/support/shared_example_groups.rb   |   41 +
 rspec-core/spec/support/spec_files.rb              |   44 +
 rspec-expectations/Changelog.md                    |  399 +++++
 License.txt => rspec-expectations/License.txt      |    1 -
 rspec-expectations/README.md                       |  184 +++
 rspec-expectations/features/README.md              |   48 +
 rspec-expectations/features/Upgrade.md             |   53 +
 .../features/built_in_matchers/README.md           |   90 ++
 .../features/built_in_matchers/be.feature          |  175 +++
 .../features/built_in_matchers/be_within.feature   |   48 +
 .../features/built_in_matchers/cover.feature       |   47 +
 .../features/built_in_matchers/end_with.feature    |   48 +
 .../features/built_in_matchers/equality.feature    |  139 ++
 .../features/built_in_matchers/exist.feature       |   45 +
 .../built_in_matchers/expect_change.feature        |   59 +
 .../built_in_matchers/expect_error.feature         |  144 ++
 .../features/built_in_matchers/have.feature        |  109 ++
 .../features/built_in_matchers/include.feature     |  174 +++
 .../features/built_in_matchers/match.feature       |   52 +
 .../features/built_in_matchers/operators.feature   |  227 +++
 .../features/built_in_matchers/predicates.feature  |  137 ++
 .../features/built_in_matchers/respond_to.feature  |   84 ++
 .../features/built_in_matchers/satisfy.feature     |   33 +
 .../features/built_in_matchers/start_with.feature  |   48 +
 .../built_in_matchers/throw_symbol.feature         |   91 ++
 .../features/built_in_matchers/types.feature       |  116 ++
 .../features/built_in_matchers/yield.feature       |  161 ++
 .../custom_matchers/access_running_example.feature |   53 +
 .../define_diffable_matcher.feature                |   27 +
 .../custom_matchers/define_matcher.feature         |  368 +++++
 .../define_matcher_outside_rspec.feature           |   38 +
 .../define_matcher_with_fluent_interface.feature   |   24 +
 .../features/customized_message.feature            |   22 +
 rspec-expectations/features/diffing.feature        |   85 ++
 .../features/implicit_docstrings.feature           |   52 +
 .../step_definitions/additional_cli_steps.rb       |   22 +
 rspec-expectations/features/support/env.rb         |   14 +
 rspec-expectations/features/support/rubinius.rb    |    6 +
 .../features/syntax_configuration.feature          |   71 +
 .../features/test_frameworks/test_unit.feature     |   44 +
 rspec-expectations/lib/rspec-expectations.rb       |    1 +
 rspec-expectations/lib/rspec/expectations.rb       |   47 +
 .../lib/rspec/expectations/deprecation.rb          |   17 +
 .../lib/rspec/expectations/differ.rb               |  140 ++
 .../lib/rspec/expectations/errors.rb               |    9 +
 .../lib/rspec/expectations/expectation_target.rb   |   87 ++
 .../lib/rspec/expectations/extensions.rb           |    2 +
 .../lib/rspec/expectations/extensions/array.rb     |    9 +
 .../lib/rspec/expectations/extensions/object.rb    |   29 +
 .../lib/rspec/expectations/fail_with.rb            |   79 +
 .../lib/rspec/expectations/handler.rb              |   68 +
 .../lib/rspec/expectations/syntax.rb               |  164 ++
 .../lib/rspec/expectations/version.rb              |    9 +
 rspec-expectations/lib/rspec/matchers.rb           |  697 +++++++++
 rspec-expectations/lib/rspec/matchers/be_close.rb  |    9 +
 rspec-expectations/lib/rspec/matchers/built_in.rb  |   39 +
 .../lib/rspec/matchers/built_in/base_matcher.rb    |   68 +
 .../lib/rspec/matchers/built_in/be.rb              |  197 +++
 .../lib/rspec/matchers/built_in/be_instance_of.rb  |   15 +
 .../lib/rspec/matchers/built_in/be_kind_of.rb      |   11 +
 .../lib/rspec/matchers/built_in/be_within.rb       |   55 +
 .../lib/rspec/matchers/built_in/change.rb          |  141 ++
 .../lib/rspec/matchers/built_in/cover.rb           |   21 +
 .../lib/rspec/matchers/built_in/eq.rb              |   22 +
 .../lib/rspec/matchers/built_in/eql.rb             |   23 +
 .../lib/rspec/matchers/built_in/equal.rb           |   48 +
 .../lib/rspec/matchers/built_in/exist.rb           |   26 +
 .../lib/rspec/matchers/built_in/has.rb             |   48 +
 .../lib/rspec/matchers/built_in/have.rb            |  124 ++
 .../lib/rspec/matchers/built_in/include.rb         |   61 +
 .../lib/rspec/matchers/built_in/match.rb           |   12 +
 .../lib/rspec/matchers/built_in/match_array.rb     |   51 +
 .../lib/rspec/matchers/built_in/raise_error.rb     |  123 ++
 .../lib/rspec/matchers/built_in/respond_to.rb      |   74 +
 .../lib/rspec/matchers/built_in/satisfy.rb         |   30 +
 .../rspec/matchers/built_in/start_and_end_with.rb  |   48 +
 .../lib/rspec/matchers/built_in/throw_symbol.rb    |   94 ++
 .../lib/rspec/matchers/built_in/yield.rb           |  296 ++++
 .../lib/rspec/matchers/compatibility.rb            |   14 +
 .../lib/rspec/matchers/configuration.rb            |  108 ++
 rspec-expectations/lib/rspec/matchers/dsl.rb       |   24 +
 .../matchers/extensions/instance_eval_with_args.rb |   39 +
 .../lib/rspec/matchers/generated_descriptions.rb   |   35 +
 rspec-expectations/lib/rspec/matchers/matcher.rb   |  300 ++++
 .../lib/rspec/matchers/method_missing.rb           |   12 +
 .../lib/rspec/matchers/operator_matcher.rb         |  109 ++
 rspec-expectations/lib/rspec/matchers/pretty.rb    |   70 +
 .../lib/rspec/matchers/test_unit_integration.rb    |   11 +
 rspec-expectations/metadata.yml                    |  333 +++++
 .../spec/rspec/expectations/differ_spec.rb         |  203 +++
 .../rspec/expectations/expectation_target_spec.rb  |   82 +
 .../rspec/expectations/extensions/kernel_spec.rb   |   67 +
 .../spec/rspec/expectations/fail_with_spec.rb      |  114 ++
 .../spec/rspec/expectations/handler_spec.rb        |  227 +++
 .../spec/rspec/expectations/syntax_spec.rb         |  139 ++
 .../spec/rspec/matchers/base_matcher_spec.rb       |   62 +
 .../spec/rspec/matchers/be_close_spec.rb           |   22 +
 .../spec/rspec/matchers/be_instance_of_spec.rb     |   63 +
 .../spec/rspec/matchers/be_kind_of_spec.rb         |   41 +
 rspec-expectations/spec/rspec/matchers/be_spec.rb  |  522 +++++++
 .../spec/rspec/matchers/be_within_spec.rb          |  137 ++
 .../spec/rspec/matchers/change_spec.rb             |  567 +++++++
 .../spec/rspec/matchers/configuration_spec.rb      |  206 +++
 .../spec/rspec/matchers/cover_spec.rb              |   69 +
 .../rspec/matchers/description_generation_spec.rb  |  190 +++
 rspec-expectations/spec/rspec/matchers/dsl_spec.rb |   57 +
 rspec-expectations/spec/rspec/matchers/eq_spec.rb  |   60 +
 rspec-expectations/spec/rspec/matchers/eql_spec.rb |   41 +
 .../spec/rspec/matchers/equal_spec.rb              |   78 +
 .../spec/rspec/matchers/exist_spec.rb              |  124 ++
 rspec-expectations/spec/rspec/matchers/has_spec.rb |  122 ++
 .../spec/rspec/matchers/have_spec.rb               |  455 ++++++
 .../matchers/include_matcher_integration_spec.rb   |   30 +
 .../spec/rspec/matchers/include_spec.rb            |  531 +++++++
 .../spec/rspec/matchers/match_array_spec.rb        |  194 +++
 .../spec/rspec/matchers/match_spec.rb              |   61 +
 .../spec/rspec/matchers/matcher_spec.rb            |  471 ++++++
 .../spec/rspec/matchers/matchers_spec.rb           |   37 +
 .../spec/rspec/matchers/method_missing_spec.rb     |   28 +
 .../spec/rspec/matchers/operator_matcher_spec.rb   |  223 +++
 .../spec/rspec/matchers/raise_error_spec.rb        |  485 ++++++
 .../spec/rspec/matchers/respond_to_spec.rb         |  292 ++++
 .../spec/rspec/matchers/satisfy_spec.rb            |   44 +
 .../rspec/matchers/start_with_end_with_spec.rb     |  186 +++
 .../spec/rspec/matchers/throw_symbol_spec.rb       |  116 ++
 .../spec/rspec/matchers/yield_spec.rb              |  514 +++++++
 rspec-expectations/spec/spec_helper.rb             |   54 +
 rspec-expectations/spec/support/classes.rb         |   56 +
 rspec-expectations/spec/support/in_sub_process.rb  |   38 +
 rspec-expectations/spec/support/matchers.rb        |   22 +
 rspec-expectations/spec/support/ruby_version.rb    |   10 +
 rspec-expectations/spec/support/shared_examples.rb |   13 +
 rspec-mocks/Changelog.md                           |  410 +++++
 License.txt => rspec-mocks/License.txt             |    1 -
 rspec-mocks/README.md                              |  315 ++++
 rspec-mocks/features/README.md                     |   67 +
 rspec-mocks/features/Scope.md                      |   17 +
 rspec-mocks/features/Upgrade.md                    |   22 +
 rspec-mocks/features/argument_matchers/README.md   |   27 +
 .../features/argument_matchers/explicit.feature    |   59 +
 .../argument_matchers/general_matchers.feature     |   85 ++
 .../argument_matchers/type_matchers.feature        |   26 +
 .../features/message_expectations/README.md        |   73 +
 .../allow_any_instance_of.feature                  |   26 +
 .../message_expectations/any_instance.feature      |   21 +
 .../block_local_expectations.feature.pending       |   55 +
 .../message_expectations/call_original.feature     |   24 +
 .../expect_any_instance_of.feature                 |   27 +
 .../expect_message_using_expect.feature            |  107 ++
 .../expect_message_using_should_receive.feature    |  118 ++
 .../message_expectations/receive_counts.feature    |  209 +++
 .../warn_when_expectation_is_set_on_nil.feature    |   50 +
 rspec-mocks/features/method_stubs/README.md        |   73 +
 .../features/method_stubs/any_instance.feature     |  136 ++
 .../features/method_stubs/as_null_object.feature   |   40 +
 .../simple_return_value_with_allow.feature         |   44 +
 .../simple_return_value_with_stub.feature          |   64 +
 .../features/method_stubs/stub_chain.feature       |   51 +
 .../method_stubs/stub_implementation.feature       |   48 +
 rspec-mocks/features/method_stubs/to_ary.feature   |   51 +
 rspec-mocks/features/mutating_constants/README.md  |   82 +
 .../hiding_defined_constant.feature                |   64 +
 .../stub_defined_constant.feature                  |   79 +
 .../stub_undefined_constant.feature                |   50 +
 .../features/outside_rspec/configuration.feature   |   62 +
 .../features/outside_rspec/standalone.feature      |   33 +
 .../features/spies/spy_partial_mock_method.feature |   34 +
 .../features/spies/spy_pure_mock_method.feature    |   76 +
 .../features/spies/spy_unstubbed_method.feature    |   18 +
 .../step_definitions/additional_cli_steps.rb       |   11 +
 rspec-mocks/features/support/env.rb                |   13 +
 rspec-mocks/features/support/rubinius.rb           |    6 +
 .../features/test_frameworks/test_unit.feature     |   43 +
 rspec-mocks/lib/rspec/mocks.rb                     |   92 ++
 rspec-mocks/lib/rspec/mocks/any_instance/chain.rb  |   93 ++
 .../rspec/mocks/any_instance/expectation_chain.rb  |   42 +
 .../lib/rspec/mocks/any_instance/message_chains.rb |   60 +
 .../lib/rspec/mocks/any_instance/recorder.rb       |  206 +++
 .../lib/rspec/mocks/any_instance/stub_chain.rb     |   38 +
 .../rspec/mocks/any_instance/stub_chain_chain.rb   |   23 +
 .../lib/rspec/mocks/argument_list_matcher.rb       |   97 ++
 rspec-mocks/lib/rspec/mocks/argument_matchers.rb   |  238 +++
 rspec-mocks/lib/rspec/mocks/configuration.rb       |   55 +
 rspec-mocks/lib/rspec/mocks/deprecation.rb         |   18 +
 rspec-mocks/lib/rspec/mocks/error_generator.rb     |  179 +++
 rspec-mocks/lib/rspec/mocks/errors.rb              |   12 +
 rspec-mocks/lib/rspec/mocks/example_methods.rb     |  156 ++
 .../lib/rspec/mocks/extensions/instance_exec.rb    |   34 +
 rspec-mocks/lib/rspec/mocks/extensions/marshal.rb  |   17 +
 rspec-mocks/lib/rspec/mocks/framework.rb           |   34 +
 .../lib/rspec/mocks/instance_method_stasher.rb     |   94 ++
 .../lib/rspec/mocks/matchers/have_received.rb      |   93 ++
 rspec-mocks/lib/rspec/mocks/matchers/receive.rb    |   96 ++
 rspec-mocks/lib/rspec/mocks/message_expectation.rb |  583 ++++++++
 rspec-mocks/lib/rspec/mocks/method_double.rb       |  265 ++++
 rspec-mocks/lib/rspec/mocks/mock.rb                |    7 +
 rspec-mocks/lib/rspec/mocks/mutate_const.rb        |  403 +++++
 rspec-mocks/lib/rspec/mocks/order_group.rb         |   40 +
 rspec-mocks/lib/rspec/mocks/proxy.rb               |  216 +++
 rspec-mocks/lib/rspec/mocks/proxy_for_nil.rb       |   37 +
 rspec-mocks/lib/rspec/mocks/space.rb               |   87 ++
 rspec-mocks/lib/rspec/mocks/standalone.rb          |    3 +
 rspec-mocks/lib/rspec/mocks/stub_chain.rb          |   51 +
 rspec-mocks/lib/rspec/mocks/syntax.rb              |  349 +++++
 rspec-mocks/lib/rspec/mocks/targets.rb             |   69 +
 rspec-mocks/lib/rspec/mocks/test_double.rb         |  135 ++
 rspec-mocks/lib/rspec/mocks/version.rb             |    7 +
 rspec-mocks/lib/spec/mocks.rb                      |    4 +
 rspec-mocks/metadata.yml                           |  328 ++++
 .../spec/rspec/mocks/and_call_original_spec.rb     |  243 +++
 rspec-mocks/spec/rspec/mocks/and_yield_spec.rb     |  127 ++
 .../mocks/any_instance/message_chains_spec.rb      |   40 +
 rspec-mocks/spec/rspec/mocks/any_instance_spec.rb  |  963 ++++++++++++
 .../spec/rspec/mocks/any_number_of_times_spec.rb   |   36 +
 .../spec/rspec/mocks/argument_expectation_spec.rb  |   32 +
 rspec-mocks/spec/rspec/mocks/at_least_spec.rb      |  151 ++
 rspec-mocks/spec/rspec/mocks/at_most_spec.rb       |   90 ++
 .../spec/rspec/mocks/block_return_value_spec.rb    |   88 ++
 .../spec/rspec/mocks/bug_report_10260_spec.rb      |    8 +
 .../spec/rspec/mocks/bug_report_10263_spec.rb      |   27 +
 .../spec/rspec/mocks/bug_report_11545_spec.rb      |   32 +
 .../spec/rspec/mocks/bug_report_496_spec.rb        |   17 +
 .../spec/rspec/mocks/bug_report_600_spec.rb        |   22 +
 .../spec/rspec/mocks/bug_report_7611_spec.rb       |   16 +
 .../spec/rspec/mocks/bug_report_8165_spec.rb       |   31 +
 .../spec/rspec/mocks/bug_report_830_spec.rb        |   21 +
 .../spec/rspec/mocks/bug_report_957_spec.rb        |   22 +
 .../combining_implementation_instructions_spec.rb  |  205 +++
 rspec-mocks/spec/rspec/mocks/configuration_spec.rb |  150 ++
 rspec-mocks/spec/rspec/mocks/double_spec.rb        |   24 +
 .../spec/rspec/mocks/extensions/marshal_spec.rb    |   54 +
 .../rspec/mocks/failing_argument_matchers_spec.rb  |  110 ++
 .../rspec/mocks/hash_excluding_matcher_spec.rb     |   67 +
 .../rspec/mocks/hash_including_matcher_spec.rb     |   90 ++
 .../rspec/mocks/instance_method_stasher_spec.rb    |   58 +
 .../rspec/mocks/matchers/have_received_spec.rb     |  266 ++++
 .../spec/rspec/mocks/matchers/receive_spec.rb      |  328 ++++
 rspec-mocks/spec/rspec/mocks/methods_spec.rb       |   27 +
 rspec-mocks/spec/rspec/mocks/mock_ordering_spec.rb |  103 ++
 rspec-mocks/spec/rspec/mocks/mock_space_spec.rb    |  113 ++
 rspec-mocks/spec/rspec/mocks/mock_spec.rb          |  798 ++++++++++
 .../spec/rspec/mocks/multiple_return_value_spec.rb |  132 ++
 rspec-mocks/spec/rspec/mocks/mutate_const_spec.rb  |  501 +++++++
 .../rspec/mocks/nil_expectation_warning_spec.rb    |   68 +
 .../spec/rspec/mocks/null_object_mock_spec.rb      |  123 ++
 rspec-mocks/spec/rspec/mocks/once_counts_spec.rb   |   52 +
 rspec-mocks/spec/rspec/mocks/options_hash_spec.rb  |   35 +
 rspec-mocks/spec/rspec/mocks/partial_mock_spec.rb  |  205 +++
 .../partial_mock_using_mocks_directly_spec.rb      |   95 ++
 .../rspec/mocks/passing_argument_matchers_spec.rb  |  142 ++
 .../spec/rspec/mocks/precise_counts_spec.rb        |   68 +
 .../spec/rspec/mocks/record_messages_spec.rb       |   26 +
 rspec-mocks/spec/rspec/mocks/serialization_spec.rb |   89 ++
 rspec-mocks/spec/rspec/mocks/stash_spec.rb         |   46 +
 rspec-mocks/spec/rspec/mocks/stub_chain_spec.rb    |  154 ++
 .../spec/rspec/mocks/stub_implementation_spec.rb   |   81 +
 rspec-mocks/spec/rspec/mocks/stub_spec.rb          |  353 +++++
 .../mocks/stubbed_message_expectations_spec.rb     |   58 +
 .../mocks/syntax_agnostic_message_matchers_spec.rb |   81 +
 rspec-mocks/spec/rspec/mocks/test_double_spec.rb   |   67 +
 rspec-mocks/spec/rspec/mocks/to_ary_spec.rb        |   54 +
 rspec-mocks/spec/rspec/mocks/twice_counts_spec.rb  |   66 +
 rspec-mocks/spec/rspec/mocks_spec.rb               |   65 +
 rspec-mocks/spec/spec_helper.rb                    |   60 +
 License.txt => rspec/License.txt                   |    0
 README.md => rspec/README.md                       |    0
 {lib => rspec/lib}/rspec.rb                        |    0
 {lib => rspec/lib}/rspec/version.rb                |    0
 metadata.yml => rspec/metadata.yml                 |    0
 482 files changed, 61026 insertions(+), 7 deletions(-)

diff --git a/debian/control b/debian/control
index 115e242..dc899c2 100644
--- a/debian/control
+++ b/debian/control
@@ -3,19 +3,57 @@ Section: ruby
 Priority: optional
 Maintainer: Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>
 Uploaders: Lucas Nussbaum <lucas at lucas-nussbaum.net>, Cédric Boutillier <boutil at debian.org>
-Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.3.0~)
+Build-Depends: debhelper (>= 7.0.50~), gem2deb (>= 0.4.0~), rake, ruby-childprocess, ruby-fakefs, ruby-nokogiri, ruby-json, ruby-diff-lcs
 Standards-Version: 3.9.4
 Vcs-Git: git://anonscm.debian.org/pkg-ruby-extras/ruby-rspec.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ruby-extras/ruby-rspec.git
-Homepage: https://github.com/rspec/rspec
+Homepage: http://rspec.info/
 XS-Ruby-Versions: all
 
 Package: ruby-rspec
 Architecture: all
+X-DhRuby-Root: rspec
 XB-Ruby-Versions: ${ruby:Versions}
-Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-rspec-core (>= 2.14~)
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-rspec-core (>= ${binary:Version})
 Description: Behaviour Driven Development framework for Ruby - metapackage
  RSpec is a Behaviour Driven Development framework for Ruby. It
  provides a framework for writing and executing examples of how your
  Ruby application should behave.
 
+Package: ruby-rspec-core
+Architecture: all
+X-DhRuby-Root: rspec-core
+XB-Ruby-Versions: ${ruby:Versions}
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-rspec-expectations (>= ${binary:Version}), ruby-rspec-mocks (>= ${binary:Version})
+Suggests: ruby-rspec
+Description: Behaviour Driven Development framework for Ruby - core
+ RSpec is a Behaviour Driven Development framework for Ruby. It
+ provides a framework for writing and executing examples of how your
+ Ruby application should behave.
+
+Package: ruby-rspec-expectations
+Architecture: all
+X-DhRuby-Root: rspec-expectations
+XB-Ruby-Versions: ${ruby:Versions}
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter, ruby-diff-lcs
+Suggests: ruby-rspec
+Description: Behaviour Driven Development framework for Ruby - expectations
+ RSpec is a Behaviour Driven Development framework for Ruby. It
+ provides a framework for writing and executing examples of how your
+ Ruby application should behave.
+ .
+ This package provides the handling of expectations (should/should_not and
+ matchers).
+
+Package: ruby-rspec-mocks
+Architecture: all
+X-DhRuby-Root: rspec-mocks
+XB-Ruby-Versions: ${ruby:Versions}
+Depends: ${shlibs:Depends}, ${misc:Depends}, ruby | ruby-interpreter
+Suggests: ruby-rspec
+Description: Behaviour Driven Development framework for Ruby - mocks
+ RSpec is a Behaviour Driven Development framework for Ruby. It
+ provides a framework for writing and executing examples of how your
+ Ruby application should behave.
+ .
+ This package provides support for stubbing and mocking.
diff --git a/debian/copyright b/debian/copyright
index e45e85c..1998684 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -6,12 +6,12 @@ Files: *
 Copyright: Copyright 2009 Chad Humphries
            Copyright 2006, 2009 David Chelimsky,
            Copyright 2006 The RSpec Development Team
-           Copyright 2005 Steven Baker 
+           Copyright 2005 Steven Baker
 License: Expat
 
 Files: debian/*
 Copyright: Copyright 2011 Lucas Nussbaum <lucas at lucas-nussbaum.net>
-           Copyright 2011-2013 Cédric Boutillier <boutil at debian.org> 
+           Copyright 2011-2013 Cédric Boutillier <boutil at debian.org>
 License: Expat
 
 License: Expat
diff --git a/debian/patches/disable-autotest-in-tests.patch b/debian/patches/disable-autotest-in-tests.patch
new file mode 100644
index 0000000..7d34078
--- /dev/null
+++ b/debian/patches/disable-autotest-in-tests.patch
@@ -0,0 +1,16 @@
+Description: Disable autotest in tests
+Author: Lucas Nussbaum <lucas at lucas-nussbaum.net>
+Last-Update: 2013-03-26
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/rspec-core/spec/spec_helper.rb
++++ b/rspec-core/spec/spec_helper.rb
+@@ -16,7 +16,7 @@ end
+ 
+ Spork.prefork do
+   require 'rspec/autorun'
+-  require 'autotest/rspec2'
++#  require 'autotest/rspec2'
+   require 'aruba/api'
+ 
+   if RUBY_PLATFORM == 'java'
diff --git a/debian/patches/fix-commandline-test.patch b/debian/patches/fix-commandline-test.patch
new file mode 100644
index 0000000..bb528b7
--- /dev/null
+++ b/debian/patches/fix-commandline-test.patch
@@ -0,0 +1,33 @@
+Description: Fix 'CommandLine configures streams before command line options' when no .rspec exists
+Author: Jérémy Bobbio <lunar at debian.org>
+Last-Update: 2013-03-26
+
+When running the specs from an unpacked gem, there is no `.rspec` available, which
+means that `config.force` never gets called and the "Commandline configures
+streams before command line options" test fails.
+
+So instead of relying on a file that is not always present, we temporarily pass
+a 'forced' option through an environment variable.
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/rspec-core/spec/rspec/core/command_line_spec.rb
++++ b/rspec-core/spec/rspec/core/command_line_spec.rb
+@@ -15,6 +15,9 @@ module RSpec::Core
+     it "configures streams before command line options" do
+       config.stub :load_spec_files
+ 
++      old_env = ENV['SPEC_OPTS']
++      ENV['SPEC_OPTS'] = '--default_path spec'
++
+       # this is necessary to ensure that color works correctly on windows
+       config.should_receive(:error_stream=).ordered
+       config.should_receive(:output_stream=).ordered
+@@ -22,6 +25,8 @@ module RSpec::Core
+ 
+       command_line = build_command_line
+       command_line.run err, out
++
++      ENV['SPEC_OPTS'] = old_env
+     end
+ 
+     it "assigns ConfigurationOptions built from Array of options to @options" do
diff --git a/debian/patches/remove-aruba-stuff-in-tests.patch b/debian/patches/remove-aruba-stuff-in-tests.patch
new file mode 100644
index 0000000..8e9a683
--- /dev/null
+++ b/debian/patches/remove-aruba-stuff-in-tests.patch
@@ -0,0 +1,32 @@
+Description: remove use of aruba in spec_helper.rb
+ Aruba is not packaged for Debian (yet). In the mean time, as it is not
+ essential for the test suite, anything related to Aruba is commented out in
+ spec_helper.rb.
+Author: Cédric Boutillier <cedric.boutillier at gmail.com>
+Last-Update: 2013-03-26
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/rspec-core/spec/spec_helper.rb
++++ b/rspec-core/spec/spec_helper.rb
+@@ -17,7 +17,7 @@
+ Spork.prefork do
+   require 'rspec/autorun'
+ #  require 'autotest/rspec2'
+-  require 'aruba/api'
++#  require 'aruba/api'
+ 
+   if RUBY_PLATFORM == 'java'
+     # Works around https://jira.codehaus.org/browse/JRUBY-5678
+@@ -101,9 +101,9 @@
+     c.alias_it_behaves_like_to 'it_has_behavior'
+     c.around {|example| Sandboxing.sandboxed { example.run }}
+     c.include(RSpecHelpers)
+-    c.include Aruba::Api, :example_group => {
+-      :file_path => /spec\/command_line/
+-    }
++#    c.include Aruba::Api, :example_group => {
++#      :file_path => /spec\/command_line/
++#    }
+ 
+     c.expect_with :rspec do |expectations|
+       expectations.syntax = :expect
diff --git a/debian/patches/remove-rubygems-stuff-in-tests.patch b/debian/patches/remove-rubygems-stuff-in-tests.patch
new file mode 100644
index 0000000..0af9a17
--- /dev/null
+++ b/debian/patches/remove-rubygems-stuff-in-tests.patch
@@ -0,0 +1,13 @@
+Description: remove requirement on rubygems in spec_helper.rb
+Author: Cédric Boutillier <cedric.boutillier at gmail.com>
+Last-Update: 2013-03-26
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/rspec-core/spec/spec_helper.rb
++++ b/rspec-core/spec/spec_helper.rb
+@@ -1,4 +1,4 @@
+-require 'rubygems'
++#require 'rubygems'
+ 
+ begin
+   require 'spork'
diff --git a/debian/patches/ruby_test_bin.patch b/debian/patches/ruby_test_bin.patch
new file mode 100644
index 0000000..a767cf5
--- /dev/null
+++ b/debian/patches/ruby_test_bin.patch
@@ -0,0 +1,18 @@
+Description: use RUBY_TEST_BIN environment variable for ruby executable
+Author: Cédric Boutillier <boutil at debian.org>
+Origin: vendor
+Forwarded: not-needed
+Last-Update: 2013-08-10
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/rspec-core/spec/rspec/core_spec.rb
++++ b/rspec-core/spec/rspec/core_spec.rb
+@@ -61,7 +61,7 @@
+            "puts RSpec::Mocks.name; " +
+            "puts RSpec::Expectations.name"
+ 
+-    result = `ruby -e '#{code}'`.chomp
++    result = `#{ENV['RUBY_TEST_BIN']} -e '#{code}'`.chomp
+     expect(result.split("\n")).to eq(%w[ RSpec::Mocks RSpec::Expectations ])
+   end
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..bcbb2d2
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,5 @@
+disable-autotest-in-tests.patch
+remove-rubygems-stuff-in-tests.patch
+remove-aruba-stuff-in-tests.patch
+fix-commandline-test.patch
+ruby_test_bin.patch
diff --git a/debian/require-rubygems.overrides b/debian/require-rubygems.overrides
new file mode 100644
index 0000000..e208e9f
--- /dev/null
+++ b/debian/require-rubygems.overrides
@@ -0,0 +1 @@
+debian/ruby-rspec-core/usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb
diff --git a/debian/rspec.1.pod b/debian/rspec.1.pod
new file mode 100644
index 0000000..cadd1d2
--- /dev/null
+++ b/debian/rspec.1.pod
@@ -0,0 +1,161 @@
+=encoding UTF-8
+
+=head1 NAME
+
+rspec - standalone test runner for Ruby RSpec test suites
+
+=head1 SYNOPSYS
+
+B<rspec> [I<options>] [I<files or directories>]
+
+=head1 DESCRIPTION
+
+The Ruby script B<rspec> allows you to run tests written with RSpec, a testing
+tool for Ruby, from the command line. When run without arguments, B<rspec>
+finds automatically all the spec files of your projects, and runs them. It is
+possible to restrict the tests to a subset by specifying the names of
+particular spec files or by using some of the filtering options.
+
+Various options can be passed to B<rspec> to modify the output of the tests, or
+the way the tests are run.
+
+=head1 OPTIONS
+
+=over
+
+=item B<-I> I<PATH>
+
+Specify PATH to add to $LOAD_PATH (may be used more than once).
+
+=item B<-r>, B<--require> I<PATH>
+
+Require a file.
+
+=item B<-O>, B<--options> I<PATH>
+
+Specify the path to a custom options file.
+
+=item B<--order> I<TYPE>[:I<SEED>]
+
+Run examples by the specified order type. I<TYPE> can be either B<default>, for which 
+files are ordered based on the underlying file system's order, or B<rand>, for which 
+the order of files, groups and examples is randomized. B<random> is an alias
+for B<rand>. A I<SEED> can be indicated for the B<random> type, e.g. B<--order>
+B<random>:123
+
+=item     B<--seed> I<SEED>
+
+Equivalent of B<--order> B<rand>:I<SEED>.
+
+=item B<-d>, B<--debugger>
+
+Enable debugging.
+
+=item B<--fail-fast>
+
+Abort the run on first failure.
+
+=item B<--failure-exit-code> I<CODE>
+
+Override the exit code used when there are failing specs.
+
+=item B<-X>, B<-->[B<no->]B<drb>
+
+Run examples via DRb.
+
+=item B<--drb-port> I<PORT>
+
+Port to connect to the DRb server.
+
+=item B<--init>
+
+Initialize your project with RSpec.
+
+=item B<--configure>
+
+Deprecated. Use B<--init> instead.
+
+=back
+
+=head1 OUTPUT OPTIONS
+
+=over
+
+=item B<-f>, B<--format> I<FORMATTER>
+
+Choose a formatter. The various choices are [B<p>]B<rogress> (default - dots),
+[B<d>]B<ocumentation> (group and example names), [B<h>]B<tml>, [B<t>]B<extmate>
+or a custom formatter class name.
+
+=item B<-o>, B<--out> I<FILE>
+
+Write output to a file instead of STDOUT. This option applies
+to the previously specified B<--format>, or the default format
+if no format is specified.
+
+=item B<-b>, B<--backtrace>
+
+Enable full backtrace.
+
+=item B<-c>, B<-->[B<no->]B<color>, B<-->[B<no->]B<colour>
+
+Enable color in the output.
+
+=item B<-p>, B<--profile>
+
+Enable profiling of examples and list 10 slowest examples.
+
+=back
+
+=head1 FILTERING AND TAG OPTIONS
+
+In addition to the following options for selecting specific files, groups,
+or examples, you can select a single example by appending the line number to
+the filename:
+
+      rspec path/to/a_spec.rb:37
+
+=over
+
+=item B<-P>, B<--pattern> I<PATTERN>
+
+Load files matching pattern (default: "spec/**/*_spec.rb").
+
+=item B<-e>, B<--example> I<STRING>
+
+Run examples whose full nested names include I<STRING>.
+
+=item B<-l>, B<--line_number> I<LINE>
+
+Specify line number of an example or group (may be used more than once).
+
+=item B<-t>, B<--tag> I<TAG>[:I<VALUE>]
+
+Run examples with the specified tag, or exclude examples by adding ~ before the
+tag, e.g. ~slow.  I<TAG> is always converted to a symbol.
+
+=item B<--default_path> I<PATH>
+
+Set the default path where RSpec looks for examples (can be a path to a file or
+a directory).
+
+=back
+
+=head1 UTILITY OPTIONS
+
+=over
+
+=item B<-v>, B<--version>
+
+Display the version.
+
+=item B<-h>, B<--help>
+
+Display a message similar to this manpage.
+
+=back
+
+=head1 AUTHORS
+
+This man page inspired by the help message of B<rspec>, has been written by
+Cédric Boutillier for the Debian Project, but may be used by others.
diff --git a/debian/ruby-rspec-core.docs b/debian/ruby-rspec-core.docs
new file mode 100644
index 0000000..101b170
--- /dev/null
+++ b/debian/ruby-rspec-core.docs
@@ -0,0 +1,2 @@
+README.md
+features
diff --git a/debian/ruby-rspec-core.install b/debian/ruby-rspec-core.install
new file mode 100644
index 0000000..c3dad3c
--- /dev/null
+++ b/debian/ruby-rspec-core.install
@@ -0,0 +1 @@
+exe/rspec usr/bin/
diff --git a/debian/ruby-rspec-core.manpages b/debian/ruby-rspec-core.manpages
new file mode 100644
index 0000000..c188990
--- /dev/null
+++ b/debian/ruby-rspec-core.manpages
@@ -0,0 +1 @@
+man/rspec.1
diff --git a/debian/ruby-tests.rb b/debian/ruby-tests.rb
new file mode 100644
index 0000000..7cfc3a4
--- /dev/null
+++ b/debian/ruby-tests.rb
@@ -0,0 +1,9 @@
+$:.unshift 'spec'
+$:.unshift 'lib'
+require "rspec/core"
+EXC_TESTS = [
+  # require 'syntax' gem
+  'spec/rspec/core/formatters/text_mate_formatter_spec.rb',
+  'spec/rspec/core/formatters/html_formatter_spec.rb'
+]
+exit(RSpec::Core::Runner.run(Dir["spec/rspec/**/*_spec.rb"] - EXC_TESTS, $stderr, $stdout))
diff --git a/debian/rules b/debian/rules
index a5e7dc8..4ec3338 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,3 +13,21 @@
 
 %:
 	dh $@ --buildsystem=ruby --with ruby
+
+override_dh_installman:
+	mkdir man
+	pod2man --center "" --release "" --name RSPEC --utf8 debian/rspec.1.pod man/rspec.1
+	dh_installman
+
+override_dh_auto_install:
+	dh_auto_install
+	rm -rf debian/ruby-rspec-core/usr/lib/ruby/vendor_ruby/autotest/
+
+override_dh_auto_clean:
+	rm -rf man/
+	dh_auto_clean
+
+override_dh_installchangelogs:
+	dh_installchangelogs -pruby-rspec-core rspec-core/Changelog.md -O--buildsystem=ruby
+	dh_installchangelogs -pruby-rspec-expectations rspec-expectations/Changelog.md -O--buildsystem=ruby
+	dh_installchangelogs -pruby-rspec-mocks rspec-mocks/Changelog.md -O--buildsystem=ruby
diff --git a/debian/source/local-options b/debian/source/local-options
new file mode 100644
index 0000000..4aceb10
--- /dev/null
+++ b/debian/source/local-options
@@ -0,0 +1 @@
+unapply-patches
diff --git a/rspec-core/Changelog.md b/rspec-core/Changelog.md
new file mode 100644
index 0000000..61eed54
--- /dev/null
+++ b/rspec-core/Changelog.md
@@ -0,0 +1,881 @@
+### 2.14.5 / 2013-08-13
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.14.4...v2.14.5)
+
+Bug fixes:
+
+* Fix a `NoMethodError` that was being raised when there were no shared
+  examples or contexts declared and `RSpec.world.reset` is invoked.
+  (thepoho, Jon Rowe, Myron Marston)
+* Fix a deprecation warning that was being incorrectly displayed when
+  `shared_examples` are declared at top level in a `module` scope.
+  (Jon Rowe)
+* Fix after(:all) hooks so consecutive (same context) scopes will run even if
+  one raises an error. (Jon Rowe, Trejkaz)
+* JsonFormatter no longer dies if `dump_profile` isn't defined (Alex / @MasterLambaster, Jon Rowe)
+
+### 2.14.4 / 2013-07-21
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.14.3...v2.14.4)
+
+Bug fixes
+
+* Fix regression in 2.14: ensure configured requires (via `-r` option)
+  are loaded before spec files are loaded. This allows the spec files
+  to programatically change the file pattern (Jon Rowe).
+* Autoload `RSpec::Mocks` and `RSpec::Expectations` when referenced if
+  they are not already loaded (`RSpec::Matches` has been autoloaded
+  for a while). In the `rspec` gem, we changed it recently to stop
+  loading `rspec/mocks` and `rspec/expectations` by default, as some
+  users reported problems where they were intending to use mocha,
+  not rspec-mocks, but rspec-mocks was loaded and causing a conflict.
+  rspec-core loads mocks and expectations at the appropriate time, so
+  it seemed like a safe change -- but caused a problem for some authors
+  of libraries that integrate with RSpec. This fixes that problem.
+  (Myron Marston)
+* Gracefully handle a command like `rspec --profile path/to/spec.rb`:
+  the `path/to/spec.rb` arg was being wrongly treated as the `profile`
+  integer arg, which got cast `0` using `to_i`, causing no profiled
+  examples to be printed. (Jon Rowe)
+
+### 2.14.3 / 2013-07-13
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.14.2...v2.14.3)
+
+Bug fixes
+
+* Fix deprecation notices issued from `RSpec::Core::RakeTask` so
+  that they work properly when all of rspec-core is not loaded.
+  (This was a regression in 2.14) (Jon Rowe)
+
+### 2.14.2 / 2013-07-09
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.14.1...v2.14.2)
+
+Bug fixes
+
+* Fix regression caused by 2.14.1 release: formatters that
+  report that they `respond_to?` a notification, but had
+  no corresponding method would raise an error when registered.
+  The new fix is to just implement `start` on the deprecation
+  formatter to fix the original JRuby/ruby-debug issue.
+  (Jon Rowe)
+
+### 2.14.1 / 2013-07-08
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.14.0...v2.14.1)
+
+Bug fixes
+
+* Address deprecation formatter failure when using `ruby-debug` on
+  JRuby: fix `RSpec::Core::Reporter` to not send a notification
+  when the formatter's implementation of the notification method
+  comes from `Kernel` (Alex Portnov, Jon Rowe).
+
+### 2.14.0 / 2013-07-06
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.14.0.rc1...v2.14.0)
+
+Enhancements
+
+* Apply focus to examples defined with `fit` (equivalent of
+  `it "description", focus: true`) (Michael de Silva)
+
+Bug fixes
+
+* Ensure methods defined by `let` take precedence over others
+  when there is a name collision (e.g. from an included module).
+  (Jon Rowe, Andy Lindeman and Myron Marston)
+
+### 2.14.0.rc1 / 2013-05-27
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.13.1...v2.14.0.rc1)
+
+Enhancements
+
+* Improved Windows detection inside Git Bash, for better `--color` handling.
+* Add profiling of the slowest example groups to `--profile` option.
+  The output is sorted by the slowest average example groups.
+* Don't show slow examples if there's a failure and both `--fail-fast`
+  and `--profile` options are used (Paweł Gościcki).
+* Rather than always adding `spec` to the load path, add the configured
+  `--default-path` to the load path (which defaults to `spec`). This
+  better supports folks who choose to put their specs in a different
+  directory (John Feminella).
+* Add some logic to test time duration precision. Make it a
+  function of time, dropping precision as the time increases. (Aaron Kromer)
+* Add new `backtrace_inclusion_patterns` config option. Backtrace lines
+  that match one of these patterns will _always_ be included in the
+  backtrace, even if they match an exclusion pattern, too (Sam Phippen).
+* Support ERB trim mode using the `-` when parsing `.rspec` as ERB
+  (Gabor Garami).
+* Give a better error message when let and subject are called without a block.
+  (Sam Phippen).
+* List the precedence of `.rspec-local` in the configuration documentation
+  (Sam Phippen)
+* Support `{a,b}` shell expansion syntax in `--pattern` option
+  (Konstantin Haase).
+* Add cucumber documentation for --require command line option
+  (Bradley Schaefer)
+* Expose configruation options via config:
+  * `config.libs` returns the libs configured to be added onto the load path
+  * `full_backtrace?` returns the state of the backtrace cleaner
+  * `debug?` returns true when the debugger is loaded
+  * `line_numbers` returns the line numbers we are filtering by (if any)
+  * `full_description` returns the RegExp used to filter descriptions
+  (Jon Rowe)
+* Add setters for RSpec.world and RSpec.configuration (Alex Soulim)
+* Configure ruby's warning behaviour with `--warnings` (Jon Rowe)
+* Fix an obscure issue on old versions of `1.8.7` where `Time.dup` wouldn't
+  allow access to `Time.now` (Jon Rowe)
+* Make `shared_examples_for` context aware, so that keys may be safely reused
+  in multiple contexts without colliding. (Jon Rowe)
+* Add a configurable `deprecation_stream` (Jon Rowe)
+* Publish deprecations through a formatter (David Chelimsky)
+
+Bug fixes
+
+* Make JSON formatter behave the same when it comes to `--profile` as
+  the text formatter (Paweł Gościcki).
+* Fix named subjects so that if an inner group defines a method that
+  overrides the named method, `subject` still retains the originally
+  declared value (Myron Marston).
+* Fix random ordering so that it does not cause `rand` in examples in
+  nested sibling contexts to return the same value (Max Shytikov).
+* Use the new `backtrace_inclusion_patterns` config option to ensure
+  that folks who develop code in a directory matching one of the default
+  exclusion patterns (e.g. `gems`) still get the normal backtrace
+  filtering (Sam Phippen).
+* Fix ordering of `before` hooks so that `before` hooks declared in
+  `RSpec.configure` run before `before` hooks declared in a shared
+  context (Michi Huber and Tejas Dinkar).
+* Fix `Example#full_description` so that it gets filled in by the last
+  matcher description (as `Example#description` already did) when no
+  doc string has been provided (David Chelimsky).
+* Fix the memoized methods (`let` and `subject`) leaking `define_method`
+  as a `public` method. (Thomas Holmes and Jon Rowe) (#873)
+* Fix warnings coming from the test suite. (Pete Higgins)
+
+Deprecations
+
+* Deprecate `Configuration#backtrace_clean_patterns` in favor of
+  `Configuration#backtrace_exclusion_patterns` for greater consistency
+  and symmetry with new `backtrace_inclusion_patterns` config option
+  (Sam Phippen).
+* Deprecate `Configuration#requires=` in favor of using ruby's
+  `require`. Requires specified by the command line can still be
+  accessed by the `Configuration#require` reader. (Bradley Schaefer)
+* Deprecate calling `SharedExampleGroups` defined across sibling contexts
+  (Jon Rowe)
+
+### 2.13.1 / 2013-03-12
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.13.0...v2.13.1)
+
+Bug fixes
+
+* Use hook classes as proxies rather than extending hook blocks to support
+  lambdas for before/after/around hooks. (David Chelimsky)
+* Fix regression in 2.13.0 that caused confusing behavior when overriding
+  a named subject with an unnamed subject in an inner group and then
+  referencing the outer group subject's name. The fix for this required
+  us to disallow using `super` in a named subject (which is confusing,
+  anyway -- named subjects create 2 methods, so which method on the
+  parent example group are you `super`ing to?) but `super` in an unnamed
+  subject continues to work (Myron Marston).
+* Do not allow a referenced `let` or `subject` in `before(:all)` to cause
+  other `let` declarations to leak across examples (Myron Marston).
+* Work around odd ruby 1.9 bug with `String#match` that was triggered
+  by passing it a regex from a `let` declaration. For more info, see
+  http://bugs.ruby-lang.org/issues/8059 (Aaron Kromer).
+* Add missing `require 'set'` to `base_text_formatter.rb` (Tom
+  Anderson).
+
+Deprecations
+
+* Deprecate accessing `let` or `subject` declarations in `before(:all)`.
+  These were not intended to be called in a `before(:all)` hook, as
+  they exist to define state that is reset between each example, while
+  `before(:all)` exists to define state that is shared across examples
+  in an example group (Myron Marston).
+
+### 2.13.0 / 2013-02-23
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.12.2...v2.13.0)
+
+Enhancements
+
+* Allow `--profile` option to take a count argument that
+  determines the number of slow examples to dump
+  (Greggory Rothmeier).
+* Add `subject!` that is the analog to `let!`. It defines an
+  explicit subject and sets a `before` hook that will invoke
+  the subject (Zubin Henner).
+* Fix `let` and `subject` declaration so that `super`
+  and `return` can be used in them, just like in a normal
+  method. (Myron Marston)
+* Allow output colors to be configured individually.
+  (Charlie Maffitt)
+* Always dump slow examples when `--profile` option is given,
+  even when an example failed (Myron Marston).
+
+Bug fixes
+
+* Don't blow up when dumping error output for instances
+  of anonymous error classes (Myron Marston).
+* Fix default backtrace filters so lines from projects
+  containing "gems" in the name are not filtered, but
+  lines from installed gems still are (Myron Marston).
+* Fix autotest command so that is uses double quotes
+  rather than single quotes for windows compatibility
+  (Jonas Tingeborn).
+* Fix `its` so that uses of `subject` in a `before` or `let`
+  declaration in the parent group continue to reference the
+  parent group's subject. (Olek Janiszewski)
+
+### 2.12.2 / 2012-12-13
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.12.1...v2.12.2)
+
+Bug fixes
+
+* Fix `RSpec::Core::RakeTask` so that it is compatible with rake 0.8.7
+  on ruby 1.8.7. We had accidentally broke it in the 2.12 release
+  (Myron Marston).
+* Fix `RSpec::Core::RakeTask` so it is tolerant of the `Rspec` constant
+  for backwards compatibility (Patrick Van Stee)
+
+### 2.12.1 / 2012-12-01
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.12.0...v2.12.1)
+
+Bug fixes
+
+* Specs are run even if another at\_exit hook calls `exit`. This allows
+  Test::Unit and RSpec to run together. (Suraj N. Kurapati)
+* Fix full doc string concatenation so that it handles the case of a
+  method string (e.g. "#foo") being nested under a context string
+  (e.g. "when it is tuesday"), so that we get "when it is tuesday #foo"
+  rather than "when it is tuesday#foo". (Myron Marston)
+* Restore public API I unintentionally broke in 2.12.0:
+  `RSpec::Core::Formatters::BaseFormatter#format_backtrce(backtrace, example)`
+  (Myron Marston).
+
+### 2.12.0 / 2012-11-12
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.11.1...v2.12.0)
+
+Enhancements
+
+* Add support for custom ordering strategies for groups and examples.
+  (Myron Marston)
+* JSON Formatter (Alex Chaffee)
+* Refactor rake task internals (Sam Phippen)
+* Refactor HtmlFormatter (Pete Hodgson)
+* Autotest supports a path to Ruby that contains spaces (dsisnero)
+* Provide a helpful warning when a shared example group is redefined.
+  (Mark Burns).
+* `--default_path` can be specified as `--default-line`. `--line_number` can be
+  specified as `--line-number`. Hyphens are more idiomatic command line argument
+  separators (Sam Phippen).
+* A more useful error message is shown when an invalid command line option is
+  used (Jordi Polo).
+* Add `format_docstrings { |str| }` config option. It can be used to
+  apply formatting rules to example group and example docstrings.
+  (Alex Tan)
+* Add support for an `.rspec-local` options file. This is intended to
+  allow individual developers to set options in a git-ignored file that
+  override the common project options in `.rspec`. (Sam Phippen)
+* Support for mocha 0.13.0. (Andy Lindeman)
+
+Bug fixes
+
+* Remove override of `ExampleGroup#ancestors`. This is a core ruby method that
+  RSpec shouldn't override. Instead, define `ExampleGroup#parent_groups`. (Myron
+  Marston)
+* Limit monkey patching of shared example/context declaration methods
+  (`shared_examples_for`, etc.) to just the objects that need it rather than
+  every object in the system (Myron Marston).
+* Fix Metadata#fetch to support computed values (Sam Goldman).
+* Named subject can now be referred to from within subject block in a nested
+  group (tomykaira).
+* Fix `fail_fast` so that it properly exits when an error occurs in a
+  `before(:all) hook` (Bradley Schaefer).
+* Make the order spec files are loaded consistent, regardless of the
+  order of the files returned by the OS or the order passed at
+  the command line (Jo Liss and Sam Phippen).
+* Ensure instance variables from `before(:all)` are always exposed
+  from `after(:all)`, even if an error occurs in `before(:all)`
+  (Sam Phippen).
+* `rspec --init` no longer generates an incorrect warning about `--configure`
+  being deprecated (Sam Phippen).
+* Fix pluralization of `1 seconds` (Odin Dutton)
+* Fix ANSICON url (Jarmo Pertman)
+* Use dup of Time so reporting isn't clobbered by examples that modify Time
+  without properly restoring it. (David Chelimsky)
+
+Deprecations
+
+* `share_as` is no longer needed. `shared_context` and/or
+  `RSpec::SharedContext` provide better mechanisms (Sam Phippen).
+* Deprecate `RSpec.configuration` with a block (use `RSpec.configure`).
+
+
+### 2.11.1 / 2012-07-18
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.11.0...v2.11.1)
+
+Bug fixes
+
+* Fix the way we autoload RSpec::Matchers so that custom matchers can be
+  defined before rspec-core has been configured to definitely use
+  rspec-expectations. (Myron Marston)
+* Fix typo in --help message printed for -e option. (Jo Liss)
+* Fix ruby warnings. (Myron Marston)
+* Ignore mock expectation failures when the example has already failed.
+  Mock expectation failures have always been ignored in this situation,
+  but due to my changes in 27059bf1 it was printing a confusing message.
+  (Myron Marston).
+
+### 2.11.0 / 2012-07-07
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.10.1...v2.11.0)
+
+Enhancements
+
+* Support multiple `--example` options. (Daniel Doubrovkine @dblock)
+* Named subject e.g. `subject(:article) { Article.new }`
+    * see [http://blog.davidchelimsky.net/2012/05/13/spec-smell-explicit-use-of-subject/](http://blog.davidchelimsky.net/2012/05/13/spec-smell-explicit-use-of-subject/)
+      for background.
+    * thanks to Bradley Schaefer for suggesting it and Avdi Grimm for almost
+      suggesting it.
+* `config.mock_with` and `config.expect_with` yield custom config object to a
+  block if given
+    * aids decoupling from rspec-core's configuation
+* `include_context` and `include_examples` support a block, which gets eval'd
+  in the current context (vs the nested context generated by `it_behaves_like`).
+* Add `config.order = 'random'` to the `spec_helper.rb` generated by `rspec
+  --init`.
+* Delay the loading of DRb (Myron Marston).
+* Limit monkey patching of `describe` onto just the objects that need it rather
+  than every object in the system (Myron Marston).
+
+Bug fixes
+
+* Support alternative path separators. For example, on Windows, you can now do
+  this: `rspec spec\subdir`. (Jarmo Pertman @jarmo)
+* When an example raises an error and an after or around hook does as
+  well, print out the hook error. Previously, the error was silenced and
+  the user got no feedback about what happened. (Myron Marston)
+* `--require` and `-I` are merged among different configuration sources (Andy
+  Lindeman)
+* Delegate to mocha methods instead of aliasing them in mocha adapter.
+
+### 2.10.1 / 2012-05-19
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.10.0...v2.10.1)
+
+Bug fixes
+
+* `RSpec.reset` properly reinits configuration and world
+* Call `to_s` before `split` on exception messages that might not always be
+  Strings (slyphon)
+
+### 2.10.0 / 2012-05-03
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.9.0...v2.10.0)
+
+Enhancements
+
+* Add `prepend_before` and `append_after` hooks (preethiramdev)
+    * intended for extension libs
+    * restores rspec-1 behavior
+* Reporting of profiled examples (moro)
+    * Report the total amount of time taken for the top slowest examples.
+    * Report what percentage the slowest examples took from the total runtime.
+
+Bug fixes
+
+* Properly parse `SPEC_OPTS` options.
+* `example.description` returns the location of the example if there is no
+  explicit description or matcher-generated description.
+* RDoc fixes (Grzegorz Świrski)
+* Do not modify example ancestry when dumping errors (Michael Grosser)
+
+### 2.9.0 / 2012-03-17
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.8.0...v2.9.0)
+
+Enhancements
+
+* Support for "X minutes X seconds" spec run duration in formatter. (uzzz)
+* Strip whitespace from group and example names in doc formatter.
+* Removed spork-0.9 shim. If you're using spork-0.8.x, you'll need to upgrade
+  to 0.9.0.
+
+Bug fixes
+
+* Restore `--full_backtrace` option
+* Ensure that values passed to `config.filter_run` are respected when running
+  over DRb (using spork).
+* Ensure shared example groups are reset after a run (as example groups are).
+* Remove `rescue false` from calls to filters represented as Procs
+* Ensure `described_class` gets the closest constant (pyromaniac)
+* In "autorun", don't run the specs in the `at_exit` hook if there was an
+  exception (most likely due to a SyntaxError). (sunaku)
+* Don't extend groups with modules already used to extend ancestor groups.
+* `its` correctly memoizes nil or false values (Yamada Masaki)
+
+### 2.8.0 / 2012-01-04
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.8.0.rc2...v2.8.0)
+
+Bug fixes
+
+* For metadata filtering, restore passing the entire array to the proc, rather
+  than each item in the array (weidenfreak)
+* Ensure each spec file is loaded only once
+    * Fixes a bug that caused all the examples in a file to be run when
+      referenced twice with line numbers in a command, e.g.
+        * `rspec path/to/file:37 path/to/file:42`
+
+### 2.8.0.rc2 / 2011-12-19
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.8.0.rc1...v2.8.0.rc2)
+
+Enhancments
+
+* new `--init` command (Peter Schröder)
+    * generates `spec/spec_helper.rb`
+    * deletes obsolete files (on confirmation)
+    * merged with and deprecates `--configure` command, which generated
+      `.rspec`
+* use `require_relative` when available (Ian Leitch)
+* `include_context` and `include_examples` accept params (Calvin Bascom)
+* print the time for every example in the html formatter (Richie Vos)
+* several tasty refactoring niblets (Sasha)
+* `it "does something", :x => [:foo,'bar',/baz/] (Ivan Neverov)
+    * supports matching n command line tag values with an example or group
+
+### 2.8.0.rc1 / 2011-11-06
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.7.1...v2.8.0.rc1)
+
+Enhancements
+
+* `--order` (Justin Ko)
+    * run examples in random order: `--order rand`
+    * specify the seed: `--order rand:123`
+* `--seed SEED`
+    * equivalent of `--order rand:SEED`
+* SharedContext supports `let` (David Chelimsky)
+* Filter improvements (David Chelimsky)
+    * override opposing tags from the command line
+    * override RSpec.configure tags from the command line
+    * `--line_number 37` overrides all other filters
+    * `path/to/file.rb:37` overrides all other filters
+    * refactor: consolidate filter management in a FilterManger object
+* Eliminate Ruby warnings (Matijs van Zuijlen)
+* Make reporter.report an API (David Chelimsky)
+    * supports extension tools like interative_rspec
+
+Changes
+
+* change `config.color_enabled` (getter/setter/predicate) to `color` to align
+  with `--[no]-color` CLI option.
+    * `color_enabled` is still supported for now, but will likley be deprecated
+      in a 2.x release so we can remove it in 3.0.
+
+Bug fixes
+
+* Make sure the `bar` in `--tag foo:bar` makes it to DRb (Aaron Gibralter)
+* Fix bug where full descriptions of groups nested 3 deep  were repeated.
+* Restore report of time to run to start after files are loaded.
+    * fixes bug where run times were cumalitive in spork
+    * fixes compatibility with time-series metrics
+* Don't error out when `config.mock_with` or `expect_with` is re-specifying the
+  current config (Myron Marston)
+
+* Deprecations
+    * :alias option on `configuration.add_setting`. Use `:alias_with` on the
+      original setting declaration instead.
+
+### 2.7.1 / 2011-10-20
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.7.0...v2.7.1)
+
+Bug fixes
+
+* tell autotest the correct place to find the rspec executable
+
+### 2.7.0 / 2011-10-16
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.4...v2.7.0)
+
+NOTE: RSpec's release policy dictates that there should not be any backward
+incompatible changes in minor releases, but we're making an exception to
+release a change to how RSpec interacts with other command line tools.
+
+As of 2.7.0, you must explicity `require "rspec/autorun"` unless you use the
+`rspec` command (which already does this for you).
+
+Enhancements
+
+* Add `example.exception` (David Chelimsky)
+* `--default_path` command line option (Justin Ko)
+* support multiple `--line_number` options (David J. Hamilton)
+    * also supports `path/to/file.rb:5:9` (runs examples on lines 5 and 9)
+* Allow classes/modules to be used as shared example group identifiers (Arthur
+  Gunn)
+* Friendly error message when shared context cannot be found (Sławosz
+  Sławiński)
+* Clear formatters when resetting config (John Bintz)
+* Add `xspecify` and xexample as temp-pending methods (David Chelimsky)
+* Add `--no-drb` option (Iain Hecker)
+* Provide more accurate run time by registering start time before code is
+  loaded (David Chelimsky)
+    * reverted in 2.8.0
+* Rake task default pattern finds specs in symlinked dirs (Kelly Felkins)
+* Rake task no longer does anything to invoke bundler since Bundler already
+  handles it for us. Thanks to Andre Arko for the tip.
+* Add `--failure-exit-code` option (Chris Griego)
+
+Bug fixes
+
+* Include `Rake::DSL` to remove deprecation warnings in Rake > 0.8.7 (Pivotal
+  Casebook)
+* Only eval `let` block once even if it returns `nil` (Adam Meehan)
+* Fix `--pattern` option (wasn't being recognized) (David Chelimsky)
+* Only implicitly `require "rspec/autorun"` with the `rspec` command (David
+  Chelimsky)
+* Ensure that rspec's `at_exit` defines the exit code (Daniel Doubrovkine)
+* Show the correct snippet in the HTML and TextMate formatters (Brian Faherty)
+
+### 2.6.4 / 2011-06-06
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.3...v2.6.4)
+
+NOTE: RSpec's release policy dictates that there should not be new
+functionality in patch releases, but this minor enhancement slipped in by
+accident.  As it doesn't add a new API, we decided to leave it in rather than
+roll back this release.
+
+Enhancements
+
+* Add summary of commands to run individual failed examples.
+
+Bug fixes
+
+* Support exclusion filters in DRb. (Yann Lugrin)
+* Fix --example escaping when run over DRb. (Elliot Winkler)
+* Use standard ANSI codes for color formatting so colors work in a wider set of
+  color schemes.
+
+### 2.6.3 / 2011-05-24
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.2...v2.6.3)
+
+Bug fixes
+
+* Explicitly convert exit code to integer, avoiding TypeError when return
+  value of run is IO object proxied by `DRb::DRbObject` (Julian Scheid)
+* Clarify behavior of `--example` command line option
+* Build using a rubygems-1.6.2 to avoid downstream yaml parsing error
+
+### 2.6.2 / 2011-05-21
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.1...v2.6.2)
+
+Bug fixes
+
+* Warn rather than raise when HOME env var is not defined
+* Properly merge command-line exclusions with default :if and :unless (joshcooper)
+
+### 2.6.1 / 2011-05-19
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.6.0...v2.6.1)
+
+Bug fixes
+
+* Don't extend nil when filters are nil
+* `require 'rspec/autorun'` when running rcov.
+
+### 2.6.0 / 2011-05-12
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.1...v2.6.0)
+
+Enhancements
+
+* `shared_context` (Damian Nurzynski)
+    * extend groups matching specific metadata with:
+        * method definitions
+        * subject declarations
+        * let/let! declarations
+        * etc (anything you can do in a group)
+* `its([:key])` works for any subject with #[]. (Peter Jaros)
+* `treat_symbols_as_metadata_keys_with_true_values` (Myron Marston)
+* Print a deprecation warning when you configure RSpec after defining an
+  example.  All configuration should happen before any examples are defined.
+  (Myron Marston)
+* Pass the exit status of a DRb run to the invoking process. This causes specs
+  run via DRb to not just return true or false. (Ilkka Laukkanen)
+* Refactoring of `ConfigurationOptions#parse_options` (Rodrigo Rosenfeld Rosas)
+* Report excluded filters in runner output (tip from andyl)
+* Clean up messages for filters/tags.
+* Restore --pattern/-P command line option from rspec-1
+* Support false as well as true in config.full_backtrace= (Andreas Tolf
+  Tolfsen)
+
+Bug fixes
+
+* Don't stumble over an exception without a message (Hans Hasselberg)
+* Remove non-ascii characters from comments that were choking rcov (Geoffrey
+  Byers)
+* Fixed backtrace so it doesn't include lines from before the autorun at_exit
+  hook (Myron Marston)
+* Include RSpec::Matchers when first example group is defined, rather than just
+  before running the examples.  This works around an obscure bug in ruby 1.9
+  that can cause infinite recursion. (Myron Marston)
+* Don't send `example_group_[started|finished]` to formatters for empty groups.
+* Get specs passing on jruby (Sidu Ponnappa)
+* Fix bug where mixing nested groups and outer-level examples gave
+  unpredictable :line_number behavior (Artur Małecki)
+* Regexp.escape the argument to --example (tip from Elliot Winkler)
+* Correctly pass/fail pending block with message expectations
+* CommandLine returns exit status (0/1) instead of true/false
+* Create path to formatter output file if it doesn't exist (marekj).
+
+
+### 2.5.1 / 2011-02-06
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.5.0...v2.5.1)
+
+NOTE: this release breaks compatibility with rspec/autotest/bundler
+integration, but does so in order to greatly simplify it.
+
+With this release, if you want the generated autotest command to include
+'bundle exec', require Autotest's bundler plugin in a .autotest file in the
+project's root directory or in your home directory:
+
+    require "autotest/bundler"
+
+Now you can just type 'autotest' on the commmand line and it will work as you expect.
+
+If you don't want 'bundle exec', there is nothing you have to do.
+
+### 2.5.0 / 2011-02-05
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.4.0...v2.5.0)
+
+Enhancements
+
+* Autotest::Rspec2 parses command line args passed to autotest after '--'
+* --skip-bundler option for autotest command
+* Autotest regexp fixes (Jon Rowe)
+* Add filters to html and textmate formatters (Daniel Quimper)
+* Explicit passing of block (need for JRuby 1.6) (John Firebaugh)
+
+Bug fixes
+
+* fix dom IDs in HTML formatter (Brian Faherty)
+* fix bug with --drb + formatters when not running in drb
+* include --tag options in drb args (monocle)
+* fix regression so now SPEC_OPTS take precedence over CLI options again (Roman
+  Chernyatchik)
+* only call its(:attribute) once (failing example from Brian Dunn)
+* fix bizarre bug where rspec would hang after String.alias :to_int :to_i
+  (Damian Nurzynski)
+
+Deprecations
+
+* implicit inclusion of 'bundle exec' when Gemfile present (use autotest's
+  bundler plugin instead)
+
+### 2.4.0 / 2011-01-02
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.3.1...v2.4.0)
+
+Enhancements
+
+* start the debugger on -d so the stack trace is visible when it stops
+  (Clifford Heath)
+* apply hook filtering to examples as well as groups (Myron Marston)
+* support multiple formatters, each with their own output
+* show exception classes in failure messages unless they come from RSpec
+  matchers or message expectations
+* before(:all) { pending } sets all examples to pending
+
+Bug fixes
+
+* fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota
+  Fukumori)
+* fix bug when running in jruby: be explicit about passing block to super (John
+  Firebaugh)
+* rake task doesn't choke on paths with quotes (Janmejay Singh)
+* restore --options option from rspec-1
+* require 'ostruct' to fix bug with its([key]) (Kim Burgestrand)
+* --configure option generates .rspec file instead of autotest/discover.rb
+
+### 2.3.1 / 2010-12-16
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.3.0...v2.3.1)
+
+Bug fixes
+
+* send debugger warning message to $stdout if RSpec.configuration.error_stream
+  has not been defined yet.
+* HTML Formatter _finally_ properly displays nested groups (Jarmo Pertman)
+* eliminate some warnings when running RSpec's own suite (Jarmo Pertman)
+
+### 2.3.0 / 2010-12-12
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.2.1...v2.3.0)
+
+Enhancements
+
+* tell autotest to use "rspec2" if it sees a .rspec file in the project's root
+  directory
+    * replaces the need for ./autotest/discover.rb, which will not work with
+      all versions of ZenTest and/or autotest
+* config.expect_with
+    * :rspec          # => rspec/expectations
+    * :stdlib         # => test/unit/assertions
+    * :rspec, :stdlib # => both
+
+Bug fixes
+
+* fix dev Gemfile to work on non-mac-os machines (Lake Denman)
+* ensure explicit subject is only eval'd once (Laszlo Bacsi)
+
+### 2.2.1 / 2010-11-28
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.2.0...v2.2.1)
+
+Bug fixes
+* alias_method instead of override Kernel#method_missing (John Wilger)
+* changed --autotest to --tty in generated command (MIKAMI Yoshiyuki)
+* revert change to debugger (had introduced conflict with Rails)
+    * also restored --debugger/-debug option
+
+### 2.2.0 / 2010-11-28
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.1.0...v2.2.0)
+
+Deprecations/changes
+
+* --debug/-d on command line is deprecated and now has no effect
+* win32console is now ignored; Windows users must use ANSICON for color support
+  (Bosko Ivanisevic)
+
+Enhancements
+
+* When developing locally rspec-core now works with the rspec-dev setup or your
+  local gems
+* Raise exception with helpful message when rspec-1 is loaded alongside rspec-2
+  (Justin Ko)
+* debugger statements _just work_ as long as ruby-debug is installed
+  * otherwise you get warned, but not fired
+* Expose example.metadata in around hooks
+* Performance improvments (much faster now)
+
+Bug fixes
+
+* Make sure --fail-fast makes it across drb
+* Pass -Ilib:spec to rcov
+
+### 2.1.0 / 2010-11-07
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.1...v2.1.0)
+
+Enhancments
+
+* Add skip_bundler option to rake task to tell rake task to ignore the presence
+  of a Gemfile (jfelchner)
+* Add gemfile option to rake task to tell rake task what Gemfile to look for
+  (defaults to 'Gemfile')
+* Allow passing caller trace into Metadata to support extensions (Glenn
+  Vanderburg)
+* Add deprecation warning for Spec::Runner.configure to aid upgrade from
+  RSpec-1
+* Add deprecated Spec::Rake::SpecTask to aid upgrade from RSpec-1
+* Add 'autospec' command with helpful message to aid upgrade from RSpec-1
+* Add support for filtering with tags on CLI (Lailson Bandeira)
+* Add a helpful message about RUBYOPT when require fails in bin/rspec (slyphon)
+* Add "-Ilib" to the default rcov options (Tianyi Cui)
+* Make the expectation framework configurable (default rspec, of course)
+  (Justin Ko)
+* Add 'pending' to be conditional (Myron Marston)
+* Add explicit support for :if and :unless as metadata keys for conditional run
+  of examples (Myron Marston)
+* Add --fail-fast command line option (Jeff Kreeftmeijer)
+
+Bug fixes
+
+* Eliminate stack overflow with "subject { self }"
+* Require 'rspec/core' in the Raketask (ensures it required when running rcov)
+
+### 2.0.1 / 2010-10-18
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0...v2.0.1)
+
+Bug fixes
+
+* Restore color when using spork + autotest
+* Pending examples without docstrings render the correct message (Josep M.
+  Bach)
+* Fixed bug where a failure in a spec file ending in anything but _spec.rb
+  would fail in a confusing way.
+* Support backtrace lines from erb templates in html formatter (Alex Crichton)
+
+### 2.0.0 / 2010-10-10
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.rc...v2.0.0)
+
+RSpec-1 compatibility
+
+* Rake task uses ENV["SPEC"] as file list if present
+
+Bug fixes
+
+* Bug Fix: optparse --out foo.txt (Leonardo Bessa)
+* Suppress color codes for non-tty output (except autotest)
+
+### 2.0.0.rc / 2010-10-05
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.22...v2.0.0.rc)
+
+Enhancements
+
+* implicitly require unknown formatters so you don't have to require the file
+  explicitly on the commmand line (Michael Grosser)
+* add --out/-o option to assign output target
+* added fail_fast configuration option to abort on first failure
+* support a Hash subject (its([:key]) { should == value }) (Josep M. Bach)
+
+Bug fixes
+
+* Explicitly require rspec version to fix broken rdoc task (Hans de Graaff)
+* Ignore backtrace lines that come from other languages, like Java or
+  Javascript (Charles Lowell)
+* Rake task now does what is expected when setting (or not setting)
+  fail_on_error and verbose
+* Fix bug in which before/after(:all) hooks were running on excluded nested
+  groups (Myron Marston)
+* Fix before(:all) error handling so that it fails examples in nested groups,
+  too (Myron Marston)
+
+### 2.0.0.beta.22 / 2010-09-12
+
+[full changelog](http://github.com/rspec/rspec-core/compare/v2.0.0.beta.20...v2.0.0.beta.22)
+
+Enhancements
+
+* removed at_exit hook
+* CTRL-C stops the run (almost) immediately
+    * first it cleans things up by running the appropriate after(:all) and
+      after(:suite) hooks
+    * then it reports on any examples that have already run
+* cleaned up rake task
+    * generate correct task under variety of conditions
+    * options are more consistent
+    * deprecated redundant options
+* run 'bundle exec autotest' when Gemfile is present
+* support ERB in .rspec options files (Justin Ko)
+* depend on bundler for development tasks (Myron Marston)
+* add example_group_finished to formatters and reporter (Roman Chernyatchik)
+
+Bug fixes
+
+* support paths with spaces when using autotest (Andreas Neuhaus)
+* fix module_exec with ruby 1.8.6 (Myron Marston)
+* remove context method from top-level
+    * was conflicting with irb, for example
+* errors in before(:all) are now reported correctly (Chad Humphries)
+
+Removals
+
+* removed -o --options-file command line option
+    * use ./.rspec and ~/.rspec
diff --git a/License.txt b/rspec-core/License.txt
similarity index 100%
copy from License.txt
copy to rspec-core/License.txt
diff --git a/rspec-core/README.md b/rspec-core/README.md
new file mode 100644
index 0000000..4b4d185
--- /dev/null
+++ b/rspec-core/README.md
@@ -0,0 +1,261 @@
+# rspec-core [![Build Status](https://secure.travis-ci.org/rspec/rspec-core.png?branch=master)](http://travis-ci.org/rspec/rspec-core) [![Code Climate](https://codeclimate.com/github/rspec/rspec-core.png)](https://codeclimate.com/github/rspec/rspec-core)
+
+rspec-core provides the structure for writing executable examples of how your
+code should behave, and an `rspec` command with tools to constrain which
+examples get run and tailor the output.
+
+## install
+
+    gem install rspec      # for rspec-core, rspec-expectations, rspec-mocks
+    gem install rspec-core # for rspec-core only
+    rspec --help
+
+## basic structure
+
+RSpec uses the words "describe" and "it" so we can express concepts like a conversation:
+
+    "Describe an order."
+    "It sums the prices of its line items."
+
+```ruby
+describe Order do
+  it "sums the prices of its line items" do
+    order = Order.new
+    order.add_entry(LineItem.new(:item => Item.new(
+      :price => Money.new(1.11, :USD)
+    )))
+    order.add_entry(LineItem.new(:item => Item.new(
+      :price => Money.new(2.22, :USD),
+      :quantity => 2
+    )))
+    expect(order.total).to eq(Money.new(5.55, :USD))
+  end
+end
+```
+
+The `describe` method creates an [ExampleGroup](http://rubydoc.info/gems/rspec-core/RSpec/Core/ExampleGroup).  Within the
+block passed to `describe` you can declare examples using the `it` method.
+
+Under the hood, an example group is a class in which the block passed to
+`describe` is evaluated. The blocks passed to `it` are evaluated in the
+context of an _instance_ of that class.
+
+## nested groups
+
+You can also declare nested nested groups using the `describe` or `context`
+methods:
+
+```ruby
+describe Order do
+  context "with no items" do
+    it "behaves one way" do
+      # ...
+    end
+  end
+
+  context "with one item" do
+    it "behaves another way" do
+      # ...
+    end
+  end
+end
+```
+
+## aliases
+
+You can declare example groups using either `describe` or `context`, though
+only `describe` is available at the top level.
+
+You can declare examples within a group using any of `it`, `specify`, or
+`example`.
+
+## shared examples and contexts
+
+Declare a shared example group using `shared_examples`, and then include it
+in any group using `include_examples`.
+
+```ruby
+shared_examples "collections" do |collection_class|
+  it "is empty when first created" do
+    expect(collection_class.new).to be_empty
+  end
+end
+
+describe Array do
+  include_examples "collections", Array
+end
+
+describe Hash do
+  include_examples "collections", Hash
+end
+```
+
+Nearly anything that can be declared within an example group can be declared
+within a shared example group. This includes `before`, `after`, and `around`
+hooks, `let` declarations, and nested groups/contexts.
+
+You can also use the names `shared_context` and `include_context`. These are
+pretty much the same as `shared_examples` and `include_examples`, providing
+more accurate naming when you share hooks, `let` declarations, helper methods,
+etc, but no examples.
+
+## metadata
+
+rspec-core stores a metadata hash with every example and group, which
+contains their descriptions, the locations at which they were
+declared, etc, etc. This hash powers many of rspec-core's features,
+including output formatters (which access descriptions and locations),
+and filtering before and after hooks.
+
+Although you probably won't ever need this unless you are writing an
+extension, you can access it from an example like this:
+
+```ruby
+it "does something" do
+  expect(example.metadata[:description]).to eq("does something")
+end
+```
+
+### `described_class`
+
+When a class is passed to `describe`, you can access it from an example
+using the `described_class` method, which is a wrapper for
+`example.metadata[:described_class]`.
+
+```ruby
+describe Widget do
+  example do
+    expect(described_class).to equal(Widget)
+  end
+end
+```
+
+This is useful in extensions or shared example groups in which the specific
+class is unknown. Taking the collections shared example group from above, we can
+clean it up a bit using `described_class`:
+
+```ruby
+shared_examples "collections" do
+  it "is empty when first created" do
+    expect(described_class.new).to be_empty
+  end
+end
+
+describe Array do
+  include_examples "collections"
+end
+
+describe Hash do
+  include_examples "collections"
+end
+```
+
+## the `rspec` command
+
+When you install the rspec-core gem, it installs the `rspec` executable,
+which you'll use to run rspec. The `rspec` command comes with many useful
+options.
+Run `rspec --help` to see the complete list.
+
+## store command line options `.rspec`
+
+You can store command line options in a `.rspec` file in the project's root
+directory, and the `rspec` command will read them as though you typed them on
+the command line.
+
+## autotest integration
+
+rspec-core ships with an Autotest extension, which is loaded automatically if
+there is a `.rspec` file in the project's root directory.
+
+## rcov integration
+
+rcov is best integrated via the [rcov rake
+task](http://www.rubydoc.info/github/relevance/rcov/master/Rcov/RcovTask).
+
+rcov can also be integrated via the rspec rake task, but it requires a bit
+more setup:
+
+```ruby
+# Rakefile
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec) do |config|
+  config.rcov = true
+end
+
+task :default => :spec
+
+# spec/spec_helper.rb
+require 'rspec/autorun' # **add this**
+```
+
+## get started
+
+Start with a simple example of behavior you expect from your system. Do
+this before you write any implementation code:
+
+```ruby
+# in spec/calculator_spec.rb
+describe Calculator do
+  describe '#add' do
+    it 'returns the sum of its arguments' do
+      expect(Calculator.new.add(1, 2)).to eq(3)
+    end
+  end
+end
+```
+
+Run this with the rspec command, and watch it fail:
+
+```
+$ rspec spec/calculator_spec.rb
+./spec/calculator_spec.rb:1: uninitialized constant Calculator
+```
+
+Implement the simplest solution:
+
+```ruby
+# in lib/calculator.rb
+class Calculator
+  def add(a,b)
+    a + b
+  end
+end
+```
+
+Be sure to require the implementation file in the spec:
+
+```ruby
+# in spec/calculator_spec.rb
+# - RSpec adds ./lib to the $LOAD_PATH
+require "calculator"
+```
+
+Now run the spec again, and watch it pass:
+
+```
+$ rspec spec/calculator_spec.rb
+.
+
+Finished in 0.000315 seconds
+1 example, 0 failures
+```
+
+Use the `documentation` formatter to see the resulting spec:
+
+```
+$ rspec spec/calculator_spec.rb --format doc
+Calculator
+  #add
+    returns the sum of its arguments
+
+Finished in 0.000379 seconds
+1 example, 0 failures
+```
+
+## Also see
+
+* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
+* [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations)
+* [http://github.com/rspec/rspec-mocks](http://github.com/rspec/rspec-mocks)
diff --git a/rspec-core/exe/autospec b/rspec-core/exe/autospec
new file mode 100755
index 0000000..9085ebb
--- /dev/null
+++ b/rspec-core/exe/autospec
@@ -0,0 +1,13 @@
+#!/usr/bin/env ruby
+require 'rspec/core/deprecation'
+RSpec.warn_deprecation <<-WARNING
+************************************************************
+REMOVAL NOTICE: you are using behaviour that has been
+removed from rspec-2.
+
+* The 'autospec' command is no longer supported.
+* Please use 'autotest' instead.
+
+This message will be removed from a future version of rspec.
+************************************************************
+WARNING
diff --git a/rspec-core/exe/rspec b/rspec-core/exe/rspec
new file mode 100755
index 0000000..b0dd17e
--- /dev/null
+++ b/rspec-core/exe/rspec
@@ -0,0 +1,25 @@
+#!/usr/bin/env ruby
+
+begin
+  require 'rspec/autorun'
+rescue LoadError
+  $stderr.puts <<-EOS
+#{'*'*50}
+  Could not find 'rspec/autorun'
+
+  This may happen if you're using rubygems as your package manager, but it is not
+  being required through some mechanism before executing the rspec command.
+
+  You may need to do one of the following in your shell:
+
+    # for bash/zsh
+    export RUBYOPT=rubygems
+
+    # for csh, etc.
+    set RUBYOPT=rubygems
+
+  For background, please see http://gist.github.com/54177.
+#{'*'*50}
+  EOS
+  exit(1)
+end
diff --git a/rspec-core/features/Autotest.md b/rspec-core/features/Autotest.md
new file mode 100644
index 0000000..e30c382
--- /dev/null
+++ b/rspec-core/features/Autotest.md
@@ -0,0 +1,38 @@
+RSpec ships with a specialized subclass of Autotest. To use it, just add a
+`.rspec` file to your project's root directory, and run the `autotest` command
+as normal:
+
+    $ autotest
+
+## Bundler
+
+The `autotest` command generates a shell command that runs your specs. If you
+are using Bundler, and you want the shell command to include `bundle exec`,
+require the Autotest bundler plugin in a `.autotest` file in the project's root
+directory or your home directory:
+
+    # in .autotest
+    require "autotest/bundler"
+
+## Upgrading from previous versions of rspec
+
+Previous versions of RSpec used a different mechanism for telling autotest to
+invoke RSpec's Autotest extension: it generated an `autotest/discover.rb` file
+in the project's root directory. This is no longer necessary with the new
+approach of RSpec looking for a `.rspec` file, so feel free to delete the
+`autotest/discover.rb` file in the project root if you have one.
+
+## Gotchas
+
+### Invalid Option: --tty
+
+The `--tty` option was [added in rspec-core-2.2.1](changelog), and is used
+internally by RSpec. If you see an error citing it as an invalid option, you'll
+probably see there are two or more versions of rspec-core in the backtrace: one
+< 2.2.1 and one >= 2.2.1.
+
+This usually happens because you have a newer rspec-core installed, and an
+older rspec-core specified in a Bundler Gemfile. If this is the case, you can:
+
+1. specify the newer version in the Gemfile (recommended)
+2. prefix the `autotest` command with `bundle exec`
diff --git a/rspec-core/features/README.md b/rspec-core/features/README.md
new file mode 100644
index 0000000..fbad5b7
--- /dev/null
+++ b/rspec-core/features/README.md
@@ -0,0 +1,17 @@
+rspec-core provides the structure for RSpec code examples:
+
+    describe Account do
+      it "has a balance of zero when first opened" do
+        # example code goes here - for more on the
+        # code inside the examples, see rspec-expectations
+        # and rspec-mocks
+      end
+    end
+
+## Issues
+
+This documentation is [open
+source](https://github.com/rspec/rspec-core/tree/master/features), and a work
+in progress.  If you find it incomplete or confusing, please [submit an
+issue](http://github.com/rspec/rspec-core/issues), or, better yet, [a pull
+request](http://github.com/rspec/rspec-core).
diff --git a/rspec-core/features/Upgrade.md b/rspec-core/features/Upgrade.md
new file mode 100644
index 0000000..e78d445
--- /dev/null
+++ b/rspec-core/features/Upgrade.md
@@ -0,0 +1,364 @@
+The [Changelog](changelog) has a complete list of everything that changed, but
+here are more detailed explanations for those items that warrant them.
+
+# rspec-core-2.7.0.rc1
+
+## what's new
+
+### `rspec` command with no arguments
+
+Now you can just type
+
+    rspec
+
+to run all the specs in the `spec` directory.  If you keep your specs in a
+different directory, you can override the default with the `--default_path`
+argument in a config file:
+
+    # in .rspec
+    --default_path specs
+
+### `rspec` command supports multiple line numbers
+
+Use either of the following to run the examples declared on lines
+37 and 42 of `a_spec.rb`:
+
+    rspec path/to/a_spec.rb --line_number 37 --line_number 42
+    rspec path/to/a_spec.rb:37:42
+
+## what's changed
+
+### `skip_bundler` and `gemfile` rake task options are deprecated and have no effect.
+
+RSpec's rake task invokes the `rspec` command in a subshell. If you invoke
+`bundle exec rake` or include `Bundler.setup` in your `Rakefile`, then
+Bundler will be activated in the subshell as well.
+
+Previously, the rake task managed this for you based on the presence of a
+`Gemfile`. In 2.7.0.rc1, this is done based on the presence of the
+`BUNDLE_GEMFILE` environment variable, which is set in the parent shell by Bundler.
+
+In 2.7.0.rc2 (not yet released), the rake task doesn't do anything at all.
+Turns out Bundler just does the right thing, so rspec doesn't need to do
+anything.
+
+# rspec-core-2.6
+
+## new APIs for sharing content
+
+Use `shared_context` together with `include_context` to share before/after
+hooks, let declarations, and method definitions across example groups.
+
+Use `shared_examples` together with `include_examples` to share examples
+across different contexts.
+
+All of the old APIs are still supported, but these 4 are easy to remember, and
+serve most use cases.
+
+See `shared_context` and `shared_examples` under "Example Groups" for more
+information.
+
+## `treat_symbols_as_metadata_keys_with_true_values`
+
+Yes it's a long name, but it's a great feature, and it's going to be the
+default behavior in rspec-3. This lets you add metadata to a group or example
+like this:
+
+    describe "something", :awesome do
+      ...
+
+And then you can run that group (or example) using the tags feature:
+
+    rspec spec --tag awesome
+
+We're making this an opt-in for rspec-2.6 because `describe "string", :symbol`
+is a perfectly legal construct in pre-2.6 releases and we want to maintain
+compatibility in minor releases as much as is possible.
+
+# rspec-core-2.3
+
+## `config.expect_with`
+
+Use this to configure RSpec to use rspec/expectations (default),
+stdlib assertions (Test::Unit with Ruby 1.8, MiniTest with Ruby 1.9),
+or both:
+
+    RSpec.configure do |config|
+      config.expect_with :rspec          # => rspec/expectations
+      config.expect_with :stdlib         # => Test::Unit or MinitTest
+      config.expect_with :rspec, :stdlib # => both
+    end
+
+# rspec-core-2.1
+
+## Command line
+
+### `--tags`
+
+Now you can tag groups and examples using metadata and access those tags from
+the command line. So if you have a group with `:foo => true`:
+
+    describe "something", :foo => true do
+      it "does something" do
+        # ...
+      end
+    end
+
+... now you can run just that group like this:
+
+    rspec spec --tags foo
+
+### `--fail-fast`
+
+Add this flag to the command line to tell rspec to clean up and exit after the
+first failure:
+
+    rspec spec --fail-fast
+
+## Metata/filtering
+
+### :if and :unless keys
+
+Use :if and :unless keys to conditionally run examples with simple boolean
+expressions:
+
+    describe "something" do
+      it "does something", :if => RUBY_VERSION == 1.8.6 do
+        # ...
+      end
+      it "does something", :unless => RUBY_VERSION == 1.8.6 do
+        # ...
+      end
+    end
+
+## Conditionally 'pending' examples
+
+Make examples pending based on a condition.  This is most useful when you
+have an example that runs in multiple contexts and fails in one of those due to
+a bug in a third-party dependency that you expect to be fixed in the future.
+
+    describe "something" do
+      it "does something that doesn't yet work right on JRuby" do
+        pending("waiting for the JRuby team to fix issue XYZ", :if => RUBY_PLATFORM == 'java') do
+          # the content of your spec
+        end
+      end
+    end
+
+This example would run normally on all ruby interpretters except JRuby.  On JRuby,
+it uses the block form of `pending`, which causes the example to still be run and
+will remain pending as long as it fails.  In the future, if you upgraded your
+JRuby installation to a newer release that allows the example to pass, RSpec
+will report it as a failure (`Expected pending '...' to fail.  No Error was raised.`),
+so that know that you can remove the call to `pending`.
+
+# New features in rspec-core-2.0
+
+### Runner
+
+The new runner for rspec-2 comes from Micronaut.
+
+### Metadata!
+
+In rspec-2, every example and example group comes with metadata information
+like the file and line number on which it was declared, the arguments passed to
+`describe` and `it`, etc.  This metadata can be appended to through a hash
+argument passed to `describe` or `it`, allowing us to pre and post-process
+each example in a variety of ways.
+
+### Filtering
+
+The most obvious use is for filtering the run. For example:
+
+    # in spec/spec_helper.rb
+    RSpec.configure do |c|
+      c.filter_run :focus => true
+    end
+
+    # in any spec file
+    describe "something" do
+      it "does something", :focus => true do
+        # ....
+      end
+    end
+
+When you run the `rspec` command, rspec will run only the examples that have
+`:focus => true` in the hash.
+
+You can also add `run_all_when_everything_filtered` to the config:
+
+    RSpec.configure do |c|
+      c.filter_run :focus => true
+      c.run_all_when_everything_filtered = true
+    end
+
+Now if there are no examples tagged with `:focus => true`, all examples
+will be run. This makes it really easy to focus on one example for a
+while, but then go back to running all of the examples by removing that
+argument from `it`. Works with `describe` too, in which case it runs
+all of the examples in that group.
+
+The configuration will accept a lambda, which provides a lot of flexibility
+in filtering examples. Say, for example, you have a spec for functionality that
+behaves slightly differently in Ruby 1.8 and Ruby 1.9. We have that in
+rspec-core, and here's how we're getting the right stuff to run under the
+right version:
+
+    # in spec/spec_helper.rb
+    RSpec.configure do |c|
+      c.exclusion_filter = { :ruby => lambda {|version|
+        !(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
+      }}
+    end
+
+    # in any spec file
+    describe "something" do
+      it "does something", :ruby => 1.8 do
+        # ....
+      end
+
+      it "does something", :ruby => 1.9 do
+        # ....
+      end
+    end
+
+In this case, we're using `exclusion_filter` instead of `filter_run` or
+`filter`, which indicate _inclusion_ filters. So each of those examples is
+excluded if we're _not_ running the version of Ruby they work with.
+
+### Shared example groups
+
+Shared example groups are now run in a nested group within the including group
+(they used to be run in the same group). Nested groups inherit `before`, `after`,
+`around`, and `let` hooks, as well as any methods that are defined in the parent
+group.
+
+This new approach provides better encapsulation, better output, and an
+opportunity to add contextual information to the shared group via a block
+passed to `it_should_behave_like`.
+
+See [features/example\_groups/shared\_example\_group.feature](http://github.com/rspec/rspec-core/blob/master/features/example_groups/shared_example_group.feature) for more information.
+
+NOTICE: The including example groups no longer have access to any of the
+methods, hooks, or state defined inside a shared group. This will break rspec-1
+specs that were using shared example groups to extend the behavior of including
+groups.
+
+# Upgrading from rspec-1.x
+
+### rspec command
+
+The command to run specs is now `rspec` instead of `spec`.
+
+    rspec ./spec
+
+#### Co-habitation of rspec-1 and rspec-2
+
+Early beta versions of RSpec-2 included a `spec` command, which conflicted with
+the RSpec-1 `spec` command because RSpec-1's was installed by the rspec gem,
+while RSpec-2's is installed by the rspec-core gem.
+
+If you installed one of these early versions, the safest bet is to uninstall
+rspec-1 and rspec-core-2, and then reinstall both. After you do this, you will
+be able to run rspec-2 like this:
+
+    rspec ./spec
+
+... and rspec-1 like this:
+
+    spec _1.3.1_ ./spec
+
+Rubygems inspects the first argument to any gem executable to see if it's
+formatted like a version number surrounded by underscores. If so, it uses that
+version (e.g.  `1.3.1`). If not, it uses the most recent version (e.g.
+`2.0.0`).
+
+### rake task
+
+A few things changed in the Rake task used to run specs:
+
+1.  The file in which it is defined changed from `spec/rake/spectask` to
+    `rspec/core/rake_task`
+
+2.  The `spec_opts` accessor has been deprecated in favor of `rspec_opts`. Also,
+    the `rspec` command no longer supports the `--options` command line option
+    so the options must be embedded directly in the Rakefile, or stored in the
+    `.rspec` files mentioned above.
+
+3.  In RSpec-1, the rake task would read in rcov options from an `rcov.opts`
+    file. This is ignored by RSpec-2. RCov options are now set directly on the Rake
+    task:
+
+        RSpec::Core::RakeTask.new(:rcov) do |t|
+          t.rcov_opts =  %q[--exclude "spec"]
+        end
+
+3.  The `spec_files` accessor has been replaced by `pattern`.
+
+        # rspec-1
+        require 'spec/rake/spectask'
+
+        Spec::Rake::SpecTask.new do |t|
+          t.spec_opts = ['--options', "\"spec/spec.opts\""]
+          t.spec_files = FileList['spec/**/*.rb']
+        end
+
+        # rspec-2
+        require 'rspec/core/rake_task'
+
+        RSpec::Core::RakeTask.new do |t|
+          t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
+          t.pattern = 'spec/**/*_spec.rb'
+        end
+
+### autotest
+
+`autospec` is dead. Long live `autotest`.
+
+### RSpec is the new Spec
+
+The root namespace (top level module) is now `RSpec` instead of `Spec`, and
+the root directory under `lib` within all of the `rspec` gems is `rspec` instead of `spec`.
+
+### Configuration
+
+Typically in `spec/spec_helper.rb`, configuration is now done like this:
+
+    RSpec.configure do |c|
+      # ....
+    end
+
+### .rspec
+
+Command line options can be persisted in a `.rspec` file in a project. You
+can also store a `.rspec` file in your home directory (`~/.rspec`) with global
+options. Precedence is:
+
+    command line
+    ./.rspec
+    ~/.rspec
+
+### `context` is no longer a top-level method
+
+We removed `context` from the main object because it was creating conflicts with
+IRB and some users who had `Context` domain objects. `describe` is still there,
+so if you want to use `context` at the top level, just alias it:
+
+    alias :context :describe
+
+Of course, you can still use `context` to declare a nested group:
+
+    describe "something" do
+      context "in some context" do
+        it "does something" do
+          # ...
+        end
+      end
+    end
+
+### `$KCODE` no longer set implicitly to `'u'`
+
+In RSpec-1, the runner set `$KCODE` to `'u'`, which impacts, among other
+things, the behaviour of Regular Expressions when applied to non-ascii
+characters. This is no longer the case in RSpec-2.
+
diff --git a/rspec-core/features/command_line/README.md b/rspec-core/features/command_line/README.md
new file mode 100644
index 0000000..e86c431
--- /dev/null
+++ b/rspec-core/features/command_line/README.md
@@ -0,0 +1,28 @@
+The `rspec` command comes with several options you can use to customize RSpec's
+behavior, including output formats, filtering examples, etc.
+
+For a full list of options, run the `rspec` command with the `--help` flag:
+
+    $ rspec --help
+
+### Run with `ruby`
+
+Generally, life is simpler if you just use the `rspec` command. If you must use the `ruby`
+command, however, you'll want to do the following:
+
+* `require 'rspec/autorun'`
+
+This tells RSpec to run your examples.  Do this in any file that you are
+passing to the `ruby` command.
+
+* Update the `LOAD_PATH`
+
+It is conventional to put configuration in and require assorted support files
+from `spec/spec_helper.rb`. It is also conventional to require that file from
+the spec files using `require 'spec_helper'`. This works because RSpec
+implicitly adds the `spec` directory to the `LOAD_PATH`. It also adds `lib`, so
+your implementation files will be on the `LOAD_PATH` as well.
+
+If you're using the `ruby` command, you'll need to do this yourself:
+
+    ruby -Ilib -Ispec path/to/spec.rb
diff --git a/rspec-core/features/command_line/example_name_option.feature b/rspec-core/features/command_line/example_name_option.feature
new file mode 100644
index 0000000..d036418
--- /dev/null
+++ b/rspec-core/features/command_line/example_name_option.feature
@@ -0,0 +1,97 @@
+Feature: --example option
+
+  Use the --example (or -e) option to filter examples by name.
+
+  The argument is matched against the full description of the example,
+  which is the concatenation of descriptions of the group (including
+  any nested groups) and the example.
+
+  This allows you to run a single uniquely named example, all examples with
+  similar names, all the examples in a uniquely named group, etc, etc.
+
+  You can also use the option more than once to specify multiple example matches.
+
+  Background:
+    Given a file named "first_spec.rb" with:
+      """ruby
+      describe "first group" do
+        it "first example in first group" do; end
+        it "second example in first group" do; end
+      end
+      """
+    And a file named "second_spec.rb" with:
+      """ruby
+      describe "second group" do
+        it "first example in second group" do; end
+        it "second example in second group" do; end
+      end
+      """
+    And a file named "third_spec.rb" with:
+      """ruby
+      describe "third group" do
+        it "first example in third group" do; end
+        context "nested group" do
+          it "first example in nested group" do; end
+          it "second example in nested group" do; end
+        end
+      end
+      """
+    And a file named "fourth_spec.rb" with:
+      """ruby
+      describe Array do
+        describe "#length" do
+          it "is the number of items" do
+            Array.new([1,2,3]).length.should eq 3
+          end
+        end
+      end
+      """
+
+  Scenario: no matches
+    When I run `rspec . --example nothing_like_this`
+    Then the process should succeed even though no examples were run
+
+  Scenario: match on one word
+    When I run `rspec . --example example`
+    Then the examples should all pass
+
+  Scenario: one match in each context
+    When I run `rspec . --example 'first example'`
+    Then the examples should all pass
+
+  Scenario: one match in one file using just the example name
+    When I run `rspec . --example 'first example in first group'`
+    Then the examples should all pass
+
+  Scenario: one match in one file using the example name and the group name
+    When I run `rspec . --example 'first group first example in first group'`
+    Then the examples should all pass
+
+  Scenario: all examples in one group
+    When I run `rspec . --example 'first group'`
+    Then the examples should all pass
+
+  Scenario: one match in one file with group name
+    When I run `rspec . --example 'second group first example'`
+    Then the examples should all pass
+
+  Scenario: all examples in one group including examples in nested groups
+    When I run `rspec . --example 'third group'`
+    Then the examples should all pass
+
+  Scenario: Object#method
+    When I run `rspec . --example 'Array#length'`
+    Then the examples should all pass
+
+  Scenario: Multiple applications of example name option
+    When I run `rspec . --example 'first group' --example 'second group' --format d`
+    Then the examples should all pass
+    And the output should contain all of these:
+      |first example in first group|
+      |second example in first group|
+      |first example in second group|
+      |second example in second group|
+    And the output should not contain any of these:
+      |first example in third group|
+      |nested group first example in nested group|
+      |nested group second example in nested group|
diff --git a/rspec-core/features/command_line/exit_status.feature b/rspec-core/features/command_line/exit_status.feature
new file mode 100644
index 0000000..3aca1d5
--- /dev/null
+++ b/rspec-core/features/command_line/exit_status.feature
@@ -0,0 +1,82 @@
+Feature: exit status
+
+  The rspec command exits with an exit status of 0 if all examples pass,
+  and 1 if any examples fail. The failure exit code can be overridden
+  using the --failure-exit-code option.
+
+  Scenario: exit with 0 when all examples pass
+    Given a file named "ok_spec.rb" with:
+      """ruby
+      describe "ok" do
+        it "passes" do
+        end
+      end
+      """
+    When I run `rspec ok_spec.rb`
+    Then the exit status should be 0
+    And the examples should all pass
+
+  Scenario: exit with 1 when one example fails
+    Given a file named "ko_spec.rb" with:
+      """ruby
+      describe "KO" do
+        it "fails" do
+          raise "KO"
+        end
+      end
+      """
+    When I run `rspec ko_spec.rb`
+    Then the exit status should be 1
+    And the output should contain "1 example, 1 failure"
+
+  Scenario: exit with 1 when a nested examples fails
+    Given a file named "nested_ko_spec.rb" with:
+      """ruby
+      describe "KO" do
+        describe "nested" do
+          it "fails" do
+            raise "KO"
+          end
+        end
+      end
+      """
+    When I run `rspec nested_ko_spec.rb`
+    Then the exit status should be 1
+    And the output should contain "1 example, 1 failure"
+
+  Scenario: exit with 0 when no examples are run
+    Given a file named "a_no_examples_spec.rb" with:
+      """ruby
+      """
+    When I run `rspec a_no_examples_spec.rb`
+    Then the exit status should be 0
+    And the output should contain "0 examples"
+
+  Scenario: exit with 2 when one example fails and --failure-exit-code is 2
+    Given a file named "ko_spec.rb" with:
+      """ruby
+      describe "KO" do
+        it "fails" do
+          raise "KO"
+        end
+      end
+      """
+    When I run `rspec --failure-exit-code 2 ko_spec.rb`
+    Then the exit status should be 2
+    And the output should contain "1 example, 1 failure"
+
+  Scenario: exit with rspec's exit code when an at_exit hook is added upstream
+    Given a file named "exit_at_spec.rb" with:
+      """ruby
+      require 'rspec/autorun'
+      at_exit { exit(0) }
+
+      describe "exit 0 at_exit" do
+        it "does not interfere with rspec's exit code" do
+          fail
+        end
+      end
+      """
+    When I run `ruby exit_at_spec.rb`
+    Then the exit status should be 1
+    And the output should contain "1 example, 1 failure"
diff --git a/rspec-core/features/command_line/format_option.feature b/rspec-core/features/command_line/format_option.feature
new file mode 100644
index 0000000..de5878f
--- /dev/null
+++ b/rspec-core/features/command_line/format_option.feature
@@ -0,0 +1,75 @@
+Feature: --format option
+
+  Use the --format option to tell RSpec how to format the output.
+
+  RSpec ships with several formatters built in. By default, it uses the progress
+  formatter, which generates output like this:
+
+      ....F.....*.....
+
+  A '.' represents a passing example, 'F' is failing, and '*' is pending.
+
+  Use the documentation formatter to see the documentation strings passed to
+  `describe`, `it`, and their aliases:
+
+      $ rspec spec --format documentation
+
+  You can also specify an output target ($stdout by default) with an --out
+  option immediately following the --format option:
+
+      $ rspec spec --format documentation --out rspec.txt
+
+  Run `rspec --help` to see a listing of available formatters.
+
+  Background:
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "does something that passes" do
+          5.should eq(5)
+        end
+
+        it "does something that fails" do
+          5.should eq(4)
+        end
+
+        it "does something that is pending", :pending => true do
+          5.should be > 3
+        end
+      end
+      """
+
+  Scenario: progress bar format (default)
+    When I run `rspec --format progress example_spec.rb`
+    Then the output should contain ".F*"
+
+  Scenario: documentation format
+    When I run `rspec example_spec.rb --format documentation`
+    Then the output should contain:
+      """
+      something
+        does something that passes
+        does something that fails (FAILED - 1)
+        does something that is pending (PENDING: No reason given)
+      """
+
+  Scenario: documentation format saved to a file
+    When I run `rspec example_spec.rb --format documentation --out rspec.txt`
+    Then the file "rspec.txt" should contain:
+      """
+      something
+        does something that passes
+        does something that fails (FAILED - 1)
+        does something that is pending (PENDING: No reason given)
+      """
+
+  Scenario: multiple formats and output targets
+    When I run `rspec example_spec.rb --format progress --format documentation --out rspec.txt`
+    Then the output should contain ".F*"
+    And the file "rspec.txt" should contain:
+      """
+      something
+        does something that passes
+        does something that fails (FAILED - 1)
+        does something that is pending (PENDING: No reason given)
+      """
diff --git a/rspec-core/features/command_line/init.feature b/rspec-core/features/command_line/init.feature
new file mode 100644
index 0000000..92d626b
--- /dev/null
+++ b/rspec-core/features/command_line/init.feature
@@ -0,0 +1,18 @@
+Feature: --init option
+
+  Use the --init option on the command line to generate conventional
+  files for an rspec project.
+
+  Scenario: generate .rspec
+    When I run `rspec --init`
+    Then the following files should exist:
+      | .rspec |
+    And the output should contain "create   .rspec"
+
+  Scenario: .rspec file already exists
+    Given a file named ".rspec" with:
+      """
+      --color
+      """
+    When I run `rspec --init`
+    Then the output should contain "exist   .rspec"
diff --git a/rspec-core/features/command_line/line_number_appended_to_path.feature b/rspec-core/features/command_line/line_number_appended_to_path.feature
new file mode 100644
index 0000000..502a792
--- /dev/null
+++ b/rspec-core/features/command_line/line_number_appended_to_path.feature
@@ -0,0 +1,140 @@
+Feature: line number appended to file path
+
+  To run one or more examples or groups, you can append the line number to the path, e.g.
+
+      rspec path/to/example_spec.rb:37
+
+  Background:
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "outer group" do
+
+        it "first example in outer group" do
+
+        end
+
+        it "second example in outer group" do
+
+        end
+
+        describe "nested group" do
+
+          it "example in nested group" do
+
+          end
+
+        end
+
+      end
+      """
+    And a file named "example2_spec.rb" with:
+      """ruby
+      describe "yet another group" do
+        it "first example in second file" do
+        end
+        it "second example in second file" do
+        end
+      end
+      """
+
+  Scenario: nested groups - outer group on declaration line
+    When I run `rspec example_spec.rb:1 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    And the output should contain "first example in outer group"
+    And the output should contain "example in nested group"
+
+  Scenario: nested groups - outer group inside block before example
+    When I run `rspec example_spec.rb:2 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    And the output should contain "first example in outer group"
+    And the output should contain "example in nested group"
+
+  Scenario: nested groups - inner group on declaration line
+    When I run `rspec example_spec.rb:11 --format doc`
+    Then the examples should all pass
+    And the output should contain "example in nested group"
+    And the output should not contain "second example in outer group"
+    And the output should not contain "first example in outer group"
+
+  Scenario: nested groups - inner group inside block before example
+    When I run `rspec example_spec.rb:12 --format doc`
+    Then the examples should all pass
+    And the output should contain "example in nested group"
+    And the output should not contain "second example in outer group"
+    And the output should not contain "first example in outer group"
+
+  Scenario: two examples - first example on declaration line
+    When I run `rspec example_spec.rb:3 --format doc`
+    Then the examples should all pass
+    And the output should contain "first example in outer group"
+    But the output should not contain "second example in outer group"
+    And the output should not contain "example in nested group"
+
+  Scenario: two examples - first example inside block
+    When I run `rspec example_spec.rb:4 --format doc`
+    Then the examples should all pass
+    And the output should contain "first example in outer group"
+    But the output should not contain "second example in outer group"
+    And the output should not contain "example in nested group"
+
+  Scenario: two examples - first example on end
+    When I run `rspec example_spec.rb:5 --format doc`
+    Then the examples should all pass
+    And the output should contain "first example in outer group"
+    But the output should not contain "second example in outer group"
+    And the output should not contain "example in nested group"
+
+  Scenario: two examples - first example after end but before next example
+    When I run `rspec example_spec.rb:6 --format doc`
+    Then the examples should all pass
+    And the output should contain "first example in outer group"
+    But the output should not contain "second example in outer group"
+    And the output should not contain "example in nested group"
+
+  Scenario: two examples - second example on declaration line
+    When I run `rspec example_spec.rb:7 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    But the output should not contain "first example in outer group"
+    And the output should not contain "example in nested group"
+
+  Scenario: two examples - second example inside block
+    When I run `rspec example_spec.rb:7 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    But the output should not contain "first example in outer group"
+    And the output should not contain "example in nested group"
+
+  Scenario: two examples - second example on end
+    When I run `rspec example_spec.rb:7 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    But the output should not contain "first example in outer group"
+    And the output should not contain "example in nested group"
+
+  Scenario: specified multiple times for different files
+    When I run `rspec example_spec.rb:7 example2_spec.rb:4 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    And the output should contain "second example in second file"
+    But the output should not contain "first example in outer group"
+    And the output should not contain "nested group"
+    And the output should not contain "first example in second file"
+
+  Scenario: specified multiple times for the same file with multiple arguments
+    When I run `rspec example_spec.rb:7 example_spec.rb:11 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    And the output should contain "nested group"
+    But the output should not contain "first example in outer group"
+    And the output should not contain "second file"
+
+  Scenario: specified multiple times for the same file with a single argument
+    When I run `rspec example_spec.rb:7:11 --format doc`
+    Then the examples should all pass
+    And the output should contain "second example in outer group"
+    And the output should contain "nested group"
+    But the output should not contain "first example in outer group"
+    And the output should not contain "second file"
diff --git a/rspec-core/features/command_line/line_number_option.feature b/rspec-core/features/command_line/line_number_option.feature
new file mode 100644
index 0000000..62d253d
--- /dev/null
+++ b/rspec-core/features/command_line/line_number_option.feature
@@ -0,0 +1,58 @@
+Feature: --line_number option
+
+  To run a examples or groups by line numbers, one can use the --line_number option:
+
+      rspec path/to/example_spec.rb --line_number 37
+
+  This option can be specified multiple times.
+
+  Scenario: standard examples
+    Given a file named "example_spec.rb" with:
+      """ruby
+      require "rspec/expectations"
+
+      describe 9 do
+
+        it "should be > 8" do
+          9.should be > 8
+        end
+
+        it "should be < 10" do
+          9.should be < 10
+        end
+
+        it "should be 3 squared" do
+          9.should be 3*3
+        end
+
+      end
+      """
+    When I run `rspec example_spec.rb --line_number 5 --format doc`
+    Then the examples should all pass
+    And the output should contain "should be > 8"
+    But the output should not contain "should be < 10"
+    And the output should not contain "should be 3*3"
+
+    When I run `rspec example_spec.rb --line_number 5 --line_number 9 --format doc`
+    Then the examples should all pass
+    And the output should contain "should be > 8"
+    And the output should contain "should be < 10"
+    But the output should not contain "should be 3*3"
+
+  Scenario: one liner
+    Given a file named "example_spec.rb" with:
+      """ruby
+      require "rspec/expectations"
+
+      describe 9 do
+
+        it { should be > 8 }
+
+        it { should be < 10 }
+
+      end
+      """
+    When I run `rspec example_spec.rb --line_number 5 --format doc`
+    Then the examples should all pass
+    Then the output should contain "should be > 8"
+    But the output should not contain "should be < 10"
diff --git a/rspec-core/features/command_line/order.feature b/rspec-core/features/command_line/order.feature
new file mode 100644
index 0000000..65a4048
--- /dev/null
+++ b/rspec-core/features/command_line/order.feature
@@ -0,0 +1,29 @@
+Feature: --order (new in rspec-core-2.8)
+
+  Use the `--order` option to tell RSpec how to order the files, groups, and
+  examples. Options are `default` and `rand`:
+
+  Default is:
+
+    * files are ordered based on the underlying file system's order (typically
+      case-sensitive alpha on *nix OS's and case-insenstive alpha in Windows)
+    * groups/examples are loaded in the order in which they are declared
+
+  Use `rand` to randomize the order of files, groups within files, and
+  examples within groups.*
+
+  * Nested groups are always run from top-level to bottom-level in order to avoid
+    executing `before(:all)` and `after(:all)` hooks more than once, but the order
+    of groups at each level is randomized.
+
+  You can also specify a seed
+
+  <h3>Examples</h3>
+
+      --order default
+      --order rand
+      --order rand:123
+      --seed 123 # same as --order rand:123
+
+  The `default` option is only necessary when you have `--order rand` stored in a
+  config file (e.g. `.rspec`) and you want to override it from the command line.
diff --git a/rspec-core/features/command_line/pattern_option.feature b/rspec-core/features/command_line/pattern_option.feature
new file mode 100644
index 0000000..99ba9b9
--- /dev/null
+++ b/rspec-core/features/command_line/pattern_option.feature
@@ -0,0 +1,49 @@
+Feature: pattern option
+
+  By default, RSpec loads files matching the pattern:
+
+      "spec/**/*_spec.rb"
+
+  Use the `--pattern` option to declare a different pattern.
+
+  Scenario: default pattern
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "addition" do
+        it "adds things" do
+          (1 + 2).should eq(3)
+        end
+      end
+      """
+    When I run `rspec`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: override the default pattern on the command line
+    Given a file named "spec/example.spec" with:
+      """ruby
+      describe "addition" do
+        it "adds things" do
+          (1 + 2).should eq(3)
+        end
+      end
+      """
+    When I run `rspec --pattern "spec/**/*.spec"`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: override the default pattern in configuration
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+        RSpec.configure do |config|
+          config.pattern << ',**/*.spec'
+        end
+      """
+    And a file named "spec/example.spec" with:
+      """ruby
+      describe "addition" do
+        it "adds things" do
+          (1 + 2).should eq(3)
+        end
+      end
+      """
+    When I run `rspec -rspec_helper`
+    Then the output should contain "1 example, 0 failures"
diff --git a/rspec-core/features/command_line/rake_task.feature b/rspec-core/features/command_line/rake_task.feature
new file mode 100644
index 0000000..16514e9
--- /dev/null
+++ b/rspec-core/features/command_line/rake_task.feature
@@ -0,0 +1,122 @@
+Feature: rake task
+
+  RSpec ships with a rake task with a number of useful options
+
+  Scenario: default options with passing spec (prints command and exit status is 0)
+    Given a file named "Rakefile" with:
+      """ruby
+      require 'rspec/core/rake_task'
+
+      RSpec::Core::RakeTask.new(:spec)
+
+      task :default => :spec
+      """
+    And a file named "spec/thing_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "does something" do
+          # pass
+        end
+      end
+      """
+    When I run `rake`
+    Then the output should match /(ruby|rbx) -S rspec/
+    Then the exit status should be 0
+
+  Scenario: default options with failing spec (exit status is 1)
+    Given a file named "Rakefile" with:
+      """ruby
+      require 'rspec/core/rake_task'
+
+      RSpec::Core::RakeTask.new(:spec)
+
+      task :default => :spec
+      """
+    And a file named "spec/thing_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "does something" do
+          fail
+        end
+      end
+      """
+    When I run `rake`
+    Then the exit status should be 1
+
+  Scenario: fail_on_error = false with failing spec (exit status is 0)
+    Given a file named "Rakefile" with:
+      """ruby
+      require 'rspec/core/rake_task'
+
+      RSpec::Core::RakeTask.new(:spec) do |t|
+        t.fail_on_error = false
+      end
+
+      task :default => :spec
+      """
+    And a file named "spec/thing_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "does something" do
+          fail
+        end
+      end
+      """
+    When I run `rake`
+    Then the exit status should be 0
+
+  Scenario: rspec_opts is specified in order to pass args to the rspec command
+    Given a file named "Rakefile" with:
+      """ruby
+      require 'rspec/core/rake_task'
+
+      RSpec::Core::RakeTask.new(:spec) do |t|
+        t.rspec_opts = "--tag fast"
+      end
+      """
+    And a file named "spec/thing_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "has a tag", :fast => true do
+          # pass
+        end
+
+        it "does not have a tag" do
+          fail
+        end
+      end
+      """
+    When I run `rake spec`
+    Then the exit status should be 0
+    Then the output should match:
+      """
+      (ruby|rbx) -S rspec ./spec/thing_spec.rb --tag fast
+      """
+
+  Scenario: rspec_opts is specified using arguments to the rake task
+    Given a file named "Rakefile" with:
+      """ruby
+      require 'rspec/core/rake_task'
+
+      RSpec::Core::RakeTask.new(:spec, :tag) do |t, task_args|
+        t.rspec_opts = "--tag #{task_args[:tag]}"
+      end
+      """
+    And a file named "spec/thing_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "has a tag", :fast => true do
+          # pass
+        end
+
+        it "does not have a tag" do
+          fail
+        end
+      end
+      """
+    When I run `rake spec[fast]`
+    Then the exit status should be 0
+    Then the output should match:
+      """
+      (ruby|rbx) -S rspec ./spec/thing_spec.rb --tag fast
+      """
diff --git a/rspec-core/features/command_line/require_option.feature b/rspec-core/features/command_line/require_option.feature
new file mode 100644
index 0000000..a07e325
--- /dev/null
+++ b/rspec-core/features/command_line/require_option.feature
@@ -0,0 +1,43 @@
+Feature: --require option
+
+  Use the `--require` (or `-r`) option to specify a file to require
+  before running specs.
+
+  Scenario: using the --require option
+    Given a file named "logging_formatter.rb" with:
+      """ruby
+      require "rspec/core/formatters/base_text_formatter"
+      require 'delegate'
+
+      class LoggingFormatter < RSpec::Core::Formatters::BaseTextFormatter
+        def initialize(output)
+          super LoggingIO.new(output)
+        end
+
+        class LoggingIO < SimpleDelegator
+          def initialize(output)
+            @file = File.new('rspec.log', 'w')
+            super
+          end
+
+          def puts(message)
+            [@file, __getobj__].each { |out| out.puts message }
+          end
+
+          def close
+            @file.close
+          end
+        end
+      end
+      """
+    And a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "an embarassing situation" do
+        it "happens to everyone" do
+        end
+      end
+      """
+    When I run `rspec --require ./logging_formatter.rb --format LoggingFormatter`
+    Then the output should contain "1 example, 0 failures"
+    And  the file "rspec.log" should contain "1 example, 0 failures"
+    And  the exit status should be 0
diff --git a/rspec-core/features/command_line/ruby.feature b/rspec-core/features/command_line/ruby.feature
new file mode 100644
index 0000000..f60f57f
--- /dev/null
+++ b/rspec-core/features/command_line/ruby.feature
@@ -0,0 +1,22 @@
+Feature: run with ruby command
+
+  You can use the `ruby` command to run specs. You just need to require
+  `rspec/autorun`.
+
+  Generally speaking, you're better off using the `rspec` command, which
+  requires `rspec/autorun` for you, but some tools only work with the `ruby`
+  command.
+
+  Scenario:
+    Given a file named "example_spec.rb" with:
+      """ruby
+      require 'rspec/autorun'
+
+      describe 1 do
+        it "is < 2" do
+          1.should be < 2
+        end
+      end
+      """
+    When I run `ruby example_spec.rb`
+    Then the output should contain "1 example, 0 failures"
diff --git a/rspec-core/features/command_line/tag.feature b/rspec-core/features/command_line/tag.feature
new file mode 100644
index 0000000..ebcf365
--- /dev/null
+++ b/rspec-core/features/command_line/tag.feature
@@ -0,0 +1,98 @@
+Feature: --tag option
+
+  Use the --tag (or -t) option to filter the examples by tags.
+
+  The tag can be a simple name or a name:value pair. In the first case,
+  examples with :name => true will be filtered. In the second case, examples
+  with :name => value will be filtered, where value is always a string.  In
+  both cases, name is converted to a symbol.
+
+  Tags can also be used to exclude examples by adding a ~ before the tag.  For
+  example ~tag will exclude all examples marked with :tag => true and
+  ~tag:value will exclude all examples marked with :tag => value.
+
+  To be compatible with the Cucumber syntax, tags can optionally start with
+  an @ symbol, which will be ignored.
+
+  Background:
+    Given a file named "tagged_spec.rb" with:
+      """ruby
+      describe "group with tagged specs" do
+        it "example I'm working now", :focus => true do; end
+        it "special example with string", :type => 'special' do; end
+        it "special example with symbol", :type => :special do; end
+        it "slow example", :skip => true do; end
+        it "ordinary example", :speed => 'slow' do; end
+        it "untagged example" do; end
+      end
+      """
+
+  Scenario: filter examples with non-existent tag
+    When I run `rspec . --tag mytag`
+    Then the process should succeed even though no examples were run
+
+  Scenario: filter examples with a simple tag
+    When I run `rspec . --tag focus`
+    Then the output should contain "include {:focus=>true}"
+    And the examples should all pass
+
+  Scenario: filter examples with a simple tag and @
+    When I run `rspec . --tag @focus`
+    Then the output should contain "include {:focus=>true}"
+    Then the examples should all pass
+
+  Scenario: filter examples with a name:value tag
+    When I run `rspec . --tag type:special`
+    Then the output should contain:
+      """
+      include {:type=>"special"}
+      """
+    And the output should contain "2 examples"
+    And the examples should all pass
+
+  Scenario: filter examples with a name:value tag and @
+    When I run `rspec . --tag @type:special`
+    Then the output should contain:
+      """
+      include {:type=>"special"}
+      """
+    And the examples should all pass
+
+  Scenario: exclude examples with a simple tag
+    When I run `rspec . --tag ~skip`
+    Then the output should contain "exclude {:skip=>true}"
+    Then the examples should all pass
+
+  Scenario: exclude examples with a simple tag and @
+    When I run `rspec . --tag ~@skip`
+    Then the output should contain "exclude {:skip=>true}"
+    Then the examples should all pass
+
+  Scenario: exclude examples with a name:value tag
+    When I run `rspec . --tag ~speed:slow`
+    Then the output should contain:
+      """
+      exclude {:speed=>"slow"}
+      """
+    Then the examples should all pass
+
+  Scenario: exclude examples with a name:value tag and @
+    When I run `rspec . --tag ~@speed:slow`
+    Then the output should contain:
+      """
+      exclude {:speed=>"slow"}
+      """
+    Then the examples should all pass
+
+  Scenario: filter examples with a simple tag, exclude examples with another tag
+    When I run `rspec . --tag focus --tag ~skip`
+    Then the output should contain "include {:focus=>true}"
+    And the output should contain "exclude {:skip=>true}"
+    And the examples should all pass
+
+  Scenario: exclude examples with multiple tags
+    When I run `rspec . --tag ~skip --tag ~speed:slow`
+    Then the output should contain one of the following:
+      | exclude {:skip=>true, :speed=>"slow"} |
+      | exclude {:speed=>"slow", :skip=>true} |
+    Then the examples should all pass
diff --git a/rspec-core/features/command_line/warnings_option.feature b/rspec-core/features/command_line/warnings_option.feature
new file mode 100644
index 0000000..b359fe9
--- /dev/null
+++ b/rspec-core/features/command_line/warnings_option.feature
@@ -0,0 +1,29 @@
+Feature: run with warnings enabled
+
+  You can use the `--warnings` option to run specs with warnings enabled
+
+  @unsupported-on-rbx
+  Scenario:
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe do
+        it 'generates warning' do
+          @undefined
+        end
+      end
+      """
+    When I run `rspec --warnings example_spec.rb`
+    Then the output should contain "warning"
+
+  @unsupported-on-rbx
+  Scenario:
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe do
+        it 'generates warning' do
+          @undefined
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should not contain "warning"
diff --git a/rspec-core/features/configuration/alias_example_to.feature b/rspec-core/features/configuration/alias_example_to.feature
new file mode 100644
index 0000000..c488eeb
--- /dev/null
+++ b/rspec-core/features/configuration/alias_example_to.feature
@@ -0,0 +1,48 @@
+Feature: alias_example_to
+
+  Use `config.alias_example_to` to create new example group methods
+  that define examples with the configured metadata.
+
+  If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
+  to `true`, you can specify metadata using only symbols.
+
+  Scenario: Use alias_example_to to define focused example
+    Given a file named "alias_example_to_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.alias_example_to :fit, :focused => true
+        c.filter_run :focused => true
+      end
+
+      describe "an example group" do
+        it "does one thing" do
+        end
+
+        fit "does another thing" do
+        end
+      end
+      """
+    When I run `rspec alias_example_to_spec.rb --format doc`
+    Then the output should contain "does another thing"
+    And the output should not contain "does one thing"
+
+  Scenario: use symbols as metadata
+    Given a file named "use_symbols_as_metadata_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.treat_symbols_as_metadata_keys_with_true_values = true
+        c.alias_example_to :fit, :focused
+        c.filter_run :focused
+      end
+
+      describe "an example group" do
+        it "does one thing" do
+        end
+
+        fit "does another thing" do
+        end
+      end
+      """
+    When I run `rspec use_symbols_as_metadata_spec.rb --format doc`
+    Then the output should contain "does another thing"
+    And the output should not contain "does one thing"
diff --git a/rspec-core/features/configuration/backtrace_clean_patterns.feature b/rspec-core/features/configuration/backtrace_clean_patterns.feature
new file mode 100644
index 0000000..1353928
--- /dev/null
+++ b/rspec-core/features/configuration/backtrace_clean_patterns.feature
@@ -0,0 +1,102 @@
+Feature: Backtrace cleaning
+
+  To aid in diagnozing spec failures, RSpec cleans matching lines from backtraces. The default patterns cleaned are:
+
+    /\/lib\d*\/ruby\//,
+    /org\/jruby\//,
+    /bin\//,
+    /gems/,
+    /spec\/spec_helper\.rb/,
+    /lib\/rspec\/(core|expectations|matchers|mocks)/
+
+  This list can be modified or replaced with the `backtrace_clean_patterns` option. Additionally, rspec can be run with the `--backtrace` option to skip backtrace cleaning entirely.
+
+  Scenario: default configuration
+    Given a file named "spec/failing_spec.rb" with:
+    """ruby
+    describe "2 + 2" do
+      it "is 5" do
+        (2+2).should eq(5)
+      end
+    end
+    """
+    When I run `rspec`
+    Then the output should contain "1 example, 1 failure"
+    And the output should not contain "lib/rspec/expectations"
+
+  Scenario: With a custom setting for backtrace_clean_patterns
+    Given a file named "spec/spec_helper.rb" with:
+    """ruby
+    RSpec.configure do |config|
+      config.backtrace_clean_patterns = [
+        /spec_helper/
+      ]
+    end
+
+    def foo
+      "bar"
+    end
+    """
+    And a file named "spec/example_spec.rb" with:
+    """ruby
+    require 'spec_helper'
+    describe "foo" do
+      it "returns baz" do
+        foo.should eq("baz")
+      end
+    end
+    """
+    When I run `rspec`
+    Then the output should contain "1 example, 1 failure"
+    And the output should contain "lib/rspec/expectations"
+
+  Scenario: Adding a pattern
+    Given a file named "spec/matchers/be_baz_matcher.rb" with:
+    """ruby
+    RSpec::Matchers.define :be_baz do |_|
+      match do |actual|
+        actual == "baz"
+      end
+    end
+    """
+    And a file named "spec/example_spec.rb" with:
+    """ruby
+    RSpec.configure do |config|
+      config.backtrace_clean_patterns << /be_baz_matcher/
+    end
+
+    describe "bar" do
+      it "is baz" do
+        "bar".should be_baz
+      end
+    end
+    """
+    When I run `rspec`
+    Then the output should contain "1 example, 1 failure"
+    But the output should not contain "be_baz_matcher"
+    And the output should not contain "lib/rspec/expectations"
+
+  Scenario: Running with the --backtrace option
+    Given a file named "spec/matchers/be_baz_matcher.rb" with:
+    """ruby
+    RSpec::Matchers.define :be_baz do |_|
+      match do |actual|
+        actual == "baz"
+      end
+    end
+    """
+    And a file named "spec/example_spec.rb" with:
+    """ruby
+    RSpec.configure do |config|
+      config.backtrace_clean_patterns << /be_baz_matcher/
+    end
+
+    describe "bar" do
+      it "is baz" do
+        "bar".should be_baz
+      end
+    end
+    """
+    When I run `rspec --backtrace`
+    Then the output should contain "1 example, 1 failure"
+    And the output should not contain "be_baz_matcher"
diff --git a/rspec-core/features/configuration/custom_settings.feature b/rspec-core/features/configuration/custom_settings.feature
new file mode 100644
index 0000000..23772fc
--- /dev/null
+++ b/rspec-core/features/configuration/custom_settings.feature
@@ -0,0 +1,84 @@
+Feature: custom settings
+
+  Extensions like rspec-rails can add their own configuration settings.
+
+  Scenario: simple setting (with defaults)
+    Given a file named "additional_setting_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.add_setting :custom_setting
+      end
+
+      describe "custom setting" do
+        it "is nil by default" do
+          RSpec.configuration.custom_setting.should be_nil
+        end
+
+        it "acts false by default" do
+          RSpec.configuration.custom_setting.should be_false
+        end
+
+        it "is exposed as a predicate" do
+          RSpec.configuration.custom_setting?.should be_false
+        end
+
+        it "can be overridden" do
+          RSpec.configuration.custom_setting = true
+          RSpec.configuration.custom_setting.should be_true
+          RSpec.configuration.custom_setting?.should be_true
+        end
+      end
+      """
+    When I run `rspec ./additional_setting_spec.rb`
+    Then the examples should all pass
+
+  Scenario: default to true
+    Given a file named "additional_setting_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.add_setting :custom_setting, :default => true
+      end
+
+      describe "custom setting" do
+        it "is true by default" do
+          RSpec.configuration.custom_setting.should be_true
+        end
+
+        it "is exposed as a predicate" do
+          RSpec.configuration.custom_setting?.should be_true
+        end
+
+        it "can be overridden" do
+          RSpec.configuration.custom_setting = false
+          RSpec.configuration.custom_setting.should be_false
+          RSpec.configuration.custom_setting?.should be_false
+        end
+      end
+      """
+    When I run `rspec ./additional_setting_spec.rb`
+    Then the examples should all pass
+
+  Scenario: overridden in a subsequent RSpec.configure block
+    Given a file named "additional_setting_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.add_setting :custom_setting
+      end
+
+      RSpec.configure do |c|
+        c.custom_setting = true
+      end
+
+      describe "custom setting" do
+        it "returns the value set in the last cofigure block to get eval'd" do
+          RSpec.configuration.custom_setting.should be_true
+        end
+
+        it "is exposed as a predicate" do
+          RSpec.configuration.custom_setting?.should be_true
+        end
+      end
+      """
+    When I run `rspec ./additional_setting_spec.rb`
+    Then the examples should all pass
+
diff --git a/rspec-core/features/configuration/default_path.feature b/rspec-core/features/configuration/default_path.feature
new file mode 100644
index 0000000..4f2ae84
--- /dev/null
+++ b/rspec-core/features/configuration/default_path.feature
@@ -0,0 +1,38 @@
+Feature: default_path
+
+  As of rspec-2.7, you can just type `rspec` to run all specs that live
+  in the `spec` directory.
+
+  This is supported by a `--default_path` option, which is set to `spec` by
+  default. If you prefer to keep your specs in a different directory, or assign
+  an individual file to `--default_path`, you can do so on the command line or
+  in a configuration file (`.rspec`, `~/.rspec`, or a custom file).
+
+  NOTE: this option is not supported on `RSpec.configuration`, as it needs to
+  be set before spec files are loaded.
+
+  Scenario: run `rspec` with default default_path (`spec` directory)
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "passes" do
+        end
+      end
+      """
+    When I run `rspec`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: run `rspec` with customized default_path
+    Given a file named ".rspec" with:
+      """
+      --default_path behavior
+      """
+    Given a file named "behavior/example_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "passes" do
+        end
+      end
+      """
+    When I run `rspec`
+    Then the output should contain "1 example, 0 failures"
diff --git a/rspec-core/features/configuration/deprecation_stream.feature b/rspec-core/features/configuration/deprecation_stream.feature
new file mode 100644
index 0000000..9ed57fa
--- /dev/null
+++ b/rspec-core/features/configuration/deprecation_stream.feature
@@ -0,0 +1,58 @@
+Feature: deprecation_stream
+
+  Define a custom output stream for warning about deprecations (default `$stderr`).
+
+    RSpec.configure {|c| c.deprecation_stream = File.open('deprecations.txt', 'w') }
+
+  or
+
+    RSpec.configure {|c| c.deprecation_stream = 'deprecations.txt' }
+
+  Background:
+    Given a file named "lib/foo.rb" with:
+      """ruby
+      class Foo
+        def bar
+          RSpec.deprecate "Foo#bar"
+        end
+      end
+      """
+
+  Scenario: default - print deprecations to $stderr
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "foo"
+      describe "calling a deprecated method" do
+        example { Foo.new.bar }
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should contain "DEPRECATION: Foo#bar is deprecated"
+
+  Scenario: configure using the path to a file
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "foo"
+      RSpec.configure {|c| c.deprecation_stream = 'deprecations.txt' }
+      describe "calling a deprecated method" do
+        example { Foo.new.bar }
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should not contain "DEPRECATION"
+    But the output should contain "1 deprecation logged to deprecations.txt"
+    And the file "deprecations.txt" should contain "Foo#bar is deprecated"
+
+  Scenario: configure using a File object
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "foo"
+      RSpec.configure {|c| c.deprecation_stream = File.open('deprecations.txt', 'w') }
+      describe "calling a deprecated method" do
+        example { Foo.new.bar }
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should not contain "DEPRECATION"
+    But the output should contain "1 deprecation logged to deprecations.txt"
+    And the file "deprecations.txt" should contain "Foo#bar is deprecated"
diff --git a/rspec-core/features/configuration/fail_fast.feature b/rspec-core/features/configuration/fail_fast.feature
new file mode 100644
index 0000000..c0cd1ec
--- /dev/null
+++ b/rspec-core/features/configuration/fail_fast.feature
@@ -0,0 +1,77 @@
+Feature: fail fast
+
+  Use the fail_fast option to tell RSpec to abort the run on first failure:
+
+      RSpec.configure {|c| c.fail_fast = true}
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure {|c| c.fail_fast = true}
+      """
+
+  Scenario: fail_fast with no failures (runs all examples)
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "passes" do
+        end
+
+        it "passes too" do
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: fail_fast with first example failing (only runs the one example)
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "something" do
+        it "fails" do
+          fail
+        end
+
+        it "passes" do
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb -fd`
+    Then the output should contain "1 example, 1 failure"
+
+  Scenario: fail_fast with multiple files, second example failing (only runs the first two examples)
+    Given a file named "spec/example_1_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "something" do
+        it "passes" do
+        end
+
+        it "fails" do
+          fail
+        end
+      end
+
+      describe "something else" do
+        it "fails" do
+          fail
+        end
+      end
+      """
+    And a file named "spec/example_2_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "something" do
+        it "passes" do
+        end
+      end
+
+      describe "something else" do
+        it "fails" do
+          fail
+        end
+      end
+      """
+    When I run `rspec spec`
+    Then the output should contain "2 examples, 1 failure"
diff --git a/rspec-core/features/configuration/failure_exit_code.feature b/rspec-core/features/configuration/failure_exit_code.feature
new file mode 100644
index 0000000..9b49608
--- /dev/null
+++ b/rspec-core/features/configuration/failure_exit_code.feature
@@ -0,0 +1,36 @@
+Feature: failure exit code
+
+  Use the feature_exit_code option to set a custom exit code when RSpec fails.
+
+    RSpec.configure { |c| c.failure_exit_code = 42 }
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure { |c| c.failure_exit_code = 42 }
+      """
+
+  Scenario: a failing spec with the default exit code
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "something" do
+        it "fails" do
+          fail
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the exit status should be 1
+
+  Scenario: a failing spec with a custom exit code
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require 'spec_helper'
+      describe "something" do
+        it "fails" do
+          fail
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the exit status should be 42
diff --git a/rspec-core/features/configuration/order_and_seed.feature b/rspec-core/features/configuration/order_and_seed.feature
new file mode 100644
index 0000000..b3cb26c
--- /dev/null
+++ b/rspec-core/features/configuration/order_and_seed.feature
@@ -0,0 +1,3 @@
+Feature: set the order and/or seed
+
+  You can set the order to run specs and specify a seed if you are running the specs using the 'random' ordering.  See <a href='../command_line/order.feature'>the documentation on the --order command line option</a> for more on this.
diff --git a/rspec-core/features/configuration/output_stream.feature b/rspec-core/features/configuration/output_stream.feature
new file mode 100644
index 0000000..176f7b9
--- /dev/null
+++ b/rspec-core/features/configuration/output_stream.feature
@@ -0,0 +1,24 @@
+Feature: output_stream
+
+  Define a custom output stream (default `$stdout`).  Aliases: `:output`, `:out`.
+
+    RSpec.configure { |c| c.output_stream = File.open('saved_output', 'w') }
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure {|c| c.output_stream = File.open('saved_output', 'w') }
+      """
+
+  Scenario: redirecting output
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require 'spec_helper'
+      describe "an example" do
+        it "passes" do
+          true
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the file "saved_output" should contain "1 example, 0 failures"
diff --git a/rspec-core/features/configuration/pattern.feature b/rspec-core/features/configuration/pattern.feature
new file mode 100644
index 0000000..4080e99
--- /dev/null
+++ b/rspec-core/features/configuration/pattern.feature
@@ -0,0 +1,38 @@
+Feature: pattern
+
+  Use the pattern option to tell RSpec to look for specs in files that match a pattern other than "**/*_spec.rb".
+
+  Background:
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "two specs here" do
+        it "passes" do
+        end
+
+        it "passes too" do
+        end
+      end
+      """
+    And a file named "spec/example_test.rb" with:
+      """ruby
+      describe "only one spec" do
+        it "passes" do
+        end
+      end
+      """
+
+  Scenario: by default, RSpec runs files that match "**/*_spec.rb"
+   When I run `rspec`
+   Then the output should contain "2 examples, 0 failures"
+
+  Scenario: the --pattern flag makes RSpec run files matching the specified pattern and ignore the default pattern
+   When I run `rspec -P "**/*_test.rb"`
+   Then the output should contain "1 example, 0 failures"
+
+  Scenario: the --pattern flag can be used to pass in multiple patterns, separated by comma
+   When I run `rspec -P "**/*_test.rb,**/*_spec.rb"`
+   Then the output should contain "3 examples, 0 failures"
+
+  Scenario: the --pattern flag accepts shell style glob unions
+   When I run `rspec -P "**/*_{test,spec}.rb"`
+   Then the output should contain "3 examples, 0 failures"
diff --git a/rspec-core/features/configuration/profile.feature b/rspec-core/features/configuration/profile.feature
new file mode 100644
index 0000000..94d78e4
--- /dev/null
+++ b/rspec-core/features/configuration/profile.feature
@@ -0,0 +1,220 @@
+Feature: Profile examples
+
+  The `--profile` command line option (available from `RSpec.configure` as
+  `#profile_examples`), when set, will cause RSpec to dump out a list of
+  your slowest examples. By default, it prints the 10 slowest examples,
+  but you can set it to a different value to have it print more or fewer
+  slow examples. If `--fail-fast` option is used together with `--profile`
+  and there is a failure, slow examples are not shown.
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      """
+    And a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "something" do
+        it "sleeps for 0.1 seconds (example 1)" do
+          sleep 0.1
+          1.should == 1
+        end
+
+        it "sleeps for 0 seconds (example 2)" do
+          2.should == 2
+        end
+
+        it "sleeps for 0.15 seconds (example 3)" do
+          sleep 0.15
+          3.should == 3
+        end
+
+        it "sleeps for 0.05 seconds (example 4)" do
+          sleep 0.05
+          4.should == 4
+        end
+
+        it "sleeps for 0.05 seconds (example 5)" do
+          sleep 0.05
+          5.should == 5
+        end
+
+        it "sleeps for 0.05 seconds (example 6)" do
+          sleep 0.05
+          6.should == 6
+        end
+
+        it "sleeps for 0.05 seconds (example 7)" do
+          sleep 0.05
+          7.should == 7
+        end
+
+        it "sleeps for 0.05 seconds (example 8)" do
+          sleep 0.05
+          8.should == 8
+        end
+
+        it "sleeps for 0.05 seconds (example 9)" do
+          sleep 0.05
+          9.should == 9
+        end
+
+        it "sleeps for 0.05 seconds (example 10)" do
+          sleep 0.05
+          10.should == 10
+        end
+
+        it "sleeps for 0.05 seconds (example 11)" do
+          sleep 0.05
+          11.should == 11
+        end
+      end
+      """
+
+  Scenario: by default does not show profile
+    When I run `rspec spec`
+    Then the examples should all pass
+    And the output should not contain "example 1"
+    And the output should not contain "example 2"
+    And the output should not contain "example 3"
+    And the output should not contain "example 4"
+    And the output should not contain "example 5"
+    And the output should not contain "example 6"
+    And the output should not contain "example 7"
+    And the output should not contain "example 8"
+    And the output should not contain "example 9"
+    And the output should not contain "example 10"
+    And the output should not contain "example 11"
+
+  Scenario: setting `profile_examples` to true shows 10 examples
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure { |c| c.profile_examples = true }
+      """
+    When I run `rspec spec`
+    Then the examples should all pass
+    And the output should contain "Top 10 slowest examples"
+    And the output should contain "example 1"
+    And the output should not contain "example 2"
+    And the output should contain "example 3"
+    And the output should contain "example 4"
+    And the output should contain "example 5"
+    And the output should contain "example 6"
+    And the output should contain "example 7"
+    And the output should contain "example 8"
+    And the output should contain "example 9"
+    And the output should contain "example 10"
+    And the output should contain "example 11"
+
+  Scenario: setting `profile_examples` to 2 shows 2 examples
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure { |c| c.profile_examples = 2 }
+      """
+    When I run `rspec spec`
+    Then the examples should all pass
+    And the output should contain "Top 2 slowest examples"
+    And the output should contain "example 1"
+    And the output should not contain "example 2"
+    And the output should contain "example 3"
+    And the output should not contain "example 4"
+    And the output should not contain "example 5"
+    And the output should not contain "example 6"
+    And the output should not contain "example 7"
+    And the output should not contain "example 8"
+    And the output should not contain "example 9"
+    And the output should not contain "example 10"
+    And the output should not contain "example 11"
+
+  Scenario: setting profile examples through CLI
+    When I run `rspec spec --profile 2`
+    Then the examples should all pass
+    And the output should contain "Top 2 slowest examples"
+    And the output should contain "example 1"
+    And the output should not contain "example 2"
+    And the output should contain "example 3"
+    And the output should not contain "example 4"
+    And the output should not contain "example 5"
+    And the output should not contain "example 6"
+    And the output should not contain "example 7"
+    And the output should not contain "example 8"
+    And the output should not contain "example 9"
+    And the output should not contain "example 10"
+    And the output should not contain "example 11"
+
+  Scenario: Using `--no-profile` overrules config options
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure { |c| c.profile_examples = true }
+      """
+    When I run `rspec spec --no-profile`
+    Then the examples should all pass
+    And the output should not contain "example 1"
+    And the output should not contain "example 2"
+    And the output should not contain "example 3"
+    And the output should not contain "example 4"
+    And the output should not contain "example 5"
+    And the output should not contain "example 6"
+    And the output should not contain "example 7"
+    And the output should not contain "example 8"
+    And the output should not contain "example 9"
+    And the output should not contain "example 10"
+    And the output should not contain "example 11"
+
+  Scenario: Using `--profile` with `--fail-fast` shows slow examples if everything passes
+    When I run `rspec spec --fail-fast --profile`
+    Then the examples should all pass
+    And the output should contain "Top 10 slowest examples"
+    And the output should contain "example 1"
+    And the output should not contain "example 2"
+    And the output should contain "example 3"
+    And the output should contain "example 4"
+    And the output should contain "example 5"
+    And the output should contain "example 6"
+    And the output should contain "example 7"
+    And the output should contain "example 8"
+    And the output should contain "example 9"
+    And the output should contain "example 10"
+    And the output should contain "example 11"
+
+  Scenario: Using `--profile` shows slow examples even in case of failures
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "something" do
+        it "sleeps for 0.1 seconds (example 1)" do
+          sleep 0.1
+          1.should == 1
+        end
+
+        it "fails" do
+          fail
+        end
+      end
+      """
+    When I run `rspec spec --profile`
+    Then the output should contain "2 examples, 1 failure"
+    And the output should contain "Top 2 slowest examples"
+    And the output should contain "example 1"
+
+  Scenario: Using `--profile` with `--fail-fast` doesn't show slow examples in case of failures
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "something" do
+        it "sleeps for 0.1 seconds (example 1)" do
+          sleep 0.1
+          1.should == 1
+        end
+
+        it "fails" do
+          fail
+        end
+      end
+      """
+    When I run `rspec spec --fail-fast --profile`
+    Then the output should not contain "Top 2 slowest examples"
+    And the output should not contain "example 1"
diff --git a/rspec-core/features/configuration/read_options_from_file.feature b/rspec-core/features/configuration/read_options_from_file.feature
new file mode 100644
index 0000000..a117d26
--- /dev/null
+++ b/rspec-core/features/configuration/read_options_from_file.feature
@@ -0,0 +1,90 @@
+Feature: read command line configuration options from files
+
+  RSpec reads command line configuration options from files in two different
+  locations:
+
+    Local: `./.rspec-local` (i.e. in the project's root directory, can be gitignored)
+    Project:  `./.rspec` (i.e. in the project's root directory, usually checked into the project)
+    Global: `~/.rspec` (i.e. in the user's home directory)
+
+  Configuration options are loaded from `~/.rspec`, `.rspec`,
+  `.rspec-local`, command line switches, and the `SPEC_OPTS` environment
+  variable (listed in lowest to highest precedence; for example, an option
+  in `~/.rspec` can be overridden by an option in `.rspec-local`).
+
+  Scenario: color set in .rspec
+    Given a file named ".rspec" with:
+      """
+      --color
+      """
+    And a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "color_enabled" do
+        context "when set with RSpec.configure" do
+          before do
+            # color is disabled for non-tty output, so stub the output stream
+            # to say it is tty, even though we're running this with cucumber
+            RSpec.configuration.output_stream.stub(:tty?) { true }
+          end
+
+          it "is true" do
+            RSpec.configuration.should be_color_enabled
+          end
+        end
+      end
+      """
+    When I run `rspec ./spec/example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: custom options file
+    Given a file named "my.options" with:
+      """
+      --format documentation
+      """
+    And a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "formatter set in custom options file" do
+        it "sets formatter" do
+          RSpec.configuration.formatters.first.
+            should be_a(RSpec::Core::Formatters::DocumentationFormatter)
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb --options my.options`
+    Then the examples should all pass
+
+  Scenario: RSpec ignores ./.rspec when custom options file is used
+    Given a file named "my.options" with:
+      """
+      --format documentation
+      """
+    And a file named ".rspec" with:
+      """
+      --color
+      """
+    And a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "custom options file" do
+        it "causes .rspec to be ignored" do
+          RSpec.configuration.color_enabled.should be_false
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb --options my.options`
+    Then the examples should all pass
+
+  Scenario: using ERB in .rspec
+    Given a file named ".rspec" with:
+      """
+      --format <%= true ? 'documentation' : 'progress' %>
+      """
+    And a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "formatter" do
+        it "is set to documentation" do
+          RSpec.configuration.formatters.first.should be_an(RSpec::Core::Formatters::DocumentationFormatter)
+        end
+      end
+      """
+    When I run `rspec ./spec/example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/configuration/run_all_when_everything_filtered.feature b/rspec-core/features/configuration/run_all_when_everything_filtered.feature
new file mode 100644
index 0000000..88cea50
--- /dev/null
+++ b/rspec-core/features/configuration/run_all_when_everything_filtered.feature
@@ -0,0 +1,76 @@
+Feature: run all when everything filtered
+
+  Use the run_all_when_everything_filtered option to tell RSpec to run all the
+  specs in the case where you try to run a filtered list of specs but no specs
+  match that filter. This works well when paired with an inclusion filter like
+  `:focus => true`, as it will run all the examples when none match the
+  inclusion filter.
+
+    RSpec.configure { |c| c.run_all_when_everything_filtered = true }
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure {|c| c.run_all_when_everything_filtered = true}
+      """
+
+  Scenario: by default, no specs are run if they are all filtered out by an inclusion tag
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "examples" do
+        it "with no tag" do
+        end
+
+        it "with no tag as well" do
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb --tag some_tag`
+    Then the output should contain "0 examples, 0 failures"
+
+  Scenario: specs are still run if they are filtered out by an exclusion tag
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "examples" do
+        it "with no tag" do
+        end
+
+        it "with no tag as well" do
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb --tag ~some_tag`
+    Then the output should contain "2 examples, 0 failures"
+
+  Scenario: when the run_all_when_everything_filtered option is turned on, if there are any matches for the filtering tag, only those features are run
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "examples" do
+        it "with no tag", :some_tag => true do
+        end
+
+        it "with no tag as well" do
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb --tag some_tag`
+    Then the output should contain "1 example, 0 failures"
+    And the output should contain "Run options: include {:some_tag=>true}"
+
+  Scenario: when the run_all_when_everything_filtered option is turned on, all the specs are run when the tag has no matches
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "examples" do
+        it "with no tag" do
+        end
+
+        it "with no tag as well" do
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb --tag some_tag`
+    Then the output should contain "2 examples, 0 failures"
+    And the output should contain "All examples were filtered out; ignoring {:some_tag=>true}"
+
diff --git a/rspec-core/features/configuration/show_failures_in_pending_blocks.feature b/rspec-core/features/configuration/show_failures_in_pending_blocks.feature
new file mode 100644
index 0000000..65e22b9
--- /dev/null
+++ b/rspec-core/features/configuration/show_failures_in_pending_blocks.feature
@@ -0,0 +1,61 @@
+Feature: show_failures_in_pending_blocks
+
+  Use the show_failures_in_pending_blocks option to run the code in pending blocks while keeping the tests pending.
+
+    RSpec.configure { |c| c.show_failures_in_pending_blocks = true }
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure {|c| c.show_failures_in_pending_blocks = true}
+      """
+
+  Scenario: by default, code in pending examples is not exercised
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "fails" do
+        pending "code will not be exercised" do
+          fail
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should not contain "Failure/Error: pending { fail }"
+
+  Scenario: by default, code in pending blocks inside examples is not exercised
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "fails" do
+        it "code will not be exercised" do
+          pending { fail }
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should not contain "Failure/Error: pending { fail }"
+
+  Scenario: when turned on, pending code blocks inside examples are exercised
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "fails" do
+        it "code will be exercised" do
+          pending { fail }
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should contain "Failure/Error: pending { fail }"
+
+  Scenario: when turned on, code inside pending examples is not exercised
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "fails" do
+        pending "code will not be exercised" do
+          fail
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should not contain "Failure/Error: pending { fail }"
diff --git a/rspec-core/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature b/rspec-core/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
new file mode 100644
index 0000000..547979a
--- /dev/null
+++ b/rspec-core/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
@@ -0,0 +1,52 @@
+Feature: treat symbols as metadata keys with true values
+
+  Use the treat_symbols_as_metadata_keys_with_true_values option to tell RSpec that :key is shorthand for :key => true.
+
+    RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = true }
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = true }
+      """
+
+  Scenario: by default, symbols without values are ignored and the specs are filtered out
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "failed filtering" do
+        it "this will be filted out", :some_tag do
+          true
+        end
+
+        it "so will this" do
+          false
+        end
+      end
+      """
+      When I run `rspec spec/example_spec.rb --tag some_tag`
+      Then the output should contain "0 examples, 0 failures"
+      And the output should contain "All examples were filtered out"
+
+  Scenario: when treat_symbols_as_metadata_keys_with_true_values is true, specs can be tagged with only a symbol
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "spec_helper"
+      describe "run me", :some_tag do
+        it "runs" do
+          true
+        end
+      end
+
+      describe "run one of these" do
+        it "run this one", :some_tag do
+          true
+        end
+
+        it "but not me" do
+          false
+        end
+      end
+      """
+      When I run `rspec spec/example_spec.rb --tag some_tag`
+      Then the output should contain "2 examples, 0 failures"
+      And the output should contain "Run options: include {:some_tag=>true}"
diff --git a/rspec-core/features/example_groups/basic_structure.feature b/rspec-core/features/example_groups/basic_structure.feature
new file mode 100644
index 0000000..53a4793
--- /dev/null
+++ b/rspec-core/features/example_groups/basic_structure.feature
@@ -0,0 +1,55 @@
+Feature: basic structure (describe/it)
+
+  RSpec is a DSL for creating executable examples of how code is expected to
+  behave, organized in groups. It uses the words "describe" and "it" so we can
+  express concepts like a conversation:
+
+      "Describe an account when it is first opened."
+      "It has a balance of zero."
+
+  The `describe` method creates an example group.  Within the block passed to
+  `describe` you can declare nested groups using the `describe` or `context`
+  methods, or you can declare examples using the `it` or `specify` methods.
+
+  Under the hood, an example group is a class in which the block passed to
+  `describe` or `context` is evaluated. The blocks passed to `it` are evaluated
+  in the context of an _instance_ of that class.
+
+  Scenario: one group, one example
+    Given a file named "sample_spec.rb" with:
+    """ruby
+    describe "something" do
+      it "does something" do
+      end
+    end
+    """
+    When I run `rspec sample_spec.rb -fn`
+    Then the output should contain:
+      """
+      something
+        does something
+      """
+
+  Scenario: nested example groups (using context)
+    Given a file named "nested_example_groups_spec.rb" with:
+    """ruby
+    describe "something" do
+      context "in one context" do
+        it "does one thing" do
+        end
+      end
+      context "in another context" do
+        it "does another thing" do
+        end
+      end
+    end
+    """
+    When I run `rspec nested_example_groups_spec.rb -fdoc`
+    Then the output should contain:
+      """
+      something
+        in one context
+          does one thing
+        in another context
+          does another thing
+      """
diff --git a/rspec-core/features/example_groups/shared_context.feature b/rspec-core/features/example_groups/shared_context.feature
new file mode 100644
index 0000000..cf3c72b
--- /dev/null
+++ b/rspec-core/features/example_groups/shared_context.feature
@@ -0,0 +1,74 @@
+Feature: shared context
+
+  Use `shared_context` to define a block that will be evaluated in the context
+  of example groups either explicitly, using `include_context`, or implicitly by
+  matching metadata.
+
+  Background:
+    Given a file named "shared_stuff.rb" with:
+      """ruby
+      shared_context "shared stuff", :a => :b do
+        before { @some_var = :some_value }
+        def shared_method
+          "it works"
+        end
+        let(:shared_let) { {'arbitrary' => 'object'} }
+        subject do
+          'this is the subject'
+        end
+      end
+      """
+
+  Scenario: declare shared context and include it with include_context
+    Given a file named "shared_context_example.rb" with:
+      """ruby
+      require "./shared_stuff.rb"
+
+      describe "group that includes a shared context using 'include_context'" do
+        include_context "shared stuff"
+
+        it "has access to methods defined in shared context" do
+          shared_method.should eq("it works")
+        end
+
+        it "has access to methods defined with let in shared context" do
+          shared_let['arbitrary'].should eq('object')
+        end
+
+        it "runs the before hooks defined in the shared context" do
+          @some_var.should be(:some_value)
+        end
+
+        it "accesses the subject defined in the shared context" do
+          subject.should eq('this is the subject')
+        end
+      end
+      """
+    When I run `rspec shared_context_example.rb`
+    Then the examples should all pass
+
+  Scenario: declare shared context and include it with metadata
+    Given a file named "shared_context_example.rb" with:
+      """ruby
+      require "./shared_stuff.rb"
+
+      describe "group that includes a shared context using metadata", :a => :b do
+        it "has access to methods defined in shared context" do
+          shared_method.should eq("it works")
+        end
+
+        it "has access to methods defined with let in shared context" do
+          shared_let['arbitrary'].should eq('object')
+        end
+
+        it "runs the before hooks defined in the shared context" do
+          @some_var.should be(:some_value)
+        end
+
+        it "accesses the subject defined in the shared context" do
+          subject.should eq('this is the subject')
+        end
+      end
+      """
+    When I run `rspec shared_context_example.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/example_groups/shared_examples.feature b/rspec-core/features/example_groups/shared_examples.feature
new file mode 100644
index 0000000..b6e15c3
--- /dev/null
+++ b/rspec-core/features/example_groups/shared_examples.feature
@@ -0,0 +1,294 @@
+Feature: shared examples
+
+  Shared examples let you describe behaviour of types or modules. When
+  declared, a shared group's content is stored. It is only realized in the
+  context of another example group, which provides any context the shared group
+  needs to run.
+
+  A shared group is included in another group using any of:
+
+      include_examples "name"      # include the examples in the current context
+      it_behaves_like "name"       # include the examples in a nested context
+      it_should_behave_like "name" # include the examples in a nested context
+      matching metadata            # include the examples in the current context
+
+  WARNING: Files containing shared groups must be loaded before the files that
+  use them.  While there are conventions to handle this, RSpec does _not_ do
+  anything special (like autoload). Doing so would require a strict naming
+  convention for files that would break existing suites.
+
+  CONVENTIONS:
+
+  1.  The simplest approach is to require files with shared examples explicitly
+      from the files that use them. Keep in mind that RSpec adds the `spec`
+      directory to the `LOAD_PATH`, so you can say `require
+      'shared_examples_for_widgets'` to require a file at
+      `#{PROJECT_ROOT}/spec/shared_examples_for_widgets.rb`.
+
+  2.  Put files containing shared examples in `spec/support/` and require files
+      in that directory from `spec/spec_helper.rb`:
+
+          Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
+
+      This is included in the generated `spec/spec_helper.rb` file in
+      `rspec-rails`
+
+  3. When all of the groups that include the shared group, just declare
+     the shared group in the same file.
+
+  Scenario: shared examples group included in two groups in one file
+    Given a file named "collection_spec.rb" with:
+      """ruby
+      require "set"
+
+      shared_examples "a collection" do
+        let(:collection) { described_class.new([7, 2, 4]) }
+
+        context "initialized with 3 items" do
+          it "says it has three items" do
+            collection.size.should eq(3)
+          end
+        end
+
+        describe "#include?" do
+          context "with an an item that is in the collection" do
+            it "returns true" do
+              collection.include?(7).should be_true
+            end
+          end
+
+          context "with an an item that is not in the collection" do
+            it "returns false" do
+              collection.include?(9).should be_false
+            end
+          end
+        end
+      end
+
+      describe Array do
+        it_behaves_like "a collection"
+      end
+
+      describe Set do
+        it_behaves_like "a collection"
+      end
+      """
+    When I run `rspec collection_spec.rb --format documentation`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      Array
+        behaves like a collection
+          initialized with 3 items
+            says it has three items
+          #include?
+            with an an item that is in the collection
+              returns true
+            with an an item that is not in the collection
+              returns false
+
+      Set
+        behaves like a collection
+          initialized with 3 items
+            says it has three items
+          #include?
+            with an an item that is in the collection
+              returns true
+            with an an item that is not in the collection
+              returns false
+      """
+
+  Scenario: Providing context to a shared group using a block
+    Given a file named "shared_example_group_spec.rb" with:
+    """ruby
+    require "set"
+
+    shared_examples "a collection object" do
+      describe "<<" do
+        it "adds objects to the end of the collection" do
+          collection << 1
+          collection << 2
+          expect(collection.to_a).to match_array([1, 2])
+        end
+      end
+    end
+
+    describe Array do
+      it_behaves_like "a collection object" do
+        let(:collection) { Array.new }
+      end
+    end
+
+    describe Set do
+      it_behaves_like "a collection object" do
+        let(:collection) { Set.new }
+      end
+    end
+    """
+    When I run `rspec shared_example_group_spec.rb --format documentation`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      Array
+        behaves like a collection object
+          <<
+            adds objects to the end of the collection
+
+      Set
+        behaves like a collection object
+          <<
+            adds objects to the end of the collection
+      """
+
+  Scenario: Passing parameters to a shared example group
+    Given a file named "shared_example_group_params_spec.rb" with:
+    """ruby
+    shared_examples "a measurable object" do |measurement, measurement_methods|
+      measurement_methods.each do |measurement_method|
+        it "should return #{measurement} from ##{measurement_method}" do
+          subject.send(measurement_method).should == measurement
+        end
+      end
+    end
+
+    describe Array, "with 3 items" do
+      subject { [1, 2, 3] }
+      it_should_behave_like "a measurable object", 3, [:size, :length]
+    end
+
+    describe String, "of 6 characters" do
+      subject { "FooBar" }
+      it_should_behave_like "a measurable object", 6, [:size, :length]
+    end
+    """
+    When I run `rspec shared_example_group_params_spec.rb --format documentation`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      Array with 3 items
+        it should behave like a measurable object
+          should return 3 from #size
+          should return 3 from #length
+
+      String of 6 characters
+        it should behave like a measurable object
+          should return 6 from #size
+          should return 6 from #length
+      """
+
+  Scenario: Aliasing "it_should_behave_like" to "it_has_behavior"
+    Given a file named "shared_example_group_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.alias_it_should_behave_like_to :it_has_behavior, 'has behavior:'
+      end
+
+      shared_examples 'sortability' do
+        it 'responds to <=>' do
+          sortable.should respond_to(:<=>)
+        end
+      end
+
+      describe String do
+        it_has_behavior 'sortability' do
+          let(:sortable) { 'sample string' }
+        end
+      end
+      """
+    When I run `rspec shared_example_group_spec.rb --format documentation`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      String
+        has behavior: sortability
+          responds to <=>
+      """
+
+  Scenario: Sharing metadata automatically includes shared example groups
+    Given a file named "shared_example_metadata_spec.rb" with:
+      """ruby
+      shared_examples "shared stuff", :a => :b do
+        it 'runs wherever the metadata is shared' do
+        end
+      end
+
+      describe String, :a => :b do
+      end
+      """
+      When I run `rspec shared_example_metadata_spec.rb`
+      Then the output should contain:
+        """
+        1 example, 0 failures
+        """
+
+  Scenario: Shared examples are nestable by context
+    Given a file named "context_specific_examples_spec.rb" with:
+      """Ruby
+      describe "shared examples" do
+        context "per context" do
+
+          shared_examples "shared examples are nestable" do
+            specify { expect(true).to eq true }
+          end
+
+          it_behaves_like "shared examples are nestable"
+        end
+      end
+      """
+    When I run `rspec context_specific_examples_spec.rb`
+    Then the output should contain:
+      """
+      1 example, 0 failures
+      """
+
+  Scenario: Shared examples are accessible from offspring contexts
+    Given a file named "context_specific_examples_spec.rb" with:
+      """Ruby
+      describe "shared examples" do
+        shared_examples "shared examples are nestable" do
+          specify { expect(true).to eq true }
+        end
+
+        context "per context" do
+          it_behaves_like "shared examples are nestable"
+        end
+      end
+      """
+    When I run `rspec context_specific_examples_spec.rb`
+    Then the output should contain:
+      """
+      1 example, 0 failures
+      """
+    And the output should not contain:
+      """
+      Accessing shared_examples defined across contexts is deprecated
+      """
+
+  Scenario: Shared examples are isolated per context
+    Given a file named "isolated_shared_examples_spec.rb" with:
+      """Ruby
+      describe "shared examples" do
+        context do
+          shared_examples "shared examples are isolated" do
+            specify { expect(true).to eq true }
+          end
+        end
+
+        context do
+          it_behaves_like "shared examples are isolated"
+        end
+      end
+      """
+    When I run `rspec isolated_shared_examples_spec.rb`
+    Then the output should contain:
+      """
+      1 example, 0 failures
+      """
+    But the output should contain:
+      """
+      Accessing shared_examples defined across contexts is deprecated
+      """
+    And the output should contain:
+      """
+      isolated_shared_examples_spec.rb:9
+      """
diff --git a/rspec-core/features/expectation_framework_integration/configure_expectation_framework.feature b/rspec-core/features/expectation_framework_integration/configure_expectation_framework.feature
new file mode 100644
index 0000000..d0d6cbe
--- /dev/null
+++ b/rspec-core/features/expectation_framework_integration/configure_expectation_framework.feature
@@ -0,0 +1,102 @@
+Feature: configure expectation framework
+
+  By default, RSpec is configured to include rspec-expectations for expressing
+  desired outcomes. You can also configure RSpec to use:
+
+  * rspec/expectations (explicitly)
+  * stdlib assertions
+    * test/unit assertions in ruby 1.8
+    * minitest assertions in ruby 1.9
+  * rspec/expectations _and_ stlib assertions
+
+  Note that when you do not use rspec-expectations, you must explicitly
+  provide a description to every example.  You cannot rely on the generated
+  descriptions provided by rspec-expectations.
+
+  Scenario: rspec-expectations can be used by default if nothing is configured
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec::Matchers.define :be_a_multiple_of do |factor|
+        match do |actual|
+          actual % factor == 0
+        end
+      end
+
+      describe 6 do
+        it { should be_a_multiple_of(3) }
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: configure rspec-expectations (explicitly)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.expect_with :rspec
+      end
+
+      describe 5 do
+        it "is greater than 4" do
+          5.should be > 4
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: configure test/unit assertions (passing examples)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.expect_with :stdlib
+      end
+
+      describe 5 do
+        it "is greater than 4" do
+          assert 5 > 4, "expected 5 to be greater than 4"
+        end
+
+        specify { assert 5 < 6 }
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "2 examples, 0 failures"
+
+  Scenario: configure test/unit assertions (failing examples)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.expect_with :stdlib
+      end
+
+      describe 5 do
+        it "is greater than 6 (no it isn't!)" do
+          assert 5 > 6, "errantly expected 5 to be greater than 5"
+        end
+
+        specify { assert 5 > 6 }
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "2 examples, 2 failures"
+
+  Scenario: configure rspec/expecations AND test/unit assertions
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.expect_with :rspec, :stdlib
+      end
+
+      describe 5 do
+        it "is greater than 4" do
+          assert 5 > 4, "expected 5 to be greater than 4"
+        end
+
+        it "is less than 6" do
+          5.should be < 6
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/filtering/exclusion_filters.feature b/rspec-core/features/filtering/exclusion_filters.feature
new file mode 100644
index 0000000..099825c
--- /dev/null
+++ b/rspec-core/features/filtering/exclusion_filters.feature
@@ -0,0 +1,138 @@
+Feature: exclusion filters
+
+  You can exclude examples from a run by declaring an exclusion filter and
+  then tagging examples, or entire groups, with that filter.
+
+  If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
+  to `true`, you can specify metadata using only symbols.
+
+  Scenario: exclude an example
+    Given a file named "spec/sample_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        # declare an exclusion filter
+        c.filter_run_excluding :broken => true
+      end
+
+      describe "something" do
+        it "does one thing" do
+        end
+
+        # tag example for exclusion by adding metadata
+        it "does another thing", :broken => true do
+        end
+      end
+      """
+    When I run `rspec ./spec/sample_spec.rb --format doc`
+    Then the output should contain "does one thing"
+    And the output should not contain "does another thing"
+
+  Scenario: exclude a group
+    Given a file named "spec/sample_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.filter_run_excluding :broken => true
+      end
+
+      describe "group 1", :broken => true do
+        it "group 1 example 1" do
+        end
+
+        it "group 1 example 2" do
+        end
+      end
+
+      describe "group 2" do
+        it "group 2 example 1" do
+        end
+      end
+      """
+    When I run `rspec ./spec/sample_spec.rb --format doc`
+    Then the output should contain "group 2 example 1"
+    And  the output should not contain "group 1 example 1"
+    And  the output should not contain "group 1 example 2"
+
+  Scenario: exclude multiple groups
+    Given a file named "spec/sample_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.filter_run_excluding :broken => true
+      end
+
+      describe "group 1", :broken => true do
+        before(:all) do
+          raise "you should not see me"
+        end
+
+        it "group 1 example 1" do
+        end
+
+        it "group 1 example 2" do
+        end
+      end
+
+      describe "group 2", :broken => true do
+        before(:each) do
+          raise "you should not see me"
+        end
+
+        it "group 2 example 1" do
+        end
+      end
+      """
+    When I run `rspec ./spec/sample_spec.rb --format doc`
+    Then the process should succeed even though no examples were run
+    And  the output should not contain "group 1"
+    And  the output should not contain "group 2"
+
+  Scenario: before/after(:all) hooks in excluded example group are not run
+    Given a file named "spec/before_after_all_exclusion_filter_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.filter_run_excluding :broken => true
+      end
+
+      describe "group 1" do
+        before(:all) { puts "before all in included group" }
+        after(:all)  { puts "after all in included group"  }
+
+        it "group 1 example" do
+        end
+      end
+
+      describe "group 2", :broken => true do
+        before(:all) { puts "before all in excluded group" }
+        after(:all)  { puts "after all in excluded group"  }
+
+        context "context 1" do
+          it "group 2 context 1 example 1" do
+          end
+        end
+      end
+      """
+    When I run `rspec ./spec/before_after_all_exclusion_filter_spec.rb`
+    Then the output should contain "before all in included group"
+     And the output should contain "after all in included group"
+     And the output should not contain "before all in excluded group"
+     And the output should not contain "after all in excluded group"
+
+  Scenario: Use symbols as metadata
+    Given a file named "symbols_as_metadata_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.treat_symbols_as_metadata_keys_with_true_values = true
+        c.filter_run_excluding :broken
+      end
+
+      describe "something" do
+        it "does one thing" do
+        end
+
+        # tag example for exclusion by adding metadata
+        it "does another thing", :broken do
+        end
+      end
+      """
+    When I run `rspec symbols_as_metadata_spec.rb --format doc`
+    Then the output should contain "does one thing"
+    And the output should not contain "does another thing"
diff --git a/rspec-core/features/filtering/if_and_unless.feature b/rspec-core/features/filtering/if_and_unless.feature
new file mode 100644
index 0000000..154a2b4
--- /dev/null
+++ b/rspec-core/features/filtering/if_and_unless.feature
@@ -0,0 +1,168 @@
+Feature: :if and :unless
+
+  The `:if` and `:unless` metadata keys can be used to filter examples without
+  needing to configure an exclusion filter.
+
+  Scenario: implicit :if filter
+    Given a file named "implicit_if_filter_spec.rb" with:
+      """ruby
+      describe ":if => true group", :if => true do
+        it(":if => true group :if => true example", :if => true) { }
+        it(":if => true group :if => false example", :if => false) { }
+        it(":if => true group no :if example") { }
+      end
+
+      describe ":if => false group", :if => false do
+        it(":if => false group :if => true example", :if => true) { }
+        it(":if => false group :if => false example", :if => false) { }
+        it(":if => false group no :if example") { }
+      end
+
+      describe "no :if group" do
+        it("no :if group :if => true example", :if => true) { }
+        it("no :if group :if => false example", :if => false) { }
+        it("no :if group no :if example") { }
+      end
+      """
+    When I run `rspec implicit_if_filter_spec.rb --format doc`
+    Then the output should contain all of these:
+      | :if => true group :if => true example  |
+      | :if => true group no :if example       |
+      | :if => false group :if => true example |
+      | no :if group :if => true example       |
+      | no :if group no :if example            |
+    And the output should not contain any of these:
+      | :if => true group :if => false example  |
+      | :if => false group :if => false example |
+      | :if => false group no :if example       |
+      | no :if group :if => false example       |
+
+  Scenario: implicit :unless filter
+    Given a file named "implicit_unless_filter_spec.rb" with:
+      """ruby
+      describe ":unless => true group", :unless => true do
+        it(":unless => true group :unless => true example", :unless => true) { }
+        it(":unless => true group :unless => false example", :unless => false) { }
+        it(":unless => true group no :unless example") { }
+      end
+
+      describe ":unless => false group", :unless => false do
+        it(":unless => false group :unless => true example", :unless => true) { }
+        it(":unless => false group :unless => false example", :unless => false) { }
+        it(":unless => false group no :unless example") { }
+      end
+
+      describe "no :unless group" do
+        it("no :unless group :unless => true example", :unless => true) { }
+        it("no :unless group :unless => false example", :unless => false) { }
+        it("no :unless group no :unless example") { }
+      end
+      """
+    When I run `rspec implicit_unless_filter_spec.rb --format doc`
+    Then the output should contain all of these:
+      | :unless => true group :unless => false example  |
+      | :unless => false group :unless => false example |
+      | :unless => false group no :unless example       |
+      | no :unless group :unless => false example       |
+      | no :unless group no :unless example             |
+    And the output should not contain any of these:
+      | :unless => true group :unless => true example  |
+      | :unless => true group no :unless example       |
+      | :unless => false group :unless => true example |
+      | no :unless group :unless => true example       |
+
+  Scenario: combining implicit filter with explicit inclusion filter
+    Given a file named "explicit_inclusion_filter_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.filter_run :focus => true
+      end
+
+      describe "group with :focus", :focus => true do
+        it("focused example") { }
+        it("focused :if => true example", :if => true) { }
+        it("focused :if => false example", :if => false) { }
+        it("focused :unless => true example", :unless => true) { }
+        it("focused :unless => false example", :unless => false) { }
+      end
+
+      describe "group without :focus" do
+        it("unfocused example") { }
+        it("unfocused :if => true example", :if => true) { }
+        it("unfocused :if => false example", :if => false) { }
+        it("unfocused :unless => true example", :unless => true) { }
+        it("unfocused :unless => false example", :unless => false) { }
+      end
+      """
+    When I run `rspec explicit_inclusion_filter_spec.rb --format doc`
+    Then the output should contain all of these:
+      | focused example                  |
+      | focused :if => true example      |
+      | focused :unless => false example |
+    And the output should not contain any of these:
+      | focused :if => false example     |
+      | focused :unless => true example  |
+      | unfocused                        |
+
+  Scenario: combining implicit filter with explicit exclusion filter
+    Given a file named "explicit_exclusion_filter_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.filter_run_excluding :broken => true
+      end
+
+      describe "unbroken group" do
+        it("included example") { }
+        it("included :if => true example", :if => true) { }
+        it("included :if => false example", :if => false) { }
+        it("included :unless => true example", :unless => true) { }
+        it("included :unless => false example", :unless => false) { }
+      end
+
+      describe "broken group", :broken => true do
+        it("excluded example") { }
+        it("excluded :if => true example", :if => true) { }
+        it("excluded :if => false example", :if => false) { }
+        it("excluded :unless => true example", :unless => true) { }
+        it("excluded :unless => false example", :unless => false) { }
+      end
+      """
+    When I run `rspec explicit_exclusion_filter_spec.rb --format doc`
+    Then the output should contain all of these:
+      | included example                  |
+      | included :if => true example      |
+      | included :unless => false example |
+    And the output should not contain any of these:
+      | included :if => false example     |
+      | included :unless => true example  |
+      | excluded                          |
+
+  Scenario: override implicit :if and :unless exclusion filters
+    Given a file named "override_implicit_filters_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.filter_run_excluding :if => :exclude_me, :unless => :exclude_me_for_unless
+      end
+
+      describe ":if filtering" do
+        it(":if => true example", :if => true) { }
+        it(":if => false example", :if => false) { }
+        it(":if => :exclude_me example", :if => :exclude_me) { }
+      end
+
+      describe ":unless filtering" do
+        it(":unless => true example", :unless => true) { }
+        it(":unless => false example", :unless => false) { }
+        it(":unless => :exclude_me_for_unless example", :unless => :exclude_me_for_unless) { }
+      end
+      """
+    When I run `rspec override_implicit_filters_spec.rb --format doc`
+    Then the output should contain all of these:
+      | :if => true example      |
+      | :if => false example     |
+      | :unless => true example  |
+      | :unless => false example |
+    And the output should not contain any of these:
+      | :if => :exclude_me example                |
+      | :unless => :exclude_me_for_unless example |
+
diff --git a/rspec-core/features/filtering/inclusion_filters.feature b/rspec-core/features/filtering/inclusion_filters.feature
new file mode 100644
index 0000000..4bef6ee
--- /dev/null
+++ b/rspec-core/features/filtering/inclusion_filters.feature
@@ -0,0 +1,105 @@
+Feature: inclusion filters
+
+  You can constrain which examples are run by declaring an inclusion filter. The
+  most common use case is to focus on a subset of examples as you're focused on
+  a particular problem.
+
+  You can specify metadata using only symbols if you set the
+  `treat_symbols_as_metadata_keys_with_true_values` config option to `true`.
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.filter_run_including :focus => true
+      end
+      """
+
+  Scenario: focus on an example
+    Given a file named "spec/sample_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "something" do
+        it "does one thing" do
+        end
+
+        it "does another thing", :focus => true do
+        end
+      end
+      """
+    When I run `rspec spec/sample_spec.rb --format doc`
+    Then the output should contain "does another thing"
+    And the output should not contain "does one thing"
+
+  Scenario: focus on a group
+    Given a file named "spec/sample_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "group 1", :focus => true do
+        it "group 1 example 1" do
+        end
+
+        it "group 1 example 2" do
+        end
+      end
+
+      describe "group 2" do
+        it "group 2 example 1" do
+        end
+      end
+      """
+    When I run `rspec spec/sample_spec.rb --format doc`
+    Then the output should contain "group 1 example 1"
+    And  the output should contain "group 1 example 2"
+    And  the output should not contain "group 2 example 1"
+
+  Scenario: before/after(:all) hooks in unmatched example group are not run
+    Given a file named "spec/before_after_all_inclusion_filter_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "group 1", :focus => true do
+        before(:all) { puts "before all in focused group" }
+        after(:all)  { puts "after all in focused group"  }
+
+        it "group 1 example" do
+        end
+      end
+
+      describe "group 2" do
+        before(:all) { puts "before all in unfocused group" }
+        after(:all)  { puts "after all in unfocused group"  }
+
+        context "context 1" do
+          it "group 2 context 1 example 1" do
+          end
+        end
+      end
+      """
+    When I run `rspec ./spec/before_after_all_inclusion_filter_spec.rb`
+    Then the output should contain "before all in focused group"
+     And the output should contain "after all in focused group"
+     And the output should not contain "before all in unfocused group"
+     And the output should not contain "after all in unfocused group"
+
+  Scenario: Use symbols as metadata
+    Given a file named "symbols_as_metadata_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.treat_symbols_as_metadata_keys_with_true_values = true
+        c.filter_run :current_example
+      end
+
+      describe "something" do
+        it "does one thing" do
+        end
+
+        it "does another thing", :current_example do
+        end
+      end
+      """
+    When I run `rspec symbols_as_metadata_spec.rb --format doc`
+    Then the output should contain "does another thing"
+    And the output should not contain "does one thing"
diff --git a/rspec-core/features/formatters/configurable_colors.feature b/rspec-core/features/formatters/configurable_colors.feature
new file mode 100644
index 0000000..9c490f6
--- /dev/null
+++ b/rspec-core/features/formatters/configurable_colors.feature
@@ -0,0 +1,31 @@
+Feature: Configurable colors
+
+  RSpec allows you to configure the terminal colors used in the text formatters.
+
+  * `failure_color`: Color used when tests fail (default: `:red`)
+  * `success_color`: Color used when tests pass (default: `:green`)
+  * `pending_color`: Color used when tests are pending (default: `:yellow`)
+  * `fixed_color`: Color used when a pending block inside an example passes, but was expected to fail (default: `:blue`)
+  * `detail_color`: Color used for miscellaneous test details (default: `:cyan`)
+
+  Colors are normally specified as symbols. Options are `:black`, `:red`,
+  `:green`, `:yellow`, `:blue`, `:magenta`, `:cyan`, and `:white`.
+
+  @ansi
+  Scenario: Customizing the failure color
+    Given a file named "custom_failure_color_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.failure_color = :magenta
+        config.tty = true
+        config.color = true
+      end
+
+      describe "failure" do
+        it "fails and uses the custom color" do
+          expect(2).to eq(4)
+        end
+      end
+      """
+      When I run `rspec custom_failure_color_spec.rb --format progress`
+      Then the failing example is printed in magenta
diff --git a/rspec-core/features/formatters/custom_formatter.feature b/rspec-core/features/formatters/custom_formatter.feature
new file mode 100644
index 0000000..01ff1e6
--- /dev/null
+++ b/rspec-core/features/formatters/custom_formatter.feature
@@ -0,0 +1,36 @@
+Feature: custom formatters
+
+  RSpec ships with general purpose output formatters. You can tell RSpec which
+  one to use using the [`--format` command line
+  option]('../command_line/format_option').
+
+  When RSpec's built-in output formatters don't, however, give you everything
+  you need, you can write your own custom formatter and tell RSpec to use that
+  one instead.  The simplest way is to subclass RSpec's `BaseTextFormatter`,
+  and then override just the methods that you want to modify.
+
+  Scenario: custom formatter
+    Given a file named "custom_formatter.rb" with:
+      """ruby
+      require "rspec/core/formatters/base_text_formatter"
+
+      class CustomFormatter < RSpec::Core::Formatters::BaseTextFormatter
+        def initialize(output)
+          super(output)
+        end
+
+        def example_started(proxy)
+          output << "example: " << proxy.description
+        end
+      end
+      """
+    And a file named "example_spec.rb" with:
+      """ruby
+      describe "my group" do
+        specify "my example" do
+        end
+      end
+      """
+    When I run `rspec example_spec.rb --require ./custom_formatter.rb --format CustomFormatter`
+    Then the output should contain "example: my example"
+    And  the exit status should be 0
diff --git a/rspec-core/features/formatters/json_formatter.feature b/rspec-core/features/formatters/json_formatter.feature
new file mode 100644
index 0000000..9bac429
--- /dev/null
+++ b/rspec-core/features/formatters/json_formatter.feature
@@ -0,0 +1,30 @@
+Feature: JSON formatter
+
+  Scenario: Formatting example names for retry
+    Given a file named "various_spec.rb" with:
+    """ruby
+    describe "Various" do
+      it "fails" do
+        "fail".should eq("succeed")
+      end
+
+      it "succeeds" do
+        "succeed".should eq("succeed")
+      end
+
+      it "pends"
+    end
+    """
+    When I run `rspec various_spec.rb --format j`
+    Then the output should contain all of these:
+          |"summary_line":"3 examples, 1 failure, 1 pending"|
+          |"examples":[                                     |
+          |"description":"fails"                             |
+          |"full_description":"Various fails"                |
+          |"status":"failed"                                 |
+          |"file_path":"./various_spec.rb"                   |
+          |"line_number":2                                   |
+          |"exception":{                                     |
+          |"class":"RSpec::Expectations::ExpectationNotMetError"|
+
+    And the exit status should be 1
diff --git a/rspec-core/features/formatters/text_formatter.feature b/rspec-core/features/formatters/text_formatter.feature
new file mode 100644
index 0000000..6ae1fb7
--- /dev/null
+++ b/rspec-core/features/formatters/text_formatter.feature
@@ -0,0 +1,46 @@
+Feature: text formatter
+
+  In order to easily see the result of running my specs
+  As an RSpec user
+  I want clear, concise, well-formatted output
+
+  Scenario: Backtrace formatting for failing specs in multiple files
+    Given a file named "string_spec.rb" with:
+      """ruby
+      describe String do
+        it "has a failing example" do
+          "foo".reverse.should eq("ofo")
+        end
+      end
+      """
+    And a file named "integer_spec.rb" with:
+      """ruby
+      describe Integer do
+        it "has a failing example" do
+          (7 + 5).should eq(11)
+        end
+      end
+      """
+    When I run `rspec integer_spec.rb string_spec.rb`
+    Then the backtrace-normalized output should contain:
+      """
+        1) Integer has a failing example
+           Failure/Error: (7 + 5).should eq(11)
+             
+             expected: 11
+                  got: 12
+             
+             (compared using ==)
+           # ./integer_spec.rb:3
+      """
+    And the backtrace-normalized output should contain:
+      """
+        2) String has a failing example
+           Failure/Error: "foo".reverse.should eq("ofo")
+             
+             expected: "ofo"
+                  got: "oof"
+             
+             (compared using ==)
+           # ./string_spec.rb:3
+      """
diff --git a/rspec-core/features/helper_methods/arbitrary_methods.feature b/rspec-core/features/helper_methods/arbitrary_methods.feature
new file mode 100644
index 0000000..26968b4
--- /dev/null
+++ b/rspec-core/features/helper_methods/arbitrary_methods.feature
@@ -0,0 +1,40 @@
+Feature: arbitrary helper methods
+
+  You can define methods in any example group using Ruby's `def` keyword or
+  `define_method` method. These _helper_ methods are exposed to examples in the
+  group in which they are defined and groups nested within that group, but not
+  parent or sibling groups.
+
+  Scenario: use a method defined in the same group
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "an example" do
+        def help
+          :available
+        end
+
+        it "has access to methods defined in its group" do
+          help.should be(:available)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: use a method defined in a parent group
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "an example" do
+        def help
+          :available
+        end
+
+        describe "in a nested group" do
+          it "has access to methods defined in its parent group" do
+            help.should be(:available)
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/helper_methods/let.feature b/rspec-core/features/helper_methods/let.feature
new file mode 100644
index 0000000..26f5f7c
--- /dev/null
+++ b/rspec-core/features/helper_methods/let.feature
@@ -0,0 +1,50 @@
+Feature: let and let!
+
+  Use `let` to define a memoized helper method.  The value will be cached
+  across multiple calls in the same example but not across examples.
+
+  Note that `let` is lazy-evaluated: it is not evaluated until the first time
+  the method it defines is invoked. You can use `let!` to force the method's
+  invocation before each example.
+
+  Scenario: use let to define memoized helper method
+    Given a file named "let_spec.rb" with:
+      """ruby
+      $count = 0
+      describe "let" do
+        let(:count) { $count += 1 }
+
+        it "memoizes the value" do
+          count.should eq(1)
+          count.should eq(1)
+        end
+
+        it "is not cached across examples" do
+          count.should eq(2)
+        end
+      end
+      """
+    When I run `rspec let_spec.rb`
+    Then the examples should all pass
+
+  Scenario: use let! to define a memoized helper method that is called in a before hook
+    Given a file named "let_bang_spec.rb" with:
+      """ruby
+      $count = 0
+      describe "let!" do
+        invocation_order = []
+
+        let!(:count) do
+          invocation_order << :let!
+          $count += 1
+        end
+
+        it "calls the helper method in a before hook" do
+          invocation_order << :example
+          invocation_order.should == [:let!, :example]
+          count.should eq(1)
+        end
+      end
+      """
+    When I run `rspec let_bang_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/helper_methods/modules.feature b/rspec-core/features/helper_methods/modules.feature
new file mode 100644
index 0000000..ce7294a
--- /dev/null
+++ b/rspec-core/features/helper_methods/modules.feature
@@ -0,0 +1,149 @@
+Feature: Define helper methods in a module
+
+  You can define helper methods in a module and include it in
+  your example groups using the `config.include` configuration
+  option.  `config.extend` can be used to extend the module onto
+  your example groups so that the methods in the module are available
+  in the example groups themselves (but not in the actual examples).
+
+  You can also include or extend the module onto only certain example
+  groups by passing a metadata hash as the last argument.  Only groups
+  that match the given metadata will include or extend the module.
+
+  If you set the `treat_symbols_as_metadata_keys_with_true_values` config option
+  to `true`, you can specify metadata using only symbols.
+
+  Background:
+    Given a file named "helpers.rb" with:
+      """ruby
+      module Helpers
+        def help
+          :available
+        end
+      end
+      """
+
+  Scenario: include a module in all example groups
+    Given a file named "include_module_spec.rb" with:
+      """ruby
+      require './helpers'
+
+      RSpec.configure do |c|
+        c.include Helpers
+      end
+
+      describe "an example group" do
+        it "has access to the helper methods defined in the module" do
+          help.should be(:available)
+        end
+      end
+      """
+    When I run `rspec include_module_spec.rb`
+    Then the examples should all pass
+
+  Scenario: extend a module in all example groups
+    Given a file named "extend_module_spec.rb" with:
+      """ruby
+      require './helpers'
+
+      RSpec.configure do |c|
+        c.extend Helpers
+      end
+
+      describe "an example group" do
+        puts "Help is #{help}"
+
+        it "does not have access to the helper methods defined in the module" do
+          expect { help }.to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec extend_module_spec.rb`
+    Then the examples should all pass
+    And the output should contain "Help is available"
+
+  Scenario: include a module in only some example groups
+    Given a file named "include_module_in_some_groups_spec.rb" with:
+      """ruby
+      require './helpers'
+
+      RSpec.configure do |c|
+        c.include Helpers, :foo => :bar
+      end
+
+      describe "an example group with matching metadata", :foo => :bar do
+        it "has access to the helper methods defined in the module" do
+          help.should be(:available)
+        end
+      end
+
+      describe "an example group without matching metadata" do
+        it "does not have access to the helper methods defined in the module" do
+          expect { help }.to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec include_module_in_some_groups_spec.rb`
+    Then the examples should all pass
+
+  Scenario: extend a module in only some example groups
+    Given a file named "extend_module_in_only_some_groups_spec.rb" with:
+      """ruby
+      require './helpers'
+
+      RSpec.configure do |c|
+        c.extend Helpers, :foo => :bar
+      end
+
+      describe "an example group with matching metadata", :foo => :bar do
+        puts "In a matching group, help is #{help}"
+
+        it "does not have access to the helper methods defined in the module" do
+          expect { help }.to raise_error(NameError)
+        end
+      end
+
+      describe "an example group without matching metadata" do
+        puts "In a non-matching group, help is #{help rescue 'not available'}"
+
+        it "does not have access to the helper methods defined in the module" do
+          expect { help }.to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec extend_module_in_only_some_groups_spec.rb`
+    Then the examples should all pass
+    And the output should contain "In a matching group, help is available"
+    And the output should contain "In a non-matching group, help is not available"
+
+  Scenario: use symbols as metadata
+    Given a file named "symbols_as_metadata_spec.rb" with:
+      """ruby
+      require './helpers'
+
+      RSpec.configure do |c|
+        c.treat_symbols_as_metadata_keys_with_true_values = true
+        c.include Helpers, :include_helpers
+        c.extend  Helpers, :extend_helpers
+      end
+
+      describe "an example group with matching include metadata", :include_helpers do
+        puts "In a group not matching the extend filter, help is #{help rescue 'not available'}"
+
+        it "has access to the helper methods defined in the module" do
+          help.should be(:available)
+        end
+      end
+
+      describe "an example group with matching extend metadata", :extend_helpers do
+        puts "In a group matching the extend filter, help is #{help}"
+
+        it "does not have access to the helper methods defined in the module" do
+          expect { help }.to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec symbols_as_metadata_spec.rb`
+    Then the examples should all pass
+    And the output should contain "In a group not matching the extend filter, help is not available"
+    And the output should contain "In a group matching the extend filter, help is available"
diff --git a/rspec-core/features/hooks/around_hooks.feature b/rspec-core/features/hooks/around_hooks.feature
new file mode 100644
index 0000000..d1cabec
--- /dev/null
+++ b/rspec-core/features/hooks/around_hooks.feature
@@ -0,0 +1,343 @@
+Feature: around hooks
+
+  Around hooks receive the example as a block argument, extended to behave like
+  a proc.  This lets you define code that should be executed before and after
+  the example. Of course, you can do the same thing with before and after hooks,
+  and it's often cleaner to do so.
+
+  Where around hooks shine is when you want to run an example in a block. For
+  example, if your database library offers a transaction method that receives
+  a block, you can use an around hook as described in the first scenario:
+
+  WARNING: around hooks do not share state with the example the way before and
+  after hooks do. This means that you can not share instance variables between
+  around hooks and examples.
+
+  Also, mock frameworks are set up and torn down within the context of running
+  the example, so you can not interact with them directly in around hooks.
+
+  Scenario: use the example as a proc within the block passed to around()
+    Given a file named "example_spec.rb" with:
+      """ruby
+      class Database
+        def self.transaction
+          puts "open transaction"
+          yield
+          puts "close transaction"
+        end
+      end
+
+      describe "around filter" do
+        around(:each) do |example|
+          Database.transaction(&example)
+        end
+
+        it "gets run in order" do
+          puts "run the example"
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain:
+      """
+      open transaction
+      run the example
+      close transaction
+      """
+
+  Scenario: invoke the example using run()
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "around hook" do
+        around(:each) do |example|
+          puts "around each before"
+          example.run
+          puts "around each after"
+        end
+
+        it "gets run in order" do
+          puts "in the example"
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain:
+      """
+      around each before
+      in the example
+      around each after
+      """
+
+  Scenario: access the example metadata
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "something" do
+        around(:each) do |example|
+          puts example.metadata[:foo]
+          example.run
+        end
+
+        it "does something", :foo => "this should show up in the output" do
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "this should show up in the output"
+
+  Scenario: define a global around hook
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.around(:each) do |example|
+          puts "around each before"
+          example.run
+          puts "around each after"
+        end
+      end
+
+      describe "around filter" do
+        it "gets run in order" do
+          puts "in the example"
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain:
+      """
+      around each before
+      in the example
+      around each after
+      """
+
+  Scenario: before/after(:each) hooks are wrapped by the around hook
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "around filter" do
+        around(:each) do |example|
+          puts "around each before"
+          example.run
+          puts "around each after"
+        end
+
+        before(:each) do
+          puts "before each"
+        end
+
+        after(:each) do
+          puts "after each"
+        end
+
+        it "gets run in order" do
+          puts "in the example"
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain:
+      """
+      around each before
+      before each
+      in the example
+      after each
+      around each after
+      """
+
+  Scenario: before/after(:all) hooks are NOT wrapped by the around hook
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "around filter" do
+        around(:each) do |example|
+          puts "around each before"
+          example.run
+          puts "around each after"
+        end
+
+        before(:all) do
+          puts "before all"
+        end
+
+        after(:all) do
+          puts "after all"
+        end
+
+        it "gets run in order" do
+          puts "in the example"
+        end
+      end
+      """
+    When I run `rspec --format progress example_spec.rb`
+    Then the output should contain:
+      """
+      before all
+      around each before
+      in the example
+      around each after
+      .after all
+      """
+
+  Scenario: examples run by an around block are run in the configured context
+    Given a file named "example_spec.rb" with:
+      """ruby
+      module IncludedInConfigureBlock
+        def included_in_configure_block; true; end
+      end
+
+      RSpec.configure do |c|
+        c.include IncludedInConfigureBlock
+      end
+
+      describe "around filter" do
+        around(:each) do |example|
+          example.run
+        end
+
+        it "runs the example in the correct context" do
+          included_in_configure_block.should be_true
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failure"
+
+  Scenario: implicitly pending examples are detected as Not yet implemented
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "implicit pending example" do
+        around(:each) do |example|
+          example.run
+        end
+
+        it "should be detected as Not yet implemented"
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failures, 1 pending"
+    And the output should contain:
+      """
+      Pending:
+        implicit pending example should be detected as Not yet implemented
+          # Not yet implemented
+      """
+
+
+  Scenario: explicitly pending examples are detected as pending
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "explicit pending example" do
+        around(:each) do |example|
+          example.run
+        end
+
+        it "should be detected as pending" do
+          pending
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failures, 1 pending"
+    And the output should contain:
+      """
+        explicit pending example should be detected as pending
+          # No reason given
+      """
+
+  Scenario: multiple around hooks in the same scope
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "if there are multiple around hooks in the same scope" do
+        around(:each) do |example|
+          puts "first around hook before"
+          example.run
+          puts "first around hook after"
+        end
+
+        around(:each) do |example|
+          puts "second around hook before"
+          example.run
+          puts "second around hook after"
+        end
+
+        it "they should all be run" do
+          puts "in the example"
+          1.should eq(1)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failure"
+    And the output should contain:
+      """
+      first around hook before
+      second around hook before
+      in the example
+      second around hook after
+      first around hook after
+      """
+
+  Scenario: around hooks in multiple scopes
+    Given a file named "example_spec.rb" with:
+    """ruby
+    describe "if there are around hooks in an outer scope" do
+      around(:each) do |example|
+        puts "first outermost around hook before"
+        example.run
+        puts "first outermost around hook after"
+      end
+
+      around(:each) do |example|
+        puts "second outermost around hook before"
+        example.run
+        puts "second outermost around hook after"
+      end
+
+      describe "outer scope" do
+        around(:each) do |example|
+          puts "first outer around hook before"
+          example.run
+          puts "first outer around hook after"
+        end
+
+        around(:each) do |example|
+          puts "second outer around hook before"
+          example.run
+          puts "second outer around hook after"
+        end
+
+        describe "inner scope" do
+          around(:each) do |example|
+            puts "first inner around hook before"
+            example.run
+            puts "first inner around hook after"
+          end
+
+          around(:each) do |example|
+            puts "second inner around hook before"
+            example.run
+            puts "second inner around hook after"
+          end
+
+          it "they should all be run" do
+            puts "in the example"
+          end
+        end
+      end
+    end
+    """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failure"
+    And the output should contain:
+    """
+    first outermost around hook before
+    second outermost around hook before
+    first outer around hook before
+    second outer around hook before
+    first inner around hook before
+    second inner around hook before
+    in the example
+    second inner around hook after
+    first inner around hook after
+    second outer around hook after
+    first outer around hook after
+    second outermost around hook after
+    first outermost around hook after
+    """
diff --git a/rspec-core/features/hooks/before_and_after_hooks.feature b/rspec-core/features/hooks/before_and_after_hooks.feature
new file mode 100644
index 0000000..be12110
--- /dev/null
+++ b/rspec-core/features/hooks/before_and_after_hooks.feature
@@ -0,0 +1,427 @@
+Feature: before and after hooks
+
+  Use `before` and `after` hooks to execute arbitrary code before and/or
+  after the body of an example is run:
+
+      before(:each) # run before each example
+      before(:all)  # run one time only, before all of the examples in a group
+
+      after(:each) # run after each example
+      after(:all)  # run one time only, after all of the examples in a group
+
+  Before and after blocks are called in the following order:
+
+      before suite
+      before all
+      before each
+      after  each
+      after  all
+      after  suite
+
+  `before` and `after` hooks can be defined directly in the example groups they
+  should run in, or in a global RSpec.configure block.
+
+  Setting instance variables are not supported in `before(:suite)`.
+
+  Mocks are only supported in `before(:each)`.
+
+  Scenario: define before(:each) block
+    Given a file named "before_each_spec.rb" with:
+      """ruby
+      require "rspec/expectations"
+
+      class Thing
+        def widgets
+          @widgets ||= []
+        end
+      end
+
+      describe Thing do
+        before(:each) do
+          @thing = Thing.new
+        end
+
+        describe "initialized in before(:each)" do
+          it "has 0 widgets" do
+            @thing.should have(0).widgets
+          end
+
+          it "can get accept new widgets" do
+            @thing.widgets << Object.new
+          end
+
+          it "does not share state across examples" do
+            @thing.should have(0).widgets
+          end
+        end
+      end
+      """
+    When I run `rspec before_each_spec.rb`
+    Then the examples should all pass
+
+  Scenario: define before(:all) block in example group
+    Given a file named "before_all_spec.rb" with:
+      """ruby
+      require "rspec/expectations"
+
+      class Thing
+        def widgets
+          @widgets ||= []
+        end
+      end
+
+      describe Thing do
+        before(:all) do
+          @thing = Thing.new
+        end
+
+        describe "initialized in before(:all)" do
+          it "has 0 widgets" do
+            @thing.should have(0).widgets
+          end
+
+          it "can get accept new widgets" do
+            @thing.widgets << Object.new
+          end
+
+          it "shares state across examples" do
+            @thing.should have(1).widgets
+          end
+        end
+      end
+      """
+    When I run `rspec before_all_spec.rb`
+    Then the examples should all pass
+
+    When I run `rspec before_all_spec.rb:15`
+    Then the examples should all pass
+
+  Scenario: failure in before(:all) block
+    Given a file named "before_all_spec.rb" with:
+      """ruby
+      describe "an error in before(:all)" do
+        before(:all) do
+          raise "oops"
+        end
+
+        it "fails this example" do
+        end
+
+        it "fails this example, too" do
+        end
+
+        after(:all) do
+          puts "after all ran"
+        end
+
+        describe "nested group" do
+          it "fails this third example" do
+          end
+
+          it "fails this fourth example" do
+          end
+
+          describe "yet another level deep" do
+            it "fails this last example" do
+            end
+          end
+        end
+      end
+      """
+    When I run `rspec before_all_spec.rb --format documentation`
+    Then the output should contain "5 examples, 5 failures"
+    And the output should contain:
+      """
+      an error in before(:all)
+        fails this example (FAILED - 1)
+        fails this example, too (FAILED - 2)
+        nested group
+          fails this third example (FAILED - 3)
+          fails this fourth example (FAILED - 4)
+          yet another level deep
+            fails this last example (FAILED - 5)
+      after all ran
+      """
+
+    When I run `rspec before_all_spec.rb:9 --format documentation`
+    Then the output should contain "1 example, 1 failure"
+    And the output should contain:
+      """
+      an error in before(:all)
+        fails this example, too (FAILED - 1)
+      """
+
+  Scenario: failure in after(:all) block
+    Given a file named "after_all_spec.rb" with:
+      """ruby
+      describe "an error in after(:all)" do
+        after(:all) do
+          raise StandardError.new("Boom!")
+        end
+
+        it "passes this example" do
+        end
+
+        it "passes this example, too" do
+        end
+      end
+      """
+    When I run `rspec after_all_spec.rb`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      An error occurred in an after(:all) hook.
+        StandardError: Boom!
+      """
+
+  Scenario: define before and after blocks in configuration
+    Given a file named "befores_in_configuration_spec.rb" with:
+      """ruby
+      require "rspec/expectations"
+
+      RSpec.configure do |config|
+        config.before(:each) do
+          @before_each = "before each"
+        end
+        config.before(:all) do
+          @before_all = "before all"
+        end
+      end
+
+      describe "stuff in before blocks" do
+        describe "with :all" do
+          it "should be available in the example" do
+            @before_all.should eq("before all")
+          end
+        end
+        describe "with :each" do
+          it "should be available in the example" do
+            @before_each.should eq("before each")
+          end
+        end
+      end
+      """
+    When I run `rspec befores_in_configuration_spec.rb`
+    Then the examples should all pass
+
+  Scenario: before/after blocks are run in order
+    Given a file named "ensure_block_order_spec.rb" with:
+      """ruby
+      require "rspec/expectations"
+
+      describe "before and after callbacks" do
+        before(:all) do
+          puts "before all"
+        end
+
+        before(:each) do
+          puts "before each"
+        end
+
+        after(:each) do
+          puts "after each"
+        end
+
+        after(:all) do
+          puts "after all"
+        end
+
+        it "gets run in order" do
+
+        end
+      end
+      """
+    When I run `rspec --format progress ensure_block_order_spec.rb`
+    Then the output should contain:
+      """
+      before all
+      before each
+      after each
+      .after all
+      """
+
+  Scenario: before/after blocks defined in config are run in order
+    Given a file named "configuration_spec.rb" with:
+      """ruby
+      require "rspec/expectations"
+
+      RSpec.configure do |config|
+        config.before(:suite) do
+          puts "before suite"
+        end
+
+        config.before(:all) do
+          puts "before all"
+        end
+
+        config.before(:each) do
+          puts "before each"
+        end
+
+        config.after(:each) do
+          puts "after each"
+        end
+
+        config.after(:all) do
+          puts "after all"
+        end
+
+        config.after(:suite) do
+          puts "after suite"
+        end
+      end
+
+      describe "ignore" do
+        example "ignore" do
+        end
+      end
+      """
+    When I run `rspec --format progress configuration_spec.rb`
+    Then the output should contain:
+      """
+      before suite
+      before all
+      before each
+      after each
+      .after all
+      after suite
+      """
+
+  Scenario: before/after all blocks are run once
+    Given a file named "before_and_after_all_spec.rb" with:
+      """ruby
+      describe "before and after callbacks" do
+        before(:all) do
+          puts "outer before all"
+        end
+
+        example "in outer group" do
+        end
+
+        after(:all) do
+          puts "outer after all"
+        end
+
+        describe "nested group" do
+          before(:all) do
+            puts "inner before all"
+          end
+
+          example "in nested group" do
+          end
+
+          after(:all) do
+            puts "inner after all"
+          end
+        end
+
+      end
+      """
+    When I run `rspec --format progress before_and_after_all_spec.rb`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      outer before all
+      .inner before all
+      .inner after all
+      outer after all
+      """
+
+    When I run `rspec --format progress before_and_after_all_spec.rb:14`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      outer before all
+      inner before all
+      .inner after all
+      outer after all
+      """
+
+    When I run `rspec --format progress before_and_after_all_spec.rb:6`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      outer before all
+      .outer after all
+      """
+
+  Scenario: nested examples have access to state set in outer before(:all)
+    Given a file named "before_all_spec.rb" with:
+      """ruby
+      describe "something" do
+        before :all do
+          @value = 123
+        end
+
+        describe "nested" do
+          it "access state set in before(:all)" do
+            @value.should eq(123)
+          end
+
+          describe "nested more deeply" do
+            it "access state set in before(:all)" do
+              @value.should eq(123)
+            end
+          end
+        end
+
+        describe "nested in parallel" do
+          it "access state set in before(:all)" do
+            @value.should eq(123)
+          end
+        end
+      end
+      """
+    When I run `rspec before_all_spec.rb`
+    Then the examples should all pass
+
+  Scenario: before/after all blocks have access to state
+    Given a file named "before_and_after_all_spec.rb" with:
+      """ruby
+      describe "before and after callbacks" do
+        before(:all) do
+          @outer_state = "set in outer before all"
+        end
+
+        example "in outer group" do
+          @outer_state.should eq("set in outer before all")
+        end
+
+        describe "nested group" do
+          before(:all) do
+            @inner_state = "set in inner before all"
+          end
+
+          example "in nested group" do
+            @outer_state.should eq("set in outer before all")
+            @inner_state.should eq("set in inner before all")
+          end
+
+          after(:all) do
+            @inner_state.should eq("set in inner before all")
+          end
+        end
+
+        after(:all) do
+          @outer_state.should eq("set in outer before all")
+        end
+      end
+      """
+    When I run `rspec before_and_after_all_spec.rb`
+    Then the examples should all pass
+
+  Scenario: exception in before(:each) is captured and reported as failure
+    Given a file named "error_in_before_each_spec.rb" with:
+      """ruby
+      describe "error in before(:each)" do
+        before(:each) do
+          raise "this error"
+        end
+
+        it "is reported as failure" do
+        end
+      end
+      """
+    When I run `rspec error_in_before_each_spec.rb`
+    Then the output should contain "1 example, 1 failure"
+    And the output should contain "this error"
diff --git a/rspec-core/features/hooks/filtering.feature b/rspec-core/features/hooks/filtering.feature
new file mode 100644
index 0000000..4c2a6cb
--- /dev/null
+++ b/rspec-core/features/hooks/filtering.feature
@@ -0,0 +1,234 @@
+Feature: filters
+
+  `before`, `after`, and `around` hooks defined in the block passed to
+  `RSpec.configure` can be constrained to specific examples and/or groups using
+  metadata as a filter.
+
+      RSpec.configure do |c|
+        c.before(:each, :type => :model) do
+        end
+      end
+
+      describe "something", :type => :model do
+      end
+
+  You can specify metadata using only symbols if you set the
+  `treat_symbols_as_metadata_keys_with_true_values` config option to `true`.
+
+  Scenario: filter `before(:each)` hooks using arbitrary metadata
+    Given a file named "filter_before_each_hooks_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.before(:each, :foo => :bar) do
+          invoked_hooks << :before_each_foo_bar
+        end
+      end
+
+      describe "a filtered before :each hook" do
+        let(:invoked_hooks) { [] }
+
+        describe "group without matching metadata" do
+          it "does not run the hook" do
+            invoked_hooks.should be_empty
+          end
+
+          it "runs the hook for an example with matching metadata", :foo => :bar do
+            invoked_hooks.should == [:before_each_foo_bar]
+          end
+        end
+
+        describe "group with matching metadata", :foo => :bar do
+          it "runs the hook" do
+            invoked_hooks.should == [:before_each_foo_bar]
+          end
+        end
+      end
+      """
+    When I run `rspec filter_before_each_hooks_spec.rb`
+    Then the examples should all pass
+
+  Scenario: filter `after(:each)` hooks using arbitrary metadata
+    Given a file named "filter_after_each_hooks_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.after(:each, :foo => :bar) do
+          raise "boom!"
+        end
+      end
+
+      describe "a filtered after :each hook" do
+        describe "group without matching metadata" do
+          it "does not run the hook" do
+            # should pass
+          end
+
+          it "runs the hook for an example with matching metadata", :foo => :bar do
+            # should fail
+          end
+        end
+
+        describe "group with matching metadata", :foo => :bar do
+          it "runs the hook" do
+            # should fail
+          end
+        end
+      end
+      """
+    When I run `rspec filter_after_each_hooks_spec.rb`
+    Then the output should contain "3 examples, 2 failures"
+
+  Scenario: filter around(:each) hooks using arbitrary metadata
+    Given a file named "filter_around_each_hooks_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.around(:each, :foo => :bar) do |example|
+          order << :before_around_each_foo_bar
+          example.run
+          order.should == [:before_around_each_foo_bar, :example]
+        end
+      end
+
+      describe "a filtered around(:each) hook" do
+        let(:order) { [] }
+
+        describe "a group without matching metadata" do
+          it "does not run the hook" do
+            order.should be_empty
+          end
+
+          it "runs the hook for an example with matching metadata", :foo => :bar do
+            order.should == [:before_around_each_foo_bar]
+            order << :example
+          end
+        end
+
+        describe "a group with matching metadata", :foo => :bar do
+          it "runs the hook for an example with matching metadata", :foo => :bar do
+            order.should == [:before_around_each_foo_bar]
+            order << :example
+          end
+        end
+      end
+      """
+    When I run `rspec filter_around_each_hooks_spec.rb`
+    Then the examples should all pass
+
+  Scenario: filter before(:all) hooks using arbitrary metadata
+    Given a file named "filter_before_all_hooks_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.before(:all, :foo => :bar) { @hook = :before_all_foo_bar }
+      end
+
+      describe "a filtered before(:all) hook" do
+        describe "a group without matching metadata" do
+          it "does not run the hook" do
+            @hook.should be_nil
+          end
+
+          describe "a nested subgroup with matching metadata", :foo => :bar do
+            it "runs the hook" do
+              @hook.should == :before_all_foo_bar
+            end
+          end
+        end
+
+        describe "a group with matching metadata", :foo => :bar do
+          it "runs the hook" do
+            @hook.should == :before_all_foo_bar
+          end
+
+          describe "a nested subgroup" do
+            it "runs the hook" do
+              @hook.should == :before_all_foo_bar
+            end
+          end
+        end
+      end
+      """
+    When I run `rspec filter_before_all_hooks_spec.rb`
+    Then the examples should all pass
+
+  Scenario: filter after(:all) hooks using arbitrary metadata
+    Given a file named "filter_after_all_hooks_spec.rb" with:
+      """ruby
+      example_msgs = []
+
+      RSpec.configure do |config|
+        config.after(:all, :foo => :bar) do
+          puts "after :all"
+        end
+      end
+
+      describe "a filtered after(:all) hook" do
+        describe "a group without matching metadata" do
+          it "does not run the hook" do
+            puts "unfiltered"
+          end
+        end
+
+        describe "a group with matching metadata", :foo => :bar do
+          it "runs the hook" do
+            puts "filtered 1"
+          end
+        end
+
+        describe "another group without matching metadata" do
+          describe "a nested subgroup with matching metadata", :foo => :bar do
+            it "runs the hook" do
+              puts "filtered 2"
+            end
+          end
+        end
+      end
+      """
+    When I run `rspec --format progress filter_after_all_hooks_spec.rb`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      unfiltered
+      .filtered 1
+      .after :all
+      filtered 2
+      .after :all
+      """
+
+  Scenario: Use symbols as metadata
+    Given a file named "less_verbose_metadata_filter.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.treat_symbols_as_metadata_keys_with_true_values = true
+        c.before(:each, :before_each) { puts "before each" }
+        c.after(:each,  :after_each) { puts "after each" }
+        c.around(:each, :around_each) do |example|
+          puts "around each (before)"
+          example.run
+          puts "around each (after)"
+        end
+        c.before(:all, :before_all) { puts "before all" }
+        c.after(:all,  :after_all) { puts "after all" }
+      end
+
+      describe "group 1", :before_all, :after_all do
+        it("") { puts "example 1" }
+        it("", :before_each) { puts "example 2" }
+        it("", :after_each) { puts "example 3" }
+        it("", :around_each) { puts "example 4" }
+      end
+      """
+    When I run `rspec --format progress less_verbose_metadata_filter.rb`
+    Then the examples should all pass
+    And the output should contain:
+      """
+      before all
+      example 1
+      .before each
+      example 2
+      .example 3
+      after each
+      .around each (before)
+      example 4
+      around each (after)
+      .after all
+      """
+
diff --git a/rspec-core/features/metadata/current_example.feature b/rspec-core/features/metadata/current_example.feature
new file mode 100644
index 0000000..5fee6b4
--- /dev/null
+++ b/rspec-core/features/metadata/current_example.feature
@@ -0,0 +1,17 @@
+Feature: current example
+
+  You can reference the example object, and access its metadata, using
+  the `example` method within an example.
+
+  Scenario: access the example object from within an example
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "knows itself as example" do
+          example.description.should eq("knows itself as example")
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the example should pass
+
diff --git a/rspec-core/features/metadata/described_class.feature b/rspec-core/features/metadata/described_class.feature
new file mode 100644
index 0000000..237d4cf
--- /dev/null
+++ b/rspec-core/features/metadata/described_class.feature
@@ -0,0 +1,17 @@
+Feature: described class
+
+  If the first argument to the outermost example group is a class, the class is
+  exposed to each example via the described_class() method.
+
+  Scenario: access the described class from the example
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      describe Fixnum do
+        it "is available as described_class" do
+          described_class.should eq(Fixnum)
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the example should pass
+
diff --git a/rspec-core/features/metadata/user_defined.feature b/rspec-core/features/metadata/user_defined.feature
new file mode 100644
index 0000000..faa6634
--- /dev/null
+++ b/rspec-core/features/metadata/user_defined.feature
@@ -0,0 +1,113 @@
+Feature: User-defined metadata
+
+  You can attach user-defined metadata to any example group or example.
+  Pass a hash as the last argument (before the block) to `describe`,
+  `context` or `it`.  RSpec supports many configuration options that apply
+  only to certain examples or groups based on the metadata.
+
+  Metadata defined on an example group is available (and can be overridden)
+  by any sub-group or from any example in that group or a sub-group.
+
+  In addition, there is a configuration option (which will be the default
+  behavior in RSpec 3) that allows you to specify metadata using just
+  symbols:
+
+  ```ruby
+  RSpec.configure do |c|
+    c.treat_symbols_as_metadata_keys_with_true_values = true
+  end
+  ```
+
+  Each symbol passed as an argument to `describe`, `context` or `it` will
+  be a key in the metadata hash, with a corresponding value of `true`.
+
+  Scenario: define group metadata using a hash
+    Given a file named "define_group_metadata_with_hash_spec.rb" with:
+      """ruby
+      describe "a group with user-defined metadata", :foo => 17 do
+        it 'has access to the metadata in the example' do
+          example.metadata[:foo].should eq(17)
+        end
+
+        it 'does not have access to metadata defined on sub-groups' do
+          example.metadata.should_not include(:bar)
+        end
+
+        describe 'a sub-group with user-defined metadata', :bar => 12 do
+          it 'has access to the sub-group metadata' do
+            example.metadata[:foo].should eq(17)
+          end
+
+          it 'also has access to metadata defined on parent groups' do
+            example.metadata[:bar].should eq(12)
+          end
+        end
+      end
+      """
+    When I run `rspec define_group_metadata_with_hash_spec.rb`
+    Then the examples should all pass
+
+  Scenario: define example metadata using a hash
+    Given a file named "define_example_metadata_with_hash_spec.rb" with:
+      """ruby
+      describe "a group with no user-defined metadata" do
+        it 'has an example with metadata', :foo => 17 do
+          example.metadata[:foo].should eq(17)
+          example.metadata.should_not include(:bar)
+        end
+
+        it 'has another example with metadata', :bar => 12, :bazz => 33 do
+          example.metadata[:bar].should eq(12)
+          example.metadata[:bazz].should eq(33)
+          example.metadata.should_not include(:foo)
+        end
+      end
+      """
+    When I run `rspec define_example_metadata_with_hash_spec.rb`
+    Then the examples should all pass
+
+  Scenario: override user-defined metadata
+    Given a file named "override_metadata_spec.rb" with:
+      """ruby
+      describe "a group with user-defined metadata", :foo => 'bar' do
+        it 'can be overridden by an example', :foo => 'bazz' do
+          example.metadata[:foo].should == 'bazz'
+        end
+
+        describe "a sub-group with an override", :foo => 'goo' do
+          it 'can be overridden by a sub-group' do
+            example.metadata[:foo].should == 'goo'
+          end
+        end
+      end
+      """
+    When I run `rspec override_metadata_spec.rb`
+    Then the examples should all pass
+
+  Scenario: less verbose metadata
+    Given a file named "less_verbose_metadata_spec.rb" with:
+      """ruby
+      RSpec.configure do |c|
+        c.treat_symbols_as_metadata_keys_with_true_values = true
+      end
+
+      describe "a group with simple metadata", :fast, :simple, :bug => 73 do
+        it 'has `:fast => true` metadata' do
+          example.metadata[:fast].should == true
+        end
+
+        it 'has `:simple => true` metadata' do
+          example.metadata[:simple].should == true
+        end
+
+        it 'can still use a hash for metadata' do
+          example.metadata[:bug].should eq(73)
+        end
+
+        it 'can define simple metadata on an example', :special do
+          example.metadata[:special].should == true
+        end
+      end
+      """
+    When I run `rspec less_verbose_metadata_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/mock_framework_integration/use_any_framework.feature b/rspec-core/features/mock_framework_integration/use_any_framework.feature
new file mode 100644
index 0000000..4cc2f3c
--- /dev/null
+++ b/rspec-core/features/mock_framework_integration/use_any_framework.feature
@@ -0,0 +1,106 @@
+Feature: mock with an alternative framework
+
+  In addition to rspec, mocha, flexmock, and RR, you can choose an alternate
+  framework as the mocking framework. You (or the framework authors) just needs
+  to provide an adapter that hooks RSpec's events into those of the framework.
+
+  A mock framework adapter must expose three methods:
+
+  * `setup_mocks_for_rspec`
+    * called before each example is run
+  * `verify_mocks_for_rspec`
+    * called after each example is run
+    * this is where message expectation failures should result in an error with
+      the appropriate failure message
+  * `teardown_mocks_for_rspec`
+    * called after `verify_mocks_for_rspec`
+    * use this to clean up resources, restore objects to earlier state, etc
+    * guaranteed to run even if there are failures
+
+  Scenario: Mock with alternate framework
+    Given a file named "expector.rb" with:
+      """ruby
+      class Expector
+        class << self
+          def expectors
+            @expectors ||= []
+          end
+
+          def clear_expectors
+            expectors.clear
+          end
+
+          def verify_expectors
+            expectors.each {|d| d.verify}
+          end
+        end
+
+        def initialize
+          self.class.expectors << self
+        end
+
+        def expectations
+          @expectations ||= []
+        end
+
+        def expect(message)
+          expectations << message.to_s
+        end
+
+        def verify
+          unless expectations.empty?
+            raise expectations.map {|e|
+              "expected #{e}, but it was never received"
+            }.join("\n")
+          end
+        end
+
+      private
+
+        def method_missing(name, *args, &block)
+          expectations.delete(name.to_s)
+        end
+
+      public
+
+        module RSpecAdapter
+          def setup_mocks_for_rspec
+            # no setup necessary
+          end
+
+          def verify_mocks_for_rspec
+            Expector.verify_expectors.each {|d| d.verify}
+          end
+
+          def teardown_mocks_for_rspec
+            Expector.clear_expectors
+          end
+        end
+      end
+      """
+
+    Given a file named "example_spec.rb" with:
+      """ruby
+      require File.expand_path("../expector", __FILE__)
+
+      RSpec.configure do |config|
+        config.mock_framework = Expector::RSpecAdapter
+      end
+
+      describe Expector do
+        it "passes when message is received" do
+          expector = Expector.new
+          expector.expect(:foo)
+          expector.foo
+        end
+
+        it "fails when message is received" do
+          expector = Expector.new
+          expector.expect(:foo)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb --format doc`
+    Then the exit status should be 1
+    And the output should contain "2 examples, 1 failure"
+    And the output should contain "fails when message is received (FAILED - 1)"
diff --git a/rspec-core/features/mock_framework_integration/use_flexmock.feature b/rspec-core/features/mock_framework_integration/use_flexmock.feature
new file mode 100644
index 0000000..63b2083
--- /dev/null
+++ b/rspec-core/features/mock_framework_integration/use_flexmock.feature
@@ -0,0 +1,96 @@
+Feature: mock with flexmock
+
+  Configure RSpec to use flexmock as shown in the scenarios below.
+
+  Scenario: passing message expectation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :flexmock
+      end
+
+      describe "mocking with Flexmock" do
+        it "passes when it should" do
+          receiver = flexmock('receiver')
+          receiver.should_receive(:message).once
+          receiver.message
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: failing message expecation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :flexmock
+      end
+
+      describe "mocking with Flexmock" do
+        it "fails when it should" do
+          receiver = flexmock('receiver')
+          receiver.should_receive(:message).once
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 1 failure"
+
+  Scenario: failing message expectation in pending block (remains pending)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :flexmock
+      end
+
+      describe "failed message expectation in a pending block" do
+        it "is listed as pending" do
+          pending do
+            receiver = flexmock('receiver')
+            receiver.should_receive(:message).once
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failures, 1 pending"
+    And the exit status should be 0
+
+  Scenario: passing message expectation in pending block (fails)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :flexmock
+      end
+
+      describe "passing message expectation in a pending block" do
+        it "fails with FIXED" do
+          pending do
+            receiver = flexmock('receiver')
+            receiver.should_receive(:message).once
+            receiver.message
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "FIXED"
+    Then the output should contain "1 example, 1 failure"
+    And the exit status should be 1
+
+  Scenario: accessing RSpec.configuration.mock_framework.framework_name
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :flexmock
+      end
+
+      describe "RSpec.configuration.mock_framework.framework_name" do
+        it "returns :flexmock" do
+          RSpec.configuration.mock_framework.framework_name.should eq(:flexmock)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/mock_framework_integration/use_mocha.feature b/rspec-core/features/mock_framework_integration/use_mocha.feature
new file mode 100644
index 0000000..73e40cf
--- /dev/null
+++ b/rspec-core/features/mock_framework_integration/use_mocha.feature
@@ -0,0 +1,97 @@
+Feature: mock with mocha
+
+  Configure RSpec to use mocha as shown in the scenarios below.
+
+  Scenario: passing message expectation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :mocha
+      end
+
+      describe "mocking with RSpec" do
+        it "passes when it should" do
+          receiver = mock('receiver')
+          receiver.expects(:message).once
+          receiver.message
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: failing message expecation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :mocha
+      end
+
+      describe "mocking with RSpec" do
+        it "fails when it should" do
+          receiver = mock('receiver')
+          receiver.expects(:message).once
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 1 failure"
+
+  Scenario: failing message expectation in pending block (remains pending)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :mocha
+      end
+
+      describe "failed message expectation in a pending block" do
+        it "is listed as pending" do
+          pending do
+            receiver = mock('receiver')
+            receiver.expects(:message).once
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failures, 1 pending"
+    And the exit status should be 0
+
+  Scenario: passing message expectation in pending block (fails)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :mocha
+      end
+
+      describe "passing message expectation in a pending block" do
+        it "fails with FIXED" do
+          pending do
+            receiver = mock('receiver')
+            receiver.expects(:message).once
+            receiver.message
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "FIXED"
+    Then the output should contain "1 example, 1 failure"
+    And the exit status should be 1
+
+  Scenario: accessing RSpec.configuration.mock_framework.framework_name
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :mocha
+      end
+
+      describe "RSpec.configuration.mock_framework.framework_name" do
+        it "returns :mocha" do
+          RSpec.configuration.mock_framework.framework_name.should eq(:mocha)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
diff --git a/rspec-core/features/mock_framework_integration/use_rr.feature b/rspec-core/features/mock_framework_integration/use_rr.feature
new file mode 100644
index 0000000..26e4f0e
--- /dev/null
+++ b/rspec-core/features/mock_framework_integration/use_rr.feature
@@ -0,0 +1,98 @@
+Feature: mock with rr
+
+  Configure RSpec to use rr as shown in the scenarios below.
+
+  Scenario: passing message expectation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rr
+      end
+
+      describe "mocking with RSpec" do
+        it "passes when it should" do
+          receiver = Object.new
+          mock(receiver).message
+          receiver.message
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: failing message expecation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rr
+      end
+
+      describe "mocking with RSpec" do
+        it "fails when it should" do
+          receiver = Object.new
+          mock(receiver).message
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 1 failure"
+
+  Scenario: failing message expectation in pending block (remains pending)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rr
+      end
+
+      describe "failed message expectation in a pending block" do
+        it "is listed as pending" do
+          pending do
+            receiver = Object.new
+            mock(receiver).message
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failures, 1 pending"
+    And the exit status should be 0
+
+  Scenario: passing message expectation in pending block (fails)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rr
+      end
+
+      describe "passing message expectation in a pending block" do
+        it "fails with FIXED" do
+          pending do
+            receiver = Object.new
+            mock(receiver).message
+            receiver.message
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "FIXED"
+    Then the output should contain "1 example, 1 failure"
+    And the exit status should be 1
+
+  Scenario: accessing RSpec.configuration.mock_framework.framework_name
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rr
+      end
+
+      describe "RSpec.configuration.mock_framework.framework_name" do
+        it "returns :rr" do
+          RSpec.configuration.mock_framework.framework_name.should eq(:rr)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+
diff --git a/rspec-core/features/mock_framework_integration/use_rspec.feature b/rspec-core/features/mock_framework_integration/use_rspec.feature
new file mode 100644
index 0000000..ca7b22a
--- /dev/null
+++ b/rspec-core/features/mock_framework_integration/use_rspec.feature
@@ -0,0 +1,97 @@
+Feature: mock with rspec
+
+  RSpec uses its own mocking framework by default, or you can configure it
+  explicitly.
+
+  Scenario: passing message expectation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rspec
+      end
+
+      describe "mocking with RSpec" do
+        it "passes when it should" do
+          receiver = double('receiver')
+          receiver.should_receive(:message)
+          receiver.message
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: failing message expecation
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rspec
+      end
+
+      describe "mocking with RSpec" do
+        it "fails when it should" do
+          receiver = double('receiver')
+          receiver.should_receive(:message)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 1 failure"
+
+  Scenario: failing message expectation in pending block (remains pending)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rspec
+      end
+
+      describe "failed message expectation in a pending block" do
+        it "is listed as pending" do
+          pending do
+            receiver = double('receiver')
+            receiver.should_receive(:message)
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "1 example, 0 failures, 1 pending"
+    And the exit status should be 0
+
+  Scenario: passing message expectation in pending block (fails)
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rspec
+      end
+
+      describe "passing message expectation in a pending block" do
+        it "fails with FIXED" do
+          pending do
+            receiver = double('receiver')
+            receiver.should_receive(:message)
+            receiver.message
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "FIXED"
+    Then the output should contain "1 example, 1 failure"
+    And the exit status should be 1
+
+  Scenario: accessing RSpec.configuration.mock_framework.framework_name
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_framework = :rspec
+      end
+
+      describe "RSpec.configuration.mock_framework.framework_name" do
+        it "returns :rspec" do
+          RSpec.configuration.mock_framework.framework_name.should eq(:rspec)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/pending/pending_examples.feature b/rspec-core/features/pending/pending_examples.feature
new file mode 100644
index 0000000..68b9db2
--- /dev/null
+++ b/rspec-core/features/pending/pending_examples.feature
@@ -0,0 +1,229 @@
+Feature: pending examples
+
+  RSpec offers four ways to indicate that an example is disabled pending
+  some action.
+
+  Scenario: pending implementation
+    Given a file named "example_without_block_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "is a pending example"
+      end
+      """
+    When I run `rspec example_without_block_spec.rb`
+    Then the exit status should be 0
+    And the output should contain "1 example, 0 failures, 1 pending"
+    And the output should contain "Not yet implemented"
+    And the output should contain "example_without_block_spec.rb:2"
+
+  Scenario: pending any arbitrary reason, with no block
+    Given a file named "pending_without_block_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "is implemented but waiting" do
+          pending("something else getting finished")
+          this_should_not_get_executed
+        end
+      end
+      """
+    When I run `rspec pending_without_block_spec.rb`
+    Then the exit status should be 0
+    And the output should contain "1 example, 0 failures, 1 pending"
+    And the output should contain:
+      """
+      Pending:
+        an example is implemented but waiting
+          # something else getting finished
+          # ./pending_without_block_spec.rb:2
+      """
+
+  Scenario: pending any arbitrary reason, with a block that fails
+    Given a file named "pending_with_failing_block_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "is implemented but waiting" do
+          pending("something else getting finished") do
+            raise "this is the failure"
+          end
+        end
+      end
+      """
+    When I run `rspec pending_with_failing_block_spec.rb`
+    Then the exit status should be 0
+    And the output should contain "1 example, 0 failures, 1 pending"
+    And the output should contain:
+      """
+      Pending:
+        an example is implemented but waiting
+          # something else getting finished
+          # ./pending_with_failing_block_spec.rb:2
+      """
+
+  Scenario: pending any arbitrary reason, with a block that passes
+    Given a file named "pending_with_passing_block_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "is implemented but waiting" do
+          pending("something else getting finished") do
+            true.should be(true)
+          end
+        end
+      end
+      """
+    When I run `rspec pending_with_passing_block_spec.rb`
+    Then the exit status should not be 0
+    And the output should contain "1 example, 1 failure"
+    And the output should contain "FIXED"
+    And the output should contain "Expected pending 'something else getting finished' to fail. No Error was raised."
+    And the output should contain "pending_with_passing_block_spec.rb:3"
+
+  Scenario: temporarily pending by prefixing `it`, `specify`, or `example` with an x
+    Given a file named "temporarily_pending_spec.rb" with:
+      """ruby
+      describe "an example" do
+        xit "is pending using xit" do
+        end
+
+        xspecify "is pending using xspecify" do
+        end
+
+        xexample "is pending using xexample" do
+        end
+      end
+      """
+    When I run `rspec temporarily_pending_spec.rb`
+    Then the exit status should be 0
+    And the output should contain "3 examples, 0 failures, 3 pending"
+    And the output should contain:
+      """
+      Pending:
+        an example is pending using xit
+          # Temporarily disabled with xit
+          # ./temporarily_pending_spec.rb:2
+        an example is pending using xspecify
+          # Temporarily disabled with xspecify
+          # ./temporarily_pending_spec.rb:5
+        an example is pending using xexample
+          # Temporarily disabled with xexample
+          # ./temporarily_pending_spec.rb:8
+      """
+
+  Scenario: example with no docstring and pending method using documentation formatter
+    Given a file named "pending_with_no_docstring_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "checks something" do
+          (3+4).should eq(7)
+        end
+        specify do
+          pending
+        end
+      end
+      """
+    When I run `rspec pending_with_no_docstring_spec.rb --format documentation`
+    Then the exit status should be 0
+    And the output should contain "2 examples, 0 failures, 1 pending"
+    And the output should contain:
+      """
+      an example
+        checks something
+        example at ./pending_with_no_docstring_spec.rb:5 (PENDING: No reason given)
+      """
+
+  Scenario: pending with no docstring using documentation formatter
+    Given a file named "pending_with_no_docstring_spec.rb" with:
+      """ruby
+      describe "an example" do
+        it "checks something" do
+          (3+4).should eq(7)
+        end
+        pending do
+          "string".reverse.should eq("gnirts")
+        end
+      end
+      """
+    When I run `rspec pending_with_no_docstring_spec.rb --format documentation`
+    Then the exit status should be 0
+    And the output should contain "2 examples, 0 failures, 1 pending"
+    And the output should contain:
+      """
+      an example
+        checks something
+        example at ./pending_with_no_docstring_spec.rb:5 (PENDING: No reason given)
+      """
+
+  Scenario: conditionally pending examples
+    Given a file named "conditionally_pending_spec.rb" with:
+      """ruby
+      describe "a failing spec" do
+        def run_test; raise "failure"; end
+
+        it "is pending when pending with a true :if condition" do
+          pending("true :if", :if => true) { run_test }
+        end
+
+        it "fails when pending with a false :if condition" do
+          pending("false :if", :if => false) { run_test }
+        end
+
+        it "is pending when pending with a false :unless condition" do
+          pending("false :unless", :unless => false) { run_test }
+        end
+
+        it "fails when pending with a true :unless condition" do
+          pending("true :unless", :unless => true) { run_test }
+        end
+      end
+
+      describe "a passing spec" do
+        def run_test; true.should be(true); end
+
+        it "fails when pending with a true :if condition" do
+          pending("true :if", :if => true) { run_test }
+        end
+
+        it "passes when pending with a false :if condition" do
+          pending("false :if", :if => false) { run_test }
+        end
+
+        it "fails when pending with a false :unless condition" do
+          pending("false :unless", :unless => false) { run_test }
+        end
+
+        it "passes when pending with a true :unless condition" do
+          pending("true :unless", :unless => true) { run_test }
+        end
+      end
+      """
+    When I run `rspec ./conditionally_pending_spec.rb`
+    Then the output should contain "8 examples, 4 failures, 2 pending"
+    And the output should contain:
+      """
+      Pending:
+        a failing spec is pending when pending with a true :if condition
+          # true :if
+          # ./conditionally_pending_spec.rb:4
+        a failing spec is pending when pending with a false :unless condition
+          # false :unless
+          # ./conditionally_pending_spec.rb:12
+      """
+    And the output should contain:
+      """
+        1) a failing spec fails when pending with a false :if condition
+           Failure/Error: def run_test; raise "failure"; end
+      """
+    And the output should contain:
+      """
+        2) a failing spec fails when pending with a true :unless condition
+           Failure/Error: def run_test; raise "failure"; end
+      """
+    And the output should contain:
+      """
+        3) a passing spec fails when pending with a true :if condition FIXED
+           Expected pending 'true :if' to fail. No Error was raised.
+      """
+    And the output should contain:
+      """
+        4) a passing spec fails when pending with a false :unless condition FIXED
+           Expected pending 'false :unless' to fail. No Error was raised.
+      """
diff --git a/rspec-core/features/spec_files/arbitrary_file_suffix.feature b/rspec-core/features/spec_files/arbitrary_file_suffix.feature
new file mode 100644
index 0000000..1e3439c
--- /dev/null
+++ b/rspec-core/features/spec_files/arbitrary_file_suffix.feature
@@ -0,0 +1,13 @@
+Feature: arbitrary file suffix
+
+  Scenario: .spec
+    Given a file named "a.spec" with:
+      """ruby
+      describe "something" do
+        it "does something" do
+          3.should eq(3)
+        end
+      end
+      """
+    When I run `rspec a.spec`
+    Then the examples should all pass
diff --git a/rspec-core/features/step_definitions/additional_cli_steps.rb b/rspec-core/features/step_definitions/additional_cli_steps.rb
new file mode 100644
index 0000000..a6acb02
--- /dev/null
+++ b/rspec-core/features/step_definitions/additional_cli_steps.rb
@@ -0,0 +1,49 @@
+require 'rspec/core'  # to fix annoying "undefined method `configuration' for RSpec:Module (NoMethodError)"
+
+Then /^the output should contain all of these:$/ do |table|
+  table.raw.flatten.each do |string|
+    assert_partial_output(string, all_output)
+  end
+end
+
+Then /^the output should not contain any of these:$/ do |table|
+  table.raw.flatten.each do |string|
+    all_output.should_not =~ regexp(string)
+  end
+end
+
+Then /^the output should contain one of the following:$/ do |table|
+  matching_output = table.raw.flatten.select do |string|
+    all_output =~ regexp(string)
+  end
+
+  matching_output.should have(1).item
+end
+
+Then /^the example(?:s)? should(?: all)? pass$/ do
+  step %q{the output should contain "0 failures"}
+  step %q{the output should not contain "0 examples"}
+  step %q{the exit status should be 0}
+end
+
+Then /^the process should succeed even though no examples were run$/ do
+  step %q{the output should contain "0 examples, 0 failures"}
+  step %q{the exit status should be 0}
+end
+
+Then /^the backtrace\-normalized output should contain:$/ do |partial_output|
+  # ruby 1.9 includes additional stuff in the backtrace,
+  # so we need to normalize it to compare it with our expected output.
+  normalized_output = all_output.split("\n").map do |line|
+    line =~ /(^\s+# [^:]+:\d+)/ ? $1 : line # http://rubular.com/r/zDD7DdWyzF
+  end.join("\n")
+
+  normalized_output.should =~ regexp(partial_output)
+end
+
+# This step can be generalized if it's ever used to test other colors
+Then /^the failing example is printed in magenta$/ do
+  # \e[35m = enable magenta
+  # \e[0m  = reset colors
+  expect(all_output).to include("\e[35m" + "F" + "\e[0m")
+end
diff --git a/rspec-core/features/subject/attribute_of_subject.feature b/rspec-core/features/subject/attribute_of_subject.feature
new file mode 100644
index 0000000..b7788c6
--- /dev/null
+++ b/rspec-core/features/subject/attribute_of_subject.feature
@@ -0,0 +1,124 @@
+Feature: attribute of subject
+
+  WARNING: `its` will be extracted from rspec-core-3.0 into its own gem.
+
+  Use the `its` method as a short-hand to generate a nested example group with
+  a single example that specifies the expected value of an attribute of the
+  subject.  This can be used with an implicit or explicit subject.
+
+  `its` accepts a symbol or a string, and a block representing the example.
+
+      its(:size)    { should eq(1) }
+      its("length") { should eq(1) }
+
+  You can use a string with dots to specify a nested attribute (i.e. an
+  attribute of the attribute of the subject).
+
+      its("phone_numbers.size") { should eq(2) }
+
+  When the subject is a hash, you can pass in an array with a single key to
+  access the value at that key in the hash.
+
+      its([:key]) { should eq(value) }
+
+  Scenario: specify value of an attribute
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe Array do
+        context "when first created" do
+          its(:size) { should eq(0) }
+        end
+      end
+      """
+    When I run `rspec example_spec.rb --format documentation`
+    Then the output should contain:
+      """
+      Array
+        when first created
+          size
+            should eq 0
+      """
+
+  Scenario: specify value of a nested attribute
+    Given a file named "example_spec.rb" with:
+      """ruby
+      class Person
+        attr_reader :phone_numbers
+        def initialize
+          @phone_numbers = []
+        end
+      end
+
+      describe Person do
+        context "with one phone number (555-1212)"do
+          subject do
+            person = Person.new
+            person.phone_numbers << "555-1212"
+            person
+          end
+
+          its("phone_numbers.first") { should eq("555-1212") }
+        end
+      end
+      """
+    When I run `rspec example_spec.rb --format documentation`
+    Then the output should contain:
+      """
+      Person
+        with one phone number (555-1212)
+          phone_numbers.first
+            should eq "555-1212"
+      """
+
+  Scenario: specify value of an attribute of a hash
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe Hash do
+        context "with two items" do
+          subject do
+            {:one => 'one', :two => 'two'}
+          end
+
+          its(:size) { should eq(2) }
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: specify value for key in a hash
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe Hash do
+        context "with keys :one and 'two'" do
+          subject do
+            {:one => 1, "two" => 2}
+          end
+
+          its([:one]) { should eq(1) }
+          its(["two"]) { should eq(2) }
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: specify value for key in a hash-like object
+    Given a file named "example_spec.rb" with:
+      """ruby
+      require 'matrix'
+
+      describe Matrix do
+        context "with values [[1, 2], [3, 4]]" do
+          subject do
+            Matrix[[1, 2], [3, 4]]
+          end
+
+          its([0, 1]) { should eq(2) }
+          its([1, 0]) { should eq(3) }
+          its([1, 2]) { should be_nil }
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/subject/explicit_subject.feature b/rspec-core/features/subject/explicit_subject.feature
new file mode 100644
index 0000000..43611be
--- /dev/null
+++ b/rspec-core/features/subject/explicit_subject.feature
@@ -0,0 +1,101 @@
+Feature: explicit subject
+
+  Use `subject` in the group scope to explicitly define the value that is
+  returned by the `subject` method in the example scope.
+
+  Note that while the examples below demonstrate how `subject` can be used as a
+  user-facing concept, we recommend that you reserve it for support of custom
+  matchers and/or extension libraries that hide its use from examples.
+
+  Scenario: subject in top level group
+    Given a file named "top_level_subject_spec.rb" with:
+      """ruby
+      describe Array, "with some elements" do
+        subject { [1,2,3] }
+        it "should have the prescribed elements" do
+          subject.should == [1,2,3]
+        end
+      end
+      """
+    When I run `rspec top_level_subject_spec.rb`
+    Then the examples should all pass
+
+  Scenario: subject in a nested group
+    Given a file named "nested_subject_spec.rb" with:
+      """ruby
+      describe Array do
+        subject { [1,2,3] }
+        describe "with some elements" do
+          it "should have the prescribed elements" do
+            subject.should == [1,2,3]
+          end
+        end
+      end
+      """
+    When I run `rspec nested_subject_spec.rb`
+    Then the examples should all pass
+
+  Scenario: access subject from before block
+    Given a file named "top_level_subject_spec.rb" with:
+      """ruby
+      describe Array, "with some elements" do
+        subject { [] }
+        before { subject.push(1,2,3) }
+        it "should have the prescribed elements" do
+          subject.should == [1,2,3]
+        end
+      end
+      """
+    When I run `rspec top_level_subject_spec.rb`
+    Then the examples should all pass
+
+  Scenario: invoke helper method from subject block
+    Given a file named "helper_subject_spec.rb" with:
+      """ruby
+      describe Array do
+        def prepared_array; [1,2,3] end
+        subject { prepared_array }
+        describe "with some elements" do
+          it "should have the prescribed elements" do
+            subject.should == [1,2,3]
+          end
+        end
+      end
+      """
+    When I run `rspec helper_subject_spec.rb`
+    Then the examples should all pass
+
+  Scenario: subject block is invoked at most once per example
+    Given a file named "nil_subject_spec.rb" with:
+      """ruby
+      describe Array do
+        describe "#[]" do
+          context "with index out of bounds" do
+            before { Array.should_receive(:one_two_three).once.and_return([1,2,3]) }
+            subject { Array.one_two_three[42] }
+            it { should be_nil }
+          end
+        end
+      end
+      """
+    When I run `rspec nil_subject_spec.rb`
+    Then the examples should all pass
+
+  Scenario: subject bang method
+    Given a file named "subject_bang_spec.rb" with:
+      """ruby
+      describe Array do
+        describe '#pop' do
+          let(:prepared_array) { [1,2,3] }
+          subject! { prepared_array.pop }
+          it "removes the last value from the array" do
+            prepared_array.should eq([1,2])
+          end
+          it "returns the last value of the array" do
+            subject.should eq(3)
+          end
+        end
+      end
+      """
+    When I run `rspec subject_bang_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/subject/implicit_receiver.feature b/rspec-core/features/subject/implicit_receiver.feature
new file mode 100644
index 0000000..209bbe6
--- /dev/null
+++ b/rspec-core/features/subject/implicit_receiver.feature
@@ -0,0 +1,29 @@
+Feature: implicit receiver
+
+  When `should` is called in an example without an explicit receiver, it is
+  invoked against the subject (explicit or implicit).
+
+  Scenario: implicit subject
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe Array do
+        describe "when first created" do
+          it { should be_empty }
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: explicit subject
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe Array do
+        describe "with 3 items" do
+          subject { [1,2,3] }
+          it { should_not be_empty }
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/subject/implicit_subject.feature b/rspec-core/features/subject/implicit_subject.feature
new file mode 100644
index 0000000..e470e88
--- /dev/null
+++ b/rspec-core/features/subject/implicit_subject.feature
@@ -0,0 +1,63 @@
+Feature: implicitly defined subject
+
+  If the first argument to the outermost example group is a class, an instance
+  of that class is exposed to each example via the `subject` method.
+
+  While the examples below demonstrate how `subject` can be used as a
+  user-facing concept, we recommend that you reserve it for support of custom
+  matchers and/or extension libraries that hide its use from examples.
+
+  Scenario: subject exposed in top level group
+    Given a file named "top_level_subject_spec.rb" with:
+      """ruby
+      describe Array do
+        it "should be empty when first created" do
+          subject.should be_empty
+        end
+      end
+      """
+    When I run `rspec ./top_level_subject_spec.rb`
+    Then the examples should all pass
+
+  Scenario: subject in a nested group
+    Given a file named "nested_subject_spec.rb" with:
+      """ruby
+      describe Array do
+        describe "when first created" do
+          it "should be empty" do
+            subject.should be_empty
+          end
+        end
+      end
+      """
+    When I run `rspec nested_subject_spec.rb`
+    Then the examples should all pass
+
+  Scenario: subject in a nested group with a different class (outermost wins)
+    Given a file named "nested_subject_spec.rb" with:
+      """ruby
+      class ArrayWithOneElement < Array
+        def initialize(*)
+          super
+          unshift "first element"
+        end
+      end
+
+      describe Array do
+        describe ArrayWithOneElement do
+          context "referenced as subject" do
+            it "should be empty (because it is the Array declared at the top)" do
+              subject.should be_empty
+            end
+          end
+
+          context "created in the example" do
+            it "should not be empty" do
+              ArrayWithOneElement.new.should_not be_empty
+            end
+          end
+        end
+      end
+      """
+    When I run `rspec nested_subject_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-core/features/support/env.rb b/rspec-core/features/support/env.rb
new file mode 100644
index 0000000..609e513
--- /dev/null
+++ b/rspec-core/features/support/env.rb
@@ -0,0 +1,14 @@
+require 'aruba/cucumber'
+
+timeouts = { 'java' => 60 }
+
+Before do
+  @aruba_timeout_seconds = timeouts.fetch(RUBY_PLATFORM) { 10 }
+end
+
+Aruba.configure do |config|
+  config.before_cmd do |cmd|
+    set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived
+  end
+end if RUBY_PLATFORM == 'java'
+
diff --git a/rspec-core/features/support/rubinius.rb b/rspec-core/features/support/rubinius.rb
new file mode 100644
index 0000000..3907962
--- /dev/null
+++ b/rspec-core/features/support/rubinius.rb
@@ -0,0 +1,6 @@
+# Required until https://github.com/rubinius/rubinius/issues/2430 is resolved
+ENV['RBXOPT'] = "#{ENV["RBXOPT"]} -Xcompiler.no_rbc"
+
+Around "@unsupported-on-rbx" do |scenario, block|
+  block.call unless defined?(Rubinius)
+end
diff --git a/rspec-core/lib/autotest/discover.rb b/rspec-core/lib/autotest/discover.rb
new file mode 100644
index 0000000..9dbde51
--- /dev/null
+++ b/rspec-core/lib/autotest/discover.rb
@@ -0,0 +1 @@
+Autotest.add_discovery { "rspec2" } if File.exist?("./.rspec")
diff --git a/rspec-core/lib/autotest/rspec2.rb b/rspec-core/lib/autotest/rspec2.rb
new file mode 100644
index 0000000..fbd78d4
--- /dev/null
+++ b/rspec-core/lib/autotest/rspec2.rb
@@ -0,0 +1,73 @@
+require 'autotest'
+require 'rspec/core/deprecation'
+
+# Derived from the `Autotest` class, extends the `autotest` command to work
+# with RSpec.
+#
+# @note this will be extracted to a separate gem when we release rspec-3.
+class Autotest::Rspec2 < Autotest
+
+  RSPEC_EXECUTABLE = File.expand_path('../../../exe/rspec', __FILE__)
+
+  def initialize
+    super()
+    clear_mappings
+    setup_rspec_project_mappings
+
+    # Example for Ruby 1.8: http://rubular.com/r/AOXNVDrZpx
+    # Example for Ruby 1.9: http://rubular.com/r/85ag5AZ2jP
+    self.failed_results_re = /^\s*\d+\).*\n\s+(?:\e\[\d*m)?Failure.*(\n(?:\e\[\d*m)?\s+#\s(.*)?:\d+(?::.*)?(?:\e\[\d*m)?)+$/m
+    self.completed_re = /\n(?:\e\[\d*m)?\d* examples?/m
+  end
+
+  # Adds conventional spec-to-file mappings to Autotest configuation.
+  def setup_rspec_project_mappings
+    add_mapping(%r%^spec/.*_spec\.rb$%) { |filename, _|
+      filename
+    }
+    add_mapping(%r%^lib/(.*)\.rb$%) { |_, m|
+      ["spec/#{m[1]}_spec.rb"]
+    }
+    add_mapping(%r%^spec/(spec_helper|shared/.*)\.rb$%) {
+      files_matching %r%^spec/.*_spec\.rb$%
+    }
+  end
+
+  # Overrides Autotest's implementation to read rspec output
+  def consolidate_failures(failed)
+    filters = new_hash_of_arrays
+    failed.each do |spec, trace|
+      if trace =~ /(.*spec\.rb)/
+        filters[$1] << spec
+      end
+    end
+    return filters
+  end
+
+  # Overrides Autotest's implementation to generate the rspec command to run
+  def make_test_cmd(files_to_test)
+    files_to_test.empty? ? '' :
+      %|#{prefix}"#{ruby}"#{suffix} -S "#{RSPEC_EXECUTABLE}" --tty #{normalize(files_to_test).keys.flatten.map { |f| %|"#{f}"|}.join(' ')}|
+  end
+
+  # Generates a map of filenames to Arrays for Autotest
+  def normalize(files_to_test)
+    files_to_test.keys.inject({}) do |result, filename|
+      result.merge!(File.expand_path(filename) => [])
+    end
+  end
+
+  private
+
+  def suffix
+    using_bundler? ? "" : defined?(:Gem) ? " -rrubygems" : ""
+  end
+
+  def using_bundler?
+    prefix =~ /bundle exec/
+  end
+
+  def gemfile?
+    File.exist?('./Gemfile')
+  end
+end
diff --git a/rspec-core/lib/rspec/autorun.rb b/rspec-core/lib/rspec/autorun.rb
new file mode 100644
index 0000000..18cc1ed
--- /dev/null
+++ b/rspec-core/lib/rspec/autorun.rb
@@ -0,0 +1,2 @@
+require 'rspec/core'
+RSpec::Core::Runner.autorun
diff --git a/rspec-core/lib/rspec/core.rb b/rspec-core/lib/rspec/core.rb
new file mode 100644
index 0000000..0080d66
--- /dev/null
+++ b/rspec-core/lib/rspec/core.rb
@@ -0,0 +1,169 @@
+require_rspec = if defined?(require_relative)
+  lambda do |path|
+    require_relative path
+  end
+else
+  lambda do |path|
+    require "rspec/#{path}"
+  end
+end
+
+require 'set'
+require 'time'
+require 'rbconfig'
+require_rspec['core/filter_manager']
+require_rspec['core/dsl']
+require_rspec['core/extensions/kernel']
+require_rspec['core/extensions/instance_eval_with_args']
+require_rspec['core/extensions/module_eval_with_args']
+require_rspec['core/extensions/ordered']
+require_rspec['core/deprecation']
+require_rspec['core/backward_compatibility']
+require_rspec['core/reporter']
+
+require_rspec['core/metadata_hash_builder']
+require_rspec['core/hooks']
+require_rspec['core/memoized_helpers']
+require_rspec['core/metadata']
+require_rspec['core/pending']
+require_rspec['core/formatters']
+
+require_rspec['core/world']
+require_rspec['core/configuration']
+require_rspec['core/project_initializer']
+require_rspec['core/option_parser']
+require_rspec['core/configuration_options']
+require_rspec['core/command_line']
+require_rspec['core/runner']
+require_rspec['core/example']
+require_rspec['core/shared_example_group/collection']
+require_rspec['core/shared_example_group']
+require_rspec['core/example_group']
+require_rspec['core/version']
+
+module RSpec
+  autoload :SharedContext, 'rspec/core/shared_context'
+
+  # @private
+  def self.wants_to_quit
+  # Used internally to determine what to do when a SIGINT is received
+    world.wants_to_quit
+  end
+
+  # @private
+  # Used internally to determine what to do when a SIGINT is received
+  def self.wants_to_quit=(maybe)
+    world.wants_to_quit=(maybe)
+  end
+
+  # @private
+  # Internal container for global non-configuration data
+  def self.world
+    @world ||= RSpec::Core::World.new
+  end
+
+  # @private
+  # Used internally to set the global object
+  def self.world=(new_world)
+    @world = new_world
+  end
+
+  # @private
+  # Used internally to ensure examples get reloaded between multiple runs in
+  # the same process.
+  def self.reset
+    @world = nil
+    @configuration = nil
+  end
+
+  # Returns the global [Configuration](RSpec/Core/Configuration) object. While you
+  # _can_ use this method to access the configuration, the more common
+  # convention is to use [RSpec.configure](RSpec#configure-class_method).
+  #
+  # @example
+  #     RSpec.configuration.drb_port = 1234
+  # @see RSpec.configure
+  # @see Core::Configuration
+  def self.configuration
+    if block_given?
+      RSpec.warn_deprecation <<-WARNING
+
+*****************************************************************
+DEPRECATION WARNING
+
+* RSpec.configuration with a block is deprecated and has no effect.
+* please use RSpec.configure with a block instead.
+
+Called from #{caller(0)[1]}
+*****************************************************************
+
+WARNING
+    end
+    @configuration ||= RSpec::Core::Configuration.new
+  end
+
+  # @private
+  # Used internally to set the global object
+  def self.configuration=(new_configuration)
+    @configuration = new_configuration
+  end
+
+  # Yields the global configuration to a block.
+  # @yield [Configuration] global configuration
+  #
+  # @example
+  #     RSpec.configure do |config|
+  #       config.add_formatter 'documentation'
+  #     end
+  # @see Core::Configuration
+  def self.configure
+    yield configuration if block_given?
+  end
+
+  # @private
+  # Used internally to clear remaining groups when fail_fast is set
+  def self.clear_remaining_example_groups
+    world.example_groups.clear
+  end
+
+  # @private
+  def self.windows_os?
+    RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/
+  end
+
+  module Core
+    # @private
+    # This avoids issues with reporting time caused by examples that
+    # change the value/meaning of Time.now without properly restoring
+    # it.
+    class Time
+      class << self
+        define_method(:now,&::Time.method(:now))
+      end
+    end
+  end
+
+  MODULES_TO_AUTOLOAD = {
+    :Matchers     => "rspec/expectations",
+    :Expectations => "rspec/expectations",
+    :Mocks        => "rspec/mocks"
+  }
+
+  def self.const_missing(name)
+    # Load rspec-expectations when RSpec::Matchers is referenced. This allows
+    # people to define custom matchers (using `RSpec::Matchers.define`) before
+    # rspec-core has loaded rspec-expectations (since it delays the loading of
+    # it to allow users to configure a different assertion/expectation
+    # framework). `autoload` can't be used since it works with ruby's built-in
+    # require (e.g. for files that are available relative to a load path dir),
+    # but not with rubygems' extended require.
+    #
+    # As of rspec 2.14.1, we no longer require `rspec/mocks` and
+    # `rspec/expectations` when `rspec` is required, so we want
+    # to make them available as an autoload. For more info, see:
+    require MODULES_TO_AUTOLOAD.fetch(name) { return super }
+    ::RSpec.const_get(name)
+  end
+end
+
+require_rspec['core/backward_compatibility']
diff --git a/rspec-core/lib/rspec/core/backtrace_cleaner.rb b/rspec-core/lib/rspec/core/backtrace_cleaner.rb
new file mode 100644
index 0000000..229f5fa
--- /dev/null
+++ b/rspec-core/lib/rspec/core/backtrace_cleaner.rb
@@ -0,0 +1,46 @@
+module RSpec
+  module Core
+    class BacktraceCleaner
+
+      DEFAULT_EXCLUSION_PATTERNS = [
+        /\/lib\d*\/ruby\//,
+        /org\/jruby\//,
+        /bin\//,
+        %r|/gems/|,
+        /spec\/spec_helper\.rb/,
+        /lib\/rspec\/(core|expectations|matchers|mocks)/
+      ]
+
+      attr_accessor :inclusion_patterns
+      attr_accessor :exclusion_patterns
+
+      def initialize(inclusion_patterns=nil, exclusion_patterns=DEFAULT_EXCLUSION_PATTERNS.dup)
+        @exclusion_patterns = exclusion_patterns
+
+        if inclusion_patterns.nil?
+          @inclusion_patterns = (matches_an_exclusion_pattern? Dir.getwd) ? [Regexp.new(Dir.getwd)] : []
+        else
+          @inclusion_patterns = inclusion_patterns
+        end
+      end
+
+      def exclude?(line)
+        @inclusion_patterns.none? {|p| line =~ p} and matches_an_exclusion_pattern?(line)
+      end
+
+      def full_backtrace=(true_or_false)
+        @exclusion_patterns = true_or_false ? [] : DEFAULT_EXCLUSION_PATTERNS.dup
+      end
+
+      def full_backtrace?
+        @exclusion_patterns.empty?
+      end
+
+      private
+
+      def matches_an_exclusion_pattern?(line)
+        @exclusion_patterns.any? {|p| line =~ p}
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/backward_compatibility.rb b/rspec-core/lib/rspec/core/backward_compatibility.rb
new file mode 100644
index 0000000..b11c028
--- /dev/null
+++ b/rspec-core/lib/rspec/core/backward_compatibility.rb
@@ -0,0 +1,55 @@
+module RSpec
+  module Core
+    # @private
+    module ConstMissing
+      # Used to print deprecation warnings for Rspec and Spec constants (use
+      # RSpec instead)
+      def const_missing(name)
+        case name
+        when :Rspec, :Spec
+          RSpec.deprecate(name.to_s, :replacement => "RSpec")
+          RSpec
+        else
+          begin
+            super
+          rescue Exception => e
+            e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
+            raise e
+          end
+        end
+      end
+    end
+  end
+
+  module Runner
+    # @deprecated use RSpec.configure instead.
+    def self.configure(&block)
+      RSpec.deprecate("Spec::Runner.configure", :replacement => "RSpec.configure")
+      RSpec.configure(&block)
+    end
+  end
+
+  # @private
+  module Rake
+    # Used to print deprecation warnings for Rake::SpecTask constant (use
+    # RSpec::Core::RakeTask instead)
+    def self.const_missing(name)
+      case name
+      when :SpecTask
+        RSpec.deprecate("Spec::Rake::SpecTask", :replacement => "RSpec::Core::RakeTask")
+        require 'rspec/core/rake_task'
+        RSpec::Core::RakeTask
+      else
+        begin
+          super
+        rescue Exception => e
+          e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
+          raise e
+        end
+      end
+    end
+
+  end
+end
+
+Object.extend(RSpec::Core::ConstMissing)
diff --git a/rspec-core/lib/rspec/core/command_line.rb b/rspec-core/lib/rspec/core/command_line.rb
new file mode 100644
index 0000000..b0e01ba
--- /dev/null
+++ b/rspec-core/lib/rspec/core/command_line.rb
@@ -0,0 +1,36 @@
+module RSpec
+  module Core
+    class CommandLine
+      def initialize(options, configuration=RSpec::configuration, world=RSpec::world)
+        if Array === options
+          options = ConfigurationOptions.new(options)
+          options.parse_options
+        end
+        @options       = options
+        @configuration = configuration
+        @world         = world
+      end
+
+      # Configures and runs a suite
+      #
+      # @param [IO] err
+      # @param [IO] out
+      def run(err, out)
+        @configuration.error_stream = err
+        @configuration.output_stream ||= out
+        @options.configure(@configuration)
+        @configuration.load_spec_files
+        @world.announce_filters
+
+        @configuration.reporter.report(@world.example_count, @configuration.randomize? ? @configuration.seed : nil) do |reporter|
+          begin
+            @configuration.run_hook(:before, :suite)
+            @world.example_groups.ordered.map {|g| g.run(reporter)}.all? ? 0 : @configuration.failure_exit_code
+          ensure
+            @configuration.run_hook(:after, :suite)
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/configuration.rb b/rspec-core/lib/rspec/core/configuration.rb
new file mode 100644
index 0000000..3455386
--- /dev/null
+++ b/rspec-core/lib/rspec/core/configuration.rb
@@ -0,0 +1,1174 @@
+require 'fileutils'
+require 'rspec/core/backtrace_cleaner'
+require 'rspec/core/ruby_project'
+require 'rspec/core/formatters/deprecation_formatter.rb'
+
+module RSpec
+  module Core
+    # Stores runtime configuration information.
+    #
+    # Configuration options are loaded from `~/.rspec`, `.rspec`,
+    # `.rspec-local`, command line switches, and the `SPEC_OPTS` environment
+    # variable (listed in lowest to highest precedence; for example, an option
+    # in `~/.rspec` can be overridden by an option in `.rspec-local`).
+    #
+    # @example Standard settings
+    #     RSpec.configure do |c|
+    #       c.drb          = true
+    #       c.drb_port     = 1234
+    #       c.default_path = 'behavior'
+    #     end
+    #
+    # @example Hooks
+    #     RSpec.configure do |c|
+    #       c.before(:suite) { establish_connection }
+    #       c.before(:each)  { log_in_as :authorized }
+    #       c.around(:each)  { |ex| Database.transaction(&ex) }
+    #     end
+    #
+    # @see RSpec.configure
+    # @see Hooks
+    class Configuration
+      include RSpec::Core::Hooks
+
+      class MustBeConfiguredBeforeExampleGroupsError < StandardError; end
+
+      # @private
+      def self.define_reader(name)
+        define_method(name) do
+          variable = instance_variable_defined?("@#{name}") ? instance_variable_get("@#{name}") : nil
+          value_for(name, variable)
+        end
+      end
+
+      # @private
+      def self.deprecate_alias_key
+        RSpec.deprecate("add_setting with :alias option", :replacement => ":alias_with")
+      end
+
+      # @private
+      def self.define_aliases(name, alias_name)
+        alias_method alias_name, name
+        alias_method "#{alias_name}=", "#{name}="
+        define_predicate_for alias_name
+      end
+
+      # @private
+      def self.define_predicate_for(*names)
+        names.each {|name| alias_method "#{name}?", name}
+      end
+
+      # @private
+      #
+      # Invoked by the `add_setting` instance method. Use that method on a
+      # `Configuration` instance rather than this class method.
+      def self.add_setting(name, opts={})
+        raise "Use the instance add_setting method if you want to set a default" if opts.has_key?(:default)
+        if opts[:alias]
+          deprecate_alias_key
+          define_aliases(opts[:alias], name)
+        else
+          attr_writer name
+          define_reader name
+          define_predicate_for name
+        end
+        [opts[:alias_with]].flatten.compact.each do |alias_name|
+          define_aliases(name, alias_name)
+        end
+      end
+
+      # @macro [attach] add_setting
+      #   @attribute $1
+
+      # Path to use if no path is provided to the `rspec` command (default:
+      # `"spec"`). Allows you to just type `rspec` instead of `rspec spec` to
+      # run all the examples in the `spec` directory.
+      add_setting :default_path
+
+      # Run examples over DRb (default: `false`). RSpec doesn't supply the DRb
+      # server, but you can use tools like spork.
+      add_setting :drb
+
+      # The drb_port (default: nil).
+      add_setting :drb_port
+
+      # Default: `$stderr`.
+      add_setting :error_stream
+
+      # Default: `$stderr`.
+      add_setting :deprecation_stream
+
+      # Clean up and exit after the first failure (default: `false`).
+      add_setting :fail_fast
+
+      # The exit code to return if there are any failures (default: 1).
+      add_setting :failure_exit_code
+
+      # Determines the order in which examples are run (default: OS standard
+      # load order for files, declaration order for groups and examples).
+      define_reader :order
+
+      # Indicates files configured to be required
+      define_reader :requires
+
+      # Returns dirs that have been prepended to the load path by #lib=
+      define_reader :libs
+
+      # Default: `$stdout`.
+      # Also known as `output` and `out`
+      add_setting :output_stream, :alias_with => [:output, :out]
+
+      # Load files matching this pattern (default: `'**/*_spec.rb'`)
+      add_setting :pattern, :alias_with => :filename_pattern
+
+      # Report the times for the slowest examples (default: `false`).
+      # Use this to specify the number of examples to include in the profile.
+      add_setting :profile_examples
+
+      # Run all examples if none match the configured filters (default: `false`).
+      add_setting :run_all_when_everything_filtered
+
+      # Allow user to configure their own success/pending/failure colors
+      # @param [Symbol] should be one of the following: [:black, :white, :red, :green, :yellow, :blue, :magenta, :cyan]
+      add_setting :success_color
+      add_setting :pending_color
+      add_setting :failure_color
+      add_setting :default_color
+      add_setting :fixed_color
+      add_setting :detail_color
+
+      # Seed for random ordering (default: generated randomly each run).
+      #
+      # When you run specs with `--order random`, RSpec generates a random seed
+      # for the randomization and prints it to the `output_stream` (assuming
+      # you're using RSpec's built-in formatters). If you discover an ordering
+      # dependency (i.e. examples fail intermittently depending on order), set
+      # this (on Configuration or on the command line with `--seed`) to run
+      # using the same seed while you debug the issue.
+      #
+      # We recommend, actually, that you use the command line approach so you
+      # don't accidentally leave the seed encoded.
+      define_reader :seed
+
+      # When a block passed to pending fails (as expected), display the failure
+      # without reporting it as a failure (default: false).
+      add_setting :show_failures_in_pending_blocks
+
+      # Convert symbols to hashes with the symbol as a key with a value of
+      # `true` (default: false).
+      #
+      # This allows you to tag a group or example like this:
+      #
+      #     describe "something slow", :slow do
+      #       # ...
+      #     end
+      #
+      # ... instead of having to type:
+      #
+      #     describe "something slow", :slow => true do
+      #       # ...
+      #     end
+      add_setting :treat_symbols_as_metadata_keys_with_true_values
+
+      # @private
+      add_setting :tty
+      # @private
+      add_setting :include_or_extend_modules
+      # @private
+      add_setting :files_to_run
+      # @private
+      add_setting :expecting_with_rspec
+      # @private
+      attr_accessor :filter_manager
+
+      attr_reader :backtrace_cleaner
+
+      def initialize
+        @expectation_frameworks = []
+        @include_or_extend_modules = []
+        @mock_framework = nil
+        @files_to_run = []
+        @formatters = []
+        @color = false
+        @pattern = '**/*_spec.rb'
+        @failure_exit_code = 1
+
+        @backtrace_cleaner = BacktraceCleaner.new
+
+        @default_path = 'spec'
+        @deprecation_stream = $stderr
+        @filter_manager = FilterManager.new
+        @preferred_options = {}
+        @seed = srand % 0xFFFF
+        @failure_color = :red
+        @success_color = :green
+        @pending_color = :yellow
+        @default_color = :white
+        @fixed_color = :blue
+        @detail_color = :cyan
+        @profile_examples = false
+        @requires = []
+        @libs = []
+      end
+
+      # @private
+      #
+      # Used to set higher priority option values from the command line.
+      def force(hash)
+        if hash.has_key?(:seed)
+          hash[:order], hash[:seed] = order_and_seed_from_seed(hash[:seed])
+        elsif hash.has_key?(:order)
+          set_order_and_seed(hash)
+        end
+        @preferred_options.merge!(hash)
+        self.warnings = value_for :warnings, nil
+      end
+
+      # @private
+      def reset
+        @reporter = nil
+        @formatters.clear
+      end
+
+      # @overload add_setting(name)
+      # @overload add_setting(name, opts)
+      # @option opts [Symbol] :default
+      #
+      #   set a default value for the generated getter and predicate methods:
+      #
+      #       add_setting(:foo, :default => "default value")
+      #
+      # @option opts [Symbol] :alias_with
+      #
+      #   Use `:alias_with` to alias the setter, getter, and predicate to another
+      #   name, or names:
+      #
+      #       add_setting(:foo, :alias_with => :bar)
+      #       add_setting(:foo, :alias_with => [:bar, :baz])
+      #
+      # Adds a custom setting to the RSpec.configuration object.
+      #
+      #     RSpec.configuration.add_setting :foo
+      #
+      # Used internally and by extension frameworks like rspec-rails, so they
+      # can add config settings that are domain specific. For example:
+      #
+      #     RSpec.configure do |c|
+      #       c.add_setting :use_transactional_fixtures,
+      #         :default => true,
+      #         :alias_with => :use_transactional_examples
+      #     end
+      #
+      # `add_setting` creates three methods on the configuration object, a
+      # setter, a getter, and a predicate:
+      #
+      #     RSpec.configuration.foo=(value)
+      #     RSpec.configuration.foo
+      #     RSpec.configuration.foo? # returns true if foo returns anything but nil or false
+      def add_setting(name, opts={})
+        default = opts.delete(:default)
+        (class << self; self; end).class_eval do
+          add_setting(name, opts)
+        end
+        send("#{name}=", default) if default
+      end
+
+      # Returns the configured mock framework adapter module
+      def mock_framework
+        mock_with :rspec unless @mock_framework
+        @mock_framework
+      end
+
+      # Delegates to mock_framework=(framework)
+      def mock_framework=(framework)
+        mock_with framework
+      end
+
+      # The patterns to discard from backtraces. Deprecated, use
+      # Configuration#backtrace_exclusion_patterns instead
+      #
+      # Defaults to RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS
+      #
+      # One can replace the list by using the setter or modify it through the
+      # getter
+      #
+      # To override this behaviour and display a full backtrace, use
+      # `--backtrace`on the command line, in a `.rspec` file, or in the
+      # `rspec_options` attribute of RSpec's rake task.
+      def backtrace_clean_patterns
+        RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
+                        :replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
+        @backtrace_cleaner.exclusion_patterns
+      end
+
+      def backtrace_clean_patterns=(patterns)
+        RSpec.deprecate("RSpec::Core::Configuration#backtrace_clean_patterns",
+                        :replacement => "RSpec::Core::Configuration#backtrace_exclusion_patterns")
+        @backtrace_cleaner.exclusion_patterns = patterns
+      end
+
+      # The patterns to always include to backtraces.
+      #
+      # Defaults to [Regexp.new Dir.getwd] if the current working directory
+      # matches any of the exclusion patterns. Otherwise it defaults to empty.
+      #
+      # One can replace the list by using the setter or modify it through the
+      # getter
+      def backtrace_inclusion_patterns
+        @backtrace_cleaner.inclusion_patterns
+      end
+
+      def backtrace_inclusion_patterns=(patterns)
+        @backtrace_cleaner.inclusion_patterns = patterns
+      end
+
+      # The patterns to discard from backtraces.
+      #
+      # Defaults to RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS
+      #
+      # One can replace the list by using the setter or modify it through the
+      # getter
+      #
+      # To override this behaviour and display a full backtrace, use
+      # `--backtrace`on the command line, in a `.rspec` file, or in the
+      # `rspec_options` attribute of RSpec's rake task.
+      def backtrace_exclusion_patterns
+        @backtrace_cleaner.exclusion_patterns
+      end
+
+      def backtrace_exclusion_patterns=(patterns)
+        @backtrace_cleaner.exclusion_patterns = patterns
+      end
+
+      # Sets the mock framework adapter module.
+      #
+      # `framework` can be a Symbol or a Module.
+      #
+      # Given any of `:rspec`, `:mocha`, `:flexmock`, or `:rr`, configures the
+      # named framework.
+      #
+      # Given `:nothing`, configures no framework. Use this if you don't use
+      # any mocking framework to save a little bit of overhead.
+      #
+      # Given a Module, includes that module in every example group. The module
+      # should adhere to RSpec's mock framework adapter API:
+      #
+      #     setup_mocks_for_rspec
+      #       - called before each example
+      #
+      #     verify_mocks_for_rspec
+      #       - called after each example. Framework should raise an exception
+      #         when expectations fail
+      #
+      #     teardown_mocks_for_rspec
+      #       - called after verify_mocks_for_rspec (even if there are errors)
+      #
+      # If the module responds to `configuration` and `mock_with` receives a block,
+      # it will yield the configuration object to the block e.g.
+      #
+      #     config.mock_with OtherMockFrameworkAdapter do |mod_config|
+      #       mod_config.custom_setting = true
+      #     end
+      def mock_with(framework)
+        framework_module = case framework
+        when Module
+          framework
+        when String, Symbol
+          require case framework.to_s
+                  when /rspec/i
+                    'rspec/core/mocking/with_rspec'
+                  when /mocha/i
+                    'rspec/core/mocking/with_mocha'
+                  when /rr/i
+                    'rspec/core/mocking/with_rr'
+                  when /flexmock/i
+                    'rspec/core/mocking/with_flexmock'
+                  else
+                    'rspec/core/mocking/with_absolutely_nothing'
+                  end
+          RSpec::Core::MockFrameworkAdapter
+        end
+
+        new_name, old_name = [framework_module, @mock_framework].map do |mod|
+          mod.respond_to?(:framework_name) ?  mod.framework_name : :unnamed
+        end
+
+        unless new_name == old_name
+          assert_no_example_groups_defined(:mock_framework)
+        end
+
+        if block_given?
+          raise "#{framework_module} must respond to `configuration` so that mock_with can yield it." unless framework_module.respond_to?(:configuration)
+          yield framework_module.configuration
+        end
+
+        @mock_framework = framework_module
+      end
+
+      # Returns the configured expectation framework adapter module(s)
+      def expectation_frameworks
+        expect_with :rspec if @expectation_frameworks.empty?
+        @expectation_frameworks
+      end
+
+      # Delegates to expect_with(framework)
+      def expectation_framework=(framework)
+        expect_with(framework)
+      end
+
+      # Sets the expectation framework module(s) to be included in each example
+      # group.
+      #
+      # `frameworks` can be `:rspec`, `:stdlib`, a custom module, or any
+      # combination thereof:
+      #
+      #     config.expect_with :rspec
+      #     config.expect_with :stdlib
+      #     config.expect_with :rspec, :stdlib
+      #     config.expect_with OtherExpectationFramework
+      #
+      # RSpec will translate `:rspec` and `:stdlib` into the appropriate
+      # modules.
+      #
+      # ## Configuration
+      #
+      # If the module responds to `configuration`, `expect_with` will
+      # yield the `configuration` object if given a block:
+      #
+      #     config.expect_with OtherExpectationFramework do |custom_config|
+      #       custom_config.custom_setting = true
+      #     end
+      def expect_with(*frameworks)
+        modules = frameworks.map do |framework|
+          case framework
+          when Module
+            framework
+          when :rspec
+            require 'rspec/expectations'
+            self.expecting_with_rspec = true
+            ::RSpec::Matchers
+          when :stdlib
+            require 'test/unit/assertions'
+            ::Test::Unit::Assertions
+          else
+            raise ArgumentError, "#{framework.inspect} is not supported"
+          end
+        end
+
+        if (modules - @expectation_frameworks).any?
+          assert_no_example_groups_defined(:expect_with)
+        end
+
+        if block_given?
+          raise "expect_with only accepts a block with a single argument. Call expect_with #{modules.length} times, once with each argument, instead." if modules.length > 1
+          raise "#{modules.first} must respond to `configuration` so that expect_with can yield it." unless modules.first.respond_to?(:configuration)
+          yield modules.first.configuration
+        end
+
+        @expectation_frameworks.push(*modules)
+      end
+
+      def full_backtrace?
+        @backtrace_cleaner.full_backtrace?
+      end
+
+      def full_backtrace=(true_or_false)
+        @backtrace_cleaner.full_backtrace = true_or_false
+      end
+
+      def color(output=output_stream)
+        # rspec's built-in formatters all call this with the output argument,
+        # but defaulting to output_stream for backward compatibility with
+        # formatters in extension libs
+        return false unless output_to_tty?(output)
+        value_for(:color, @color)
+      end
+
+      def color=(bool)
+        if bool
+          if RSpec.windows_os? and not ENV['ANSICON']
+            warn "You must use ANSICON 1.31 or later (http://adoxa.3eeweb.com/ansicon/) to use colour on Windows"
+            @color = false
+          else
+            @color = true
+          end
+        end
+      end
+
+      # TODO - deprecate color_enabled - probably not until the last 2.x
+      # release before 3.0
+      alias_method :color_enabled, :color
+      alias_method :color_enabled=, :color=
+      define_predicate_for :color_enabled, :color
+
+      def libs=(libs)
+        libs.map do |lib|
+          @libs.unshift lib
+          $LOAD_PATH.unshift lib
+        end
+      end
+
+      def requires=(paths)
+        RSpec.deprecate("RSpec::Core::Configuration#requires=(paths)",
+                        :replacement => "paths.each {|path| require path}")
+        paths.map {|path| require path}
+        @requires += paths
+      end
+
+      def debug=(bool)
+        return unless bool
+        begin
+          require 'ruby-debug'
+          Debugger.start
+        rescue LoadError => e
+          raise <<-EOM
+
+#{'*'*50}
+#{e.message}
+
+If you have it installed as a ruby gem, then you need to either require
+'rubygems' or configure the RUBYOPT environment variable with the value
+'rubygems'.
+
+#{e.backtrace.join("\n")}
+#{'*'*50}
+EOM
+        end
+      end
+
+      def debug?
+        !!defined?(Debugger)
+      end
+
+      # Run examples defined on `line_numbers` in all files to run.
+      def line_numbers=(line_numbers)
+        filter_run :line_numbers => line_numbers.map{|l| l.to_i}
+      end
+
+      def line_numbers
+        filter.fetch(:line_numbers,[])
+      end
+
+      def full_description=(description)
+        filter_run :full_description => Regexp.union(*Array(description).map {|d| Regexp.new(d) })
+      end
+
+      def full_description
+        filter.fetch :full_description, nil
+      end
+
+      # @overload add_formatter(formatter)
+      #
+      # Adds a formatter to the formatters collection. `formatter` can be a
+      # string representing any of the built-in formatters (see
+      # `built_in_formatter`), or a custom formatter class.
+      #
+      # ### Note
+      #
+      # For internal purposes, `add_formatter` also accepts the name of a class
+      # and paths to use for output streams, but you should consider that a
+      # private api that may change at any time without notice.
+      def add_formatter(formatter_to_use, *paths)
+        formatter_class =
+          built_in_formatter(formatter_to_use) ||
+          custom_formatter(formatter_to_use) ||
+          (raise ArgumentError, "Formatter '#{formatter_to_use}' unknown - maybe you meant 'documentation' or 'progress'?.")
+
+        paths << output if paths.empty?
+        formatters << formatter_class.new(*paths.map {|p| String === p ? file_at(p) : p})
+      end
+
+      alias_method :formatter=, :add_formatter
+
+      def formatters
+        @formatters ||= []
+      end
+
+      def reporter
+        @reporter ||= begin
+                        add_formatter('progress') if formatters.empty?
+                        add_formatter(RSpec::Core::Formatters::DeprecationFormatter, deprecation_stream, output_stream)
+                        Reporter.new(*formatters)
+                      end
+      end
+
+      # @api private
+      #
+      # Defaults `profile_examples` to 10 examples when `@profile_examples` is `true`.
+      #
+      def profile_examples
+        profile = value_for(:profile_examples, @profile_examples)
+        if profile && !profile.is_a?(Integer)
+          10
+        else
+          profile
+        end
+      end
+
+      # @private
+      def files_or_directories_to_run=(*files)
+        files = files.flatten
+        files << default_path if (command == 'rspec' || Runner.running_in_drb?) && default_path && files.empty?
+        self.files_to_run = get_files_to_run(files)
+      end
+
+      # Creates a method that delegates to `example` including the submitted
+      # `args`. Used internally to add variants of `example` like `pending`:
+      #
+      # @example
+      #     alias_example_to :pending, :pending => true
+      #
+      #     # This lets you do this:
+      #
+      #     describe Thing do
+      #       pending "does something" do
+      #         thing = Thing.new
+      #       end
+      #     end
+      #
+      #     # ... which is the equivalent of
+      #
+      #     describe Thing do
+      #       it "does something", :pending => true do
+      #         thing = Thing.new
+      #       end
+      #     end
+      def alias_example_to(new_name, *args)
+        extra_options = build_metadata_hash_from(args)
+        RSpec::Core::ExampleGroup.alias_example_to(new_name, extra_options)
+      end
+
+      # Define an alias for it_should_behave_like that allows different
+      # language (like "it_has_behavior" or "it_behaves_like") to be
+      # employed when including shared examples.
+      #
+      # Example:
+      #
+      #     alias_it_behaves_like_to(:it_has_behavior, 'has behavior:')
+      #
+      # allows the user to include a shared example group like:
+      #
+      #     describe Entity do
+      #       it_has_behavior 'sortability' do
+      #         let(:sortable) { Entity.new }
+      #       end
+      #     end
+      #
+      # which is reported in the output as:
+      #
+      #     Entity
+      #       has behavior: sortability
+      #         # sortability examples here
+      def alias_it_behaves_like_to(new_name, report_label = '')
+        RSpec::Core::ExampleGroup.alias_it_behaves_like_to(new_name, report_label)
+      end
+
+      alias_method :alias_it_should_behave_like_to, :alias_it_behaves_like_to
+
+      # Adds key/value pairs to the `inclusion_filter`. If the
+      # `treat_symbols_as_metadata_keys_with_true_values` config option is set
+      # to true and `args` includes any symbols that are not part of a hash,
+      # each symbol is treated as a key in the hash with the value `true`.
+      #
+      # ### Note
+      #
+      # Filters set using this method can be overridden from the command line
+      # or config files (e.g. `.rspec`).
+      #
+      # @example
+      #     # given this declaration
+      #     describe "something", :foo => 'bar' do
+      #       # ...
+      #     end
+      #
+      #     # any of the following will include that group
+      #     config.filter_run_including :foo => 'bar'
+      #     config.filter_run_including :foo => /^ba/
+      #     config.filter_run_including :foo => lambda {|v| v == 'bar'}
+      #     config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
+      #
+      #     # given a proc with an arity of 1, the lambda is passed the value related to the key, e.g.
+      #     config.filter_run_including :foo => lambda {|v| v == 'bar'}
+      #
+      #     # given a proc with an arity of 2, the lambda is passed the value related to the key,
+      #     # and the metadata itself e.g.
+      #     config.filter_run_including :foo => lambda {|v,m| m[:foo] == 'bar'}
+      #
+      #     # with treat_symbols_as_metadata_keys_with_true_values = true
+      #     filter_run_including :foo # same as filter_run_including :foo => true
+      def filter_run_including(*args)
+        filter_manager.include_with_low_priority build_metadata_hash_from(args)
+      end
+
+      alias_method :filter_run, :filter_run_including
+
+      # Clears and reassigns the `inclusion_filter`. Set to `nil` if you don't
+      # want any inclusion filter at all.
+      #
+      # ### Warning
+      #
+      # This overrides any inclusion filters/tags set on the command line or in
+      # configuration files.
+      def inclusion_filter=(filter)
+        filter_manager.include! build_metadata_hash_from([filter])
+      end
+
+      alias_method :filter=, :inclusion_filter=
+
+      # Returns the `inclusion_filter`. If none has been set, returns an empty
+      # hash.
+      def inclusion_filter
+        filter_manager.inclusions
+      end
+
+      alias_method :filter, :inclusion_filter
+
+      # Adds key/value pairs to the `exclusion_filter`. If the
+      # `treat_symbols_as_metadata_keys_with_true_values` config option is set
+      # to true and `args` excludes any symbols that are not part of a hash,
+      # each symbol is treated as a key in the hash with the value `true`.
+      #
+      # ### Note
+      #
+      # Filters set using this method can be overridden from the command line
+      # or config files (e.g. `.rspec`).
+      #
+      # @example
+      #     # given this declaration
+      #     describe "something", :foo => 'bar' do
+      #       # ...
+      #     end
+      #
+      #     # any of the following will exclude that group
+      #     config.filter_run_excluding :foo => 'bar'
+      #     config.filter_run_excluding :foo => /^ba/
+      #     config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
+      #     config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
+      #
+      #     # given a proc with an arity of 1, the lambda is passed the value related to the key, e.g.
+      #     config.filter_run_excluding :foo => lambda {|v| v == 'bar'}
+      #
+      #     # given a proc with an arity of 2, the lambda is passed the value related to the key,
+      #     # and the metadata itself e.g.
+      #     config.filter_run_excluding :foo => lambda {|v,m| m[:foo] == 'bar'}
+      #
+      #     # with treat_symbols_as_metadata_keys_with_true_values = true
+      #     filter_run_excluding :foo # same as filter_run_excluding :foo => true
+      def filter_run_excluding(*args)
+        filter_manager.exclude_with_low_priority build_metadata_hash_from(args)
+      end
+
+      # Clears and reassigns the `exclusion_filter`. Set to `nil` if you don't
+      # want any exclusion filter at all.
+      #
+      # ### Warning
+      #
+      # This overrides any exclusion filters/tags set on the command line or in
+      # configuration files.
+      def exclusion_filter=(filter)
+        filter_manager.exclude! build_metadata_hash_from([filter])
+      end
+
+      # Returns the `exclusion_filter`. If none has been set, returns an empty
+      # hash.
+      def exclusion_filter
+        filter_manager.exclusions
+      end
+
+      # Tells RSpec to include `mod` in example groups. Methods defined in
+      # `mod` are exposed to examples (not example groups).  Use `filters` to
+      # constrain the groups in which to include the module.
+      #
+      # @example
+      #
+      #     module AuthenticationHelpers
+      #       def login_as(user)
+      #         # ...
+      #       end
+      #     end
+      #
+      #     module UserHelpers
+      #       def users(username)
+      #         # ...
+      #       end
+      #     end
+      #
+      #     RSpec.configure do |config|
+      #       config.include(UserHelpers) # included in all modules
+      #       config.include(AuthenticationHelpers, :type => :request)
+      #     end
+      #
+      #     describe "edit profile", :type => :request do
+      #       it "can be viewed by owning user" do
+      #         login_as users(:jdoe)
+      #         get "/profiles/jdoe"
+      #         assert_select ".username", :text => 'jdoe'
+      #       end
+      #     end
+      #
+      # @see #extend
+      def include(mod, *filters)
+        include_or_extend_modules << [:include, mod, build_metadata_hash_from(filters)]
+      end
+
+      # Tells RSpec to extend example groups with `mod`.  Methods defined in
+      # `mod` are exposed to example groups (not examples).  Use `filters` to
+      # constrain the groups to extend.
+      #
+      # Similar to `include`, but behavior is added to example groups, which
+      # are classes, rather than the examples, which are instances of those
+      # classes.
+      #
+      # @example
+      #
+      #     module UiHelpers
+      #       def run_in_browser
+      #         # ...
+      #       end
+      #     end
+      #
+      #     RSpec.configure do |config|
+      #       config.extend(UiHelpers, :type => :request)
+      #     end
+      #
+      #     describe "edit profile", :type => :request do
+      #       run_in_browser
+      #
+      #       it "does stuff in the client" do
+      #         # ...
+      #       end
+      #     end
+      #
+      # @see #include
+      def extend(mod, *filters)
+        include_or_extend_modules << [:extend, mod, build_metadata_hash_from(filters)]
+      end
+
+      # @private
+      #
+      # Used internally to extend a group with modules using `include` and/or
+      # `extend`.
+      def configure_group(group)
+        include_or_extend_modules.each do |include_or_extend, mod, filters|
+          next unless filters.empty? || group.any_apply?(filters)
+          send("safe_#{include_or_extend}", mod, group)
+        end
+      end
+
+      # @private
+      def safe_include(mod, host)
+        host.send(:include,mod) unless host < mod
+      end
+
+      # @private
+      def setup_load_path_and_require(paths)
+        directories = ['lib', default_path].select { |p| File.directory? p }
+        RSpec::Core::RubyProject.add_to_load_path(*directories)
+        paths.each {|path| require path}
+        @requires += paths
+      end
+
+      # @private
+      if RUBY_VERSION.to_f >= 1.9
+        def safe_extend(mod, host)
+          host.extend(mod) unless (class << host; self; end) < mod
+        end
+      else
+        def safe_extend(mod, host)
+          host.extend(mod) unless (class << host; self; end).included_modules.include?(mod)
+        end
+      end
+
+      # @private
+      def configure_mock_framework
+        RSpec::Core::ExampleGroup.send(:include, mock_framework)
+      end
+
+      # @private
+      def configure_expectation_framework
+        expectation_frameworks.each do |framework|
+          RSpec::Core::ExampleGroup.send(:include, framework)
+        end
+      end
+
+      # @private
+      def load_spec_files
+        files_to_run.uniq.each {|f| load File.expand_path(f) }
+        raise_if_rspec_1_is_loaded
+      end
+
+      # @private
+      DEFAULT_FORMATTER = lambda { |string| string }
+
+      # Formats the docstring output using the block provided.
+      #
+      # @example
+      #   # This will strip the descriptions of both examples and example groups.
+      #   RSpec.configure do |config|
+      #     config.format_docstrings { |s| s.strip }
+      #   end
+      def format_docstrings(&block)
+        @format_docstrings_block = block_given? ? block : DEFAULT_FORMATTER
+      end
+
+      # @private
+      def format_docstrings_block
+        @format_docstrings_block ||= DEFAULT_FORMATTER
+      end
+
+      # @api
+      #
+      # Sets the seed value and sets `order='rand'`
+      def seed=(seed)
+        order_and_seed_from_seed(seed)
+      end
+
+      # @api
+      #
+      # Sets the order and, if order is `'rand:<seed>'`, also sets the seed.
+      def order=(type)
+        order_and_seed_from_order(type)
+      end
+
+      def randomize?
+        order.to_s.match(/rand/)
+      end
+
+      # @private
+      DEFAULT_ORDERING = lambda { |list| list }
+
+      # @private
+      RANDOM_ORDERING = lambda do |list|
+        Kernel.srand RSpec.configuration.seed
+        ordering = list.sort_by { Kernel.rand(list.size) }
+        Kernel.srand # reset random generation
+        ordering
+      end
+
+      # Sets a strategy by which to order examples.
+      #
+      # @example
+      #   RSpec.configure do |config|
+      #     config.order_examples do |examples|
+      #       examples.reverse
+      #     end
+      #   end
+      #
+      # @see #order_groups
+      # @see #order_groups_and_examples
+      # @see #order=
+      # @see #seed=
+      def order_examples(&block)
+        @example_ordering_block = block
+        @order = "custom" unless built_in_orderer?(block)
+      end
+
+      # @private
+      def example_ordering_block
+        @example_ordering_block ||= DEFAULT_ORDERING
+      end
+
+      # Sets a strategy by which to order groups.
+      #
+      # @example
+      #   RSpec.configure do |config|
+      #     config.order_groups do |groups|
+      #       groups.reverse
+      #     end
+      #   end
+      #
+      # @see #order_examples
+      # @see #order_groups_and_examples
+      # @see #order=
+      # @see #seed=
+      def order_groups(&block)
+        @group_ordering_block = block
+        @order = "custom" unless built_in_orderer?(block)
+      end
+
+      # @private
+      def group_ordering_block
+        @group_ordering_block ||= DEFAULT_ORDERING
+      end
+
+      # Sets a strategy by which to order groups and examples.
+      #
+      # @example
+      #   RSpec.configure do |config|
+      #     config.order_groups_and_examples do |groups_or_examples|
+      #       groups_or_examples.reverse
+      #     end
+      #   end
+      #
+      # @see #order_groups
+      # @see #order_examples
+      # @see #order=
+      # @see #seed=
+      def order_groups_and_examples(&block)
+        order_groups(&block)
+        order_examples(&block)
+      end
+
+      # Set Ruby warnings on or off
+      def warnings= value
+        $VERBOSE = !!value
+      end
+
+      def warnings
+        $VERBOSE
+      end
+
+    private
+
+      def get_files_to_run(paths)
+        paths.map do |path|
+          path = path.gsub(File::ALT_SEPARATOR, File::SEPARATOR) if File::ALT_SEPARATOR
+          File.directory?(path) ? gather_directories(path) : extract_location(path)
+        end.flatten.sort
+      end
+
+      def gather_directories(path)
+        stripped = "{#{pattern.gsub(/\s*,\s*/, ',')}}"
+        files    = pattern =~ /^#{Regexp.escape path}/ ? Dir[stripped] : Dir["#{path}/#{stripped}"]
+        files.sort
+      end
+
+      def extract_location(path)
+        if path =~ /^(.*?)((?:\:\d+)+)$/
+          path, lines = $1, $2[1..-1].split(":").map{|n| n.to_i}
+          filter_manager.add_location path, lines
+        end
+        path
+      end
+
+      def command
+        $0.split(File::SEPARATOR).last
+      end
+
+      def value_for(key, default=nil)
+        @preferred_options.has_key?(key) ? @preferred_options[key] : default
+      end
+
+      def assert_no_example_groups_defined(config_option)
+        if RSpec.world.example_groups.any?
+          raise MustBeConfiguredBeforeExampleGroupsError.new(
+            "RSpec's #{config_option} configuration option must be configured before " +
+            "any example groups are defined, but you have already defined a group."
+          )
+        end
+      end
+
+      def raise_if_rspec_1_is_loaded
+        if defined?(Spec) && defined?(Spec::VERSION::MAJOR) && Spec::VERSION::MAJOR == 1
+          raise <<-MESSAGE
+
+#{'*'*80}
+  You are running rspec-2, but it seems as though rspec-1 has been loaded as
+  well.  This is likely due to a statement like this somewhere in the specs:
+
+      require 'spec'
+
+  Please locate that statement, remove it, and try again.
+#{'*'*80}
+MESSAGE
+        end
+      end
+
+      def output_to_tty?(output=output_stream)
+        tty? || (output.respond_to?(:tty?) && output.tty?)
+      end
+
+      def built_in_formatter(key)
+        case key.to_s
+        when 'd', 'doc', 'documentation', 's', 'n', 'spec', 'nested'
+          require 'rspec/core/formatters/documentation_formatter'
+          RSpec::Core::Formatters::DocumentationFormatter
+        when 'h', 'html'
+          require 'rspec/core/formatters/html_formatter'
+          RSpec::Core::Formatters::HtmlFormatter
+        when 't', 'textmate'
+          require 'rspec/core/formatters/text_mate_formatter'
+          RSpec::Core::Formatters::TextMateFormatter
+        when 'p', 'progress'
+          require 'rspec/core/formatters/progress_formatter'
+          RSpec::Core::Formatters::ProgressFormatter
+        when 'j', 'json'
+          require 'rspec/core/formatters/json_formatter'
+          RSpec::Core::Formatters::JsonFormatter
+        end
+      end
+
+      def custom_formatter(formatter_ref)
+        if Class === formatter_ref
+          formatter_ref
+        elsif string_const?(formatter_ref)
+          begin
+            eval(formatter_ref)
+          rescue NameError
+            require path_for(formatter_ref)
+            eval(formatter_ref)
+          end
+        end
+      end
+
+      def string_const?(str)
+        str.is_a?(String) && /\A[A-Z][a-zA-Z0-9_:]*\z/ =~ str
+      end
+
+      def path_for(const_ref)
+        underscore_with_fix_for_non_standard_rspec_naming(const_ref)
+      end
+
+      def underscore_with_fix_for_non_standard_rspec_naming(string)
+        underscore(string).sub(%r{(^|/)r_spec($|/)}, '\\1rspec\\2')
+      end
+
+      # activesupport/lib/active_support/inflector/methods.rb, line 48
+      def underscore(camel_cased_word)
+        word = camel_cased_word.to_s.dup
+        word.gsub!(/::/, '/')
+        word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
+        word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
+        word.tr!("-", "_")
+        word.downcase!
+        word
+      end
+
+      def file_at(path)
+        FileUtils.mkdir_p(File.dirname(path))
+        File.new(path, 'w')
+      end
+
+      def order_and_seed_from_seed(value)
+        order_groups_and_examples(&RANDOM_ORDERING)
+        @order, @seed = 'rand', value.to_i
+        [@order, @seed]
+      end
+
+      def set_order_and_seed(hash)
+        hash[:order], seed = order_and_seed_from_order(hash[:order])
+        hash[:seed] = seed if seed
+      end
+
+      def order_and_seed_from_order(type)
+        order, seed = type.to_s.split(':')
+        @order = order
+        @seed  = seed = seed.to_i if seed
+
+        if randomize?
+          order_groups_and_examples(&RANDOM_ORDERING)
+        elsif order == 'default'
+          @order, @seed = nil, nil
+          order_groups_and_examples(&DEFAULT_ORDERING)
+        end
+
+        return order, seed
+      end
+
+      def built_in_orderer?(block)
+        [DEFAULT_ORDERING, RANDOM_ORDERING].include?(block)
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/configuration_options.rb b/rspec-core/lib/rspec/core/configuration_options.rb
new file mode 100644
index 0000000..7ab3de1
--- /dev/null
+++ b/rspec-core/lib/rspec/core/configuration_options.rb
@@ -0,0 +1,156 @@
+require 'erb'
+require 'shellwords'
+
+module RSpec
+  module Core
+    # @private
+    class ConfigurationOptions
+      attr_reader :options
+
+      def initialize(args)
+        @args = args.dup
+        if @args.include?("--default_path")
+          @args[@args.index("--default_path")] = "--default-path"
+        end
+
+        if @args.include?("--line_number")
+          @args[@args.index("--line_number")] = "--line-number"
+        end
+      end
+
+      def configure(config)
+        config.filter_manager = filter_manager
+
+        config.libs = options[:libs] || []
+        config.setup_load_path_and_require(options[:requires] || [])
+
+        process_options_into config
+        load_formatters_into config
+      end
+
+      def parse_options
+        @options ||= extract_filters_from(*all_configs).inject do |merged, pending|
+          merged.merge(pending) { |key, oldval, newval|
+            MERGED_OPTIONS.include?(key) ? oldval + newval : newval
+          }
+        end
+      end
+
+      def drb_argv
+        DrbOptions.new(options, filter_manager).options
+      end
+
+      def filter_manager
+        @filter_manager ||= RSpec::configuration.filter_manager
+      end
+
+    private
+
+      NON_FORCED_OPTIONS = [
+        :debug, :requires, :profile, :drb, :libs, :files_or_directories_to_run,
+        :line_numbers, :full_description, :full_backtrace, :tty
+      ].to_set
+
+      MERGED_OPTIONS = [:requires, :libs].to_set
+
+      UNPROCESSABLE_OPTIONS = [:libs, :formatters, :requires].to_set
+
+      def force?(key)
+        !NON_FORCED_OPTIONS.include?(key)
+      end
+
+      def order(keys, *ordered)
+        ordered.reverse.each do |key|
+          keys.unshift(key) if keys.delete(key)
+        end
+        keys
+      end
+
+      def process_options_into(config)
+        opts = options.reject { |k, _| UNPROCESSABLE_OPTIONS.include? k }
+
+        order(opts.keys, :default_path, :pattern).each do |key|
+          force?(key) ? config.force(key => opts[key]) : config.send("#{key}=", opts[key])
+        end
+      end
+
+      def load_formatters_into(config)
+        options[:formatters].each { |pair| config.add_formatter(*pair) } if options[:formatters]
+      end
+
+      def extract_filters_from(*configs)
+        configs.compact.each do |config|
+          filter_manager.include config.delete(:inclusion_filter) if config.has_key?(:inclusion_filter)
+          filter_manager.exclude config.delete(:exclusion_filter) if config.has_key?(:exclusion_filter)
+        end
+      end
+
+      def all_configs
+        @all_configs ||= file_options << command_line_options << env_options
+      end
+
+      def file_options
+        custom_options_file ? [custom_options] : [global_options, project_options, local_options]
+      end
+
+      def env_options
+        ENV["SPEC_OPTS"] ? Parser.parse!(Shellwords.split(ENV["SPEC_OPTS"])) : {}
+      end
+
+      def command_line_options
+        @command_line_options ||= Parser.parse!(@args).merge :files_or_directories_to_run => @args
+      end
+
+      def custom_options
+        options_from(custom_options_file)
+      end
+
+      def local_options
+        @local_options ||= options_from(local_options_file)
+      end
+
+      def project_options
+        @project_options ||= options_from(project_options_file)
+      end
+
+      def global_options
+        @global_options ||= options_from(global_options_file)
+      end
+
+      def options_from(path)
+        Parser.parse(args_from_options_file(path))
+      end
+
+      def args_from_options_file(path)
+        return [] unless path && File.exist?(path)
+        config_string = options_file_as_erb_string(path)
+        config_string.split(/\n+/).map {|l| Shellwords.shellwords(l) }.flatten
+      end
+
+      def options_file_as_erb_string(path)
+        ERB.new(File.read(path), nil, '-').result(binding)
+      end
+
+      def custom_options_file
+        command_line_options[:custom_options_file]
+      end
+
+      def project_options_file
+        ".rspec"
+      end
+
+      def local_options_file
+        ".rspec-local"
+      end
+
+      def global_options_file
+        begin
+          File.join(File.expand_path("~"), ".rspec")
+        rescue ArgumentError
+          warn "Unable to find ~/.rspec because the HOME environment variable is not set"
+          nil
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/deprecation.rb b/rspec-core/lib/rspec/core/deprecation.rb
new file mode 100644
index 0000000..03bd8ff
--- /dev/null
+++ b/rspec-core/lib/rspec/core/deprecation.rb
@@ -0,0 +1,31 @@
+module RSpec
+  module Core
+    module Deprecation
+      # @private
+      #
+      # Used internally to print deprecation warnings
+      def deprecate(deprecated, replacement_or_hash={}, ignore_version=nil)
+        # Temporarily support old and new APIs while we transition the other
+        # rspec libs to use a hash for the 2nd arg and no version arg
+        data = Hash === replacement_or_hash ? replacement_or_hash : { :replacement => replacement_or_hash }
+        call_site = caller.find { |line| line !~ %r{/lib/rspec/(core|mocks|expectations|matchers|rails)/} }
+
+        RSpec.configuration.reporter.deprecation(
+          {
+            :deprecated => deprecated,
+            :call_site => call_site
+          }.merge(data)
+        )
+      end
+
+      # @private
+      #
+      # Used internally to print deprecation warnings
+      def warn_deprecation(message)
+        RSpec.configuration.reporter.deprecation :message => message
+      end
+    end
+  end
+
+  extend(Core::Deprecation)
+end
diff --git a/rspec-core/lib/rspec/core/drb_command_line.rb b/rspec-core/lib/rspec/core/drb_command_line.rb
new file mode 100644
index 0000000..8f390d9
--- /dev/null
+++ b/rspec-core/lib/rspec/core/drb_command_line.rb
@@ -0,0 +1,26 @@
+require 'drb/drb'
+require 'rspec/core/drb_options'
+
+module RSpec
+  module Core
+    class DRbCommandLine
+      def initialize(options)
+        @options = options
+      end
+
+      def drb_port
+        @options.options[:drb_port] || ENV['RSPEC_DRB'] || 8989
+      end
+
+      def run(err, out)
+        begin
+          DRb.start_service("druby://localhost:0")
+        rescue SocketError, Errno::EADDRNOTAVAIL
+          DRb.start_service("druby://:0")
+        end
+        spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{drb_port}")
+        spec_server.run(@options.drb_argv, err, out)
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/drb_options.rb b/rspec-core/lib/rspec/core/drb_options.rb
new file mode 100644
index 0000000..64ba237
--- /dev/null
+++ b/rspec-core/lib/rspec/core/drb_options.rb
@@ -0,0 +1,87 @@
+# Builds command line arguments to pass to the rspec command over DRb
+
+module RSpec::Core
+  # @private
+  class DrbOptions
+    def initialize(submitted_options, filter_manager)
+      @submitted_options = submitted_options
+      @filter_manager = filter_manager
+    end
+
+    def options
+      argv = []
+      argv << "--color"        if @submitted_options[:color]
+      argv << "--profile"      if @submitted_options[:profile_examples]
+      argv << "--backtrace"    if @submitted_options[:full_backtrace]
+      argv << "--tty"          if @submitted_options[:tty]
+      argv << "--fail-fast"    if @submitted_options[:fail_fast]
+      argv << "--options"      << @submitted_options[:custom_options_file] if @submitted_options[:custom_options_file]
+      argv << "--order"        << @submitted_options[:order]               if @submitted_options[:order]
+
+      add_failure_exit_code(argv)
+      add_full_description(argv)
+      add_line_numbers(argv)
+      add_filter(argv, :inclusion, @filter_manager.inclusions)
+      add_filter(argv, :exclusion, @filter_manager.exclusions)
+      add_formatters(argv)
+      add_libs(argv)
+      add_requires(argv)
+
+      argv + @submitted_options[:files_or_directories_to_run]
+    end
+
+    def add_failure_exit_code(argv)
+      if @submitted_options[:failure_exit_code]
+        argv << "--failure-exit-code" << @submitted_options[:failure_exit_code].to_s
+      end
+    end
+
+    def add_full_description(argv)
+      if @submitted_options[:full_description]
+        # The argument to --example is regexp-escaped before being stuffed
+        # into a regexp when received for the first time (see OptionParser).
+        # Hence, merely grabbing the source of this regexp will retain the
+        # backslashes, so we must remove them.
+        @submitted_options[:full_description].each do |description|
+          argv << "--example" << description.source.delete('\\')
+        end
+      end
+    end
+
+    def add_line_numbers(argv)
+      if @submitted_options[:line_numbers]
+        argv.push(*@submitted_options[:line_numbers].inject([]){|a,l| a << "--line_number" << l})
+      end
+    end
+
+    CONDITIONAL_FILTERS = [:if, :unless]
+
+    def add_filter(argv, name, hash)
+      hash.each_pair do |k, v|
+        next if CONDITIONAL_FILTERS.include?(k)
+        tag = name == :inclusion ? k.to_s : "~#{k}"
+        tag << ":#{v}" if v.is_a?(String)
+        argv << "--tag" << tag
+      end unless hash.empty?
+    end
+
+    def add_formatters(argv)
+      @submitted_options[:formatters].each do |pair|
+        argv << "--format" << pair[0]
+        argv << "--out" << pair[1] if pair[1]
+      end if @submitted_options[:formatters]
+    end
+
+    def add_libs(argv)
+      @submitted_options[:libs].each do |path|
+        argv << "-I" << path
+      end if @submitted_options[:libs]
+    end
+
+    def add_requires(argv)
+      @submitted_options[:requires].each do |path|
+        argv << "--require" << path
+      end if @submitted_options[:requires]
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/dsl.rb b/rspec-core/lib/rspec/core/dsl.rb
new file mode 100644
index 0000000..f73ae36
--- /dev/null
+++ b/rspec-core/lib/rspec/core/dsl.rb
@@ -0,0 +1,26 @@
+module RSpec
+  module Core
+    # Adds the `describe` method to the top-level namespace.
+    module DSL
+      # Generates a subclass of {ExampleGroup}
+      #
+      # ## Examples:
+      #
+      #     describe "something" do
+      #       it "does something" do
+      #         # example code goes here
+      #       end
+      #     end
+      #
+      # @see ExampleGroup
+      # @see ExampleGroup.describe
+      def describe(*args, &example_group_block)
+        RSpec::Core::ExampleGroup.describe(*args, &example_group_block).register
+      end
+    end
+  end
+end
+
+extend RSpec::Core::DSL
+Module.send(:include, RSpec::Core::DSL)
+
diff --git a/rspec-core/lib/rspec/core/example.rb b/rspec-core/lib/rspec/core/example.rb
new file mode 100644
index 0000000..afee4f2
--- /dev/null
+++ b/rspec-core/lib/rspec/core/example.rb
@@ -0,0 +1,331 @@
+module RSpec
+  module Core
+    # Wrapper for an instance of a subclass of {ExampleGroup}. An instance of
+    # `Example` is returned by the {ExampleGroup#example example} method
+    # exposed to examples, {Hooks#before before} and {Hooks#after after} hooks,
+    # and yielded to {Hooks#around around} hooks.
+    #
+    # Useful for configuring logging and/or taking some action based
+    # on the state of an example's metadata.
+    #
+    # @example
+    #
+    #     RSpec.configure do |config|
+    #       config.before do
+    #         log example.description
+    #       end
+    #
+    #       config.after do
+    #         log example.description
+    #       end
+    #
+    #       config.around do |ex|
+    #         log example.description
+    #         ex.run
+    #       end
+    #     end
+    #
+    #     shared_examples "auditable" do
+    #       it "does something" do
+    #         log "#{example.full_description}: #{auditable.inspect}"
+    #         auditable.should do_something
+    #       end
+    #     end
+    #
+    # @see ExampleGroup
+    class Example
+      # @private
+      #
+      # Used to define methods that delegate to this example's metadata
+      def self.delegate_to_metadata(*keys)
+        keys.each { |key| define_method(key) { @metadata[key] } }
+      end
+
+      delegate_to_metadata :full_description, :execution_result, :file_path, :pending, :location
+
+      # Returns the string submitted to `example` or its aliases (e.g.
+      # `specify`, `it`, etc).  If no string is submitted (e.g. `it { should
+      # do_something }`) it returns the message generated by the matcher if
+      # there is one, otherwise returns a message including the location of the
+      # example.
+      def description
+        description = metadata[:description].to_s.empty? ? "example at #{location}" : metadata[:description]
+        RSpec.configuration.format_docstrings_block.call(description)
+      end
+
+      # @attr_reader
+      #
+      # Returns the first exception raised in the context of running this
+      # example (nil if no exception is raised)
+      attr_reader :exception
+
+      # @attr_reader
+      #
+      # Returns the metadata object associated with this example.
+      attr_reader :metadata
+
+      # @attr_reader
+      # @private
+      #
+      # Returns the example_group_instance that provides the context for
+      # running this example.
+      attr_reader :example_group_instance
+
+      # Creates a new instance of Example.
+      # @param example_group_class the subclass of ExampleGroup in which this Example is declared
+      # @param description the String passed to the `it` method (or alias)
+      # @param metadata additional args passed to `it` to be used as metadata
+      # @param example_block the block of code that represents the example
+      def initialize(example_group_class, description, metadata, example_block=nil)
+        @example_group_class, @options, @example_block = example_group_class, metadata, example_block
+        @metadata  = @example_group_class.metadata.for_example(description, metadata)
+        @example_group_instance = @exception = nil
+        @pending_declared_in_example = false
+      end
+
+      # @deprecated access options via metadata instead
+      def options
+        @options
+      end
+
+      # Returns the example group class that provides the context for running
+      # this example.
+      def example_group
+        @example_group_class
+      end
+
+      alias_method :pending?, :pending
+
+      # @api private
+      # instance_evals the block passed to the constructor in the context of
+      # the instance of {ExampleGroup}.
+      # @param example_group_instance the instance of an ExampleGroup subclass
+      def run(example_group_instance, reporter)
+        @example_group_instance = example_group_instance
+        @example_group_instance.example = self
+
+        start(reporter)
+
+        begin
+          unless pending
+            with_around_each_hooks do
+              begin
+                run_before_each
+                @example_group_instance.instance_eval(&@example_block)
+              rescue Pending::PendingDeclaredInExample => e
+                @pending_declared_in_example = e.message
+              rescue Exception => e
+                set_exception(e)
+              ensure
+                run_after_each
+              end
+            end
+          end
+        rescue Exception => e
+          set_exception(e)
+        ensure
+          @example_group_instance.instance_variables.each do |ivar|
+            @example_group_instance.instance_variable_set(ivar, nil)
+          end
+          @example_group_instance = nil
+
+          begin
+            assign_generated_description
+          rescue Exception => e
+            set_exception(e, "while assigning the example description")
+          end
+        end
+
+        finish(reporter)
+      end
+
+      # @api private
+      #
+      # Wraps the example block in a Proc so it can invoked using `run` or
+      # `call` in [around](../Hooks#around-instance_method) hooks.
+      def self.procsy(metadata, &proc)
+        proc.extend(Procsy).with(metadata)
+      end
+
+      # Used to extend a `Proc` with behavior that makes it look something like
+      # an {Example} in an {Hooks#around around} hook.
+      #
+      # @note Procsy, itself, is not a public API, but we're documenting it
+      #   here to document how to interact with the object yielded to an
+      #   `around` hook.
+      #
+      # @example
+      #
+      #     RSpec.configure do |c|
+      #       c.around do |ex| # ex is a Proc extended with Procsy
+      #         if ex.metadata[:key] == :some_value && some_global_condition
+      #           raise "some message"
+      #         end
+      #         ex.run         # run delegates to ex.call
+      #       end
+      #     end
+      module Procsy
+        # The `metadata` of the {Example} instance.
+        attr_reader :metadata
+
+        # @api private
+        # @param [Proc]
+        # Adds a `run` method to the extended Proc, allowing it to be invoked
+        # in an [around](../Hooks#around-instance_method) hook using either
+        # `run` or `call`.
+        def self.extended(proc)
+          # @api public
+          # Foo bar
+          def proc.run; call; end
+        end
+
+        # @api private
+        def with(metadata)
+          @metadata = metadata
+          self
+        end
+      end
+
+      # @private
+      def any_apply?(filters)
+        metadata.any_apply?(filters)
+      end
+
+      # @private
+      def all_apply?(filters)
+        @metadata.all_apply?(filters) || @example_group_class.all_apply?(filters)
+      end
+
+      # @private
+      def around_each_hooks
+        @around_each_hooks ||= example_group.around_each_hooks_for(self)
+      end
+
+      # @private
+      #
+      # Used internally to set an exception in an after hook, which
+      # captures the exception but doesn't raise it.
+      def set_exception(exception, context=nil)
+        if @exception && context != :dont_print
+          # An error has already been set; we don't want to override it,
+          # but we also don't want silence the error, so let's print it.
+          msg = <<-EOS
+
+An error occurred #{context}
+  #{exception.class}: #{exception.message}
+  occurred at #{exception.backtrace.first}
+
+          EOS
+          RSpec.configuration.reporter.message(msg)
+        end
+
+        @exception ||= exception
+      end
+
+      # @private
+      #
+      # Used internally to set an exception and fail without actually executing
+      # the example when an exception is raised in before(:all).
+      def fail_with_exception(reporter, exception)
+        start(reporter)
+        set_exception(exception)
+        finish(reporter)
+      end
+
+      # @private
+      def instance_eval(*args, &block)
+        @example_group_instance.instance_eval(*args, &block)
+      end
+
+      # @private
+      def instance_eval_with_rescue(context = nil, &block)
+        @example_group_instance.instance_eval_with_rescue(context, &block)
+      end
+
+      # @private
+      def instance_eval_with_args(*args, &block)
+        @example_group_instance.instance_eval_with_args(*args, &block)
+      end
+
+    private
+
+      def with_around_each_hooks(&block)
+        if around_each_hooks.empty?
+          yield
+        else
+          @example_group_class.run_around_each_hooks(self, Example.procsy(metadata, &block))
+        end
+      rescue Exception => e
+        set_exception(e, "in an around(:each) hook")
+      end
+
+      def start(reporter)
+        reporter.example_started(self)
+        record :started_at => RSpec::Core::Time.now
+      end
+
+      # @private
+      module NotPendingExampleFixed
+        def pending_fixed?; false; end
+      end
+
+      def finish(reporter)
+        if @exception
+          @exception.extend(NotPendingExampleFixed) unless @exception.respond_to?(:pending_fixed?)
+          record_finished 'failed', :exception => @exception
+          reporter.example_failed self
+          false
+        elsif @pending_declared_in_example
+          record_finished 'pending', :pending_message => @pending_declared_in_example
+          reporter.example_pending self
+          true
+        elsif pending
+          record_finished 'pending', :pending_message => String === pending ? pending : Pending::NO_REASON_GIVEN
+          reporter.example_pending self
+          true
+        else
+          record_finished 'passed'
+          reporter.example_passed self
+          true
+        end
+      end
+
+      def record_finished(status, results={})
+        finished_at = RSpec::Core::Time.now
+        record results.merge(:status => status, :finished_at => finished_at, :run_time => (finished_at - execution_result[:started_at]).to_f)
+      end
+
+      def run_before_each
+        @example_group_instance.setup_mocks_for_rspec
+        @example_group_class.run_before_each_hooks(self)
+      end
+
+      def run_after_each
+        @example_group_class.run_after_each_hooks(self)
+        verify_mocks
+      rescue Exception => e
+        set_exception(e, "in an after(:each) hook")
+      ensure
+        @example_group_instance.teardown_mocks_for_rspec
+      end
+
+      def verify_mocks
+        @example_group_instance.verify_mocks_for_rspec
+      rescue Exception => e
+        set_exception(e, :dont_print)
+      end
+
+      def assign_generated_description
+        return unless RSpec.configuration.expecting_with_rspec?
+        if metadata[:description_args].empty? and !pending?
+          metadata[:description_args] << RSpec::Matchers.generated_description
+        end
+        RSpec::Matchers.clear_generated_description
+      end
+
+      def record(results={})
+        execution_result.update(results)
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/example_group.rb b/rspec-core/lib/rspec/core/example_group.rb
new file mode 100644
index 0000000..64eef4e
--- /dev/null
+++ b/rspec-core/lib/rspec/core/example_group.rb
@@ -0,0 +1,479 @@
+module RSpec
+  module Core
+    # ExampleGroup and {Example} are the main structural elements of
+    # rspec-core.  Consider this example:
+    #
+    #     describe Thing do
+    #       it "does something" do
+    #       end
+    #     end
+    #
+    # The object returned by `describe Thing` is a subclass of ExampleGroup.
+    # The object returned by `it "does something"` is an instance of Example,
+    # which serves as a wrapper for an instance of the ExampleGroup in which it
+    # is declared.
+    class ExampleGroup
+      extend  MetadataHashBuilder::WithDeprecationWarning
+      extend  Extensions::ModuleEvalWithArgs
+      extend  Hooks
+
+      include MemoizedHelpers
+      include Extensions::InstanceEvalWithArgs
+      include Pending
+      include SharedExampleGroup
+      extend SharedExampleGroup
+
+      # @private
+      def self.world
+        RSpec.world
+      end
+
+      # @private
+      def self.register
+        world.register(self)
+      end
+
+      class << self
+        # @private
+        def self.delegate_to_metadata(*names)
+          names.each do |name|
+            define_method name do
+              metadata[:example_group][name]
+            end
+          end
+        end
+
+        def description
+          description = metadata[:example_group][:description]
+          RSpec.configuration.format_docstrings_block.call(description)
+        end
+
+        delegate_to_metadata :described_class, :file_path
+        alias_method :display_name, :description
+        # @private
+        alias_method :describes, :described_class
+
+        # @private
+        # @macro [attach] define_example_method
+        #   @param [String] name
+        #   @param [Hash] extra_options
+        #   @param [Block] implementation
+        def self.define_example_method(name, extra_options={})
+          module_eval(<<-END_RUBY, __FILE__, __LINE__)
+            def #{name}(desc=nil, *args, &block)
+              options = build_metadata_hash_from(args)
+              options.update(:pending => RSpec::Core::Pending::NOT_YET_IMPLEMENTED) unless block
+              options.update(#{extra_options.inspect})
+              examples << RSpec::Core::Example.new(self, desc, options, block)
+              examples.last
+            end
+          END_RUBY
+        end
+
+        # Defines an example within a group.
+        define_example_method :example
+        # Defines an example within a group.
+        #
+        # @see example
+        define_example_method :it
+        # Defines an example within a group.
+        # This is here primarily for backward compatibility with early versions
+        # of RSpec which used `context` and `specify` instead of `describe` and
+        # `it`.
+        define_example_method :specify
+
+        # Shortcut to define an example with `:focus` => true
+        define_example_method :focus,   :focused => true, :focus => true
+        # Shortcut to define an example with `:focus` => true
+        define_example_method :focused, :focused => true, :focus => true
+        # Shortcut to define an example with `:focus` => true
+        # @see example
+        define_example_method :fit,     :focused => true, :focus => true
+
+        # Shortcut to define an example with :pending => true
+        define_example_method :pending,  :pending => true
+        # Shortcut to define an example with :pending => 'Temporarily disabled with xexample'
+        define_example_method :xexample, :pending => 'Temporarily disabled with xexample'
+        # Shortcut to define an example with :pending => 'Temporarily disabled with xit'
+        define_example_method :xit,      :pending => 'Temporarily disabled with xit'
+        # Shortcut to define an example with :pending => 'Temporarily disabled with xspecify'
+        define_example_method :xspecify, :pending => 'Temporarily disabled with xspecify'
+
+        # Works like `alias_method :name, :example` with the added benefit of
+        # assigning default metadata to the generated example.
+        #
+        # @note Use with caution. This extends the language used in your
+        #   specs, but does not add any additional documentation.  We use this
+        #   in rspec to define methods like `focus` and `xit`, but we also add
+        #   docs for those methods.
+        def alias_example_to name, extra={}
+          (class << self; self; end).define_example_method name, extra
+        end
+
+        # @private
+        # @macro [attach] define_nested_shared_group_method
+        #
+        #   @see SharedExampleGroup
+        def self.define_nested_shared_group_method(new_name, report_label=nil)
+          module_eval(<<-END_RUBY, __FILE__, __LINE__)
+            def #{new_name}(name, *args, &customization_block)
+              group = describe("#{report_label || "it should behave like"} \#{name}") do
+                find_and_eval_shared("examples", name, *args, &customization_block)
+              end
+              group.metadata[:shared_group_name] = name
+              group
+            end
+          END_RUBY
+        end
+
+        # Generates a nested example group and includes the shared content
+        # mapped to `name` in the nested group.
+        define_nested_shared_group_method :it_behaves_like, "behaves like"
+        # Generates a nested example group and includes the shared content
+        # mapped to `name` in the nested group.
+        define_nested_shared_group_method :it_should_behave_like
+
+        # Works like `alias_method :name, :it_behaves_like` with the added
+        # benefit of assigning default metadata to the generated example.
+        #
+        # @note Use with caution. This extends the language used in your
+        #   specs, but does not add any additional documentation.  We use this
+        #   in rspec to define `it_should_behave_like` (for backward
+        #   compatibility), but we also add docs for that method.
+        def alias_it_behaves_like_to name, *args, &block
+          (class << self; self; end).define_nested_shared_group_method name, *args, &block
+        end
+      end
+
+      # Includes shared content mapped to `name` directly in the group in which
+      # it is declared, as opposed to `it_behaves_like`, which creates a nested
+      # group. If given a block, that block is also eval'd in the current context.
+      #
+      # @see SharedExampleGroup
+      def self.include_context(name, *args, &block)
+        find_and_eval_shared("context", name, *args, &block)
+      end
+
+      # Includes shared content mapped to `name` directly in the group in which
+      # it is declared, as opposed to `it_behaves_like`, which creates a nested
+      # group. If given a block, that block is also eval'd in the current context.
+      #
+      # @see SharedExampleGroup
+      def self.include_examples(name, *args, &block)
+        find_and_eval_shared("examples", name, *args, &block)
+      end
+
+      # @private
+      def self.find_and_eval_shared(label, name, *args, &customization_block)
+        raise ArgumentError, "Could not find shared #{label} #{name.inspect}" unless
+        shared_block = shared_example_groups[name]
+
+        module_eval_with_args(*args, &shared_block)
+        module_eval(&customization_block) if customization_block
+      end
+
+      # @private
+      def self.examples
+        @examples ||= []
+      end
+
+      # @private
+      def self.filtered_examples
+        world.filtered_examples[self]
+      end
+
+      # @private
+      def self.descendant_filtered_examples
+        @descendant_filtered_examples ||= filtered_examples + children.inject([]){|l,c| l + c.descendant_filtered_examples}
+      end
+
+      # The [Metadata](Metadata) object associated with this group.
+      # @see Metadata
+      def self.metadata
+        @metadata if defined?(@metadata)
+      end
+
+      # @private
+      # @return [Metadata] belonging to the parent of a nested {ExampleGroup}
+      def self.superclass_metadata
+        @superclass_metadata ||= self.superclass.respond_to?(:metadata) ? self.superclass.metadata : nil
+      end
+
+      # Generates a subclass of this example group which inherits
+      # everything except the examples themselves.
+      #
+      # ## Examples
+      #
+      #     describe "something" do # << This describe method is defined in
+      #                             # << RSpec::Core::DSL, included in the
+      #                             # << global namespace
+      #       before do
+      #         do_something_before
+      #       end
+      #
+      #       let(:thing) { Thing.new }
+      #
+      #       describe "attribute (of something)" do
+      #         # examples in the group get the before hook
+      #         # declared above, and can access `thing`
+      #       end
+      #     end
+      #
+      # @see DSL#describe
+      def self.describe(*args, &example_group_block)
+        @_subclass_count ||= 0
+        @_subclass_count += 1
+        args << {} unless args.last.is_a?(Hash)
+        args.last.update(:example_group_block => example_group_block)
+
+        # TODO 2010-05-05: Because we don't know if const_set is thread-safe
+        child = const_set(
+          "Nested_#{@_subclass_count}",
+          subclass(self, args, &example_group_block)
+        )
+        children << child
+        child
+      end
+
+      class << self
+        alias_method :context, :describe
+      end
+
+      # @private
+      def self.subclass(parent, args, &example_group_block)
+        subclass = Class.new(parent)
+        subclass.set_it_up(*args)
+        subclass.module_eval(&example_group_block) if example_group_block
+
+        # The LetDefinitions module must be included _after_ other modules
+        # to ensure that it takes precendence when there are name collisions.
+        # Thus, we delay including it until after the example group block
+        # has been eval'd.
+        MemoizedHelpers.define_helpers_on(subclass)
+
+        subclass
+      end
+
+      # @private
+      def self.children
+        @children ||= [].extend(Extensions::Ordered::ExampleGroups)
+      end
+
+      # @private
+      def self.descendants
+        @_descendants ||= [self] + children.inject([]) {|list, c| list + c.descendants}
+      end
+
+      ## @private
+      def self.parent_groups
+        @parent_groups ||= ancestors.select {|a| a < RSpec::Core::ExampleGroup}
+      end
+
+      # @private
+      def self.top_level?
+        @top_level ||= superclass == ExampleGroup
+      end
+
+      # @private
+      def self.ensure_example_groups_are_configured
+        unless defined?(@@example_groups_configured)
+          RSpec.configuration.configure_mock_framework
+          RSpec.configuration.configure_expectation_framework
+          @@example_groups_configured = true
+        end
+      end
+
+      # @private
+      def self.set_it_up(*args)
+        # Ruby 1.9 has a bug that can lead to infinite recursion and a
+        # SystemStackError if you include a module in a superclass after
+        # including it in a subclass: https://gist.github.com/845896
+        # To prevent this, we must include any modules in RSpec::Core::ExampleGroup
+        # before users create example groups and have a chance to include
+        # the same module in a subclass of RSpec::Core::ExampleGroup.
+        # So we need to configure example groups here.
+        ensure_example_groups_are_configured
+
+        symbol_description = args.shift if args.first.is_a?(Symbol)
+        args << build_metadata_hash_from(args)
+        args.unshift(symbol_description) if symbol_description
+        @metadata = RSpec::Core::Metadata.new(superclass_metadata).process(*args)
+        hooks.register_globals(self, RSpec.configuration.hooks)
+        world.configure_group(self)
+      end
+
+      # @private
+      def self.before_all_ivars
+        @before_all_ivars ||= {}
+      end
+
+      # @private
+      def self.store_before_all_ivars(example_group_instance)
+        return if example_group_instance.instance_variables.empty?
+
+        example_group_instance.instance_variables.each { |ivar|
+          before_all_ivars[ivar] = example_group_instance.instance_variable_get(ivar)
+        }
+      end
+
+      # @private
+      def self.assign_before_all_ivars(ivars, example_group_instance)
+        ivars.each { |ivar, val| example_group_instance.instance_variable_set(ivar, val) }
+      end
+
+      # @private
+      def self.run_before_all_hooks(example_group_instance)
+        return if descendant_filtered_examples.empty?
+        begin
+          assign_before_all_ivars(superclass.before_all_ivars, example_group_instance)
+
+          BeforeAllMemoizedHash.isolate_for_before_all(example_group_instance) do
+            run_hook(:before, :all, example_group_instance)
+          end
+        ensure
+          store_before_all_ivars(example_group_instance)
+        end
+      end
+
+      # @private
+      def self.run_around_each_hooks(example, initial_procsy)
+        run_hook(:around, :each, example, initial_procsy)
+      end
+
+      # @private
+      def self.run_before_each_hooks(example)
+        run_hook(:before, :each, example)
+      end
+
+      # @private
+      def self.run_after_each_hooks(example)
+        run_hook(:after, :each, example)
+      end
+
+      # @private
+      def self.run_after_all_hooks(example_group_instance)
+        return if descendant_filtered_examples.empty?
+        assign_before_all_ivars(before_all_ivars, example_group_instance)
+
+        run_hook(:after, :all, example_group_instance)
+      end
+
+      # Runs all the examples in this group
+      def self.run(reporter)
+        if RSpec.wants_to_quit
+          RSpec.clear_remaining_example_groups if top_level?
+          return
+        end
+        reporter.example_group_started(self)
+
+        begin
+          run_before_all_hooks(new)
+          result_for_this_group = run_examples(reporter)
+          results_for_descendants = children.ordered.map {|child| child.run(reporter)}.all?
+          result_for_this_group && results_for_descendants
+        rescue Exception => ex
+          RSpec.wants_to_quit = true if fail_fast?
+          fail_filtered_examples(ex, reporter)
+        ensure
+          run_after_all_hooks(new)
+          before_all_ivars.clear
+          reporter.example_group_finished(self)
+        end
+      end
+
+      # @private
+      def self.run_examples(reporter)
+        filtered_examples.ordered.map do |example|
+          next if RSpec.wants_to_quit
+          instance = new
+          set_ivars(instance, before_all_ivars)
+          succeeded = example.run(instance, reporter)
+          RSpec.wants_to_quit = true if fail_fast? && !succeeded
+          succeeded
+        end.all?
+      end
+
+      # @private
+      def self.fail_filtered_examples(exception, reporter)
+        filtered_examples.each { |example| example.fail_with_exception(reporter, exception) }
+
+        children.each do |child|
+          reporter.example_group_started(child)
+          child.fail_filtered_examples(exception, reporter)
+          reporter.example_group_finished(child)
+        end
+        false
+      end
+
+      # @private
+      def self.fail_fast?
+        RSpec.configuration.fail_fast?
+      end
+
+      # @private
+      def self.any_apply?(filters)
+        metadata.any_apply?(filters)
+      end
+
+      # @private
+      def self.all_apply?(filters)
+        metadata.all_apply?(filters)
+      end
+
+      # @private
+      def self.declaration_line_numbers
+        @declaration_line_numbers ||= [metadata[:example_group][:line_number]] +
+          examples.collect {|e| e.metadata[:line_number]} +
+          children.inject([]) {|l,c| l + c.declaration_line_numbers}
+      end
+
+      # @private
+      def self.top_level_description
+        parent_groups.last.description
+      end
+
+      # @private
+      def self.set_ivars(instance, ivars)
+        ivars.each {|name, value| instance.instance_variable_set(name, value)}
+      end
+
+      # @attr_reader
+      # Returns the {Example} object that wraps this instance of
+      # `ExampleGroup`
+      attr_accessor :example
+
+      # @deprecated use {ExampleGroup#example}
+      def running_example
+        RSpec.deprecate("running_example",
+                        :replacement => "example")
+        example
+      end
+
+      # Returns the class or module passed to the `describe` method (or alias).
+      # Returns nil if the subject is not a class or module.
+      # @example
+      #     describe Thing do
+      #       it "does something" do
+      #         described_class == Thing
+      #       end
+      #     end
+      #
+      #
+      def described_class
+        self.class.described_class
+      end
+
+      # @private
+      # instance_evals the block, capturing and reporting an exception if
+      # raised
+      def instance_eval_with_rescue(context = nil, &hook)
+        begin
+          instance_eval(&hook)
+        rescue Exception => e
+          raise unless example
+          example.set_exception(e, context)
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/extensions/instance_eval_with_args.rb b/rspec-core/lib/rspec/core/extensions/instance_eval_with_args.rb
new file mode 100644
index 0000000..a3c1d59
--- /dev/null
+++ b/rspec-core/lib/rspec/core/extensions/instance_eval_with_args.rb
@@ -0,0 +1,44 @@
+module RSpec
+  module Core
+    module Extensions
+      # @private
+      module InstanceEvalWithArgs
+        # @private
+        #
+        # Used internally to support `instance_exec` in Ruby 1.8.6.
+        #
+        # based on Bounded Spec InstanceExec (Mauricio Fernandez)
+        # http://eigenclass.org/hiki/bounded+space+instance_exec
+        # - uses singleton_class instead of global InstanceExecHelper module
+        # - this keeps it scoped to classes/modules that include this module
+        # - only necessary for ruby 1.8.6
+        def instance_eval_with_args(*args, &block)
+          return instance_exec(*args, &block) if respond_to?(:instance_exec)
+
+          # If there are no args and the block doesn't expect any, there's no
+          # need to fake instance_exec with our hack below.
+          # Notes:
+          #   * lambda { }.arity # => -1
+          #   * lambda { || }.arity # => 0
+          #   * lambda { |*a| }.arity # -1
+          return instance_eval(&block) if block.arity < 1 && args.size.zero?
+
+          singleton_class = (class << self; self; end)
+          begin
+            orig_critical, Thread.critical = Thread.critical, true
+            n = 0
+            n += 1 while respond_to?(method_name="__instance_exec#{n}")
+            singleton_class.module_eval{ define_method(method_name, &block) }
+          ensure
+            Thread.critical = orig_critical
+          end
+          begin
+            return send(method_name, *args)
+          ensure
+            singleton_class.module_eval{ remove_method(method_name) } rescue nil
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/extensions/kernel.rb b/rspec-core/lib/rspec/core/extensions/kernel.rb
new file mode 100644
index 0000000..da2a79f
--- /dev/null
+++ b/rspec-core/lib/rspec/core/extensions/kernel.rb
@@ -0,0 +1,9 @@
+module Kernel
+  unless defined?(debugger)
+    # If not already defined by ruby-debug, this implementation prints helpful
+    # message to STDERR when ruby-debug is not loaded.
+    def debugger(*args)
+      (RSpec.configuration.error_stream || $stderr).puts "\n***** debugger statement ignored, use -d or --debug option to enable debugging\n#{caller(0)[1]}"
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/extensions/module_eval_with_args.rb b/rspec-core/lib/rspec/core/extensions/module_eval_with_args.rb
new file mode 100644
index 0000000..a6bb25a
--- /dev/null
+++ b/rspec-core/lib/rspec/core/extensions/module_eval_with_args.rb
@@ -0,0 +1,38 @@
+module RSpec
+  module Core
+    module Extensions
+      # @private
+      module ModuleEvalWithArgs
+        include InstanceEvalWithArgs
+
+        # @private
+        #
+        # Used internally to support `module_exec` in Ruby 1.8.6.
+        def module_eval_with_args(*args, &block)
+          # ruby > 1.8.6
+          return module_exec(*args, &block) if respond_to?(:module_exec)
+
+          # If there are no args and the block doesn't expect any, there's no
+          # need to fake module_exec with our hack below.
+          # Notes:
+          #   * lambda {      }.arity # => -1
+          #   * lambda { ||   }.arity # =>  0
+          #   * lambda { |*a| }.arity # => -1
+          return module_eval(&block) if block.arity < 1 && args.size.zero?
+
+          orig_singleton_methods = singleton_methods
+          instance_eval_with_args(*args, &block)
+
+          # The only difference between instance_eval and module_eval is static method defs.
+          #   * `def foo` in instance_eval defines a singleton method on the instance
+          #   * `def foo` in class/module_eval defines an instance method for the class/module
+          # Here we deal with this difference by defining an instance method for
+          # each new singleton method.
+          # This has the side effect of duplicating methods (all new class methods will
+          # become instance methods and vice versa), but I don't see a way around it...
+          (singleton_methods - orig_singleton_methods).each { |m| define_method(m, &method(m)) }
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/extensions/ordered.rb b/rspec-core/lib/rspec/core/extensions/ordered.rb
new file mode 100644
index 0000000..7264909
--- /dev/null
+++ b/rspec-core/lib/rspec/core/extensions/ordered.rb
@@ -0,0 +1,27 @@
+module RSpec
+  module Core
+    # @private
+    module Extensions
+      # @private
+      # Used to extend lists of examples and groups to support ordering
+      # strategies like randomization.
+      module Ordered
+        # @private
+        module ExampleGroups
+          # @private
+          def ordered
+            RSpec.configuration.group_ordering_block.call(self)
+          end
+        end
+
+        # @private
+        module Examples
+          # @private
+          def ordered
+            RSpec.configuration.example_ordering_block.call(self)
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/filter_manager.rb b/rspec-core/lib/rspec/core/filter_manager.rb
new file mode 100644
index 0000000..eee8f03
--- /dev/null
+++ b/rspec-core/lib/rspec/core/filter_manager.rb
@@ -0,0 +1,203 @@
+module RSpec
+  module Core
+    # Manages the filtering of examples and groups by matching tags declared on
+    # the command line or options files, or filters declared via
+    # `RSpec.configure`, with hash key/values submitted within example group
+    # and/or example declarations. For example, given this declaration:
+    #
+    #     describe Thing, :awesome => true do
+    #       it "does something" do
+    #         # ...
+    #       end
+    #     end
+    #
+    # That group (or any other with `:awesome => true`) would be filtered in
+    # with any of the following commands:
+    #
+    #     rspec --tag awesome:true
+    #     rspec --tag awesome
+    #     rspec -t awesome:true
+    #     rspec -t awesome
+    #
+    # Prefixing the tag names with `~` negates the tags, thus excluding this group with
+    # any of:
+    #
+    #     rspec --tag ~awesome:true
+    #     rspec --tag ~awesome
+    #     rspec -t ~awesome:true
+    #     rspec -t ~awesome
+    #
+    # ## Options files and command line overrides
+    #
+    # Tag declarations can be stored in `.rspec`, `~/.rspec`, or a custom
+    # options file.  This is useful for storing defaults. For example, let's
+    # say you've got some slow specs that you want to suppress most of the
+    # time. You can tag them like this:
+    #
+    #     describe Something, :slow => true do
+    #
+    # And then store this in `.rspec`:
+    #
+    #     --tag ~slow:true
+    #
+    # Now when you run `rspec`, that group will be excluded.
+    #
+    # ## Overriding
+    #
+    # Of course, you probably want to run them sometimes, so you can override
+    # this tag on the command line like this:
+    #
+    #     rspec --tag slow:true
+    #
+    # ## RSpec.configure
+    #
+    # You can also store default tags with `RSpec.configure`. We use `tag` on
+    # the command line (and in options files like `.rspec`), but for historical
+    # reasons we use the term `filter` in `RSpec.configure:
+    #
+    #     RSpec.configure do |c|
+    #       c.filter_run_including :foo => :bar
+    #       c.filter_run_excluding :foo => :bar
+    #     end
+    #
+    # These declarations can also be overridden from the command line.
+    #
+    # @see RSpec.configure
+    # @see Configuration#filter_run_including
+    # @see Configuration#filter_run_excluding
+    class FilterManager
+      DEFAULT_EXCLUSIONS = {
+        :if     => lambda { |value| !value },
+        :unless => lambda { |value| value }
+      }
+
+      STANDALONE_FILTERS = [:locations, :line_numbers, :full_description]
+
+      module Describable
+        PROC_HEX_NUMBER = /0x[0-9a-f]+@/
+        PROJECT_DIR = File.expand_path('.')
+
+        def description
+          reject { |k, v| RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS[k] == v }.inspect.gsub(PROC_HEX_NUMBER, '').gsub(PROJECT_DIR, '.').gsub(' (lambda)','')
+        end
+
+        def empty_without_conditional_filters?
+          reject { |k, v| RSpec::Core::FilterManager::DEFAULT_EXCLUSIONS[k] == v }.empty?
+        end
+      end
+
+      module BackwardCompatibility
+        def merge(orig, opposite, *updates)
+          _warn_deprecated_keys(updates.last)
+          super
+        end
+
+        def reverse_merge(orig, opposite, *updates)
+          _warn_deprecated_keys(updates.last)
+          super
+        end
+
+        # Supports a use case that probably doesn't exist: overriding the
+        # if/unless procs.
+        def _warn_deprecated_keys(updates)
+          _warn_deprecated_key(:unless, updates) if updates.has_key?(:unless)
+          _warn_deprecated_key(:if, updates)     if updates.has_key?(:if)
+        end
+
+        # Emits a deprecation warning for keys that will not be supported in
+        # the future.
+        def _warn_deprecated_key(key, updates)
+          RSpec.deprecate("FilterManager#exclude(#{key.inspect} => #{updates[key].inspect})")
+          @exclusions[key] = updates.delete(key)
+        end
+      end
+
+      attr_reader :exclusions, :inclusions
+
+      def initialize
+        @exclusions = DEFAULT_EXCLUSIONS.dup.extend(Describable)
+        @inclusions = {}.extend(Describable)
+        extend(BackwardCompatibility)
+      end
+
+      def add_location(file_path, line_numbers)
+        # locations is a hash of expanded paths to arrays of line
+        # numbers to match against. e.g.
+        #   { "path/to/file.rb" => [37, 42] }
+        locations = @inclusions.delete(:locations) || Hash.new {|h,k| h[k] = []}
+        locations[File.expand_path(file_path)].push(*line_numbers)
+        @inclusions.replace(:locations => locations)
+        @exclusions.clear
+      end
+
+      def empty?
+        inclusions.empty? && exclusions.empty_without_conditional_filters?
+      end
+
+      def prune(examples)
+        examples.select {|e| !exclude?(e) && include?(e)}
+      end
+
+      def exclude(*args)
+        merge(@exclusions, @inclusions, *args)
+      end
+
+      def exclude!(*args)
+        replace(@exclusions, @inclusions, *args)
+      end
+
+      def exclude_with_low_priority(*args)
+        reverse_merge(@exclusions, @inclusions, *args)
+      end
+
+      def exclude?(example)
+        @exclusions.empty? ? false : example.any_apply?(@exclusions)
+      end
+
+      def include(*args)
+        unless_standalone(*args) { merge(@inclusions, @exclusions, *args) }
+      end
+
+      def include!(*args)
+        unless_standalone(*args) { replace(@inclusions, @exclusions, *args) }
+      end
+
+      def include_with_low_priority(*args)
+        unless_standalone(*args) { reverse_merge(@inclusions, @exclusions, *args) }
+      end
+
+      def include?(example)
+        @inclusions.empty? ? true : example.any_apply?(@inclusions)
+      end
+
+      private
+
+      def unless_standalone(*args)
+        is_standalone_filter?(args.last) ? @inclusions.replace(args.last) : yield unless already_set_standalone_filter?
+      end
+
+      def merge(orig, opposite, *updates)
+        orig.merge!(updates.last).each_key {|k| opposite.delete(k)}
+      end
+
+      def replace(orig, opposite, *updates)
+        updates.last.each_key {|k| opposite.delete(k)}
+        orig.replace(updates.last)
+      end
+
+      def reverse_merge(orig, opposite, *updates)
+        updated = updates.last.merge(orig)
+        opposite.each_pair {|k,v| updated.delete(k) if updated[k] == v}
+        orig.replace(updated)
+      end
+
+      def already_set_standalone_filter?
+        is_standalone_filter?(inclusions)
+      end
+
+      def is_standalone_filter?(filter)
+        STANDALONE_FILTERS.any? {|key| filter.has_key?(key)}
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters.rb b/rspec-core/lib/rspec/core/formatters.rb
new file mode 100644
index 0000000..30e1c2d
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters.rb
@@ -0,0 +1,55 @@
+# ## Built-in Formatters
+#
+# * progress (default) - prints dots for passing examples, `F` for failures, `*` for pending
+# * documentation - prints the docstrings passed to `describe` and `it` methods (and their aliases)
+# * html
+# * textmate - html plus links to editor
+# * json - useful for archiving data for subsequent analysis
+#
+# The progress formatter is the default, but you can choose any one or more of
+# the other formatters by passing with the `--format` (or `-f` for short)
+# command-line option, e.g.
+#
+#     rspec --format documentation
+#
+# You can also send the output of multiple formatters to different streams, e.g.
+#
+#     rspec --format documentation --format html --out results.html
+#
+# This example sends the output of the documentation formatter to `$stdout`, and
+# the output of the html formatter to results.html.
+#
+# ## Custom Formatters
+#
+# You can tell RSpec to use a custom formatter by passing its path and name to
+# the `rspec` commmand. For example, if you define MyCustomFormatter in
+# path/to/my_custom_formatter.rb, you would type this command:
+#
+#     rspec --require path/to/my_custom_formatter.rb --format MyCustomFormatter
+#
+# The reporter calls every formatter with this protocol:
+#
+# * `start(expected_example_count)`
+# * zero or more of the following
+#   * `example_group_started(group)`
+#   * `example_started(example)`
+#   * `example_passed(example)`
+#   * `example_failed(example)`
+#   * `example_pending(example)`
+#   * `message(string)`
+# * `stop`
+# * `start_dump`
+# * `dump_pending`
+# * `dump_failures`
+# * `dump_summary(duration, example_count, failure_count, pending_count)`
+# * `seed(value)`
+# * `close`
+#
+# You can either implement all of those methods or subclass
+# `RSpec::Core::Formatters::BaseTextFormatter` and override the methods you want
+# to enhance.
+#
+# @see RSpec::Core::Formatters::BaseTextFormatter
+# @see RSpec::Core::Reporter
+module RSpec::Core::Formatters
+end
diff --git a/rspec-core/lib/rspec/core/formatters/base_formatter.rb b/rspec-core/lib/rspec/core/formatters/base_formatter.rb
new file mode 100644
index 0000000..409b9c2
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/base_formatter.rb
@@ -0,0 +1,246 @@
+require 'rspec/core/formatters/helpers'
+require 'stringio'
+
+module RSpec
+  module Core
+    module Formatters
+      # RSpec's built-in formatters are all subclasses of RSpec::Core::Formatters::BaseTextFormatter,
+      # but the BaseTextFormatter documents all of the methods needed to be implemented by a formatter,
+      # as they are called from the reporter.
+      #
+      # @see RSpec::Core::Formatters::BaseTextFormatter
+      # @see RSpec::Core::Reporter
+      class BaseFormatter
+        include Helpers
+        attr_accessor :example_group
+        attr_reader :duration, :examples, :output
+        attr_reader :example_count, :pending_count, :failure_count
+        attr_reader :failed_examples, :pending_examples
+
+        # @api public
+        #
+        # @param output
+        def initialize(output)
+          @output = output || StringIO.new
+          @example_count = @pending_count = @failure_count = 0
+          @examples = []
+          @failed_examples = []
+          @pending_examples = []
+          @example_group = nil
+        end
+
+        # @api public
+        #
+        # This method is invoked before any examples are run, right after
+        # they have all been collected. This can be useful for special
+        # formatters that need to provide progress on feedback (graphical ones).
+        #
+        # This will only be invoked once, and the next one to be invoked
+        # is {#example_group_started}.
+        #
+        # @param example_count
+        def start(example_count)
+          start_sync_output
+          @example_count = example_count
+        end
+
+        # @api public
+        #
+        # This method is invoked at the beginning of the execution of each example group.
+        #
+        # @param example_group subclass of `RSpec::Core::ExampleGroup`
+        #
+        # The next method to be invoked after this is {#example_passed},
+        # {#example_pending}, or {#example_group_finished}.
+        #
+        # @param example_group
+        def example_group_started(example_group)
+          @example_group = example_group
+        end
+
+        # @api public
+        #
+        # Invoked at the end of the execution of each example group.
+        #
+        # @param example_group subclass of `RSpec::Core::ExampleGroup`
+        def example_group_finished(example_group)
+        end
+
+        # @api public
+        #
+        # Invoked at the beginning of the execution of each example.
+        #
+        # @param example instance of subclass of `RSpec::Core::ExampleGroup`
+        # @return [Array]
+        def example_started(example)
+          examples << example
+        end
+
+        # @api public
+        #
+        # Invoked when an example passes.
+        #
+        # @param example instance of subclass of `RSpec::Core::ExampleGroup`
+        def example_passed(example)
+        end
+
+        # Invoked when an example is pending.
+        #
+        # @param example instance of subclass of `RSpec::Core::ExampleGroup`
+        # @return [Array]
+        def example_pending(example)
+          @pending_examples << example
+        end
+
+        # @api public
+        #
+        # Invoked when an example fails.
+        #
+        # @param example instance of subclass of `RSpec::Core::ExampleGroup`
+        # @return [Array]
+        def example_failed(example)
+          @failed_examples << example
+        end
+
+        # @api public
+        #
+        # Used by the reporter to send messages to the output stream.
+        #
+        # @param [String] message
+        def message(message)
+        end
+
+        # @api public
+        #
+        # Invoked after all examples have executed, before dumping post-run reports.
+        #
+        # @return [nil]
+        def stop
+        end
+
+        # @api public
+        #
+        # This method is invoked after all of the examples have executed. The next method
+        # to be invoked after this one is {#dump_failures}
+        # (BaseTextFormatter then calls {#dump_failure} once for each failed example.)
+        #
+        # @return [nil]
+        def start_dump
+        end
+
+        # @api public
+        #
+        # Dumps detailed information about each example failure.
+        #
+        # @return [nil]
+        def dump_failures
+        end
+
+        # @api public
+        #
+        # This method is invoked after the dumping of examples and failures. Each parameter
+        # is assigned to a corresponding attribute.
+        #
+        # @param duration
+        # @param example_count
+        # @param failure_count
+        # @param pending_count
+        def dump_summary(duration, example_count, failure_count, pending_count)
+          @duration = duration
+          @example_count = example_count
+          @failure_count = failure_count
+          @pending_count = pending_count
+        end
+
+        # @api public
+        #
+        # Outputs a report of pending examples.  This gets invoked
+        # after the summary if option is set to do so.
+        #
+        # @return [nil]
+        def dump_pending
+        end
+
+        # @private not intended for use outside RSpec.
+        def seed(number)
+        end
+
+        # @api public
+        #
+        # Invoked at the very end, `close` allows the formatter to clean
+        # up resources, e.g. open streams, etc.
+        def close
+          restore_sync_output
+        end
+
+        # @api public
+        #
+        # Formats the given backtrace based on configuration and
+        # the metadata of the given example.
+        def format_backtrace(backtrace, example)
+          super(backtrace, example.metadata)
+        end
+
+      protected
+
+        def configuration
+          RSpec.configuration
+        end
+
+        def read_failed_line(exception, example)
+          unless matching_line = find_failed_line(exception.backtrace, example.file_path)
+            return "Unable to find matching line from backtrace"
+          end
+
+          file_path, line_number = matching_line.match(/(.+?):(\d+)(|:\d+)/)[1..2]
+
+          if File.exist?(file_path)
+            File.readlines(file_path)[line_number.to_i - 1] ||
+              "Unable to find matching line in #{file_path}"
+          else
+            "Unable to find #{file_path} to read failed line"
+          end
+        rescue SecurityError
+          "Unable to read failed line"
+        end
+
+        def find_failed_line(backtrace, path)
+          path = File.expand_path(path)
+          backtrace.detect { |line|
+            match = line.match(/(.+?):(\d+)(|:\d+)/)
+            match && match[1].downcase == path.downcase
+          }
+        end
+
+        def start_sync_output
+          @old_sync, output.sync = output.sync, true if output_supports_sync
+        end
+
+        def restore_sync_output
+          output.sync = @old_sync if output_supports_sync and !output.closed?
+        end
+
+        def output_supports_sync
+          output.respond_to?(:sync=)
+        end
+
+        def profile_examples?
+          configuration.profile_examples
+        end
+
+        def fail_fast?
+          configuration.fail_fast
+        end
+
+        def color_enabled?
+          configuration.color_enabled?(output)
+        end
+
+        def mute_profile_output?(failure_count)
+          # Don't print out profiled info if there are failures and `--fail-fast` is used, it just clutters the output
+          !profile_examples? || (fail_fast? && failure_count != 0)
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb b/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb
new file mode 100644
index 0000000..136a1b9
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/base_text_formatter.rb
@@ -0,0 +1,329 @@
+require 'rspec/core/formatters/base_formatter'
+require 'set'
+
+module RSpec
+  module Core
+    module Formatters
+
+      # Base for all of RSpec's built-in formatters. See RSpec::Core::Formatters::BaseFormatter
+      # to learn more about all of the methods called by the reporter.
+      #
+      # @see RSpec::Core::Formatters::BaseFormatter
+      # @see RSpec::Core::Reporter
+      class BaseTextFormatter < BaseFormatter
+        def message(message)
+          output.puts message
+        end
+
+        def dump_failures
+          return if failed_examples.empty?
+          output.puts
+          output.puts "Failures:"
+          failed_examples.each_with_index do |example, index|
+            output.puts
+            pending_fixed?(example) ? dump_pending_fixed(example, index) : dump_failure(example, index)
+            dump_backtrace(example)
+          end
+        end
+
+        # @api public
+        #
+        # Colorizes the output red for failure, yellow for
+        # pending, and green otherwise.
+        #
+        # @param [String] string
+        def colorise_summary(summary)
+          if failure_count > 0
+            color(summary, RSpec.configuration.failure_color)
+          elsif pending_count > 0
+            color(summary, RSpec.configuration.pending_color)
+          else
+            color(summary, RSpec.configuration.success_color)
+          end
+        end
+
+        def dump_summary(duration, example_count, failure_count, pending_count)
+          super(duration, example_count, failure_count, pending_count)
+          dump_profile unless mute_profile_output?(failure_count)
+          output.puts "\nFinished in #{format_duration(duration)}\n"
+          output.puts colorise_summary(summary_line(example_count, failure_count, pending_count))
+          dump_commands_to_rerun_failed_examples
+        end
+
+        # @api public
+        #
+        # Outputs commands which can be used to re-run failed examples.
+        #
+        def dump_commands_to_rerun_failed_examples
+          return if failed_examples.empty?
+          output.puts
+          output.puts("Failed examples:")
+          output.puts
+
+          failed_examples.each do |example|
+            output.puts(failure_color("rspec #{RSpec::Core::Metadata::relative_path(example.location)}") + " " + detail_color("# #{example.full_description}"))
+          end
+        end
+
+        # @api public
+        #
+        # Outputs the slowest examples and example groups in a report when using `--profile COUNT` (default 10).
+        # 
+        def dump_profile
+          dump_profile_slowest_examples
+          dump_profile_slowest_example_groups
+        end
+        
+        def dump_profile_slowest_examples
+          number_of_examples = RSpec.configuration.profile_examples
+          sorted_examples = examples.sort_by {|example|
+            example.execution_result[:run_time] }.reverse.first(number_of_examples)
+
+          total, slows = [examples, sorted_examples].map {|exs|
+            exs.inject(0.0) {|i, e| i + e.execution_result[:run_time] }}
+
+          time_taken = slows / total
+          percentage = '%.1f' % ((time_taken.nan? ? 0.0 : time_taken) * 100)
+
+          output.puts "\nTop #{sorted_examples.size} slowest examples (#{format_seconds(slows)} seconds, #{percentage}% of total time):\n"
+
+          sorted_examples.each do |example|
+            output.puts "  #{example.full_description}"
+            output.puts detail_color("    #{failure_color(format_seconds(example.execution_result[:run_time]))} #{failure_color("seconds")} #{format_caller(example.location)}")
+          end
+        end
+
+        def dump_profile_slowest_example_groups
+          number_of_examples = RSpec.configuration.profile_examples
+          example_groups = {} 
+
+          examples.each do |example|
+            location = example.example_group.parent_groups.last.metadata[:example_group][:location]
+
+            example_groups[location] ||= Hash.new(0)
+            example_groups[location][:total_time]  += example.execution_result[:run_time]
+            example_groups[location][:count]       += 1
+            example_groups[location][:description] = example.example_group.top_level_description unless example_groups[location].has_key?(:description)
+          end
+
+          # stop if we've only one example group
+          return if example_groups.keys.length <= 1
+          
+          example_groups.each do |loc, hash|
+            hash[:average] = hash[:total_time].to_f / hash[:count]
+          end
+          
+          sorted_groups = example_groups.sort_by {|_, hash| -hash[:average]}.first(number_of_examples)
+
+          output.puts "\nTop #{sorted_groups.size} slowest example groups:"
+          sorted_groups.each do |loc, hash| 
+            average = "#{failure_color(format_seconds(hash[:average]))} #{failure_color("seconds")} average"
+            total   = "#{format_seconds(hash[:total_time])} seconds"
+            count   = pluralize(hash[:count], "example")
+            output.puts "  #{hash[:description]}"
+            output.puts detail_color("    #{average} (#{total} / #{count}) #{loc}")
+          end
+        end
+
+        # @api public
+        #
+        # Outputs summary with number of examples, failures and pending.
+        #
+        def summary_line(example_count, failure_count, pending_count)
+          summary = pluralize(example_count, "example")
+          summary << ", " << pluralize(failure_count, "failure")
+          summary << ", #{pending_count} pending" if pending_count > 0
+          summary
+        end
+
+        def dump_pending
+          unless pending_examples.empty?
+            output.puts
+            output.puts "Pending:"
+            pending_examples.each do |pending_example|
+              output.puts pending_color("  #{pending_example.full_description}")
+              output.puts detail_color("    # #{pending_example.execution_result[:pending_message]}")
+              output.puts detail_color("    # #{format_caller(pending_example.location)}")
+              if pending_example.execution_result[:exception] \
+                && RSpec.configuration.show_failures_in_pending_blocks?
+                dump_failure_info(pending_example)
+                dump_backtrace(pending_example)
+              end
+            end
+          end
+        end
+
+        def seed(number)
+          output.puts
+          output.puts "Randomized with seed #{number}"
+          output.puts
+        end
+
+        def close
+          output.close if IO === output && output != $stdout
+        end
+
+        VT100_COLORS = {
+          :black => 30,
+          :red => 31,
+          :green => 32,
+          :yellow => 33,
+          :blue => 34,
+          :magenta => 35,
+          :cyan => 36,
+          :white => 37
+        }
+
+        VT100_COLOR_CODES = VT100_COLORS.values.to_set
+
+        def color_code_for(code_or_symbol)
+          if VT100_COLOR_CODES.include?(code_or_symbol)
+            code_or_symbol
+          else
+            VT100_COLORS.fetch(code_or_symbol) do
+              color_code_for(:white)
+            end
+          end
+        end
+
+        def colorize(text, code_or_symbol)
+          "\e[#{color_code_for(code_or_symbol)}m#{text}\e[0m"
+        end
+
+      protected
+
+        def bold(text)
+          color_enabled? ? "\e[1m#{text}\e[0m" : text
+        end
+
+        def color(text, color_code)
+          color_enabled? ? colorize(text, color_code) : text
+        end
+
+        def failure_color(text)
+          color(text, RSpec.configuration.failure_color)
+        end
+
+        def success_color(text)
+          color(text, RSpec.configuration.success_color)
+        end
+
+        def pending_color(text)
+          color(text, RSpec.configuration.pending_color)
+        end
+
+        def fixed_color(text)
+          color(text, RSpec.configuration.fixed_color)
+        end
+
+        def detail_color(text)
+          color(text, RSpec.configuration.detail_color)
+        end
+
+        def default_color(text)
+          color(text, RSpec.configuration.default_color)
+        end
+
+        def red(text)
+          RSpec.deprecate("RSpec::Core::Formatters::BaseTextFormatter#red", :replacement => "#failure_color")
+          color(text, :red)
+        end
+
+        def green(text)
+          RSpec.deprecate("RSpec::Core::Formatters::BaseTextFormatter#green", :replacement => "#success_color")
+          color(text, :green)
+        end
+
+        def yellow(text)
+          RSpec.deprecate("RSpec::Core::Formatters::BaseTextFormatter#yellow", :replacement => "#pending_color")
+          color(text, :yellow)
+        end
+
+        def blue(text)
+          RSpec.deprecate("RSpec::Core::Formatters::BaseTextFormatter#blue", :replacement => "#fixed_color")
+          color(text, :blue)
+        end
+
+        def magenta(text)
+          RSpec.deprecate("RSpec::Core::Formatters::BaseTextFormatter#magenta")
+          color(text, :magenta)
+        end
+
+        def cyan(text)
+          RSpec.deprecate("RSpec::Core::Formatters::BaseTextFormatter#cyan", :replacement => "#detail_color")
+          color(text, :cyan)
+        end
+
+        def white(text)
+          RSpec.deprecate("RSpec::Core::Formatters::BaseTextFormatter#white", :replacement => "#default_color")
+          color(text, :white)
+        end
+
+        def short_padding
+          '  '
+        end
+
+        def long_padding
+          '     '
+        end
+
+      private
+
+        def format_caller(caller_info)
+          backtrace_line(caller_info.to_s.split(':in `block').first)
+        end
+
+        def dump_backtrace(example)
+          format_backtrace(example.execution_result[:exception].backtrace, example).each do |backtrace_info|
+            output.puts detail_color("#{long_padding}# #{backtrace_info}")
+          end
+        end
+
+        def dump_pending_fixed(example, index)
+          output.puts "#{short_padding}#{index.next}) #{example.full_description} FIXED"
+          output.puts fixed_color("#{long_padding}Expected pending '#{example.metadata[:execution_result][:pending_message]}' to fail. No Error was raised.")
+        end
+
+        def pending_fixed?(example)
+          example.execution_result[:exception].pending_fixed?
+        end
+
+        def dump_failure(example, index)
+          output.puts "#{short_padding}#{index.next}) #{example.full_description}"
+          dump_failure_info(example)
+        end
+
+        def dump_failure_info(example)
+          exception = example.execution_result[:exception]
+          exception_class_name = exception_class_name_for(exception)
+          output.puts "#{long_padding}#{failure_color("Failure/Error:")} #{failure_color(read_failed_line(exception, example).strip)}"
+          output.puts "#{long_padding}#{failure_color(exception_class_name)}:" unless exception_class_name =~ /RSpec/
+          exception.message.to_s.split("\n").each { |line| output.puts "#{long_padding}  #{failure_color(line)}" } if exception.message
+
+          if shared_group = find_shared_group(example)
+            dump_shared_failure_info(shared_group)
+          end
+        end
+
+        def exception_class_name_for(exception)
+          name = exception.class.name.to_s
+          name ="(anonymous error class)" if name == ''
+          name
+        end
+
+        def dump_shared_failure_info(group)
+          output.puts "#{long_padding}Shared Example Group: \"#{group.metadata[:shared_group_name]}\" called from " +
+            "#{backtrace_line(group.metadata[:example_group][:location])}"
+        end
+
+        def find_shared_group(example)
+          group_and_parent_groups(example).find {|group| group.metadata[:shared_group_name]}
+        end
+
+        def group_and_parent_groups(example)
+          example.example_group.parent_groups + [example.example_group]
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb b/rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb
new file mode 100644
index 0000000..b6583d4
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/deprecation_formatter.rb
@@ -0,0 +1,39 @@
+module RSpec
+  module Core
+    module Formatters
+      class DeprecationFormatter
+        def initialize(deprecation_stream=$stderr, summary_stream=$stdout)
+          @deprecation_stream = deprecation_stream
+          @summary_stream = summary_stream
+          @count = 0
+        end
+
+        def start(example_count=nil)
+          #no-op to fix #966
+        end
+
+        def deprecation(data)
+          @count += 1
+          if data[:message]
+            @deprecation_stream.print data[:message]
+          else
+            @deprecation_stream.print "DEPRECATION: " unless File === @deprecation_stream
+            @deprecation_stream.print "#{data[:deprecated]} is deprecated."
+            @deprecation_stream.print " Use #{data[:replacement]} instead." if data[:replacement]
+            @deprecation_stream.print " Called from #{data[:call_site]}." if data[:call_site]
+            @deprecation_stream.puts
+          end
+        end
+
+        def deprecation_summary
+          if @count > 0 && File === @deprecation_stream
+            @summary_stream.print "\n#{@count} deprecation"
+            @summary_stream.print "s" if @count > 1
+            @summary_stream.print " logged to "
+            @summary_stream.puts @deprecation_stream.path
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/documentation_formatter.rb b/rspec-core/lib/rspec/core/formatters/documentation_formatter.rb
new file mode 100644
index 0000000..a516c43
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/documentation_formatter.rb
@@ -0,0 +1,67 @@
+require 'rspec/core/formatters/base_text_formatter'
+
+module RSpec
+  module Core
+    module Formatters
+      class DocumentationFormatter < BaseTextFormatter
+        def initialize(output)
+          super(output)
+          @group_level = 0
+        end
+
+        def example_group_started(example_group)
+          super(example_group)
+
+          output.puts if @group_level == 0
+          output.puts "#{current_indentation}#{example_group.description.strip}"
+
+          @group_level += 1
+        end
+
+        def example_group_finished(example_group)
+          @group_level -= 1
+        end
+
+        def example_passed(example)
+          super(example)
+          output.puts passed_output(example)
+        end
+
+        def example_pending(example)
+          super(example)
+          output.puts pending_output(example, example.execution_result[:pending_message])
+        end
+
+        def example_failed(example)
+          super(example)
+          output.puts failure_output(example, example.execution_result[:exception])
+        end
+
+        def failure_output(example, exception)
+          failure_color("#{current_indentation}#{example.description.strip} (FAILED - #{next_failure_index})")
+        end
+
+        def next_failure_index
+          @next_failure_index ||= 0
+          @next_failure_index += 1
+        end
+
+        def passed_output(example)
+          success_color("#{current_indentation}#{example.description.strip}")
+        end
+
+        def pending_output(example, message)
+          pending_color("#{current_indentation}#{example.description.strip} (PENDING: #{message})")
+        end
+
+        def current_indentation
+          '  ' * @group_level
+        end
+
+        def example_group_chain
+          example_group.parent_groups.reverse
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/helpers.rb b/rspec-core/lib/rspec/core/formatters/helpers.rb
new file mode 100644
index 0000000..9883ca0
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/helpers.rb
@@ -0,0 +1,110 @@
+module RSpec
+  module Core
+    module BacktraceFormatter
+      extend self
+
+      def format_backtrace(backtrace, options = {})
+        return "" unless backtrace
+        return backtrace if options[:full_backtrace] == true
+
+        if at_exit_index = backtrace.index(RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE)
+          backtrace = backtrace[0, at_exit_index]
+        end
+
+        cleansed = backtrace.map { |line| backtrace_line(line) }.compact
+        cleansed.empty? ? backtrace : cleansed
+      end
+
+    protected
+
+      def backtrace_line(line)
+        return nil if RSpec.configuration.backtrace_cleaner.exclude?(line)
+        RSpec::Core::Metadata::relative_path(line)
+      rescue SecurityError
+        nil
+      end
+    end
+
+    module Formatters
+      module Helpers
+        include BacktraceFormatter
+
+        SUB_SECOND_PRECISION = 5
+        DEFAULT_PRECISION = 2
+
+        # @api private
+        #
+        # Formats seconds into a human-readable string.
+        #
+        # @param [Float, Fixnum] duration in seconds
+        # @return [String] human-readable time
+        #
+        # @example
+        #    format_duration(1) #=>  "1 minute 1 second"
+        #    format_duration(135.14) #=> "2 minutes 15.14 seconds"
+        def format_duration(duration)
+          precision = case
+                      when duration < 1;    SUB_SECOND_PRECISION
+                      when duration < 120;  DEFAULT_PRECISION
+                      when duration < 300;  1
+                      else                  0
+                      end
+
+          if duration > 60
+            minutes = duration.to_i / 60
+            seconds = duration - minutes * 60
+
+            "#{pluralize(minutes, 'minute')} #{pluralize(format_seconds(seconds, precision), 'second')}"
+          else
+            pluralize(format_seconds(duration, precision), 'second')
+          end
+        end
+
+        # @api private
+        #
+        # Formats seconds to have 5 digits of precision with trailing zeros removed if the number
+        # is less than 1 or with 2 digits of precision if the number is greater than zero.
+        #
+        # @param [Float] float
+        # @return [String] formatted float
+        #
+        # @example
+        #    format_seconds(0.000006) #=> "0.00001"
+        #    format_seconds(0.020000) #=> "0.02"
+        #    format_seconds(1.00000000001) #=> "1"
+        #
+        # The precision used is set in {Helpers::SUB_SECOND_PRECISION} and {Helpers::DEFAULT_PRECISION}.
+        #
+        # @see #strip_trailing_zeroes
+        def format_seconds(float, precision = nil)
+          precision ||= (float < 1) ? SUB_SECOND_PRECISION : DEFAULT_PRECISION
+          formatted = sprintf("%.#{precision}f", float)
+          strip_trailing_zeroes(formatted)
+        end
+
+        # @api private
+        #
+        # Remove trailing zeros from a string.
+        #
+        # @param [String] string string with trailing zeros
+        # @return [String] string with trailing zeros removed
+        def strip_trailing_zeroes(string)
+          stripped = string.sub(/[^1-9]+$/, '')
+          stripped.empty? ? "0" : stripped
+        end
+
+        # @api private
+        #
+        # Pluralize a word based on a count.
+        #
+        # @param [Fixnum] count number of objects
+        # @param [String] string word to be pluralized
+        # @return [String] pluralized word
+        def pluralize(count, string)
+          "#{count} #{string}#{'s' unless count.to_f == 1}"
+        end
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/html_formatter.rb b/rspec-core/lib/rspec/core/formatters/html_formatter.rb
new file mode 100644
index 0000000..567895d
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/html_formatter.rb
@@ -0,0 +1,155 @@
+require 'rspec/core/formatters/base_text_formatter'
+require 'rspec/core/formatters/html_printer'
+
+module RSpec
+  module Core
+    module Formatters
+      class HtmlFormatter < BaseTextFormatter
+
+        def initialize(output)
+          super(output)
+          @example_group_number = 0
+          @example_number = 0
+          @header_red = nil
+          @printer = HtmlPrinter.new(output)
+        end
+
+        private
+        def method_missing(m, *a, &b)
+          # no-op
+        end
+
+        public
+        def message(message)
+        end
+
+        # The number of the currently running example_group
+        def example_group_number
+          @example_group_number
+        end
+
+        # The number of the currently running example (a global counter)
+        def example_number
+          @example_number
+        end
+
+        def start(example_count)
+          super(example_count)
+          @printer.print_html_start
+          @printer.flush
+        end
+
+        def example_group_started(example_group)
+          super(example_group)
+          @example_group_red = false
+          @example_group_number += 1
+
+          unless example_group_number == 1
+            @printer.print_example_group_end
+          end
+          @printer.print_example_group_start( example_group_number, example_group.description, example_group.parent_groups.size )
+          @printer.flush
+        end
+
+        def start_dump
+          @printer.print_example_group_end
+          @printer.flush
+        end
+
+        def example_started(example)
+          super(example)
+          @example_number += 1
+        end
+
+        def example_passed(example)
+          @printer.move_progress(percent_done)
+          @printer.print_example_passed( example.description, example.execution_result[:run_time] )
+          @printer.flush
+        end
+
+        def example_failed(example)
+          super(example)
+
+          unless @header_red
+            @header_red = true
+            @printer.make_header_red
+          end
+
+          unless @example_group_red
+            @example_group_red = true
+            @printer.make_example_group_header_red(example_group_number)
+          end
+
+          @printer.move_progress(percent_done)
+
+          exception = example.metadata[:execution_result][:exception]
+          exception_details = if exception
+            {
+              :message => exception.message,
+              :backtrace => format_backtrace(exception.backtrace, example).join("\n")
+            }
+          else
+            false
+          end
+          extra = extra_failure_content(exception)
+
+          @printer.print_example_failed(
+            exception.pending_fixed?,
+            example.description,
+            example.execution_result[:run_time],
+            @failed_examples.size,
+            exception_details,
+            (extra == "") ? false : extra,
+            true
+          )
+          @printer.flush
+        end
+
+        def example_pending(example)
+
+          @printer.make_header_yellow unless @header_red
+          @printer.make_example_group_header_yellow(example_group_number) unless @example_group_red
+          @printer.move_progress(percent_done)
+          @printer.print_example_pending( example.description, example.metadata[:execution_result][:pending_message] )
+          @printer.flush
+        end
+
+        # Override this method if you wish to output extra HTML for a failed spec. For example, you
+        # could output links to images or other files produced during the specs.
+        #
+        def extra_failure_content(exception)
+          require 'rspec/core/formatters/snippet_extractor'
+          backtrace = exception.backtrace.map {|line| backtrace_line(line)}
+          backtrace.compact!
+          @snippet_extractor ||= SnippetExtractor.new
+          "    <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
+        end
+
+        def percent_done
+          result = 100.0
+          if @example_count > 0
+            result = ((example_number).to_f / @example_count.to_f * 1000).to_i / 10.0
+          end
+          result
+        end
+
+        def dump_failures
+        end
+
+        def dump_pending
+        end
+
+        def dump_summary(duration, example_count, failure_count, pending_count)
+          @printer.print_summary(
+            dry_run?,
+            duration,
+            example_count,
+            failure_count,
+            pending_count
+          )
+          @printer.flush
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/html_printer.rb b/rspec-core/lib/rspec/core/formatters/html_printer.rb
new file mode 100644
index 0000000..86936cc
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/html_printer.rb
@@ -0,0 +1,408 @@
+require 'erb'
+
+module RSpec
+  module Core
+    module Formatters
+      class HtmlPrinter
+        include ERB::Util # for the #h method
+        def initialize(output)
+          @output = output
+        end
+
+        def print_html_start
+          @output.puts HTML_HEADER
+          @output.puts REPORT_HEADER
+        end
+
+        def print_example_group_end
+          @output.puts "  </dl>"
+          @output.puts "</div>"
+        end
+
+        def print_example_group_start( group_id, description, number_of_parents  )
+          @output.puts "<div id=\"div_group_#{group_id}\" class=\"example_group passed\">"
+          @output.puts "  <dl #{indentation_style(number_of_parents)}>"
+          @output.puts "  <dt id=\"example_group_#{group_id}\" class=\"passed\">#{h(description)}</dt>"
+        end
+
+        def print_example_passed( description, run_time )
+          formatted_run_time = sprintf("%.5f", run_time)
+          @output.puts "    <dd class=\"example passed\"><span class=\"passed_spec_name\">#{h(description)}</span><span class='duration'>#{formatted_run_time}s</span></dd>"
+        end
+
+        def print_example_failed( pending_fixed, description, run_time, failure_id, exception, extra_content, escape_backtrace = false )
+          formatted_run_time = sprintf("%.5f", run_time)
+
+          @output.puts "    <dd class=\"example #{pending_fixed ? 'pending_fixed' : 'failed'}\">"
+          @output.puts "      <span class=\"failed_spec_name\">#{h(description)}</span>"
+          @output.puts "      <span class=\"duration\">#{formatted_run_time}s</span>"
+          @output.puts "      <div class=\"failure\" id=\"failure_#{failure_id}\">"
+          if exception
+            @output.puts "        <div class=\"message\"><pre>#{h(exception[:message])}</pre></div>"
+            if escape_backtrace
+              @output.puts "        <div class=\"backtrace\"><pre>#{h exception[:backtrace]}</pre></div>"
+            else
+              @output.puts "        <div class=\"backtrace\"><pre>#{exception[:backtrace]}</pre></div>"
+            end
+          end
+          @output.puts extra_content if extra_content
+          @output.puts "      </div>"
+          @output.puts "    </dd>"
+        end
+
+        def print_example_pending( description, pending_message )
+          @output.puts "    <dd class=\"example not_implemented\"><span class=\"not_implemented_spec_name\">#{h(description)} (PENDING: #{h(pending_message)})</span></dd>"
+        end
+
+        def print_summary( was_dry_run, duration, example_count, failure_count, pending_count )
+          # TODO - kill dry_run?
+          if was_dry_run
+            totals = "This was a dry-run"
+          else
+            totals =  "#{example_count} example#{'s' unless example_count == 1}, "
+            totals << "#{failure_count} failure#{'s' unless failure_count == 1}"
+            totals << ", #{pending_count} pending" if pending_count > 0
+          end
+
+          formatted_duration = sprintf("%.5f", duration)
+
+          @output.puts "<script type=\"text/javascript\">document.getElementById('duration').innerHTML = \"Finished in <strong>#{formatted_duration} seconds</strong>\";</script>"
+          @output.puts "<script type=\"text/javascript\">document.getElementById('totals').innerHTML = \"#{totals}\";</script>"
+          @output.puts "</div>"
+          @output.puts "</div>"
+          @output.puts "</body>"
+          @output.puts "</html>"
+        end
+
+        def flush
+          @output.flush
+        end
+
+        def move_progress( percent_done )
+          @output.puts "    <script type=\"text/javascript\">moveProgressBar('#{percent_done}');</script>"
+          @output.flush
+        end
+
+        def make_header_red
+          @output.puts "    <script type=\"text/javascript\">makeRed('rspec-header');</script>"
+        end
+
+        def make_header_yellow
+          @output.puts "    <script type=\"text/javascript\">makeYellow('rspec-header');</script>"
+        end
+
+        def make_example_group_header_red(group_id)
+          @output.puts "    <script type=\"text/javascript\">makeRed('div_group_#{group_id}');</script>"
+          @output.puts "    <script type=\"text/javascript\">makeRed('example_group_#{group_id}');</script>"
+        end
+
+        def make_example_group_header_yellow(group_id)
+          @output.puts "    <script type=\"text/javascript\">makeYellow('div_group_#{group_id}');</script>"
+          @output.puts "    <script type=\"text/javascript\">makeYellow('example_group_#{group_id}');</script>"
+        end
+
+
+        private
+
+        def indentation_style( number_of_parents )
+          "style=\"margin-left: #{(number_of_parents - 1) * 15}px;\""
+        end
+
+
+        REPORT_HEADER = <<-EOF
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+EOF
+
+        GLOBAL_SCRIPTS = <<-EOF
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+EOF
+
+        GLOBAL_STYLES = <<-EOF
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+EOF
+
+        HTML_HEADER = <<-EOF
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+#{GLOBAL_SCRIPTS}
+    // ]]>
+  </script>
+  <style type="text/css">
+#{GLOBAL_STYLES}
+  </style>
+</head>
+<body>
+EOF
+
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/json_formatter.rb b/rspec-core/lib/rspec/core/formatters/json_formatter.rb
new file mode 100644
index 0000000..7a2f180
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/json_formatter.rb
@@ -0,0 +1,70 @@
+require 'rspec/core/formatters/base_formatter'
+require 'json'
+
+module RSpec
+  module Core
+    module Formatters
+
+      class JsonFormatter < BaseFormatter
+
+        attr_reader :output_hash
+
+        def initialize(output)
+          super
+          @output_hash = {}
+        end
+
+        def message(message)
+          (@output_hash[:messages] ||= []) << message
+        end
+
+        def dump_summary(duration, example_count, failure_count, pending_count)
+          super(duration, example_count, failure_count, pending_count)
+          @output_hash[:summary] = {
+            :duration => duration,
+            :example_count => example_count,
+            :failure_count => failure_count,
+            :pending_count => pending_count
+          }
+          @output_hash[:summary_line] = summary_line(example_count, failure_count, pending_count)
+        end
+
+        def summary_line(example_count, failure_count, pending_count)
+          summary = pluralize(example_count, "example")
+          summary << ", " << pluralize(failure_count, "failure")
+          summary << ", #{pending_count} pending" if pending_count > 0
+          summary
+        end
+
+        def stop
+          super
+          @output_hash[:examples] = examples.map do |example|
+            {
+              :description => example.description,
+              :full_description => example.full_description,
+              :status => example.execution_result[:status],
+              # :example_group,
+              # :execution_result,
+              :file_path => example.metadata[:file_path],
+              :line_number  => example.metadata[:line_number],
+            }.tap do |hash|
+              if e=example.exception
+                hash[:exception] =  {
+                  :class => e.class.name,
+                  :message => e.message,
+                  :backtrace => e.backtrace,
+                }
+              end
+            end
+          end
+        end
+
+        def close
+          output.write @output_hash.to_json
+          output.close if IO === output && output != $stdout
+        end
+
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/progress_formatter.rb b/rspec-core/lib/rspec/core/formatters/progress_formatter.rb
new file mode 100644
index 0000000..b44cf92
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/progress_formatter.rb
@@ -0,0 +1,32 @@
+require 'rspec/core/formatters/base_text_formatter'
+module RSpec
+  module Core
+    module Formatters
+
+      class ProgressFormatter < BaseTextFormatter
+
+        def example_passed(example)
+          super(example)
+          output.print success_color('.')
+        end
+
+        def example_pending(example)
+          super(example)
+          output.print pending_color('*')
+        end
+
+        def example_failed(example)
+          super(example)
+          output.print failure_color('F')
+        end
+
+        def start_dump
+          super()
+          output.puts
+        end
+
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/snippet_extractor.rb b/rspec-core/lib/rspec/core/formatters/snippet_extractor.rb
new file mode 100644
index 0000000..f4fcda3
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/snippet_extractor.rb
@@ -0,0 +1,92 @@
+module RSpec
+  module Core
+    module Formatters
+      # @api private
+      #
+      # Extracts code snippets by looking at the backtrace of the passed error and applies synax highlighting and line numbers using html.
+      class SnippetExtractor
+        class NullConverter; def convert(code, pre); code; end; end
+
+        begin
+          require 'syntax/convertors/html'
+          @@converter = Syntax::Convertors::HTML.for_syntax "ruby"
+        rescue LoadError
+          @@converter = NullConverter.new
+        end
+
+        # @api private
+        #
+        # Extract lines of code corresponding to  a backtrace.
+        #
+        # @param [String] backtrace the backtrace from a test failure
+        # @return [String] highlighted code snippet indicating where the test failure occured
+        #
+        # @see #post_process
+        def snippet(backtrace)
+          raw_code, line = snippet_for(backtrace[0])
+          highlighted = @@converter.convert(raw_code, false)
+          highlighted << "\n<span class=\"comment\"># gem install syntax to get syntax highlighting</span>" if @@converter.is_a?(NullConverter)
+          post_process(highlighted, line)
+        end
+
+        # @api private
+        #
+        # Create a snippet from a line of code.
+        #
+        # @param [String] error_line file name with line number (i.e. 'foo_spec.rb:12')
+        # @return [String] lines around the target line within the file
+        #
+        # @see #lines_around
+        def snippet_for(error_line)
+          if error_line =~ /(.*):(\d+)/
+            file = $1
+            line = $2.to_i
+            [lines_around(file, line), line]
+          else
+            ["# Couldn't get snippet for #{error_line}", 1]
+          end
+        end
+
+        # @api private
+        #
+        # Extract lines of code centered around a particular line within a source file.
+        #
+        # @param [String] file filename
+        # @param [Fixnum] line line number
+        # @return [String] lines around the target line within the file (2 above and 1 below).
+        def lines_around(file, line)
+          if File.file?(file)
+            lines = File.read(file).split("\n")
+            min = [0, line-3].max
+            max = [line+1, lines.length-1].min
+            selected_lines = []
+            selected_lines.join("\n")
+            lines[min..max].join("\n")
+          else
+            "# Couldn't get snippet for #{file}"
+          end
+        rescue SecurityError
+          "# Couldn't get snippet for #{file}"
+        end
+
+        # @api private
+        #
+        # Adds line numbers to all lines and highlights the line where the failure occurred using html `span` tags.
+        #
+        # @param [String] highlighted syntax-highlighted snippet surrounding the offending line of code
+        # @param [Fixnum] offending_line line where failure occured
+        # @return [String] completed snippet
+        def post_process(highlighted, offending_line)
+          new_lines = []
+          highlighted.split("\n").each_with_index do |line, i|
+            new_line = "<span class=\"linenum\">#{offending_line+i-2}</span>#{line}"
+            new_line = "<span class=\"offending\">#{new_line}</span>" if i == 2
+            new_lines << new_line
+          end
+          new_lines.join("\n")
+        end
+
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/formatters/text_mate_formatter.rb b/rspec-core/lib/rspec/core/formatters/text_mate_formatter.rb
new file mode 100644
index 0000000..f288c3c
--- /dev/null
+++ b/rspec-core/lib/rspec/core/formatters/text_mate_formatter.rb
@@ -0,0 +1,34 @@
+require 'cgi'
+require 'rspec/core/formatters/html_formatter'
+
+module RSpec
+  module Core
+    module Formatters
+      # Formats backtraces so they're clickable by TextMate
+      class TextMateFormatter < HtmlFormatter
+        def backtrace_line(line, skip_textmate_conversion=false)
+          if skip_textmate_conversion
+            super(line)
+          else
+            format_backtrace_line_for_textmate(super(line))
+          end
+        end
+
+        def format_backtrace_line_for_textmate(line)
+          return nil unless line
+          CGI.escapeHTML(line).sub(/([^:]*\.e?rb):(\d*)/) do
+            "<a href=\"txmt://open?url=file://#{File.expand_path($1)}&line=#{$2}\">#{$1}:#{$2}</a> "
+          end
+        end
+
+        def extra_failure_content(exception)
+          require 'rspec/core/formatters/snippet_extractor'
+          backtrace = exception.backtrace.map {|line| backtrace_line(line, :skip_textmate_conversion)}
+          backtrace.compact!
+          @snippet_extractor ||= SnippetExtractor.new
+          "    <pre class=\"ruby\"><code>#{@snippet_extractor.snippet(backtrace)}</code></pre>"
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/hooks.rb b/rspec-core/lib/rspec/core/hooks.rb
new file mode 100644
index 0000000..d0384b5
--- /dev/null
+++ b/rspec-core/lib/rspec/core/hooks.rb
@@ -0,0 +1,519 @@
+module RSpec
+  module Core
+    module Hooks
+      include MetadataHashBuilder::WithConfigWarning
+
+      class Hook
+        attr_reader :block, :options
+
+        def initialize(block, options)
+          @block = block
+          @options = options
+        end
+
+        def options_apply?(example_or_group)
+          example_or_group.all_apply?(options)
+        end
+      end
+
+      class BeforeHook < Hook
+        def run(example)
+          example.instance_eval(&block)
+        end
+
+        def display_name
+          "before hook"
+        end
+      end
+
+      class AfterHook < Hook
+        def run(example)
+          example.instance_eval_with_rescue("in an after hook", &block)
+        end
+
+        def display_name
+          "after hook"
+        end
+      end
+
+      class AfterAllHook < Hook
+        def run(example)
+          example.instance_exec(example, &block)
+        rescue Exception => e
+          # TODO: come up with a better solution for this.
+          RSpec.configuration.reporter.message <<-EOS
+
+An error occurred in an after(:all) hook.
+  #{e.class}: #{e.message}
+  occurred at #{e.backtrace.first}
+
+EOS
+        end
+
+        def display_name
+          "after(:all) hook"
+        end
+      end
+
+      class AroundHook < Hook
+        def display_name
+          "around hook"
+        end
+      end
+
+      module HookCollectionAliases
+        def self.included(host)
+          host.send :alias_method, :prepend, :unshift
+          host.send :alias_method, :append,  :push
+        end
+      end
+
+      class HookCollection < Array
+        include HookCollectionAliases
+
+        def for(example_or_group)
+          self.class.new(select {|hook| hook.options_apply?(example_or_group)}).
+            with(example_or_group)
+        end
+
+        def with(example)
+          @example = example
+          self
+        end
+
+        def run
+          each {|h| h.run(@example) } unless empty?
+        end
+      end
+
+      class AroundHookCollection < Array
+        include HookCollectionAliases
+
+        def for(example, initial_procsy=nil)
+          self.class.new(select {|hook| hook.options_apply?(example)}).
+            with(example, initial_procsy)
+        end
+
+        def with(example, initial_procsy)
+          @example = example
+          @initial_procsy = initial_procsy
+          self
+        end
+
+        def run
+          inject(@initial_procsy) do |procsy, around_hook|
+            Example.procsy(procsy.metadata) do
+              @example.instance_eval_with_args(procsy, &around_hook.block)
+            end
+          end.call
+        end
+      end
+
+      class GroupHookCollection < Array
+        def for(group)
+          @group = group
+          self
+        end
+
+        def run
+          shift.run(@group) until empty?
+        end
+      end
+
+      module RegistersGlobals
+        def register_globals host, globals
+          [:before, :after, :around].each do |position|
+            process host, globals, position, :each
+            next if position == :around # no around(:all) hooks
+            process host, globals, position, :all
+          end
+        end
+
+        private
+        def process host, globals, position, scope
+          globals[position][scope].each do |hook|
+            unless host.parent_groups.any? { |a| a.hooks[position][scope].include? hook }
+              self[position][scope] << hook if scope == :each || hook.options_apply?(host)
+            end
+          end
+        end
+      end
+
+      # @private
+      def hooks
+        @hooks ||= {
+          :around => { :each => AroundHookCollection.new },
+          :before => { :each => HookCollection.new, :all => HookCollection.new, :suite => HookCollection.new },
+          :after =>  { :each => HookCollection.new, :all => HookCollection.new, :suite => HookCollection.new }
+        }.extend(RegistersGlobals)
+      end
+
+      # @api public
+      # @overload before(&block)
+      # @overload before(scope, &block)
+      # @overload before(scope, conditions, &block)
+      # @overload before(conditions, &block)
+      #
+      # @param [Symbol] scope `:each`, `:all`, or `:suite` (defaults to `:each`)
+      # @param [Hash] conditions
+      #   constrains this hook to examples matching these conditions e.g.
+      #   `before(:each, :ui => true) { ... }` will only run with examples or
+      #   groups declared with `:ui => true`.
+      #
+      # @see #after
+      # @see #around
+      # @see ExampleGroup
+      # @see SharedContext
+      # @see SharedExampleGroup
+      # @see Configuration
+      #
+      # Declare a block of code to be run before each example (using `:each`)
+      # or once before any example (using `:all`). These are usually declared
+      # directly in the {ExampleGroup} to which they apply, but they can also
+      # be shared across multiple groups.
+      #
+      # You can also use `before(:suite)` to run a block of code before any
+      # example groups are run. This should be declared in {RSpec.configure}
+      #
+      # Instance variables declared in `before(:each)` or `before(:all)` are
+      # accessible within each example.
+      #
+      # ### Order
+      #
+      # `before` hooks are stored in three scopes, which are run in order:
+      # `:suite`, `:all`, and `:each`. They can also be declared in several
+      # different places: `RSpec.configure`, a parent group, the current group.
+      # They are run in the following order:
+      #
+      #     before(:suite) # declared in RSpec.configure
+      #     before(:all)   # declared in RSpec.configure
+      #     before(:all)   # declared in a parent group
+      #     before(:all)   # declared in the current group
+      #     before(:each)  # declared in RSpec.configure
+      #     before(:each)  # declared in a parent group
+      #     before(:each)  # declared in the current group
+      #
+      # If more than one `before` is declared within any one scope, they are run
+      # in the order in which they are declared.
+      #
+      # ### Conditions
+      #
+      # When you add a conditions hash to `before(:each)` or `before(:all)`,
+      # RSpec will only apply that hook to groups or examples that match the
+      # conditions. e.g.
+      #
+      #     RSpec.configure do |config|
+      #       config.before(:each, :authorized => true) do
+      #         log_in_as :authorized_user
+      #       end
+      #     end
+      #
+      #     describe Something, :authorized => true do
+      #       # the before hook will run in before each example in this group
+      #     end
+      #
+      #     describe SomethingElse do
+      #       it "does something", :authorized => true do
+      #         # the before hook will run before this example
+      #       end
+      #
+      #       it "does something else" do
+      #         # the hook will not run before this example
+      #       end
+      #     end
+      #
+      # ### Warning: `before(:suite, :with => :conditions)`
+      #
+      # The conditions hash is used to match against specific examples. Since
+      # `before(:suite)` is not run in relation to any specific example or
+      # group, conditions passed along with `:suite` are effectively ignored.
+      #
+      # ### Exceptions
+      #
+      # When an exception is raised in a `before` block, RSpec skips any
+      # subsequent `before` blocks and the example, but runs all of the
+      # `after(:each)` and `after(:all)` hooks.
+      #
+      # ### Warning: implicit before blocks
+      #
+      # `before` hooks can also be declared in shared contexts which get
+      # included implicitly either by you or by extension libraries. Since
+      # RSpec runs these in the order in which they are declared within each
+      # scope, load order matters, and can lead to confusing results when one
+      # before block depends on state that is prepared in another before block
+      # that gets run later.
+      #
+      # ### Warning: `before(:all)`
+      #
+      # It is very tempting to use `before(:all)` to speed things up, but we
+      # recommend that you avoid this as there are a number of gotchas, as well
+      # as things that simply don't work.
+      #
+      # #### context
+      #
+      # `before(:all)` is run in an example that is generated to provide group
+      # context for the block.
+      #
+      # #### instance variables
+      #
+      # Instance variables declared in `before(:all)` are shared across all the
+      # examples in the group.  This means that each example can change the
+      # state of a shared object, resulting in an ordering dependency that can
+      # make it difficult to reason about failures.
+      #
+      # #### unsupported rspec constructs
+      #
+      # RSpec has several constructs that reset state between each example
+      # automatically. These are not intended for use from within `before(:all)`:
+      #
+      #   * `let` declarations
+      #   * `subject` declarations
+      #   * Any mocking, stubbing or test double declaration
+      #
+      # ### other frameworks
+      #
+      # Mock object frameworks and database transaction managers (like
+      # ActiveRecord) are typically designed around the idea of setting up
+      # before an example, running that one example, and then tearing down.
+      # This means that mocks and stubs can (sometimes) be declared in
+      # `before(:all)`, but get torn down before the first real example is ever
+      # run.
+      #
+      # You _can_ create database-backed model objects in a `before(:all)` in
+      # rspec-rails, but it will not be wrapped in a transaction for you, so
+      # you are on your own to clean up in an `after(:all)` block.
+      #
+      # @example before(:each) declared in an {ExampleGroup}
+      #
+      #     describe Thing do
+      #       before(:each) do
+      #         @thing = Thing.new
+      #       end
+      #
+      #       it "does something" do
+      #         # here you can access @thing
+      #       end
+      #     end
+      #
+      # @example before(:all) declared in an {ExampleGroup}
+      #
+      #     describe Parser do
+      #       before(:all) do
+      #         File.open(file_to_parse, 'w') do |f|
+      #           f.write <<-CONTENT
+      #             stuff in the file
+      #           CONTENT
+      #         end
+      #       end
+      #
+      #       it "parses the file" do
+      #         Parser.parse(file_to_parse)
+      #       end
+      #
+      #       after(:all) do
+      #         File.delete(file_to_parse)
+      #       end
+      #     end
+      def before(*args, &block)
+        register_hook :append, :before, *args, &block
+      end
+
+      alias_method :append_before, :before
+
+      # Adds `block` to the front of the list of `before` blocks in the same
+      # scope (`:each`, `:all`, or `:suite`).
+      #
+      # See #before for scoping semantics.
+      def prepend_before(*args, &block)
+        register_hook :prepend, :before, *args, &block
+      end
+
+      # @api public
+      # @overload after(&block)
+      # @overload after(scope, &block)
+      # @overload after(scope, conditions, &block)
+      # @overload after(conditions, &block)
+      #
+      # @param [Symbol] scope `:each`, `:all`, or `:suite` (defaults to `:each`)
+      # @param [Hash] conditions
+      #   constrains this hook to examples matching these conditions e.g.
+      #   `after(:each, :ui => true) { ... }` will only run with examples or
+      #   groups declared with `:ui => true`.
+      #
+      # @see #before
+      # @see #around
+      # @see ExampleGroup
+      # @see SharedContext
+      # @see SharedExampleGroup
+      # @see Configuration
+      #
+      # Declare a block of code to be run after each example (using `:each`) or
+      # once after all examples (using `:all`). See
+      # [#before](Hooks#before-instance_method) for more information about
+      # ordering.
+      #
+      # ### Exceptions
+      #
+      # `after` hooks are guaranteed to run even when there are exceptions in
+      # `before` hooks or examples.  When an exception is raised in an after
+      # block, the exception is captured for later reporting, and subsequent
+      # `after` blocks are run.
+      #
+      # ### Order
+      #
+      # `after` hooks are stored in three scopes, which are run in order:
+      # `:each`, `:all`, and `:suite`. They can also be declared in several
+      # different places: `RSpec.configure`, a parent group, the current group.
+      # They are run in the following order:
+      #
+      #     after(:each) # declared in the current group
+      #     after(:each) # declared in a parent group
+      #     after(:each) # declared in RSpec.configure
+      #     after(:all)  # declared in the current group
+      #     after(:all)  # declared in a parent group
+      #     after(:all)  # declared in RSpec.configure
+      #
+      # This is the reverse of the order in which `before` hooks are run.
+      # Similarly, if more than one `after` is declared within any one scope,
+      # they are run in reverse order of that in which they are declared.
+      def after(*args, &block)
+        register_hook :prepend, :after, *args, &block
+      end
+
+      alias_method :prepend_after, :after
+
+      # Adds `block` to the back of the list of `after` blocks in the same
+      # scope (`:each`, `:all`, or `:suite`).
+      #
+      # See #after for scoping semantics.
+      def append_after(*args, &block)
+        register_hook :append, :after, *args, &block
+      end
+
+      # @api public
+      # @overload around(&block)
+      # @overload around(scope, &block)
+      # @overload around(scope, conditions, &block)
+      # @overload around(conditions, &block)
+      #
+      # @param [Symbol] scope `:each` (defaults to `:each`)
+      #   present for syntax parity with `before` and `after`, but `:each` is
+      #   the only supported value.
+      #
+      # @param [Hash] conditions
+      #   constrains this hook to examples matching these conditions e.g.
+      #   `around(:each, :ui => true) { ... }` will only run with examples or
+      #   groups declared with `:ui => true`.
+      #
+      # @yield [Example] the example to run
+      #
+      # @note the syntax of `around` is similar to that of `before` and `after`
+      #   but the semantics are quite different. `before` and `after` hooks are
+      #   run in the context of of the examples with which they are associated,
+      #   whereas `around` hooks are actually responsible for running the
+      #   examples. Consequently, `around` hooks do not have direct access to
+      #   resources that are made available within the examples and their
+      #   associated `before` and `after` hooks.
+      #
+      # @note `:each` is the only supported scope.
+      #
+      # Declare a block of code, parts of which will be run before and parts
+      # after the example. It is your responsibility to run the example:
+      #
+      #     around(:each) do |ex|
+      #       # do some stuff before
+      #       ex.run
+      #       # do some stuff after
+      #     end
+      #
+      # The yielded example aliases `run` with `call`, which lets you treat it
+      # like a `Proc`.  This is especially handy when working with libaries
+      # that manage their own setup and teardown using a block or proc syntax,
+      # e.g.
+      #
+      #     around(:each) {|ex| Database.transaction(&ex)}
+      #     around(:each) {|ex| FakeFS(&ex)}
+      #
+      def around(*args, &block)
+        register_hook :prepend, :around, *args, &block
+      end
+
+      # @private
+      #
+      # Runs all of the blocks stored with the hook in the context of the
+      # example. If no example is provided, just calls the hook directly.
+      def run_hook(hook, scope, example_or_group=ExampleGroup.new, initial_procsy=nil)
+        find_hook(hook, scope, example_or_group, initial_procsy).run
+      end
+
+      # @private
+      def around_each_hooks_for(example, initial_procsy=nil)
+        AroundHookCollection.new(parent_groups.map {|a| a.hooks[:around][:each]}.flatten).for(example, initial_procsy)
+      end
+
+    private
+
+      SCOPES = [:each, :all, :suite]
+
+      HOOK_TYPES = {
+        :before => Hash.new { BeforeHook },
+        :after  => Hash.new { AfterHook  },
+        :around => Hash.new { AroundHook }
+      }
+
+      HOOK_TYPES[:after][:all] = AfterAllHook
+
+      def before_all_hooks_for(group)
+        GroupHookCollection.new(hooks[:before][:all]).for(group)
+      end
+
+      def after_all_hooks_for(group)
+        GroupHookCollection.new(hooks[:after][:all]).for(group)
+      end
+
+      def before_each_hooks_for(example)
+        HookCollection.new(parent_groups.reverse.map {|a| a.hooks[:before][:each]}.flatten).for(example)
+      end
+
+      def after_each_hooks_for(example)
+        HookCollection.new(parent_groups.map {|a| a.hooks[:after][:each]}.flatten).for(example)
+      end
+
+      def register_hook prepend_or_append, hook, *args, &block
+        scope, options = scope_and_options_from(*args)
+        hooks[hook][scope].send(prepend_or_append, HOOK_TYPES[hook][scope].new(block, options))
+      end
+
+      def find_hook(hook, scope, example_or_group, initial_procsy)
+        case [hook, scope]
+        when [:before, :all]
+          before_all_hooks_for(example_or_group)
+        when [:after, :all]
+          after_all_hooks_for(example_or_group)
+        when [:around, :each]
+          around_each_hooks_for(example_or_group, initial_procsy)
+        when [:before, :each]
+          before_each_hooks_for(example_or_group)
+        when [:after, :each]
+          after_each_hooks_for(example_or_group)
+        when [:before, :suite], [:after, :suite]
+          hooks[hook][:suite].with(example_or_group)
+        end
+      end
+
+      def scope_and_options_from(*args)
+        return extract_scope_from(args), build_metadata_hash_from(args)
+      end
+
+      def extract_scope_from(args)
+        if SCOPES.include?(args.first)
+          args.shift
+        elsif args.any? { |a| a.is_a?(Symbol) }
+          raise ArgumentError.new("You must explicitly give a scope (:each, :all, or :suite) when using symbols as metadata for a hook.")
+        else
+          :each
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/memoized_helpers.rb b/rspec-core/lib/rspec/core/memoized_helpers.rb
new file mode 100644
index 0000000..0fe7f8b
--- /dev/null
+++ b/rspec-core/lib/rspec/core/memoized_helpers.rb
@@ -0,0 +1,514 @@
+module RSpec
+  module Core
+    module MemoizedHelpers
+      # @note `subject` was contributed by Joe Ferris to support the one-liner
+      #   syntax embraced by shoulda matchers:
+      #
+      #       describe Widget do
+      #         it { should validate_presence_of(:name) }
+      #       end
+      #
+      #   While the examples below demonstrate how to use `subject`
+      #   explicitly in examples, we recommend that you define a method with
+      #   an intention revealing name instead.
+      #
+      # @example
+      #
+      #   # explicit declaration of subject
+      #   describe Person do
+      #     subject { Person.new(:birthdate => 19.years.ago) }
+      #     it "should be eligible to vote" do
+      #       subject.should be_eligible_to_vote
+      #       # ^ ^ explicit reference to subject not recommended
+      #     end
+      #   end
+      #
+      #   # implicit subject => { Person.new }
+      #   describe Person do
+      #     it "should be eligible to vote" do
+      #       subject.should be_eligible_to_vote
+      #       # ^ ^ explicit reference to subject not recommended
+      #     end
+      #   end
+      #
+      #   # one-liner syntax - should is invoked on subject
+      #   describe Person do
+      #     it { should be_eligible_to_vote }
+      #   end
+      #
+      # @note Because `subject` is designed to create state that is reset between
+      #   each example, and `before(:all)` is designed to setup state that is
+      #   shared across _all_ examples in an example group, `subject` is _not_
+      #   intended to be used in a `before(:all)` hook. RSpec 2.13.1 prints
+      #   a warning when you reference a `subject` from `before(:all)` and we plan
+      #   to have it raise an error in RSpec 3.
+      #
+      # @see #should
+      def subject
+        __memoized.fetch(:subject) do
+          __memoized[:subject] = begin
+            described = described_class || self.class.description
+            Class === described ? described.new : described
+          end
+        end
+      end
+
+      # When `should` is called with no explicit receiver, the call is
+      # delegated to the object returned by `subject`. Combined with an
+      # implicit subject this supports very concise expressions.
+      #
+      # @example
+      #
+      #   describe Person do
+      #     it { should be_eligible_to_vote }
+      #   end
+      #
+      # @see #subject
+      def should(matcher=nil, message=nil)
+        RSpec::Expectations::PositiveExpectationHandler.handle_matcher(subject, matcher, message)
+      end
+
+      # Just like `should`, `should_not` delegates to the subject (implicit or
+      # explicit) of the example group.
+      #
+      # @example
+      #
+      #   describe Person do
+      #     it { should_not be_eligible_to_vote }
+      #   end
+      #
+      # @see #subject
+      def should_not(matcher=nil, message=nil)
+        RSpec::Expectations::NegativeExpectationHandler.handle_matcher(subject, matcher, message)
+      end
+
+      private
+
+      # @private
+      def __memoized
+        @__memoized ||= {}
+      end
+
+      # Used internally to customize the behavior of the
+      # memoized hash when used in a `before(:all)` hook.
+      #
+      # @private
+      class BeforeAllMemoizedHash
+        def initialize(example_group_instance)
+          @example_group_instance = example_group_instance
+          @hash = {}
+        end
+
+        def self.isolate_for_before_all(example_group_instance)
+          example_group_instance.instance_eval do
+            @__memoized = BeforeAllMemoizedHash.new(self)
+
+            begin
+              yield
+            ensure
+              @__memoized.preserve_accessed_lets
+              @__memoized = nil
+            end
+          end
+        end
+
+        def fetch(key, &block)
+          description = if key == :subject
+            "subject"
+          else
+            "let declaration `#{key}`"
+          end
+
+          ::RSpec.warn_deprecation <<-EOS
+WARNING: #{description} accessed in a `before(:all)` hook at:
+  #{caller[1]}
+
+This is deprecated behavior that will not be supported in RSpec 3.
+
+`let` and `subject` declarations are not intended to be called
+in a `before(:all)` hook, as they exist to define state that
+is reset between each example, while `before(:all)` exists to
+define state that is shared across examples in an example group.
+EOS
+
+          @hash.fetch(key, &block)
+        end
+
+        def []=(key, value)
+          @hash[key] = value
+        end
+
+        def preserve_accessed_lets
+          hash = @hash
+
+          @example_group_instance.class.class_eval do
+            hash.each do |key, value|
+              undef_method(key) if method_defined?(key)
+              define_method(key) { value }
+            end
+          end
+        end
+      end
+
+      def self.included(mod)
+        mod.extend(ClassMethods)
+      end
+
+      module ClassMethods
+        # Generates a method whose return value is memoized after the first
+        # call. Useful for reducing duplication between examples that assign
+        # values to the same local variable.
+        #
+        # @note `let` _can_ enhance readability when used sparingly (1,2, or
+        #   maybe 3 declarations) in any given example group, but that can
+        #   quickly degrade with overuse. YMMV.
+        #
+        # @note `let` uses an `||=` conditional that has the potential to
+        #   behave in surprising ways in examples that spawn separate threads,
+        #   though we have yet to see this in practice. You've been warned.
+        #
+        # @note Because `let` is designed to create state that is reset between
+        #   each example, and `before(:all)` is designed to setup state that is
+        #   shared across _all_ examples in an example group, `let` is _not_
+        #   intended to be used in a `before(:all)` hook. RSpec 2.13.1 prints
+        #   a warning when you reference a `let` from `before(:all)` and we plan
+        #   to have it raise an error in RSpec 3.
+        #
+        # @example
+        #
+        #   describe Thing do
+        #     let(:thing) { Thing.new }
+        #
+        #     it "does something" do
+        #       # first invocation, executes block, memoizes and returns result
+        #       thing.do_something
+        #
+        #       # second invocation, returns the memoized value
+        #       thing.should be_something
+        #     end
+        #   end
+        def let(name, &block)
+          # We have to pass the block directly to `define_method` to
+          # allow it to use method constructs like `super` and `return`.
+          raise "#let or #subject called without a block" if block.nil?
+          MemoizedHelpers.module_for(self).send(:define_method, name, &block)
+
+          # Apply the memoization. The method has been defined in an ancestor
+          # module so we can use `super` here to get the value.
+          define_method(name) do
+            __memoized.fetch(name) { |k| __memoized[k] = super(&nil) }
+          end
+        end
+
+        # Just like `let`, except the block is invoked by an implicit `before`
+        # hook. This serves a dual purpose of setting up state and providing a
+        # memoized reference to that state.
+        #
+        # @example
+        #
+        #   class Thing
+        #     def self.count
+        #       @count ||= 0
+        #     end
+        #
+        #     def self.count=(val)
+        #       @count += val
+        #     end
+        #
+        #     def self.reset_count
+        #       @count = 0
+        #     end
+        #
+        #     def initialize
+        #       self.class.count += 1
+        #     end
+        #   end
+        #
+        #   describe Thing do
+        #     after(:each) { Thing.reset_count }
+        #
+        #     context "using let" do
+        #       let(:thing) { Thing.new }
+        #
+        #       it "is not invoked implicitly" do
+        #         Thing.count.should eq(0)
+        #       end
+        #
+        #       it "can be invoked explicitly" do
+        #         thing
+        #         Thing.count.should eq(1)
+        #       end
+        #     end
+        #
+        #     context "using let!" do
+        #       let!(:thing) { Thing.new }
+        #
+        #       it "is invoked implicitly" do
+        #         Thing.count.should eq(1)
+        #       end
+        #
+        #       it "returns memoized version on first invocation" do
+        #         thing
+        #         Thing.count.should eq(1)
+        #       end
+        #     end
+        #   end
+        def let!(name, &block)
+          let(name, &block)
+          before { __send__(name) }
+        end
+
+        # Declares a `subject` for an example group which can then be the
+        # implicit receiver (through delegation) of calls to `should`.
+        #
+        # Given a `name`, defines a method with that name which returns the
+        # `subject`. This lets you declare the subject once and access it
+        # implicitly in one-liners and explicitly using an intention revealing
+        # name.
+        #
+        # @param [String,Symbol] name used to define an accessor with an
+        #   intention revealing name
+        # @param block defines the value to be returned by `subject` in examples
+        #
+        # @example
+        #
+        #   describe CheckingAccount, "with $50" do
+        #     subject { CheckingAccount.new(Money.new(50, :USD)) }
+        #     it { should have_a_balance_of(Money.new(50, :USD)) }
+        #     it { should_not be_overdrawn }
+        #   end
+        #
+        #   describe CheckingAccount, "with a non-zero starting balance" do
+        #     subject(:account) { CheckingAccount.new(Money.new(50, :USD)) }
+        #     it { should_not be_overdrawn }
+        #     it "has a balance equal to the starting balance" do
+        #       account.balance.should eq(Money.new(50, :USD))
+        #     end
+        #   end
+        #
+        # @see MemoizedHelpers#should
+        def subject(name=nil, &block)
+          if name
+            let(name, &block)
+            alias_method :subject, name
+
+            self::NamedSubjectPreventSuper.send(:define_method, name) do
+              raise NotImplementedError, "`super` in named subjects is not supported"
+            end
+          else
+            let(:subject, &block)
+          end
+        end
+
+        # Just like `subject`, except the block is invoked by an implicit `before`
+        # hook. This serves a dual purpose of setting up state and providing a
+        # memoized reference to that state.
+        #
+        # @example
+        #
+        #   class Thing
+        #     def self.count
+        #       @count ||= 0
+        #     end
+        #
+        #     def self.count=(val)
+        #       @count += val
+        #     end
+        #
+        #     def self.reset_count
+        #       @count = 0
+        #     end
+        #
+        #     def initialize
+        #       self.class.count += 1
+        #     end
+        #   end
+        #
+        #   describe Thing do
+        #     after(:each) { Thing.reset_count }
+        #
+        #     context "using subject" do
+        #       subject { Thing.new }
+        #
+        #       it "is not invoked implicitly" do
+        #         Thing.count.should eq(0)
+        #       end
+        #
+        #       it "can be invoked explicitly" do
+        #         subject
+        #         Thing.count.should eq(1)
+        #       end
+        #     end
+        #
+        #     context "using subject!" do
+        #       subject!(:thing) { Thing.new }
+        #
+        #       it "is invoked implicitly" do
+        #         Thing.count.should eq(1)
+        #       end
+        #
+        #       it "returns memoized version on first invocation" do
+        #         subject
+        #         Thing.count.should eq(1)
+        #       end
+        #     end
+        #   end
+        def subject!(name=nil, &block)
+          subject(name, &block)
+          before { subject }
+        end
+
+        # Creates a nested example group named by the submitted `attribute`,
+        # and then generates an example using the submitted block.
+        #
+        # @example
+        #
+        #   # This ...
+        #   describe Array do
+        #     its(:size) { should eq(0) }
+        #   end
+        #
+        #   # ... generates the same runtime structure as this:
+        #   describe Array do
+        #     describe "size" do
+        #       it "should eq(0)" do
+        #         subject.size.should eq(0)
+        #       end
+        #     end
+        #   end
+        #
+        # The attribute can be a `Symbol` or a `String`. Given a `String`
+        # with dots, the result is as though you concatenated that `String`
+        # onto the subject in an expression.
+        #
+        # @example
+        #
+        #   describe Person do
+        #     subject do
+        #       Person.new.tap do |person|
+        #         person.phone_numbers << "555-1212"
+        #       end
+        #     end
+        #
+        #     its("phone_numbers.first") { should eq("555-1212") }
+        #   end
+        #
+        # When the subject is a `Hash`, you can refer to the Hash keys by
+        # specifying a `Symbol` or `String` in an array.
+        #
+        # @example
+        #
+        #   describe "a configuration Hash" do
+        #     subject do
+        #       { :max_users => 3,
+        #         'admin' => :all_permissions }
+        #     end
+        #
+        #     its([:max_users]) { should eq(3) }
+        #     its(['admin']) { should eq(:all_permissions) }
+        #
+        #     # You can still access to its regular methods this way:
+        #     its(:keys) { should include(:max_users) }
+        #     its(:count) { should eq(2) }
+        #   end
+        #
+        # Note that this method does not modify `subject` in any way, so if you
+        # refer to `subject` in `let` or `before` blocks, you're still
+        # referring to the outer subject.
+        #
+        # @example
+        #
+        #   describe Person do
+        #     subject { Person.new }
+        #     before { subject.age = 25 }
+        #     its(:age) { should eq(25) }
+        #   end
+        def its(attribute, &block)
+          describe(attribute) do
+            if Array === attribute
+              let(:__its_subject) { subject[*attribute] }
+            else
+              let(:__its_subject) do
+                attribute_chain = attribute.to_s.split('.')
+                attribute_chain.inject(subject) do |inner_subject, attr|
+                  inner_subject.send(attr)
+                end
+              end
+            end
+
+            def should(matcher=nil, message=nil)
+              RSpec::Expectations::PositiveExpectationHandler.handle_matcher(__its_subject, matcher, message)
+            end
+
+            def should_not(matcher=nil, message=nil)
+              RSpec::Expectations::NegativeExpectationHandler.handle_matcher(__its_subject, matcher, message)
+            end
+
+            example(&block)
+          end
+        end
+      end
+
+      # @api private
+      #
+      # Gets the LetDefinitions module. The module is mixed into
+      # the example group and is used to hold all let definitions.
+      # This is done so that the block passed to `let` can be
+      # forwarded directly on to `define_method`, so that all method
+      # constructs (including `super` and `return`) can be used in
+      # a `let` block.
+      #
+      # The memoization is provided by a method definition on the
+      # example group that supers to the LetDefinitions definition
+      # in order to get the value to memoize.
+      def self.module_for(example_group)
+        get_constant_or_yield(example_group, :LetDefinitions) do
+          mod = Module.new do
+            include Module.new {
+              example_group.const_set(:NamedSubjectPreventSuper, self)
+            }
+          end
+
+          example_group.const_set(:LetDefinitions, mod)
+          mod
+        end
+      end
+
+      # @api private
+      def self.define_helpers_on(example_group)
+        example_group.send(:include, module_for(example_group))
+      end
+
+      if Module.method(:const_defined?).arity == 1 # for 1.8
+        # @api private
+        #
+        # Gets the named constant or yields.
+        # On 1.8, const_defined? / const_get do not take into
+        # account the inheritance hierarchy.
+        def self.get_constant_or_yield(example_group, name)
+          if example_group.const_defined?(name)
+            example_group.const_get(name)
+          else
+            yield
+          end
+        end
+      else
+        # @api private
+        #
+        # Gets the named constant or yields.
+        # On 1.9, const_defined? / const_get take into account the
+        # the inheritance by default, and accept an argument to
+        # disable this behavior. It's important that we don't
+        # consider inheritance here; each example group level that
+        # uses a `let` should get its own `LetDefinitions` module.
+        def self.get_constant_or_yield(example_group, name)
+          if example_group.const_defined?(name, (check_ancestors = false))
+            example_group.const_get(name, check_ancestors)
+          else
+            yield
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/metadata.rb b/rspec-core/lib/rspec/core/metadata.rb
new file mode 100644
index 0000000..bf6521d
--- /dev/null
+++ b/rspec-core/lib/rspec/core/metadata.rb
@@ -0,0 +1,299 @@
+module RSpec
+  module Core
+    # Each ExampleGroup class and Example instance owns an instance of
+    # Metadata, which is Hash extended to support lazy evaluation of values
+    # associated with keys that may or may not be used by any example or group.
+    #
+    # In addition to metadata that is used internally, this also stores
+    # user-supplied metadata, e.g.
+    #
+    #     describe Something, :type => :ui do
+    #       it "does something", :slow => true do
+    #         # ...
+    #       end
+    #     end
+    #
+    # `:type => :ui` is stored in the Metadata owned by the example group, and
+    # `:slow => true` is stored in the Metadata owned by the example. These can
+    # then be used to select which examples are run using the `--tag` option on
+    # the command line, or several methods on `Configuration` used to filter a
+    # run (e.g. `filter_run_including`, `filter_run_excluding`, etc).
+    #
+    # @see Example#metadata
+    # @see ExampleGroup.metadata
+    # @see FilterManager
+    # @see Configuration#filter_run_including
+    # @see Configuration#filter_run_excluding
+    class Metadata < Hash
+
+      def self.relative_path(line)
+        line = line.sub(File.expand_path("."), ".")
+        line = line.sub(/\A([^:]+:\d+)$/, '\\1')
+        return nil if line == '-e:1'
+        line
+      rescue SecurityError
+        nil
+      end
+
+      # @private
+      module MetadataHash
+
+        # @private
+        # Supports lazy evaluation of some values. Extended by
+        # ExampleMetadataHash and GroupMetadataHash, which get mixed in to
+        # Metadata for ExampleGroups and Examples (respectively).
+        def [](key)
+          store_computed(key) unless has_key?(key)
+          super
+        end
+
+        def fetch(key, *args)
+          store_computed(key) unless has_key?(key)
+          super
+        end
+
+        private
+
+        def store_computed(key)
+          case key
+          when :location
+            store(:location, location)
+          when :file_path, :line_number
+            file_path, line_number = file_and_line_number
+            store(:file_path, file_path)
+            store(:line_number, line_number)
+          when :execution_result
+            store(:execution_result, {})
+          when :describes, :described_class
+            klass = described_class
+            store(:described_class, klass)
+            # TODO (2011-11-07 DC) deprecate :describes as a key
+            store(:describes, klass)
+          when :full_description
+            store(:full_description, full_description)
+          when :description
+            store(:description, build_description_from(*self[:description_args]))
+          when :description_args
+            store(:description_args, [])
+          end
+        end
+
+        def location
+          "#{self[:file_path]}:#{self[:line_number]}"
+        end
+
+        def file_and_line_number
+          first_caller_from_outside_rspec =~ /(.+?):(\d+)(|:\d+)/
+          return [Metadata::relative_path($1), $2.to_i]
+        end
+
+        def first_caller_from_outside_rspec
+          self[:caller].detect {|l| l !~ /\/lib\/rspec\/core/}
+        end
+
+        def method_description_after_module?(parent_part, child_part)
+          return false unless parent_part.is_a?(Module)
+          child_part =~ /^(#|::|\.)/
+        end
+
+        def build_description_from(first_part = '', *parts)
+          description, _ = parts.inject([first_part.to_s, first_part]) do |(desc, last_part), this_part|
+            this_part = this_part.to_s
+            this_part = (' ' + this_part) unless method_description_after_module?(last_part, this_part)
+            [(desc + this_part), this_part]
+          end
+
+          description
+        end
+      end
+
+      # Mixed in to Metadata for an Example (extends MetadataHash) to support
+      # lazy evaluation of some values.
+      module ExampleMetadataHash
+        include MetadataHash
+
+        def described_class
+          self[:example_group].described_class
+        end
+
+        def full_description
+          build_description_from(self[:example_group][:full_description], *self[:description_args])
+        end
+      end
+
+      # Mixed in to Metadata for an ExampleGroup (extends MetadataHash) to
+      # support lazy evaluation of some values.
+      module GroupMetadataHash
+        include MetadataHash
+
+        def described_class
+          container_stack.each do |g|
+            [:described_class, :describes].each do |key|
+              if g.has_key?(key)
+                value = g[key]
+                return value unless value.nil?
+              end
+            end
+          end
+
+          container_stack.reverse.each do |g|
+            candidate = g[:description_args].first
+            return candidate unless String === candidate || Symbol === candidate
+          end
+
+          nil
+        end
+
+        def full_description
+          build_description_from(*container_stack.reverse.map {|a| a[:description_args]}.flatten)
+        end
+
+        def container_stack
+          @container_stack ||= begin
+                                 groups = [group = self]
+                                 while group.has_key?(:example_group)
+                                   groups << group[:example_group]
+                                   group = group[:example_group]
+                                 end
+                                 groups
+                               end
+        end
+      end
+
+      def initialize(parent_group_metadata=nil)
+        if parent_group_metadata
+          update(parent_group_metadata)
+          store(:example_group, {:example_group => parent_group_metadata[:example_group].extend(GroupMetadataHash)}.extend(GroupMetadataHash))
+        else
+          store(:example_group, {}.extend(GroupMetadataHash))
+        end
+
+        yield self if block_given?
+      end
+
+      # @private
+      def process(*args)
+        user_metadata = args.last.is_a?(Hash) ? args.pop : {}
+        ensure_valid_keys(user_metadata)
+
+        self[:example_group].store(:description_args, args)
+        self[:example_group].store(:caller, user_metadata.delete(:caller) || caller)
+
+        update(user_metadata)
+      end
+
+      # @private
+      def for_example(description, user_metadata)
+        dup.extend(ExampleMetadataHash).configure_for_example(description, user_metadata)
+      end
+
+      # @private
+      def any_apply?(filters)
+        filters.any? {|k,v| filter_applies?(k,v)}
+      end
+
+      # @private
+      def all_apply?(filters)
+        filters.all? {|k,v| filter_applies?(k,v)}
+      end
+
+      # @private
+      def filter_applies?(key, value, metadata=self)
+        return metadata.filter_applies_to_any_value?(key, value) if Array === metadata[key] && !(Proc === value)
+        return metadata.line_number_filter_applies?(value)       if key == :line_numbers
+        return metadata.location_filter_applies?(value)          if key == :locations
+        return metadata.filters_apply?(key, value)               if Hash === value
+
+        return false unless metadata.has_key?(key)
+
+        case value
+        when Regexp
+          metadata[key] =~ value
+        when Proc
+          case value.arity
+          when 0 then value.call
+          when 2 then value.call(metadata[key], metadata)
+          else value.call(metadata[key])
+          end
+        else
+          metadata[key].to_s == value.to_s
+        end
+      end
+
+      # @private
+      def filters_apply?(key, value)
+        value.all? {|k, v| filter_applies?(k, v, self[key])}
+      end
+
+      # @private
+      def filter_applies_to_any_value?(key, value)
+        self[key].any? {|v| filter_applies?(key, v, {key => value})}
+      end
+
+      # @private
+      def location_filter_applies?(locations)
+        # it ignores location filters for other files
+        line_number = example_group_declaration_line(locations)
+        line_number ? line_number_filter_applies?(line_number) : true
+      end
+
+      # @private
+      def line_number_filter_applies?(line_numbers)
+        preceding_declaration_lines = line_numbers.map {|n| RSpec.world.preceding_declaration_line(n)}
+        !(relevant_line_numbers & preceding_declaration_lines).empty?
+      end
+
+      protected
+
+      def configure_for_example(description, user_metadata)
+        store(:description_args, [description]) if description
+        store(:caller, user_metadata.delete(:caller) || caller)
+        update(user_metadata)
+      end
+
+      private
+
+      RESERVED_KEYS = [
+        :description,
+        :example_group,
+        :execution_result,
+        :file_path,
+        :full_description,
+        :line_number,
+        :location
+      ]
+
+      def ensure_valid_keys(user_metadata)
+        RESERVED_KEYS.each do |key|
+          if user_metadata.has_key?(key)
+            raise <<-EOM
+            #{"*"*50}
+:#{key} is not allowed
+
+RSpec reserves some hash keys for its own internal use,
+including :#{key}, which is used on:
+
+            #{caller(0)[4]}.
+
+Here are all of RSpec's reserved hash keys:
+
+            #{RESERVED_KEYS.join("\n  ")}
+            #{"*"*50}
+            EOM
+          end
+        end
+      end
+
+      def example_group_declaration_line(locations)
+        locations[File.expand_path(self[:example_group][:file_path])] if self[:example_group]
+      end
+
+      # TODO - make this a method on metadata - the problem is
+      # metadata[:example_group] is not always a kind of GroupMetadataHash.
+      def relevant_line_numbers(metadata=self)
+        [metadata[:line_number]] + (metadata[:example_group] ? relevant_line_numbers(metadata[:example_group]) : [])
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/metadata_hash_builder.rb b/rspec-core/lib/rspec/core/metadata_hash_builder.rb
new file mode 100644
index 0000000..612a391
--- /dev/null
+++ b/rspec-core/lib/rspec/core/metadata_hash_builder.rb
@@ -0,0 +1,97 @@
+module RSpec
+  module Core
+    # @private
+    module MetadataHashBuilder
+      # @private
+      module Common
+        def build_metadata_hash_from(args)
+          metadata = args.last.is_a?(Hash) ? args.pop : {}
+
+          if RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values?
+            add_symbols_to_hash(metadata, args)
+          else
+            warn_about_symbol_usage(args)
+          end
+
+          metadata
+        end
+
+        private
+
+          def add_symbols_to_hash(hash, args)
+            while args.last.is_a?(Symbol)
+              hash[args.pop] = true
+            end
+          end
+
+          def warn_about_symbol_usage(args)
+            symbols = args.select { |a| a.is_a?(Symbol) }
+            return if symbols.empty?
+            Kernel.warn symbol_metadata_warning(symbols)
+          end
+      end
+
+      # @private
+      module WithConfigWarning
+        include Common
+
+        private
+
+          def symbol_metadata_warning(symbols)
+            <<-NOTICE
+
+*****************************************************************
+WARNING: You have passed symbols (#{symbols.inspect}) as metadata
+arguments to a configuration option.
+
+In RSpec 3, these symbols will be treated as metadata keys with
+a value of `true`.  To get this behavior now (and prevent this
+warning), you can set a configuration option:
+
+RSpec.configure do |c|
+  c.treat_symbols_as_metadata_keys_with_true_values = true
+end
+
+Note that this config setting should go before your other config
+settings so that they can use symbols as metadata.
+*****************************************************************
+
+NOTICE
+          end
+      end
+
+      # @private
+      module WithDeprecationWarning
+        include Common
+
+        private
+
+          def symbol_metadata_warning(symbols)
+            <<-NOTICE
+
+*****************************************************************
+DEPRECATION WARNING: you are using deprecated behaviour that will
+be removed from RSpec 3.
+
+You have passed symbols (#{symbols.inspect}) as additional
+arguments for a doc string.
+
+In RSpec 3, these symbols will be treated as metadata keys with
+a value of `true`.  To get this behavior now (and prevent this
+warning), you can set a configuration option:
+
+RSpec.configure do |c|
+  c.treat_symbols_as_metadata_keys_with_true_values = true
+end
+
+Alternately, if your intention is to use the symbol as part of the
+doc string (i.e. to specify a method name), you can change it to
+a string such as "#method_name" to remove this warning.
+*****************************************************************
+
+NOTICE
+          end
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/mocking/with_absolutely_nothing.rb b/rspec-core/lib/rspec/core/mocking/with_absolutely_nothing.rb
new file mode 100644
index 0000000..b7ee933
--- /dev/null
+++ b/rspec-core/lib/rspec/core/mocking/with_absolutely_nothing.rb
@@ -0,0 +1,11 @@
+module RSpec
+  module Core
+    module MockFrameworkAdapter
+
+      def setup_mocks_for_rspec; end
+      def verify_mocks_for_rspec; end
+      def teardown_mocks_for_rspec; end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/mocking/with_flexmock.rb b/rspec-core/lib/rspec/core/mocking/with_flexmock.rb
new file mode 100644
index 0000000..7c6e2f1
--- /dev/null
+++ b/rspec-core/lib/rspec/core/mocking/with_flexmock.rb
@@ -0,0 +1,27 @@
+#!/usr/bin/env ruby
+#
+#  Created by Jim Weirich on 2007-04-10.
+#  Copyright (c) 2007. All rights reserved.
+
+require 'flexmock/rspec'
+
+module RSpec
+  module Core
+    module MockFrameworkAdapter
+
+      def self.framework_name; :flexmock end
+
+      include FlexMock::MockContainer
+      def setup_mocks_for_rspec
+        # No setup required
+      end
+      def verify_mocks_for_rspec
+        flexmock_verify
+      end
+      def teardown_mocks_for_rspec
+        flexmock_close
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/mocking/with_mocha.rb b/rspec-core/lib/rspec/core/mocking/with_mocha.rb
new file mode 100644
index 0000000..bb96b05
--- /dev/null
+++ b/rspec-core/lib/rspec/core/mocking/with_mocha.rb
@@ -0,0 +1,52 @@
+# In order to support all versions of mocha, we have to jump through some
+# hoops here.
+#
+# mocha >= '0.13.0':
+#   require 'mocha/api' is required
+#   require 'mocha/object' raises a LoadError b/c the file no longer exists
+# mocha < '0.13.0', >= '0.9.7'
+#   require 'mocha/api' is required
+#   require 'mocha/object' is required
+# mocha < '0.9.7':
+#   require 'mocha/api' raises a LoadError b/c the file does not yet exist
+#   require 'mocha/standalone' is required
+#   require 'mocha/object' is required
+begin
+  require 'mocha/api'
+
+  begin
+    require 'mocha/object'
+  rescue LoadError
+    # Mocha >= 0.13.0 no longer contains this file nor needs it to be loaded
+  end
+rescue LoadError
+  require 'mocha/standalone'
+  require 'mocha/object'
+end
+
+module RSpec
+  module Core
+    module MockFrameworkAdapter
+      def self.framework_name; :mocha end
+
+      # Mocha::Standalone was deprecated as of Mocha 0.9.7.
+      begin
+        include Mocha::API
+      rescue NameError
+        include Mocha::Standalone
+      end
+
+      def setup_mocks_for_rspec
+        mocha_setup
+      end
+
+      def verify_mocks_for_rspec
+        mocha_verify
+      end
+
+      def teardown_mocks_for_rspec
+        mocha_teardown
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/mocking/with_rr.rb b/rspec-core/lib/rspec/core/mocking/with_rr.rb
new file mode 100644
index 0000000..d731ed0
--- /dev/null
+++ b/rspec-core/lib/rspec/core/mocking/with_rr.rb
@@ -0,0 +1,27 @@
+require 'rr'
+
+RSpec.configuration.backtrace_clean_patterns.push(RR::Errors::BACKTRACE_IDENTIFIER)
+
+module RSpec
+  module Core
+    module MockFrameworkAdapter
+
+      def self.framework_name; :rr end
+
+      include RR::Extensions::InstanceMethods
+
+      def setup_mocks_for_rspec
+        RR::Space.instance.reset
+      end
+
+      def verify_mocks_for_rspec
+        RR::Space.instance.verify_doubles
+      end
+
+      def teardown_mocks_for_rspec
+        RR::Space.instance.reset
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/mocking/with_rspec.rb b/rspec-core/lib/rspec/core/mocking/with_rspec.rb
new file mode 100644
index 0000000..f18f192
--- /dev/null
+++ b/rspec-core/lib/rspec/core/mocking/with_rspec.rb
@@ -0,0 +1,27 @@
+require 'rspec/mocks'
+
+module RSpec
+  module Core
+    module MockFrameworkAdapter
+
+      def self.framework_name; :rspec end
+
+      def self.configuration
+        RSpec::Mocks.configuration
+      end
+
+      def setup_mocks_for_rspec
+        RSpec::Mocks::setup(self)
+      end
+
+      def verify_mocks_for_rspec
+        RSpec::Mocks::verify
+      end
+
+      def teardown_mocks_for_rspec
+        RSpec::Mocks::teardown
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/option_parser.rb b/rspec-core/lib/rspec/core/option_parser.rb
new file mode 100644
index 0000000..4fad96f
--- /dev/null
+++ b/rspec-core/lib/rspec/core/option_parser.rb
@@ -0,0 +1,219 @@
+# http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html
+require 'optparse'
+
+module RSpec::Core
+  class Parser
+    def self.parse!(args)
+      new.parse!(args)
+    end
+
+    class << self
+      alias_method :parse, :parse!
+    end
+
+    def parse!(args)
+      return {} if args.empty?
+
+      convert_deprecated_args(args)
+
+      options = args.delete('--tty') ? {:tty => true} : {}
+      begin
+        parser(options).parse!(args)
+      rescue OptionParser::InvalidOption => e
+        abort "#{e.message}\n\nPlease use --help for a listing of valid options"
+      end
+
+      options
+    end
+
+    def convert_deprecated_args(args)
+      args.map! { |arg|
+        case arg
+        when "--formatter"
+          RSpec.deprecate("the --formatter option", :replacement => "-f or --format")
+          "--format"
+        when "--default_path"
+          "--default-path"
+        when "--line_number"
+          "--line-number"
+        else
+          arg
+        end
+      }
+    end
+
+    alias_method :parse, :parse!
+
+    def parser(options)
+      OptionParser.new do |parser|
+        parser.banner = "Usage: rspec [options] [files or directories]\n\n"
+
+        parser.on('-I PATH', 'Specify PATH to add to $LOAD_PATH (may be used more than once).') do |dir|
+          options[:libs] ||= []
+          options[:libs] << dir
+        end
+
+        parser.on('-r', '--require PATH', 'Require a file.') do |path|
+          options[:requires] ||= []
+          options[:requires] << path
+        end
+
+        parser.on('-O', '--options PATH', 'Specify the path to a custom options file.') do |path|
+          options[:custom_options_file] = path
+        end
+
+        parser.on('--order TYPE[:SEED]', 'Run examples by the specified order type.',
+                  '  [default] files are ordered based on the underlying file',
+                  '            system\'s order',
+                  '  [rand]    randomize the order of files, groups and examples',
+                  '  [random]  alias for rand',
+                  '  [random:SEED] e.g. --order random:123') do |o|
+          options[:order] = o
+        end
+
+        parser.on('--seed SEED', Integer, 'Equivalent of --order rand:SEED.') do |seed|
+          options[:order] = "rand:#{seed}"
+        end
+
+        parser.on('-d', '--debugger', 'Enable debugging.') do |o|
+          options[:debug] = true
+        end
+
+        parser.on('--fail-fast', 'Abort the run on first failure.') do |o|
+          options[:fail_fast] = true
+        end
+
+        parser.on('--failure-exit-code CODE', Integer, 'Override the exit code used when there are failing specs.') do |code|
+          options[:failure_exit_code] = code
+        end
+
+        parser.on('-X', '--[no-]drb', 'Run examples via DRb.') do |o|
+          options[:drb] = o
+        end
+
+        parser.on('--drb-port PORT', 'Port to connect to the DRb server.') do |o|
+          options[:drb_port] = o.to_i
+        end
+
+        parser.on('--init', 'Initialize your project with RSpec.') do |cmd|
+          ProjectInitializer.new(cmd).run
+          exit
+        end
+
+        parser.on('--configure', 'Deprecated. Use --init instead.') do |cmd|
+          warn "--configure is deprecated with no effect. Use --init instead."
+          exit
+        end
+
+        parser.separator("\n  **** Output ****\n\n")
+
+        parser.on('-f', '--format FORMATTER', 'Choose a formatter.',
+                '  [p]rogress (default - dots)',
+                '  [d]ocumentation (group and example names)',
+                '  [h]tml',
+                '  [t]extmate',
+                '  [j]son',
+                '  custom formatter class name') do |o|
+          options[:formatters] ||= []
+          options[:formatters] << [o]
+        end
+
+        parser.on('-o', '--out FILE',
+                  'Write output to a file instead of $stdout. This option applies',
+                  '  to the previously specified --format, or the default format',
+                  '  if no format is specified.'
+                 ) do |o|
+          options[:formatters] ||= [['progress']]
+          options[:formatters].last << o
+        end
+
+        parser.on('-b', '--backtrace', 'Enable full backtrace.') do |o|
+          options[:full_backtrace] = true
+        end
+
+        parser.on('-c', '--[no-]color', '--[no-]colour', 'Enable color in the output.') do |o|
+          options[:color] = o
+        end
+
+        parser.on('-p', '--[no-]profile [COUNT]', 'Enable profiling of examples and list the slowest examples (default: 10).') do |argument|
+          options[:profile_examples] = if argument.nil?
+                                         true
+                                       elsif argument == false
+                                         false
+                                       else
+                                         begin
+                                           Integer(argument)
+                                         rescue ArgumentError
+                                           Kernel.warn "Non integer specified as profile count, seperate " +
+                                                       "your path from options with -- e.g. " +
+                                                       "`rspec --profile -- #{argument}`"
+                                           true
+                                         end
+                                       end
+        end
+
+        parser.on('-w', '--warnings', 'Enable ruby warnings') do
+          options[:warnings] = true
+        end
+
+        parser.separator <<-FILTERING
+
+  **** Filtering/tags ****
+
+    In addition to the following options for selecting specific files, groups,
+    or examples, you can select a single example by appending the line number to
+    the filename:
+
+      rspec path/to/a_spec.rb:37
+
+FILTERING
+
+        parser.on('-P', '--pattern PATTERN', 'Load files matching pattern (default: "spec/**/*_spec.rb").') do |o|
+          options[:pattern] = o
+        end
+
+        parser.on('-e', '--example STRING', "Run examples whose full nested names include STRING (may be",
+                                            "  used more than once)") do |o|
+          (options[:full_description] ||= []) << Regexp.compile(Regexp.escape(o))
+        end
+
+        parser.on('-l', '--line-number LINE', 'Specify line number of an example or group (may be',
+                                              '  used more than once).') do |o|
+          (options[:line_numbers] ||= []) << o
+        end
+
+        parser.on('-t', '--tag TAG[:VALUE]',
+                  'Run examples with the specified tag, or exclude examples',
+                  'by adding ~ before the tag.',
+                  '  - e.g. ~slow',
+                  '  - TAG is always converted to a symbol') do |tag|
+          filter_type = tag =~ /^~/ ? :exclusion_filter : :inclusion_filter
+
+          name,value = tag.gsub(/^(~@|~|@)/, '').split(':')
+          name = name.to_sym
+
+          options[filter_type] ||= {}
+          options[filter_type][name] = value.nil? ? true : eval(value) rescue value
+        end
+
+        parser.on('--default-path PATH', 'Set the default path where RSpec looks for examples (can',
+                                         '  be a path to a file or a directory).') do |path|
+          options[:default_path] = path
+        end
+
+        parser.separator("\n  **** Utility ****\n\n")
+
+        parser.on('-v', '--version', 'Display the version.') do
+          puts RSpec::Core::Version::STRING
+          exit
+        end
+
+        parser.on_tail('-h', '--help', "You're looking at it.") do
+          puts parser
+          exit
+        end
+
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/pending.rb b/rspec-core/lib/rspec/core/pending.rb
new file mode 100644
index 0000000..301379c
--- /dev/null
+++ b/rspec-core/lib/rspec/core/pending.rb
@@ -0,0 +1,109 @@
+module RSpec
+  module Core
+    module Pending
+      class PendingDeclaredInExample < StandardError; end
+
+      # If Test::Unit is loaed, we'll use its error as baseclass, so that Test::Unit
+      # will report unmet RSpec expectations as failures rather than errors.
+      begin
+        class PendingExampleFixedError < Test::Unit::AssertionFailedError; end
+      rescue
+        class PendingExampleFixedError < StandardError; end
+      end
+
+      class PendingExampleFixedError
+        def pending_fixed?; true; end
+      end
+
+      NO_REASON_GIVEN = 'No reason given'
+      NOT_YET_IMPLEMENTED = 'Not yet implemented'
+
+      # @overload pending()
+      # @overload pending(message)
+      # @overload pending(message, &block)
+      #
+      # Stops execution of an example, and reports it as pending. Takes an
+      # optional message and block.
+      #
+      # @param [String] message optional message to add to the summary report.
+      # @param [Block] block optional block. If it fails, the example is
+      #   reported as pending. If it executes cleanly the example fails.
+      #
+      # @example
+      #
+      #     describe "an example" do
+      #       # reported as "Pending: no reason given"
+      #       it "is pending with no message" do
+      #         pending
+      #         this_does_not_get_executed
+      #       end
+      #
+      #       # reported as "Pending: something else getting finished"
+      #       it "is pending with a custom message" do
+      #         pending("something else getting finished")
+      #         this_does_not_get_executed
+      #       end
+      #
+      #       # reported as "Pending: something else getting finished"
+      #       it "is pending with a failing block" do
+      #         pending("something else getting finished") do
+      #           raise "this is the failure"
+      #         end
+      #       end
+      #
+      #       # reported as failure, saying we expected the block to fail but
+      #       # it passed.
+      #       it "is pending with a passing block" do
+      #         pending("something else getting finished") do
+      #           true.should be(true)
+      #         end
+      #       end
+      #     end
+      #
+      # @note `before(:each)` hooks are eval'd when you use the `pending`
+      #   method within an example. If you want to declare an example `pending`
+      #   and bypass the `before` hooks as well, you can pass `:pending => true`
+      #   to the `it` method:
+      #
+      #       it "does something", :pending => true do
+      #         # ...
+      #       end
+      #
+      #   or pass `:pending => "something else getting finished"` to add a
+      #   message to the summary report:
+      #
+      #       it "does something", :pending => "something else getting finished" do
+      #         # ...
+      #       end
+      def pending(*args)
+        return self.class.before(:each) { pending(*args) } unless example
+
+        options = args.last.is_a?(Hash) ? args.pop : {}
+        message = args.first || NO_REASON_GIVEN
+
+        if options[:unless] || (options.has_key?(:if) && !options[:if])
+          return block_given? ? yield : nil
+        end
+
+        example.metadata[:pending] = true
+        example.metadata[:execution_result][:pending_message] = message
+        if block_given?
+          begin
+            result = begin
+                       yield
+                       example.example_group_instance.instance_eval { verify_mocks_for_rspec }
+                       true
+                     end
+            example.metadata[:pending] = false
+          rescue Exception => e
+            example.execution_result[:exception] = e
+          ensure
+            teardown_mocks_for_rspec
+          end
+          raise PendingExampleFixedError.new if result
+        end
+        raise PendingDeclaredInExample.new(message)
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/project_initializer.rb b/rspec-core/lib/rspec/core/project_initializer.rb
new file mode 100644
index 0000000..0693427
--- /dev/null
+++ b/rspec-core/lib/rspec/core/project_initializer.rb
@@ -0,0 +1,86 @@
+module RSpec
+  module Core
+    class ProjectInitializer
+      def initialize(arg=nil)
+        @arg = arg
+      end
+
+      def run
+        create_spec_helper_file
+        create_dot_rspec_file
+        delete_if_confirmed("autotest/discover.rb", <<-MESSAGE)
+  RSpec registers its own discover.rb with Autotest, so autotest/discover.rb is
+  no longer needed.
+        MESSAGE
+
+        delete_if_confirmed("lib/tasks/rspec.rake", <<-MESSAGE)
+  If the file in lib/tasks/rspec.rake is the one generated by rspec-rails-1x,
+  you can get rid of it, as it is no longer needed with rspec-2.
+        MESSAGE
+      end
+
+      def create_dot_rspec_file
+        if File.exist?('.rspec')
+          report_exists('.rspec')
+        else
+          report_creating('.rspec')
+          File.open('.rspec','w') do |f|
+            f.write <<-CONTENT
+--color
+--format progress
+CONTENT
+          end
+        end
+      end
+
+      def create_spec_helper_file
+        if File.exist?('spec/spec_helper.rb')
+          report_exists("spec/spec_helper.rb")
+        else
+          report_creating("spec/spec_helper.rb")
+          FileUtils.mkdir_p('spec')
+          File.open('spec/spec_helper.rb','w') do |f|
+            f.write <<-CONTENT
+# This file was generated by the `rspec --init` command. Conventionally, all
+# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
+# Require this file using `require "spec_helper"` to ensure that it is only
+# loaded once.
+#
+# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
+RSpec.configure do |config|
+  config.treat_symbols_as_metadata_keys_with_true_values = true
+  config.run_all_when_everything_filtered = true
+  config.filter_run :focus
+
+  # Run specs in random order to surface order dependencies. If you find an
+  # order dependency and want to debug it, you can fix the order by providing
+  # the seed, which is printed after each run.
+  #     --seed 1234
+  config.order = 'random'
+end
+CONTENT
+          end
+        end
+      end
+
+      def delete_if_confirmed(path, message)
+        if File.exist?(path)
+          puts
+          puts message
+          puts
+          puts "  delete   #{path}? [y/n]"
+          FileUtils.rm_rf(path) if gets =~ /y/i
+        end
+      end
+
+      def report_exists(file)
+        puts "   exist   #{file}"
+      end
+
+      def report_creating(file)
+        puts "  create   #{file}"
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/rake_task.rb b/rspec-core/lib/rspec/core/rake_task.rb
new file mode 100644
index 0000000..a7d5aed
--- /dev/null
+++ b/rspec-core/lib/rspec/core/rake_task.rb
@@ -0,0 +1,206 @@
+require 'rspec/core/backward_compatibility'
+require 'rake'
+require 'rake/tasklib'
+require 'shellwords'
+
+module RSpec
+  module Core
+    class RakeTask < ::Rake::TaskLib
+      include ::Rake::DSL if defined?(::Rake::DSL)
+
+      # Name of task.
+      #
+      # default:
+      #   :spec
+      attr_accessor :name
+
+      # Glob pattern to match files.
+      #
+      # default:
+      #   'spec/**/*_spec.rb'
+      attr_accessor :pattern
+
+      # @deprecated
+      # Has no effect. The rake task now checks ENV['BUNDLE_GEMFILE'] instead.
+      def skip_bundler=(*)
+        deprecate("RSpec::Core::RakeTask#skip_bundler=")
+      end
+
+      # @deprecated
+      # Has no effect. The rake task now checks ENV['BUNDLE_GEMFILE'] instead.
+      def gemfile=(*)
+        deprecate("RSpec::Core::RakeTask#gemfile=", :replacement => 'ENV["BUNDLE_GEMFILE"]')
+      end
+
+      # @deprecated
+      # Use ruby_opts="-w" instead.
+      #
+      # When true, requests that the specs be run with the warning flag set.
+      # e.g. "ruby -w"
+      #
+      # default:
+      #   false
+      def warning=(true_or_false)
+        deprecate("RSpec::Core::RakeTask#warning=", :replacement => 'ruby_opts="-w"')
+        @warning = true_or_false
+      end
+
+      # Whether or not to fail Rake when an error occurs (typically when examples fail).
+      #
+      # default:
+      #   true
+      attr_accessor :fail_on_error
+
+      # A message to print to stderr when there are failures.
+      attr_accessor :failure_message
+
+      # Use verbose output. If this is set to true, the task will print the
+      # executed spec command to stdout.
+      #
+      # default:
+      #   true
+      attr_accessor :verbose
+
+      # Use rcov for code coverage?
+      #
+      # Due to the many ways `rcov` can run, if this option is enabled, it is
+      # required that `require 'rspec/autorun'` appears in `spec_helper`.rb
+      #
+      # default:
+      #   false
+      attr_accessor :rcov
+
+      # Path to rcov.
+      #
+      # default:
+      #   'rcov'
+      attr_accessor :rcov_path
+
+      # Command line options to pass to rcov.
+      #
+      # default:
+      #   nil
+      attr_accessor :rcov_opts
+
+      # Command line options to pass to ruby.
+      #
+      # default:
+      #   nil
+      attr_accessor :ruby_opts
+
+      # Path to rspec
+      #
+      # default:
+      #   'rspec'
+      attr_accessor :rspec_path
+
+      # Command line options to pass to rspec.
+      #
+      # default:
+      #   nil
+      attr_accessor :rspec_opts
+
+      # @deprecated
+      # Use rspec_opts instead.
+      #
+      # Command line options to pass to rspec.
+      #
+      # default:
+      #   nil
+      def spec_opts=(opts)
+        deprecate('RSpec::Core::RakeTask#spec_opts=', :replacement => 'rspec_opts=')
+        @rspec_opts = opts
+      end
+
+      def initialize(*args, &task_block)
+        setup_ivars(args)
+
+        desc "Run RSpec code examples" unless ::Rake.application.last_comment
+
+        task name, *args do |_, task_args|
+          RakeFileUtils.send(:verbose, verbose) do
+            task_block.call(*[self, task_args].slice(0, task_block.arity)) if task_block
+            run_task verbose
+          end
+        end
+      end
+
+      def setup_ivars(args)
+        @name = args.shift || :spec
+        @rcov_opts, @ruby_opts, @rspec_opts = nil, nil, nil
+        @warning, @rcov = false, false
+        @verbose, @fail_on_error = true, true
+
+        @rcov_path  = 'rcov'
+        @rspec_path = 'rspec'
+        @pattern    = './spec{,/*/**}/*_spec.rb'
+      end
+
+      def run_task(verbose)
+        command = spec_command
+
+        begin
+          puts command if verbose
+          success = system(command)
+        rescue
+          puts failure_message if failure_message
+        end
+        abort("#{command} failed") if fail_on_error unless success
+      end
+
+    private
+
+      if "".respond_to?(:shellescape)
+        def shellescape(string)
+          string.shellescape
+        end
+      else # 1.8.6's shellwords doesn't provide shellescape :(.
+        def shellescape(string)
+          string.gsub(/"/, '\"').gsub(/'/, "\\\\'")
+        end
+      end
+
+      def files_to_run
+        if ENV['SPEC']
+          FileList[ ENV['SPEC'] ].sort
+        else
+          FileList[ pattern ].sort.map { |f| shellescape(f) }
+        end
+      end
+
+      def spec_command
+        cmd_parts = []
+        cmd_parts << RUBY
+        cmd_parts << ruby_opts
+        cmd_parts << "-w" if @warning
+        cmd_parts << "-S" << runner
+        cmd_parts << "-Ispec:lib" << rcov_opts if rcov
+        cmd_parts << files_to_run
+        cmd_parts << "--" if rcov && rspec_opts
+        cmd_parts << rspec_opts
+        cmd_parts.flatten.reject(&blank).join(" ")
+      end
+
+      def runner
+        rcov ? rcov_path : rspec_path
+      end
+
+      def blank
+        lambda {|s| s.nil? || s == ""}
+      end
+
+      def deprecate deprecated, opts = {}
+        # unless RSpec is loaded, deprecate won't work (simply requiring the
+        # deprecate file isn't enough) so this is a check for "is rspec already
+        # loaded?" "ok use the main deprecate hook" otherwise "simple fallback"
+        # Note that we don't need rspec to be loaded for the rake task to work
+        if RSpec.respond_to?(:deprecate)
+          RSpec.deprecate deprecated, opts
+        else
+          warn "DEPRECATION: #{deprecated} is deprecated."
+        end
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/reporter.rb b/rspec-core/lib/rspec/core/reporter.rb
new file mode 100644
index 0000000..33f86f3
--- /dev/null
+++ b/rspec-core/lib/rspec/core/reporter.rb
@@ -0,0 +1,132 @@
+module RSpec::Core
+  class Reporter
+    NOTIFICATIONS = %W[start message example_group_started example_group_finished example_started
+                       example_passed example_failed example_pending start_dump dump_pending
+                       dump_failures dump_summary seed close stop deprecation deprecation_summary].map { |n| n.to_sym }
+
+    def initialize(*formatters)
+      @listeners = Hash.new { |h,k| h[k] = [] }
+      formatters.each do |formatter|
+        register_listener(formatter, *NOTIFICATIONS)
+      end
+      @example_count = @failure_count = @pending_count = 0
+      @duration = @start = nil
+    end
+
+    # @api
+    # @param [Object] An obect that wishes to be notified of reporter events
+    # @param [Array] Array of symbols represents the events a listener wishes to subscribe too
+    #
+    # Registers a listener to a list of notifications. The reporter will send notification of
+    # events to all registered listeners
+    def register_listener(listener, *notifications)
+      notifications.each do |notification|
+        @listeners[notification.to_sym] << listener if listener.respond_to?(notification)
+      end
+      true
+    end
+
+    def registered_listeners(notification)
+      @listeners[notification]
+    end
+
+    # @api
+    # @overload report(count, &block)
+    # @overload report(count, seed, &block)
+    # @param [Integer] count the number of examples being run
+    # @param [Integer] seed the seed used to randomize the spec run
+    # @param [Block] block yields itself for further reporting.
+    #
+    # Initializes the report run and yields itself for further reporting. The
+    # block is required, so that the reporter can manage cleaning up after the
+    # run.
+    #
+    # ### Warning:
+    #
+    # The `seed` argument is an internal API and is not guaranteed to be
+    # supported in the future.
+    #
+    # @example
+    #
+    #     reporter.report(group.examples.size) do |r|
+    #       example_groups.map {|g| g.run(r) }
+    #     end
+    #
+    def report(expected_example_count, seed=nil)
+      start(expected_example_count)
+      begin
+        yield self
+      ensure
+        finish(seed)
+      end
+    end
+
+    def start(expected_example_count)
+      @start = RSpec::Core::Time.now
+      notify :start, expected_example_count
+    end
+
+    def message(message)
+      notify :message, message
+    end
+
+    def example_group_started(group)
+      notify :example_group_started, group unless group.descendant_filtered_examples.empty?
+    end
+
+    def example_group_finished(group)
+      notify :example_group_finished, group unless group.descendant_filtered_examples.empty?
+    end
+
+    def example_started(example)
+      @example_count += 1
+      notify :example_started, example
+    end
+
+    def example_passed(example)
+      notify :example_passed, example
+    end
+
+    def example_failed(example)
+      @failure_count += 1
+      notify :example_failed, example
+    end
+
+    def example_pending(example)
+      @pending_count += 1
+      notify :example_pending, example
+    end
+
+    def deprecation(message)
+      notify :deprecation, message
+    end
+
+    def finish(seed)
+      begin
+        stop
+        notify :start_dump
+        notify :dump_pending
+        notify :dump_failures
+        notify :dump_summary, @duration, @example_count, @failure_count, @pending_count
+        notify :deprecation_summary
+        notify :seed, seed if seed
+      ensure
+        notify :close
+      end
+    end
+
+    alias_method :abort, :finish
+
+    def stop
+      @duration = (RSpec::Core::Time.now - @start).to_f if @start
+      notify :stop
+    end
+
+    def notify(event, *args, &block)
+      registered_listeners(event).each do |formatter|
+        formatter.send(event, *args, &block)
+      end
+    end
+
+  end
+end
diff --git a/rspec-core/lib/rspec/core/ruby_project.rb b/rspec-core/lib/rspec/core/ruby_project.rb
new file mode 100644
index 0000000..ee4fbe8
--- /dev/null
+++ b/rspec-core/lib/rspec/core/ruby_project.rb
@@ -0,0 +1,44 @@
+# This is borrowed (slightly modified) from Scott Taylor's
+# project_path project:
+#   http://github.com/smtlaissezfaire/project_path
+
+require 'pathname'
+
+module RSpec
+  module Core
+    module RubyProject
+      def add_to_load_path(*dirs)
+        dirs.map {|dir| add_dir_to_load_path(File.join(root, dir))}
+      end
+
+      def add_dir_to_load_path(dir)
+        $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)
+      end
+
+      def root
+        @project_root ||= determine_root
+      end
+
+      def determine_root
+        find_first_parent_containing('spec') || '.'
+      end
+
+      def find_first_parent_containing(dir)
+        ascend_until {|path| File.exists?(File.join(path, dir))}
+      end
+
+      def ascend_until
+        Pathname(File.expand_path('.')).ascend do |path|
+          return path if yield(path)
+        end
+      end
+
+      module_function :add_to_load_path
+      module_function :add_dir_to_load_path
+      module_function :root
+      module_function :determine_root
+      module_function :find_first_parent_containing
+      module_function :ascend_until
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/runner.rb b/rspec-core/lib/rspec/core/runner.rb
new file mode 100644
index 0000000..c66353e
--- /dev/null
+++ b/rspec-core/lib/rspec/core/runner.rb
@@ -0,0 +1,87 @@
+module RSpec
+  module Core
+    class Runner
+
+      # Register an at_exit hook that runs the suite.
+      def self.autorun
+        return if autorun_disabled? || installed_at_exit? || running_in_drb?
+        at_exit do
+          # Don't bother running any specs and just let the program terminate
+          # if we got here due to an unrescued exception (anything other than
+          # SystemExit, which is raised when somebody calls Kernel#exit).
+          next unless $!.nil? || $!.kind_of?(SystemExit)
+
+          # We got here because either the end of the program was reached or
+          # somebody called Kernel#exit.  Run the specs and then override any
+          # existing exit status with RSpec's exit status if any specs failed.
+          status = run(ARGV, $stderr, $stdout).to_i
+          exit status if status != 0
+        end
+        @installed_at_exit = true
+      end
+      AT_EXIT_HOOK_BACKTRACE_LINE = "#{__FILE__}:#{__LINE__ - 2}:in `autorun'"
+
+      def self.disable_autorun!
+        @autorun_disabled = true
+      end
+
+      def self.autorun_disabled?
+        @autorun_disabled ||= false
+      end
+
+      def self.installed_at_exit?
+        @installed_at_exit ||= false
+      end
+
+      def self.running_in_drb?
+        defined?(DRb) &&
+        (DRb.current_server rescue false) &&
+         DRb.current_server.uri =~ /druby\:\/\/127.0.0.1\:/
+      end
+
+      def self.trap_interrupt
+        trap('INT') do
+          exit!(1) if RSpec.wants_to_quit
+          RSpec.wants_to_quit = true
+          STDERR.puts "\nExiting... Interrupt again to exit immediately."
+        end
+      end
+
+      # Run a suite of RSpec examples.
+      #
+      # This is used internally by RSpec to run a suite, but is available
+      # for use by any other automation tool.
+      #
+      # If you want to run this multiple times in the same process, and you
+      # want files like spec_helper.rb to be reloaded, be sure to load `load`
+      # instead of `require`.
+      #
+      # #### Parameters
+      # * +args+ - an array of command-line-supported arguments
+      # * +err+ - error stream (Default: $stderr)
+      # * +out+ - output stream (Default: $stdout)
+      #
+      # #### Returns
+      # * +Fixnum+ - exit status code (0/1)
+      def self.run(args, err=$stderr, out=$stdout)
+        trap_interrupt
+        options = ConfigurationOptions.new(args)
+        options.parse_options
+
+        if options.options[:drb]
+          require 'rspec/core/drb_command_line'
+          begin
+            DRbCommandLine.new(options).run(err, out)
+          rescue DRb::DRbConnError
+            err.puts "No DRb server is running. Running in local process instead ..."
+            CommandLine.new(options).run(err, out)
+          end
+        else
+          CommandLine.new(options).run(err, out)
+        end
+      ensure
+        RSpec.reset
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/shared_context.rb b/rspec-core/lib/rspec/core/shared_context.rb
new file mode 100644
index 0000000..43da70f
--- /dev/null
+++ b/rspec-core/lib/rspec/core/shared_context.rb
@@ -0,0 +1,55 @@
+module RSpec
+  module Core
+    # Exposes {ExampleGroup}-level methods to a module, so you can include that
+    # module in an {ExampleGroup}.
+    #
+    # @example
+    #
+    #     module LoggedInAsAdmin
+    #       extend RSpec::Core::SharedContext
+    #       before(:each) do
+    #         log_in_as :admin
+    #       end
+    #     end
+    #
+    #     describe "admin section" do
+    #       include LoggedInAsAdmin
+    #       # ...
+    #     end
+    module SharedContext
+      # @api private
+      def included(group)
+        __shared_context_recordings.each do |recording|
+          recording.playback_onto(group)
+        end
+      end
+
+      # @api private
+      def __shared_context_recordings
+        @__shared_context_recordings ||= []
+      end
+
+      Recording = Struct.new(:method_name, :args, :block) do
+        def playback_onto(group)
+          group.__send__(method_name, *args, &block)
+        end
+      end
+
+      # @api private
+      def self.record(methods)
+        methods.each do |meth|
+          class_eval <<-EOS, __FILE__, __LINE__ + 1
+            def #{meth}(*args, &block)
+              __shared_context_recordings << Recording.new(:#{meth}, args, block)
+            end
+          EOS
+        end
+      end
+
+      record [:describe, :context] + Hooks.instance_methods(false) +
+        MemoizedHelpers::ClassMethods.instance_methods(false)
+    end
+  end
+
+  SharedContext = Core::SharedContext
+end
diff --git a/rspec-core/lib/rspec/core/shared_example_group.rb b/rspec-core/lib/rspec/core/shared_example_group.rb
new file mode 100644
index 0000000..c06a6ab
--- /dev/null
+++ b/rspec-core/lib/rspec/core/shared_example_group.rb
@@ -0,0 +1,185 @@
+module RSpec
+  module Core
+    module SharedExampleGroup
+      # @overload shared_examples(name, &block)
+      # @overload shared_examples(name, tags, &block)
+      #
+      # Wraps the `block` in a module which can then be included in example
+      # groups using `include_examples`, `include_context`, or
+      # `it_behaves_like`.
+      #
+      # @param [String] name to match when looking up this shared group
+      # @param block to be eval'd in a nested example group generated by `it_behaves_like`
+      #
+      # @example
+      #
+      #   shared_examples "auditable" do
+      #     it "stores an audit record on save!" do
+      #       lambda { auditable.save! }.should change(Audit, :count).by(1)
+      #     end
+      #   end
+      #
+      #   class Account do
+      #     it_behaves_like "auditable" do
+      #       def auditable; Account.new; end
+      #     end
+      #   end
+      #
+      # @see ExampleGroup.it_behaves_like
+      # @see ExampleGroup.include_examples
+      # @see ExampleGroup.include_context
+      def shared_examples(*args, &block)
+        SharedExampleGroup.registry.add_group(self, *args, &block)
+      end
+
+      alias_method :shared_context,      :shared_examples
+      alias_method :share_examples_for,  :shared_examples
+      alias_method :shared_examples_for, :shared_examples
+
+      # @deprecated
+      def share_as(name, &block)
+        RSpec.deprecate("Rspec::Core::SharedExampleGroup#share_as",
+                        :replacement => "RSpec::SharedContext or shared_examples")
+        SharedExampleGroup.registry.add_const(self, name, &block)
+      end
+
+      def shared_example_groups
+        SharedExampleGroup.registry.shared_example_groups_for('main', *ancestors[0..-1])
+      end
+
+      module TopLevelDSL
+        def shared_examples(*args, &block)
+          SharedExampleGroup.registry.add_group('main', *args, &block)
+        end
+
+        alias_method :shared_context,      :shared_examples
+        alias_method :share_examples_for,  :shared_examples
+        alias_method :shared_examples_for, :shared_examples
+
+        def share_as(name, &block)
+          RSpec.deprecate("Rspec::Core::SharedExampleGroup#share_as",
+                          :replacement => "RSpec::SharedContext or shared_examples")
+          SharedExampleGroup.registry.add_const('main', name, &block)
+        end
+
+        def shared_example_groups
+          SharedExampleGroup.registry.shared_example_groups_for('main')
+        end
+      end
+
+      def self.registry
+        @registry ||= Registry.new
+      end
+
+      # @private
+      #
+      # Used internally to manage the shared example groups and
+      # constants. We want to limit the number of methods we add
+      # to objects we don't own (main and Module) so this allows
+      # us to have helper methods that don't get added to those
+      # objects.
+      class Registry
+        def add_group(source, *args, &block)
+          ensure_block_has_source_location(block, caller[1])
+
+          if key? args.first
+            key = args.shift
+            warn_if_key_taken source, key, block
+            add_shared_example_group source, key, block
+          end
+
+          unless args.empty?
+            mod = Module.new
+            (class << mod; self; end).send :define_method, :extended  do |host|
+              host.class_eval(&block)
+            end
+            RSpec.configuration.extend mod, *args
+          end
+        end
+
+        def add_const(source, name, &block)
+          if Object.const_defined?(name)
+            mod = Object.const_get(name)
+            raise_name_error unless mod.created_from_caller(caller)
+          end
+
+          mod = Module.new do
+            @shared_block = block
+            @caller_line = caller.last
+
+            def self.created_from_caller(other_caller)
+              @caller_line == other_caller.last
+            end
+
+            def self.included(kls)
+              kls.describe(&@shared_block)
+              kls.children.first.metadata[:shared_group_name] = name
+            end
+          end
+
+          shared_const = Object.const_set(name, mod)
+          add_shared_example_group source, shared_const, block
+        end
+
+        def shared_example_groups_for(*sources)
+          Collection.new(sources, shared_example_groups)
+        end
+
+        def shared_example_groups
+          @shared_example_groups ||= Hash.new { |hash,key| hash[key] = Hash.new }
+        end
+
+        def clear
+          shared_example_groups.clear
+        end
+
+      private
+
+        def add_shared_example_group(source, key, block)
+          shared_example_groups[source][key] = block
+        end
+
+        def key?(candidate)
+          [String, Symbol, Module].any? { |cls| cls === candidate }
+        end
+
+        def raise_name_error
+          raise NameError, "The first argument (#{name}) to share_as must be a legal name for a constant not already in use."
+        end
+
+        def warn_if_key_taken(source, key, new_block)
+          return unless existing_block = example_block_for(source, key)
+
+          Kernel.warn <<-WARNING.gsub(/^ +\|/, '')
+            |WARNING: Shared example group '#{key}' has been previously defined at:
+            |  #{formatted_location existing_block}
+            |...and you are now defining it at:
+            |  #{formatted_location new_block}
+            |The new definition will overwrite the original one.
+          WARNING
+        end
+
+        def formatted_location(block)
+          block.source_location.join ":"
+        end
+
+        def example_block_for(source, key)
+          shared_example_groups[source][key]
+        end
+
+        def ensure_block_has_source_location(block, caller_line)
+          return if block.respond_to?(:source_location)
+
+          block.extend Module.new {
+            define_method :source_location do
+              caller_line.split(':')
+            end
+          }
+        end
+      end
+    end
+  end
+end
+
+extend RSpec::Core::SharedExampleGroup::TopLevelDSL
+Module.send(:include, RSpec::Core::SharedExampleGroup::TopLevelDSL)
diff --git a/rspec-core/lib/rspec/core/shared_example_group/collection.rb b/rspec-core/lib/rspec/core/shared_example_group/collection.rb
new file mode 100644
index 0000000..6047598
--- /dev/null
+++ b/rspec-core/lib/rspec/core/shared_example_group/collection.rb
@@ -0,0 +1,43 @@
+module RSpec
+  module Core
+    module SharedExampleGroup
+      class Collection
+
+        def initialize(sources, examples)
+          @sources, @examples = sources, examples
+        end
+
+        def [](key)
+          fetch_examples(key) || warn_deprecation_and_fetch_anyway(key)
+        end
+
+        private
+
+          def fetch_examples(key)
+            @examples[source_for key][key]
+          end
+
+          def source_for(key)
+            @sources.reverse.find { |source| @examples[source].has_key? key }
+          end
+
+          def fetch_anyway(key)
+            @examples.values.inject({}, &:merge)[key]
+          end
+
+          def warn_deprecation_and_fetch_anyway(key)
+            if (example = fetch_anyway key)
+              backtrace_line = caller.find { |line| !line.include?('lib/rspec/core') }
+              RSpec.warn_deprecation <<-WARNING.gsub(/^ /, '')
+                Accessing shared_examples defined across contexts is deprecated.
+                Please declare shared_examples within a shared context, or at the top level.
+                This message was generated at: #{backtrace_line}
+              WARNING
+              example
+            end
+          end
+
+      end
+    end
+  end
+end
diff --git a/rspec-core/lib/rspec/core/version.rb b/rspec-core/lib/rspec/core/version.rb
new file mode 100644
index 0000000..98364f1
--- /dev/null
+++ b/rspec-core/lib/rspec/core/version.rb
@@ -0,0 +1,8 @@
+module RSpec
+  module Core
+    module Version
+      STRING = '2.14.5'
+    end
+  end
+end
+
diff --git a/rspec-core/lib/rspec/core/world.rb b/rspec-core/lib/rspec/core/world.rb
new file mode 100644
index 0000000..03af2ee
--- /dev/null
+++ b/rspec-core/lib/rspec/core/world.rb
@@ -0,0 +1,127 @@
+module RSpec
+  module Core
+    class World
+
+      include RSpec::Core::Hooks
+
+      attr_reader :example_groups, :filtered_examples
+      attr_accessor :wants_to_quit
+
+      def initialize(configuration=RSpec.configuration)
+        @configuration = configuration
+        @example_groups = [].extend(Extensions::Ordered::ExampleGroups)
+        @filtered_examples = Hash.new { |hash,group|
+          hash[group] = begin
+            examples = group.examples.dup
+            examples = filter_manager.prune(examples)
+            examples.uniq
+            examples.extend(Extensions::Ordered::Examples)
+          end
+        }
+      end
+
+      def reset
+        example_groups.clear
+        SharedExampleGroup.registry.clear
+      end
+
+      def filter_manager
+        @configuration.filter_manager
+      end
+
+      def register(example_group)
+        example_groups << example_group
+        example_group
+      end
+
+      def inclusion_filter
+        @configuration.inclusion_filter
+      end
+
+      def exclusion_filter
+        @configuration.exclusion_filter
+      end
+
+      def configure_group(group)
+        @configuration.configure_group(group)
+      end
+
+      def example_count
+        example_groups.collect {|g| g.descendants}.flatten.inject(0) do |sum, g|
+          sum += g.filtered_examples.size
+        end
+      end
+
+      def preceding_declaration_line(filter_line)
+        declaration_line_numbers.sort.inject(nil) do |highest_prior_declaration_line, line|
+          line <= filter_line ? line : highest_prior_declaration_line
+        end
+      end
+
+      def reporter
+        @configuration.reporter
+      end
+
+      def announce_filters
+        filter_announcements = []
+
+        announce_inclusion_filter filter_announcements
+        announce_exclusion_filter filter_announcements
+
+        unless filter_manager.empty?
+          if filter_announcements.length == 1
+            reporter.message("Run options: #{filter_announcements[0]}")
+          else
+            reporter.message("Run options:\n  #{filter_announcements.join("\n  ")}")
+          end
+        end
+
+        if @configuration.run_all_when_everything_filtered? && example_count.zero?
+          reporter.message("#{everything_filtered_message}; ignoring #{inclusion_filter.description}")
+          filtered_examples.clear
+          inclusion_filter.clear
+        end
+
+        if example_count.zero?
+          example_groups.clear
+          if filter_manager.empty?
+            reporter.message("No examples found.")
+          elsif exclusion_filter.empty_without_conditional_filters?
+            message = everything_filtered_message
+            if @configuration.run_all_when_everything_filtered?
+              message << "; ignoring #{inclusion_filter.description}"
+            end
+            reporter.message(message)
+          elsif inclusion_filter.empty?
+            reporter.message(everything_filtered_message)
+          end
+        end
+      end
+
+      def everything_filtered_message
+        "\nAll examples were filtered out"
+      end
+
+      def announce_inclusion_filter(announcements)
+        unless inclusion_filter.empty?
+          announcements << "include #{inclusion_filter.description}"
+        end
+      end
+
+      def announce_exclusion_filter(announcements)
+        unless exclusion_filter.empty_without_conditional_filters?
+          announcements << "exclude #{exclusion_filter.description}"
+        end
+      end
+
+    private
+
+      def declaration_line_numbers
+        @line_numbers ||= example_groups.inject([]) do |lines, g|
+          lines + g.declaration_line_numbers
+        end
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/metadata.yml b/rspec-core/metadata.yml
new file mode 100644
index 0000000..3ba95fd
--- /dev/null
+++ b/rspec-core/metadata.yml
@@ -0,0 +1,547 @@
+--- !ruby/object:Gem::Specification
+name: rspec-core
+version: !ruby/object:Gem::Version
+  prerelease: 
+  version: 2.14.5
+platform: ruby
+authors:
+- Steven Baker
+- David Chelimsky
+- Chad Humphries
+autorequire: 
+bindir: exe
+cert_chain: []
+date: 2013-08-14 00:00:00.000000000 Z
+dependencies:
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 10.0.0
+    none: false
+  prerelease: false
+  name: rake
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 10.0.0
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.1.9
+    none: false
+  prerelease: false
+  name: cucumber
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.1.9
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '0.5'
+    none: false
+  prerelease: false
+  name: aruba
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '0.5'
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '4.6'
+    none: false
+  prerelease: false
+  name: ZenTest
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '4.6'
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - '='
+      - !ruby/object:Gem::Version
+        version: 1.5.2
+    none: false
+  prerelease: false
+  name: nokogiri
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - '='
+      - !ruby/object:Gem::Version
+        version: 1.5.2
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - '='
+      - !ruby/object:Gem::Version
+        version: 1.0.0
+    none: false
+  prerelease: false
+  name: syntax
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - '='
+      - !ruby/object:Gem::Version
+        version: 1.0.0
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 0.13.0
+    none: false
+  prerelease: false
+  name: mocha
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 0.13.0
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.0.4
+    none: false
+  prerelease: false
+  name: rr
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.0.4
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 0.9.0
+    none: false
+  prerelease: false
+  name: flexmock
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 0.9.0
+    none: false
+  type: :development
+description: BDD for Ruby. RSpec runner and example groups.
+email: rspec-users at rubyforge.org
+executables:
+- autospec
+- rspec
+extensions: []
+extra_rdoc_files: []
+files:
+- lib/autotest/discover.rb
+- lib/autotest/rspec2.rb
+- lib/rspec/autorun.rb
+- lib/rspec/core.rb
+- lib/rspec/core/backtrace_cleaner.rb
+- lib/rspec/core/backward_compatibility.rb
+- lib/rspec/core/command_line.rb
+- lib/rspec/core/configuration.rb
+- lib/rspec/core/configuration_options.rb
+- lib/rspec/core/deprecation.rb
+- lib/rspec/core/drb_command_line.rb
+- lib/rspec/core/drb_options.rb
+- lib/rspec/core/dsl.rb
+- lib/rspec/core/example.rb
+- lib/rspec/core/example_group.rb
+- lib/rspec/core/extensions/instance_eval_with_args.rb
+- lib/rspec/core/extensions/kernel.rb
+- lib/rspec/core/extensions/module_eval_with_args.rb
+- lib/rspec/core/extensions/ordered.rb
+- lib/rspec/core/filter_manager.rb
+- lib/rspec/core/formatters.rb
+- lib/rspec/core/formatters/base_formatter.rb
+- lib/rspec/core/formatters/base_text_formatter.rb
+- lib/rspec/core/formatters/deprecation_formatter.rb
+- lib/rspec/core/formatters/documentation_formatter.rb
+- lib/rspec/core/formatters/helpers.rb
+- lib/rspec/core/formatters/html_formatter.rb
+- lib/rspec/core/formatters/html_printer.rb
+- lib/rspec/core/formatters/json_formatter.rb
+- lib/rspec/core/formatters/progress_formatter.rb
+- lib/rspec/core/formatters/snippet_extractor.rb
+- lib/rspec/core/formatters/text_mate_formatter.rb
+- lib/rspec/core/hooks.rb
+- lib/rspec/core/memoized_helpers.rb
+- lib/rspec/core/metadata.rb
+- lib/rspec/core/metadata_hash_builder.rb
+- lib/rspec/core/mocking/with_absolutely_nothing.rb
+- lib/rspec/core/mocking/with_flexmock.rb
+- lib/rspec/core/mocking/with_mocha.rb
+- lib/rspec/core/mocking/with_rr.rb
+- lib/rspec/core/mocking/with_rspec.rb
+- lib/rspec/core/option_parser.rb
+- lib/rspec/core/pending.rb
+- lib/rspec/core/project_initializer.rb
+- lib/rspec/core/rake_task.rb
+- lib/rspec/core/reporter.rb
+- lib/rspec/core/ruby_project.rb
+- lib/rspec/core/runner.rb
+- lib/rspec/core/shared_context.rb
+- lib/rspec/core/shared_example_group.rb
+- lib/rspec/core/shared_example_group/collection.rb
+- lib/rspec/core/version.rb
+- lib/rspec/core/world.rb
+- README.md
+- License.txt
+- Changelog.md
+- .yardopts
+- .document
+- features/Autotest.md
+- features/README.md
+- features/Upgrade.md
+- features/command_line/README.md
+- features/command_line/example_name_option.feature
+- features/command_line/exit_status.feature
+- features/command_line/format_option.feature
+- features/command_line/init.feature
+- features/command_line/line_number_appended_to_path.feature
+- features/command_line/line_number_option.feature
+- features/command_line/order.feature
+- features/command_line/pattern_option.feature
+- features/command_line/rake_task.feature
+- features/command_line/require_option.feature
+- features/command_line/ruby.feature
+- features/command_line/tag.feature
+- features/command_line/warnings_option.feature
+- features/configuration/alias_example_to.feature
+- features/configuration/backtrace_clean_patterns.feature
+- features/configuration/custom_settings.feature
+- features/configuration/default_path.feature
+- features/configuration/deprecation_stream.feature
+- features/configuration/fail_fast.feature
+- features/configuration/failure_exit_code.feature
+- features/configuration/order_and_seed.feature
+- features/configuration/output_stream.feature
+- features/configuration/pattern.feature
+- features/configuration/profile.feature
+- features/configuration/read_options_from_file.feature
+- features/configuration/run_all_when_everything_filtered.feature
+- features/configuration/show_failures_in_pending_blocks.feature
+- features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
+- features/example_groups/basic_structure.feature
+- features/example_groups/shared_context.feature
+- features/example_groups/shared_examples.feature
+- features/expectation_framework_integration/configure_expectation_framework.feature
+- features/filtering/exclusion_filters.feature
+- features/filtering/if_and_unless.feature
+- features/filtering/inclusion_filters.feature
+- features/formatters/configurable_colors.feature
+- features/formatters/custom_formatter.feature
+- features/formatters/json_formatter.feature
+- features/formatters/text_formatter.feature
+- features/helper_methods/arbitrary_methods.feature
+- features/helper_methods/let.feature
+- features/helper_methods/modules.feature
+- features/hooks/around_hooks.feature
+- features/hooks/before_and_after_hooks.feature
+- features/hooks/filtering.feature
+- features/metadata/current_example.feature
+- features/metadata/described_class.feature
+- features/metadata/user_defined.feature
+- features/mock_framework_integration/use_any_framework.feature
+- features/mock_framework_integration/use_flexmock.feature
+- features/mock_framework_integration/use_mocha.feature
+- features/mock_framework_integration/use_rr.feature
+- features/mock_framework_integration/use_rspec.feature
+- features/pending/pending_examples.feature
+- features/spec_files/arbitrary_file_suffix.feature
+- features/step_definitions/additional_cli_steps.rb
+- features/subject/attribute_of_subject.feature
+- features/subject/explicit_subject.feature
+- features/subject/implicit_receiver.feature
+- features/subject/implicit_subject.feature
+- features/support/env.rb
+- features/support/rubinius.rb
+- spec/autotest/discover_spec.rb
+- spec/autotest/failed_results_re_spec.rb
+- spec/autotest/rspec_spec.rb
+- spec/command_line/order_spec.rb
+- spec/rspec/core/backtrace_cleaner_spec.rb
+- spec/rspec/core/command_line_spec.rb
+- spec/rspec/core/command_line_spec_output.txt
+- spec/rspec/core/configuration_options_spec.rb
+- spec/rspec/core/configuration_spec.rb
+- spec/rspec/core/deprecation_spec.rb
+- spec/rspec/core/deprecations_spec.rb
+- spec/rspec/core/drb_command_line_spec.rb
+- spec/rspec/core/drb_options_spec.rb
+- spec/rspec/core/dsl_spec.rb
+- spec/rspec/core/example_group_spec.rb
+- spec/rspec/core/example_spec.rb
+- spec/rspec/core/filter_manager_spec.rb
+- spec/rspec/core/formatters/base_formatter_spec.rb
+- spec/rspec/core/formatters/base_text_formatter_spec.rb
+- spec/rspec/core/formatters/deprecation_formatter_spec.rb
+- spec/rspec/core/formatters/documentation_formatter_spec.rb
+- spec/rspec/core/formatters/helpers_spec.rb
+- spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html
+- spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html
+- spec/rspec/core/formatters/html_formatted-1.8.7.html
+- spec/rspec/core/formatters/html_formatted-1.9.2.html
+- spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html
+- spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html
+- spec/rspec/core/formatters/html_formatted-1.9.3.html
+- spec/rspec/core/formatters/html_formatted-2.0.0.html
+- spec/rspec/core/formatters/html_formatter_spec.rb
+- spec/rspec/core/formatters/json_formatter_spec.rb
+- spec/rspec/core/formatters/progress_formatter_spec.rb
+- spec/rspec/core/formatters/snippet_extractor_spec.rb
+- spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html
+- spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html
+- spec/rspec/core/formatters/text_mate_formatted-1.8.7.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.2.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.3.html
+- spec/rspec/core/formatters/text_mate_formatted-2.0.0.html
+- spec/rspec/core/formatters/text_mate_formatter_spec.rb
+- spec/rspec/core/hooks_filtering_spec.rb
+- spec/rspec/core/hooks_spec.rb
+- spec/rspec/core/kernel_extensions_spec.rb
+- spec/rspec/core/memoized_helpers_spec.rb
+- spec/rspec/core/metadata_spec.rb
+- spec/rspec/core/option_parser_spec.rb
+- spec/rspec/core/pending_example_spec.rb
+- spec/rspec/core/project_initializer_spec.rb
+- spec/rspec/core/rake_task_spec.rb
+- spec/rspec/core/reporter_spec.rb
+- spec/rspec/core/resources/a_bar.rb
+- spec/rspec/core/resources/a_foo.rb
+- spec/rspec/core/resources/a_spec.rb
+- spec/rspec/core/resources/custom_example_group_runner.rb
+- spec/rspec/core/resources/formatter_specs.rb
+- spec/rspec/core/resources/utf8_encoded.rb
+- spec/rspec/core/rspec_matchers_spec.rb
+- spec/rspec/core/ruby_project_spec.rb
+- spec/rspec/core/runner_spec.rb
+- spec/rspec/core/shared_context_spec.rb
+- spec/rspec/core/shared_example_group/collection_spec.rb
+- spec/rspec/core/shared_example_group_spec.rb
+- spec/rspec/core/world_spec.rb
+- spec/rspec/core_spec.rb
+- spec/spec_helper.rb
+- spec/support/config_options_helper.rb
+- spec/support/helper_methods.rb
+- spec/support/isolate_load_path_mutation.rb
+- spec/support/isolated_directory.rb
+- spec/support/isolated_home_directory.rb
+- spec/support/matchers.rb
+- spec/support/sandboxed_mock_space.rb
+- spec/support/shared_example_groups.rb
+- spec/support/spec_files.rb
+- exe/autospec
+- exe/rspec
+homepage: http://github.com/rspec/rspec-core
+licenses:
+- MIT
+post_install_message: 
+rdoc_options:
+- --charset=UTF-8
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+      segments:
+      - 0
+      hash: 2492327081030983877
+  none: false
+required_rubygems_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+      segments:
+      - 0
+      hash: 2492327081030983877
+  none: false
+requirements: []
+rubyforge_project: rspec
+rubygems_version: 1.8.24
+signing_key: 
+specification_version: 3
+summary: rspec-core-2.14.5
+test_files:
+- features/Autotest.md
+- features/README.md
+- features/Upgrade.md
+- features/command_line/README.md
+- features/command_line/example_name_option.feature
+- features/command_line/exit_status.feature
+- features/command_line/format_option.feature
+- features/command_line/init.feature
+- features/command_line/line_number_appended_to_path.feature
+- features/command_line/line_number_option.feature
+- features/command_line/order.feature
+- features/command_line/pattern_option.feature
+- features/command_line/rake_task.feature
+- features/command_line/require_option.feature
+- features/command_line/ruby.feature
+- features/command_line/tag.feature
+- features/command_line/warnings_option.feature
+- features/configuration/alias_example_to.feature
+- features/configuration/backtrace_clean_patterns.feature
+- features/configuration/custom_settings.feature
+- features/configuration/default_path.feature
+- features/configuration/deprecation_stream.feature
+- features/configuration/fail_fast.feature
+- features/configuration/failure_exit_code.feature
+- features/configuration/order_and_seed.feature
+- features/configuration/output_stream.feature
+- features/configuration/pattern.feature
+- features/configuration/profile.feature
+- features/configuration/read_options_from_file.feature
+- features/configuration/run_all_when_everything_filtered.feature
+- features/configuration/show_failures_in_pending_blocks.feature
+- features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature
+- features/example_groups/basic_structure.feature
+- features/example_groups/shared_context.feature
+- features/example_groups/shared_examples.feature
+- features/expectation_framework_integration/configure_expectation_framework.feature
+- features/filtering/exclusion_filters.feature
+- features/filtering/if_and_unless.feature
+- features/filtering/inclusion_filters.feature
+- features/formatters/configurable_colors.feature
+- features/formatters/custom_formatter.feature
+- features/formatters/json_formatter.feature
+- features/formatters/text_formatter.feature
+- features/helper_methods/arbitrary_methods.feature
+- features/helper_methods/let.feature
+- features/helper_methods/modules.feature
+- features/hooks/around_hooks.feature
+- features/hooks/before_and_after_hooks.feature
+- features/hooks/filtering.feature
+- features/metadata/current_example.feature
+- features/metadata/described_class.feature
+- features/metadata/user_defined.feature
+- features/mock_framework_integration/use_any_framework.feature
+- features/mock_framework_integration/use_flexmock.feature
+- features/mock_framework_integration/use_mocha.feature
+- features/mock_framework_integration/use_rr.feature
+- features/mock_framework_integration/use_rspec.feature
+- features/pending/pending_examples.feature
+- features/spec_files/arbitrary_file_suffix.feature
+- features/step_definitions/additional_cli_steps.rb
+- features/subject/attribute_of_subject.feature
+- features/subject/explicit_subject.feature
+- features/subject/implicit_receiver.feature
+- features/subject/implicit_subject.feature
+- features/support/env.rb
+- features/support/rubinius.rb
+- spec/autotest/discover_spec.rb
+- spec/autotest/failed_results_re_spec.rb
+- spec/autotest/rspec_spec.rb
+- spec/command_line/order_spec.rb
+- spec/rspec/core/backtrace_cleaner_spec.rb
+- spec/rspec/core/command_line_spec.rb
+- spec/rspec/core/command_line_spec_output.txt
+- spec/rspec/core/configuration_options_spec.rb
+- spec/rspec/core/configuration_spec.rb
+- spec/rspec/core/deprecation_spec.rb
+- spec/rspec/core/deprecations_spec.rb
+- spec/rspec/core/drb_command_line_spec.rb
+- spec/rspec/core/drb_options_spec.rb
+- spec/rspec/core/dsl_spec.rb
+- spec/rspec/core/example_group_spec.rb
+- spec/rspec/core/example_spec.rb
+- spec/rspec/core/filter_manager_spec.rb
+- spec/rspec/core/formatters/base_formatter_spec.rb
+- spec/rspec/core/formatters/base_text_formatter_spec.rb
+- spec/rspec/core/formatters/deprecation_formatter_spec.rb
+- spec/rspec/core/formatters/documentation_formatter_spec.rb
+- spec/rspec/core/formatters/helpers_spec.rb
+- spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html
+- spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html
+- spec/rspec/core/formatters/html_formatted-1.8.7.html
+- spec/rspec/core/formatters/html_formatted-1.9.2.html
+- spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html
+- spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html
+- spec/rspec/core/formatters/html_formatted-1.9.3.html
+- spec/rspec/core/formatters/html_formatted-2.0.0.html
+- spec/rspec/core/formatters/html_formatter_spec.rb
+- spec/rspec/core/formatters/json_formatter_spec.rb
+- spec/rspec/core/formatters/progress_formatter_spec.rb
+- spec/rspec/core/formatters/snippet_extractor_spec.rb
+- spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html
+- spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html
+- spec/rspec/core/formatters/text_mate_formatted-1.8.7.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.2.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html
+- spec/rspec/core/formatters/text_mate_formatted-1.9.3.html
+- spec/rspec/core/formatters/text_mate_formatted-2.0.0.html
+- spec/rspec/core/formatters/text_mate_formatter_spec.rb
+- spec/rspec/core/hooks_filtering_spec.rb
+- spec/rspec/core/hooks_spec.rb
+- spec/rspec/core/kernel_extensions_spec.rb
+- spec/rspec/core/memoized_helpers_spec.rb
+- spec/rspec/core/metadata_spec.rb
+- spec/rspec/core/option_parser_spec.rb
+- spec/rspec/core/pending_example_spec.rb
+- spec/rspec/core/project_initializer_spec.rb
+- spec/rspec/core/rake_task_spec.rb
+- spec/rspec/core/reporter_spec.rb
+- spec/rspec/core/resources/a_bar.rb
+- spec/rspec/core/resources/a_foo.rb
+- spec/rspec/core/resources/a_spec.rb
+- spec/rspec/core/resources/custom_example_group_runner.rb
+- spec/rspec/core/resources/formatter_specs.rb
+- spec/rspec/core/resources/utf8_encoded.rb
+- spec/rspec/core/rspec_matchers_spec.rb
+- spec/rspec/core/ruby_project_spec.rb
+- spec/rspec/core/runner_spec.rb
+- spec/rspec/core/shared_context_spec.rb
+- spec/rspec/core/shared_example_group/collection_spec.rb
+- spec/rspec/core/shared_example_group_spec.rb
+- spec/rspec/core/world_spec.rb
+- spec/rspec/core_spec.rb
+- spec/spec_helper.rb
+- spec/support/config_options_helper.rb
+- spec/support/helper_methods.rb
+- spec/support/isolate_load_path_mutation.rb
+- spec/support/isolated_directory.rb
+- spec/support/isolated_home_directory.rb
+- spec/support/matchers.rb
+- spec/support/sandboxed_mock_space.rb
+- spec/support/shared_example_groups.rb
+- spec/support/spec_files.rb
+has_rdoc: 
diff --git a/rspec-core/spec/autotest/discover_spec.rb b/rspec-core/spec/autotest/discover_spec.rb
new file mode 100644
index 0000000..a8223b2
--- /dev/null
+++ b/rspec-core/spec/autotest/discover_spec.rb
@@ -0,0 +1,19 @@
+require "spec_helper"
+
+describe "autotest/discover.rb" do
+  context "with ./.rspec present" do
+    it "adds 'rspec2' to the list of discoveries" do
+      File.stub(:exist?).with("./.rspec") { true }
+      Autotest.should_receive(:add_discovery)
+      load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
+    end
+  end
+
+  context "with ./.rspec absent" do
+    it "does not add 'rspec2' to the list of discoveries" do
+      File.stub(:exist?) { false }
+      Autotest.should_not_receive(:add_discovery)
+      load File.expand_path("../../../lib/autotest/discover.rb", __FILE__)
+    end
+  end
+end
diff --git a/rspec-core/spec/autotest/failed_results_re_spec.rb b/rspec-core/spec/autotest/failed_results_re_spec.rb
new file mode 100644
index 0000000..04f7099
--- /dev/null
+++ b/rspec-core/spec/autotest/failed_results_re_spec.rb
@@ -0,0 +1,45 @@
+require "spec_helper"
+
+describe "failed_results_re for autotest" do
+  def run_example
+    group = RSpec::Core::ExampleGroup.describe("group")
+    group.example("example") { yield }
+    io = StringIO.new
+    formatter = RSpec::Core::Formatters::BaseTextFormatter.new(io)
+    reporter = RSpec::Core::Reporter.new(formatter)
+
+    group.run(reporter)
+    reporter.report(1, nil) {}
+    io.string
+  end
+
+  shared_examples "autotest failed_results_re" do
+    it "matches a failure" do
+      output = run_example { fail }
+      expect(output).to match(Autotest::Rspec2.new.failed_results_re)
+      expect(output).to include(__FILE__.sub(File.expand_path('.'),'.'))
+    end
+
+    it "does not match when there are no failures" do
+      output = run_example { } # pass
+      expect(output).not_to match(Autotest::Rspec2.new.failed_results_re)
+      expect(output).not_to include(__FILE__.sub(File.expand_path('.'),'.'))
+    end
+  end
+
+  context "with color enabled" do
+    before do
+      RSpec.configuration.stub(:color_enabled? => true)
+    end
+
+    include_examples "autotest failed_results_re"
+  end
+
+  context "with color disabled " do
+    before do
+      RSpec.configuration.stub(:color_enabled? => false)
+    end
+
+    include_examples "autotest failed_results_re"
+  end
+end
diff --git a/rspec-core/spec/autotest/rspec_spec.rb b/rspec-core/spec/autotest/rspec_spec.rb
new file mode 100644
index 0000000..35f7451
--- /dev/null
+++ b/rspec-core/spec/autotest/rspec_spec.rb
@@ -0,0 +1,133 @@
+require "spec_helper"
+
+describe Autotest::Rspec2 do
+  let(:rspec_autotest) { Autotest::Rspec2.new }
+  let(:spec_cmd) { File.expand_path("../../../exe/rspec", __FILE__) }
+  let(:ruby_cmd) { "/path/to/ruby" }
+
+  before do
+    File.stub(:exist?) { false }
+  end
+
+  it "uses autotest's prefix" do
+    rspec_autotest.prefix = "this is the prefix "
+    expect(rspec_autotest.make_test_cmd({'a' => 'b'})).to match(/this is the prefix/)
+  end
+
+  describe "commands" do
+    before do
+      rspec_autotest.stub(:ruby => ruby_cmd)
+      files = %w[file_one file_two]
+      @files_to_test = {
+        files[0] => [],
+        files[1] => []
+      }
+      # this is not the inner representation of Autotest!
+      rspec_autotest.files_to_test = @files_to_test
+      @to_test = files.map { |f| File.expand_path(f) }.join ' '
+    end
+
+    it "uses double quotes for windows compatibility" do
+      command = rspec_autotest.make_test_cmd(@files_to_test)
+      expect(command).to include('"')
+      expect(command).not_to include("'")
+    end
+
+    it "makes the appropriate test command" do
+      actual_command = rspec_autotest.make_test_cmd(@files_to_test)
+      expected_command = /#{ruby_cmd}.*"#{spec_cmd}" (.*)/
+
+      expect(actual_command).to match(expected_command)
+
+      actual_command =~ expected_command
+      expect($1).to match(/#{File.expand_path('file_one')}/)
+      expect($1).to match(/#{File.expand_path('file_two')}/)
+    end
+
+    it "returns a blank command for no files" do
+      expect(rspec_autotest.make_test_cmd({})).to eq('')
+    end
+
+    it "quotes the paths of files to test" do
+      cmd = rspec_autotest.make_test_cmd(@files_to_test)
+      @files_to_test.keys.each do |file_to_test|
+        expect(cmd).to match(/"#{File.expand_path(file_to_test)}"/)
+      end
+    end
+
+    it "quotes the path of the ruby executable" do
+      cmd = rspec_autotest.make_test_cmd(@files_to_test)
+      expect(cmd).to match(%r("/path/to/ruby"))
+    end
+
+    it "gives '--tty' to #{Autotest::Rspec2::RSPEC_EXECUTABLE}, not '--autotest'" do
+      cmd = rspec_autotest.make_test_cmd(@files_to_test)
+      expect(cmd).to match(' --tty ')
+      expect(cmd).not_to match(' --autotest ')
+    end
+  end
+
+  describe "mappings" do
+    before do
+      @lib_file = "lib/something.rb"
+      @spec_file = "spec/something_spec.rb"
+      rspec_autotest.hook :initialize
+    end
+
+    it "finds the spec file for a given lib file" do
+      expect(rspec_autotest).to map_specs([@spec_file]).to(@lib_file)
+    end
+
+    it "finds the spec file if given a spec file" do
+      expect(rspec_autotest).to map_specs([@spec_file]).to(@spec_file)
+    end
+
+    it "ignores files in spec dir that aren't specs" do
+      expect(rspec_autotest).to map_specs([]).to("spec/spec_helper.rb")
+    end
+
+    it "ignores untracked files (in @file)"  do
+      expect(rspec_autotest).to map_specs([]).to("lib/untracked_file")
+    end
+  end
+
+  describe "consolidating failures" do
+    let(:subject_file) { "lib/autotest/some.rb" }
+    let(:spec_file)    { "spec/autotest/some_spec.rb" }
+
+    it "returns no failures if no failures were given in the output" do
+      expect(rspec_autotest.consolidate_failures([[]])).to eq({})
+    end
+
+    it "returns a hash with the spec filename => spec name for each failure or error" do
+      failures = [ [ "false should be false", spec_file ] ]
+      expect(rspec_autotest.consolidate_failures(failures)).to eq({
+        spec_file => ["false should be false"]
+      })
+    end
+
+    context "when subject file appears before the spec file in the backtrace" do
+      let(:failures) do
+        [ [ "false should be false", "#{subject_file}:143:\n#{spec_file}:203:" ] ]
+      end
+
+      it "excludes the subject file" do
+        expect(rspec_autotest.consolidate_failures(failures).keys).not_to include(subject_file)
+      end
+
+      it "includes the spec file" do
+        expect(rspec_autotest.consolidate_failures(failures).keys).to include(spec_file)
+      end
+    end
+  end
+
+  describe "normalizing file names" do
+    it "ensures that a single file appears in files_to_test only once" do
+      @files_to_test = {}
+      ['filename.rb', './filename.rb', File.expand_path('filename.rb')].each do |file|
+        @files_to_test[file] = []
+      end
+      expect(rspec_autotest.normalize(@files_to_test)).to have(1).file
+    end
+  end
+end
diff --git a/rspec-core/spec/command_line/order_spec.rb b/rspec-core/spec/command_line/order_spec.rb
new file mode 100644
index 0000000..a1a180a
--- /dev/null
+++ b/rspec-core/spec/command_line/order_spec.rb
@@ -0,0 +1,204 @@
+require 'spec_helper'
+
+describe 'command line', :ui do
+  let(:stderr) { StringIO.new }
+  let(:stdout) { StringIO.new }
+
+  before :all do
+    write_file 'spec/simple_spec.rb', """
+      describe 'group 1' do
+        specify('group 1 example 1') {}
+        specify('group 1 example 2') {}
+        specify('group 1 example 3') {}
+        describe 'group 1-1' do
+          specify('group 1-1 example 1') {}
+          specify('group 1-1 example 2') {}
+          specify('group 1-1 example 3') {}
+        end
+      end
+    """
+
+    write_file 'spec/simple_spec2.rb', """
+      describe 'group 2' do
+        specify('group 2 example 1') {}
+        specify('group 2 example 2') {}
+        specify('group 2 example 3') {}
+        describe 'group 2-1' do
+          specify('group 2-1 example 1') {}
+          specify('group 2-1 example 2') {}
+          specify('group 2-1 example 3') {}
+        end
+      end
+    """
+
+    write_file 'spec/order_spec.rb', """
+      describe 'group 1' do
+        specify('group 1 example 1')  {}
+        specify('group 1 example 2')  {}
+        specify('group 1 example 3')  {}
+        specify('group 1 example 4')  {}
+        specify('group 1 example 5')  {}
+        specify('group 1 example 6')  {}
+        specify('group 1 example 5')  {}
+        specify('group 1 example 7')  {}
+        specify('group 1 example 8')  {}
+        specify('group 1 example 9')  {}
+        specify('group 1 example 10') {}
+
+        describe 'group 1-1' do
+          specify('group 1-1 example 1')  {}
+          specify('group 1-1 example 2')  {}
+          specify('group 1-1 example 3')  {}
+          specify('group 1-1 example 4')  {}
+          specify('group 1-1 example 5')  {}
+          specify('group 1-1 example 6')  {}
+          specify('group 1-1 example 7')  {}
+          specify('group 1-1 example 8')  {}
+          specify('group 1-1 example 9')  {}
+          specify('group 1-1 example 10') {}
+        end
+
+        describe('group 1-2')  { specify('example') {} }
+        describe('group 1-3')  { specify('example') {} }
+        describe('group 1-4')  { specify('example') {} }
+        describe('group 1-5')  { specify('example') {} }
+        describe('group 1-6')  { specify('example') {} }
+        describe('group 1-7')  { specify('example') {} }
+        describe('group 1-8')  { specify('example') {} }
+        describe('group 1-9')  { specify('example') {} }
+        describe('group 1-10') { specify('example') {} }
+      end
+
+      describe('group 2')  { specify('example') {} }
+      describe('group 3')  { specify('example') {} }
+      describe('group 4')  { specify('example') {} }
+      describe('group 5')  { specify('example') {} }
+      describe('group 6')  { specify('example') {} }
+      describe('group 7')  { specify('example') {} }
+      describe('group 8')  { specify('example') {} }
+      describe('group 9')  { specify('example') {} }
+      describe('group 10') { specify('example') {} }
+    """
+  end
+
+  describe '--order rand' do
+    it 'runs the examples and groups in a different order each time' do
+      run_command 'tmp/aruba/spec/order_spec.rb --order rand -f doc'
+      RSpec.configuration.seed = srand && srand # reset seed in same process
+      run_command 'tmp/aruba/spec/order_spec.rb --order rand -f doc'
+
+      expect(stdout.string).to match(/Randomized with seed \d+/)
+
+      top_level_groups      {|first_run, second_run| expect(first_run).to_not eq(second_run)}
+      nested_groups         {|first_run, second_run| expect(first_run).to_not eq(second_run)}
+      examples('group 1')   {|first_run, second_run| expect(first_run).to_not eq(second_run)}
+      examples('group 1-1') {|first_run, second_run| expect(first_run).to_not eq(second_run)}
+    end
+  end
+
+  describe '--order rand:SEED' do
+    it 'runs the examples and groups in the same order each time' do
+      2.times { run_command 'tmp/aruba/spec/order_spec.rb --order rand:123 -f doc' }
+
+      expect(stdout.string).to match(/Randomized with seed 123/)
+
+      top_level_groups      {|first_run, second_run| expect(first_run).to eq(second_run)}
+      nested_groups         {|first_run, second_run| expect(first_run).to eq(second_run)}
+      examples('group 1')   {|first_run, second_run| expect(first_run).to eq(second_run)}
+      examples('group 1-1') {|first_run, second_run| expect(first_run).to eq(second_run)}
+    end
+  end
+
+  describe '--seed SEED' do
+    it "forces '--order rand' and runs the examples and groups in the same order each time" do
+      2.times { run_command 'tmp/aruba/spec/order_spec.rb --seed 123 -f doc' }
+
+      expect(stdout.string).to match(/Randomized with seed \d+/)
+
+      top_level_groups      {|first_run, second_run| expect(first_run).to eq(second_run)}
+      nested_groups         {|first_run, second_run| expect(first_run).to eq(second_run)}
+      examples('group 1')   {|first_run, second_run| expect(first_run).to eq(second_run)}
+      examples('group 1-1') {|first_run, second_run| expect(first_run).to eq(second_run)}
+    end
+
+    it "runs examples in the same order, regardless of the order in which files are given" do
+      run_command 'tmp/aruba/spec/simple_spec.rb tmp/aruba/spec/simple_spec2.rb --seed 1337 -f doc'
+      run_command 'tmp/aruba/spec/simple_spec2.rb tmp/aruba/spec/simple_spec.rb --seed 1337 -f doc'
+
+      top_level_groups      {|first_run, second_run| expect(first_run).to eq(second_run)}
+      nested_groups         {|first_run, second_run| expect(first_run).to eq(second_run)}
+    end
+  end
+
+  describe '--order default on CLI with --order rand in .rspec' do
+    it "overrides --order rand with --order default" do
+      write_file '.rspec', '--order rand'
+
+      run_command 'tmp/aruba/spec/order_spec.rb --order default -f doc'
+
+      expect(stdout.string).not_to match(/Randomized/)
+
+      expect(stdout.string).to match(
+        /group 1.*group 1 example 1.*group 1 example 2.*group 1-1.*group 1-2.*group 2.*/m
+      )
+    end
+  end
+
+  context 'when a custom order is configured' do
+    before do
+      write_file 'spec/custom_order_spec.rb', """
+        RSpec.configure do |config|
+          config.order_groups_and_examples do |list|
+            list.sort_by { |item| item.description }
+          end
+        end
+
+        describe 'group B' do
+          specify('group B example D')  {}
+          specify('group B example B')  {}
+          specify('group B example A')  {}
+          specify('group B example C')  {}
+        end
+
+        describe 'group A' do
+          specify('group A example 1')  {}
+        end
+      """
+    end
+
+    it 'orders the groups and examples by the provided strategy' do
+      run_command 'tmp/aruba/spec/custom_order_spec.rb -f doc'
+
+      top_level_groups    { |groups| expect(groups.flatten).to eq(['group A', 'group B']) }
+      examples('group B') do |examples|
+        letters = examples.flatten.map { |e| e[/(.)\z/, 1] }
+        expect(letters).to eq(['A', 'B', 'C', 'D'])
+      end
+    end
+  end
+
+  def examples(group)
+    yield split_in_half(stdout.string.scan(/^\s+#{group} example.*$/))
+  end
+
+  def top_level_groups
+    yield example_groups_at_level(0)
+  end
+
+  def nested_groups
+    yield example_groups_at_level(2)
+  end
+
+  def example_groups_at_level(level)
+    split_in_half(stdout.string.scan(/^\s{#{level*2}}group.*$/))
+  end
+
+  def split_in_half(array)
+    length, midpoint = array.length, array.length / 2
+    return array.slice(0, midpoint), array.slice(midpoint, length)
+  end
+
+  def run_command(cmd)
+    RSpec::Core::Runner.run(cmd.split, stderr, stdout)
+  end
+end
diff --git a/rspec-core/spec/rspec/core/backtrace_cleaner_spec.rb b/rspec-core/spec/rspec/core/backtrace_cleaner_spec.rb
new file mode 100644
index 0000000..2de0237
--- /dev/null
+++ b/rspec-core/spec/rspec/core/backtrace_cleaner_spec.rb
@@ -0,0 +1,68 @@
+require "spec_helper"
+
+module RSpec::Core
+  describe BacktraceCleaner do
+    context "with no patterns" do
+      it "keeps all lines" do
+        lines = ["/tmp/a_file", "some_random_text", "hello\330\271!"]
+        cleaner = BacktraceCleaner.new([], [])
+        expect(lines.all? {|line| cleaner.exclude? line}).to be_false
+      end
+
+      it 'is considered a full backtrace' do
+        expect(BacktraceCleaner.new([], []).full_backtrace?).to be_true
+      end
+    end
+
+    context "with an exclusion pattern but no inclusion patterns" do
+      it "excludes lines that match the exclusion pattern" do
+        cleaner = BacktraceCleaner.new([], [/remove/])
+        expect(cleaner.exclude? "remove me").to be_true
+      end
+
+      it "keeps lines that do not match the exclusion pattern" do
+        cleaner = BacktraceCleaner.new([], [/remove/])
+        expect(cleaner.exclude? "apple").to be_false
+      end
+
+      it 'is considered a partial backtrace' do
+        expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_false
+      end
+    end
+
+    context "with an exclusion pattern and an inclusion pattern" do
+      it "excludes lines that match the exclusion pattern but not the inclusion pattern" do
+        cleaner = BacktraceCleaner.new([/keep/], [/discard/])
+        expect(cleaner.exclude? "discard").to be_true
+      end
+
+      it "keeps lines that match the inclusion pattern and the exclusion pattern" do
+        cleaner = BacktraceCleaner.new([/hi/], [/.*/])
+        expect(cleaner.exclude? "hi").to be_false
+      end
+
+      it "keeps lines that match neither pattern" do
+        cleaner = BacktraceCleaner.new([/hi/], [/delete/])
+        expect(cleaner.exclude? "fish").to be_false
+      end
+
+      it 'is considered a partial backtrace' do
+        expect(BacktraceCleaner.new([], [/remove/]).full_backtrace?).to be_false
+      end
+    end
+
+    context "with an exclusion pattern that matches the current working directory" do
+      it "defaults to having one inclusion pattern, the current working directory" do
+        cleaner = BacktraceCleaner.new(nil, [/.*/])
+        expect(Dir.getwd =~ cleaner.inclusion_patterns.first).to be_true
+      end
+    end
+
+    context "with an exclusion pattern that does not match the current working directory" do
+      it "defaults to having no exclusion patterns" do
+        cleaner = BacktraceCleaner.new(nil, [/i_wont_match_a_directory/])
+        expect(cleaner.inclusion_patterns.length).to be_zero
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/command_line_spec.rb b/rspec-core/spec/rspec/core/command_line_spec.rb
new file mode 100644
index 0000000..1025748
--- /dev/null
+++ b/rspec-core/spec/rspec/core/command_line_spec.rb
@@ -0,0 +1,108 @@
+require "spec_helper"
+require "stringio"
+require 'tmpdir'
+
+module RSpec::Core
+  describe CommandLine do
+
+    let(:out)    { StringIO.new         }
+    let(:err)    { StringIO.new         }
+    let(:config) { RSpec::configuration }
+    let(:world)  { RSpec::world         }
+
+    before { config.stub :run_hook }
+
+    it "configures streams before command line options" do
+      config.stub :load_spec_files
+
+      # this is necessary to ensure that color works correctly on windows
+      config.should_receive(:error_stream=).ordered
+      config.should_receive(:output_stream=).ordered
+      config.should_receive(:force).at_least(:once).ordered
+
+      command_line = build_command_line
+      command_line.run err, out
+    end
+
+    it "assigns ConfigurationOptions built from Array of options to @options" do
+      config_options = ConfigurationOptions.new(%w[--color])
+      command_line   = CommandLine.new(%w[--color])
+      expect(command_line.instance_eval { @options.options }).to eq(config_options.parse_options)
+    end
+
+    it "assigns submitted ConfigurationOptions to @options" do
+      config_options = ConfigurationOptions.new(%w[--color])
+      command_line   = CommandLine.new(config_options)
+      expect(command_line.instance_eval { @options }).to be(config_options)
+    end
+
+    describe "#run" do
+      context "running files" do
+        include_context "spec files"
+
+        it "returns 0 if spec passes" do
+          command_line = build_command_line passing_spec_filename
+          expect(command_line.run(err, out)).to eq 0
+        end
+
+        it "returns 1 if spec fails" do
+          command_line = build_command_line failing_spec_filename
+          expect(command_line.run(err, out)).to eq 1
+        end
+
+        it "returns 2 if spec fails and --failure-exit-code is 2" do
+          command_line = build_command_line failing_spec_filename, "--failure-exit-code", "2"
+          expect(command_line.run(err, out)).to eq 2
+        end
+      end
+
+      context "running hooks" do
+        before { config.stub :load_spec_files }
+
+        it "runs before suite hooks" do
+          config.should_receive(:run_hook).with(:before, :suite)
+          command_line = build_command_line
+          command_line.run err, out
+        end
+
+        it "runs after suite hooks" do
+          config.should_receive(:run_hook).with(:after, :suite)
+          command_line = build_command_line
+          command_line.run err, out
+        end
+
+        it "runs after suite hooks even after an error" do
+          config.should_receive(:run_hook).with(:before, :suite).and_raise "this error"
+          config.should_receive(:run_hook).with(:after , :suite)
+          expect do
+            command_line = build_command_line
+            command_line.run err, out
+          end.to raise_error
+        end
+      end
+    end
+
+    describe "#run with custom output" do
+      before { config.stub :files_to_run => [] }
+
+      let(:output_file) { File.new("#{Dir.tmpdir}/command_line_spec_output.txt", 'w') }
+
+      it "doesn't override output_stream" do
+        config.output_stream = output_file
+        command_line = build_command_line
+        command_line.run err, out
+        expect(command_line.instance_eval { @configuration.output_stream }).to eq output_file
+      end
+    end
+
+    def build_command_line *args
+      CommandLine.new build_config_options(*args)
+    end
+
+    def build_config_options *args
+      options = ConfigurationOptions.new args
+      options.parse_options
+      options
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/command_line_spec_output.txt b/rspec-core/spec/rspec/core/command_line_spec_output.txt
new file mode 100644
index 0000000..e69de29
diff --git a/rspec-core/spec/rspec/core/configuration_options_spec.rb b/rspec-core/spec/rspec/core/configuration_options_spec.rb
new file mode 100644
index 0000000..2a30393
--- /dev/null
+++ b/rspec-core/spec/rspec/core/configuration_options_spec.rb
@@ -0,0 +1,417 @@
+require 'spec_helper'
+require 'ostruct'
+require 'rspec/core/drb_options'
+
+describe RSpec::Core::ConfigurationOptions, :isolated_directory => true, :isolated_home => true do
+  include ConfigOptionsHelper
+
+  it "warns when HOME env var is not set", :unless => (RUBY_PLATFORM == 'java') do
+    without_env_vars 'HOME' do
+      coo = RSpec::Core::ConfigurationOptions.new([])
+      coo.should_receive(:warn)
+      coo.parse_options
+    end
+  end
+
+  it "duplicates the arguments array" do
+    args = ['-e', 'some spec']
+    coo = RSpec::Core::ConfigurationOptions.new(args)
+    coo.parse_options
+    expect(args).to eq(['-e', 'some spec'])
+  end
+
+  describe "#configure" do
+    it "sends libs before requires" do
+      opts = config_options_object(*%w[--require a/path -I a/lib])
+      config = double("config").as_null_object
+      config.should_receive(:libs=).ordered
+      config.should_receive(:setup_load_path_and_require).ordered
+      opts.configure(config)
+    end
+
+    it "sends loads requires before loading specs" do
+      opts = config_options_object(*%w[-rspec_helper])
+      config = double("config").as_null_object
+      expect(config).to receive(:setup_load_path_and_require).ordered
+      expect(config).to receive(:files_or_directories_to_run=).ordered
+      opts.configure(config)
+    end
+
+    it "sets up load path and requires before formatter" do
+      opts = config_options_object(*%w[--require a/path -f a/formatter])
+      config = double("config").as_null_object
+      config.should_receive(:setup_load_path_and_require).ordered
+      config.should_receive(:add_formatter).ordered
+      opts.configure(config)
+    end
+
+    it "sends default_path before files_or_directories_to_run" do
+      opts = config_options_object(*%w[--default_path spec])
+      config = double("config").as_null_object
+      config.should_receive(:force).with(:default_path => 'spec').ordered
+      config.should_receive(:files_or_directories_to_run=).ordered
+      opts.configure(config)
+    end
+
+    it "sends pattern before files_or_directories_to_run" do
+      opts = config_options_object(*%w[--pattern **/*.spec])
+      config = double("config").as_null_object
+      config.should_receive(:force).with(:pattern => '**/*.spec').ordered
+      config.should_receive(:files_or_directories_to_run=).ordered
+      opts.configure(config)
+    end
+
+    it "assigns inclusion_filter" do
+      opts = config_options_object(*%w[--tag awesome])
+      config = RSpec::Core::Configuration.new
+      opts.configure(config)
+      expect(config.inclusion_filter).to have_key(:awesome)
+    end
+
+    it "merges the :exclusion_filter option with the default exclusion_filter" do
+      opts = config_options_object(*%w[--tag ~slow])
+      config = RSpec::Core::Configuration.new
+      opts.configure(config)
+      expect(config.exclusion_filter).to have_key(:slow)
+    end
+
+    it "forces color_enabled" do
+      opts = config_options_object(*%w[--color])
+      config = RSpec::Core::Configuration.new
+      config.should_receive(:force).with(:color => true)
+      opts.configure(config)
+    end
+
+    [
+      ["--failure-exit-code", "3", :failure_exit_code, 3 ],
+      ["--pattern", "foo/bar", :pattern, "foo/bar"],
+      ["--failure-exit-code", "37", :failure_exit_code, 37],
+      ["--default_path", "behavior", :default_path, "behavior"],
+      ["--order", "rand", :order, "rand"],
+      ["--seed", "37", :order, "rand:37"],
+      ["--drb-port", "37", :drb_port, 37]
+    ].each do |cli_option, cli_value, config_key, config_value|
+      it "forces #{config_key}" do
+        opts = config_options_object(*[cli_option, cli_value].compact)
+        config = RSpec::Core::Configuration.new
+        config.should_receive(:force) do |pair|
+          expect(pair.keys.first).to eq(config_key)
+          expect(pair.values.first).to eq(config_value)
+        end
+        opts.configure(config)
+      end
+    end
+
+    it "sets debug directly" do
+      opts = config_options_object("--debug")
+      config = RSpec::Core::Configuration.new
+      config.should_receive(:debug=).with(true)
+      opts.configure(config)
+    end
+
+    it "merges --require specified by multiple configuration sources" do
+      with_env_vars 'SPEC_OPTS' => "--require file_from_env" do
+        opts = config_options_object(*%w[--require file_from_opts])
+        config = RSpec::Core::Configuration.new
+        config.should_receive(:require).with("file_from_opts")
+        config.should_receive(:require).with("file_from_env")
+        opts.configure(config)
+      end
+    end
+
+    it "merges --I specified by multiple configuration sources" do
+      with_env_vars 'SPEC_OPTS' => "-I dir_from_env" do
+        opts = config_options_object(*%w[-I dir_from_opts])
+        config = RSpec::Core::Configuration.new
+        config.should_receive(:libs=).with(["dir_from_opts", "dir_from_env"])
+        opts.configure(config)
+      end
+    end
+  end
+
+  describe "-c, --color, and --colour" do
+    it "sets :color => true" do
+      expect(parse_options('-c')).to include(:color => true)
+      expect(parse_options('--color')).to include(:color => true)
+      expect(parse_options('--colour')).to include(:color => true)
+    end
+  end
+
+  describe "--no-color" do
+    it "sets :color => false" do
+      expect(parse_options('--no-color')).to include(:color => false)
+    end
+
+    it "overrides previous :color => true" do
+      expect(parse_options('--color', '--no-color')).to include(:color => false)
+    end
+
+    it "gets overriden by a subsequent :color => true" do
+      expect(parse_options('--no-color', '--color')).to include(:color => true)
+    end
+  end
+
+  describe "-I" do
+    example "adds to :libs" do
+      expect(parse_options('-I', 'a_dir')).to include(:libs => ['a_dir'])
+    end
+    example "can be used more than once" do
+      expect(parse_options('-I', 'dir_1', '-I', 'dir_2')).to include(:libs => ['dir_1','dir_2'])
+    end
+  end
+
+  describe '--require' do
+    example "requires files" do
+      expect(parse_options('--require', 'a/path')).to include(:requires => ['a/path'])
+    end
+    example "can be used more than once" do
+      expect(parse_options('--require', 'path/1', '--require', 'path/2')).to include(:requires => ['path/1','path/2'])
+    end
+  end
+
+  describe "--format, -f" do
+    it "sets :formatter" do
+      [['--format', 'd'], ['-f', 'd'], '-fd'].each do |args|
+        expect(parse_options(*args)).to include(:formatters => [['d']])
+      end
+    end
+
+    example "can accept a class name" do
+      expect(parse_options('-fSome::Formatter::Class')).to include(:formatters => [['Some::Formatter::Class']])
+    end
+  end
+
+  describe "--profile, -p" do
+    it "sets :profile_examples" do
+      expect(parse_options('-p')).to include(:profile_examples => true)
+      expect(parse_options('--profile')).to include(:profile_examples => true)
+      expect(parse_options('-p', '4')).to include(:profile_examples => 4)
+      expect(parse_options('--profile', '3')).to include(:profile_examples => 3)
+    end
+  end
+
+  describe "--no-profile" do
+    it "sets :profile_examples to false" do
+      expect(parse_options('--no-profile')).to include(:profile_examples => false)
+    end
+  end
+
+  describe '--line_number' do
+    it "sets :line_number" do
+      expect(parse_options('-l','3')).to include(:line_numbers => ['3'])
+      expect(parse_options('--line_number','3')).to include(:line_numbers => ['3'])
+    end
+
+    it "can be specified multiple times" do
+      expect(parse_options('-l','3', '-l', '6')).to include(:line_numbers => ['3', '6'])
+      expect(parse_options('--line_number','3', '--line_number', '6')).to include(:line_numbers => ['3', '6'])
+    end
+  end
+
+  describe "--example" do
+    it "sets :full_description" do
+      expect(parse_options('--example','foo')).to include(:full_description => [/foo/])
+      expect(parse_options('-e','bar')).to include(:full_description => [/bar/])
+    end
+  end
+
+  describe "--backtrace, -b" do
+    it "sets full_backtrace on config" do
+      expect(parse_options("--backtrace")).to include(:full_backtrace => true)
+      expect(parse_options("-b")).to include(:full_backtrace => true)
+    end
+  end
+
+  describe "--debug, -d" do
+    it "sets :debug => true" do
+      expect(parse_options("--debug")).to include(:debug => true)
+      expect(parse_options("-d")).to include(:debug => true)
+    end
+  end
+
+  describe "--fail-fast" do
+    it "defaults to false" do
+      expect(parse_options[:fail_fast]).to be_false
+    end
+
+    it "sets fail_fast on config" do
+      expect(parse_options("--fail-fast")[:fail_fast]).to be_true
+    end
+  end
+
+  describe "--failure-exit-code" do
+    it "sets :failure_exit_code" do
+      expect(parse_options('--failure-exit-code', '0')).to include(:failure_exit_code => 0)
+      expect(parse_options('--failure-exit-code', '1')).to include(:failure_exit_code => 1)
+      expect(parse_options('--failure-exit-code', '2')).to include(:failure_exit_code => 2)
+    end
+
+    it "overrides previous :failure_exit_code" do
+      expect(parse_options('--failure-exit-code', '2', '--failure-exit-code', '3')).to include(:failure_exit_code => 3)
+    end
+  end
+
+  describe "--options" do
+    it "sets :custom_options_file" do
+      expect(parse_options(*%w[-O my.opts])).to include(:custom_options_file => "my.opts")
+      expect(parse_options(*%w[--options my.opts])).to include(:custom_options_file => "my.opts")
+    end
+  end
+
+  describe "--drb, -X" do
+    context "combined with --debug" do
+      it "turns off the debugger if --drb is specified first" do
+        expect(config_options_object("--drb", "--debug").drb_argv).not_to include("--debug")
+        expect(config_options_object("--drb", "-d"     ).drb_argv).not_to include("--debug")
+        expect(config_options_object("-X",    "--debug").drb_argv).not_to include("--debug")
+        expect(config_options_object("-X",    "-d"     ).drb_argv).not_to include("--debug")
+      end
+
+      it "turns off the debugger option if --drb is specified later" do
+        expect(config_options_object("--debug", "--drb").drb_argv).not_to include("--debug")
+        expect(config_options_object("-d",      "--drb").drb_argv).not_to include("--debug")
+        expect(config_options_object("--debug", "-X"   ).drb_argv).not_to include("--debug")
+        expect(config_options_object("-d",      "-X"   ).drb_argv).not_to include("--debug")
+      end
+
+      it "turns off the debugger option if --drb is specified in the options file" do
+        File.open("./.rspec", "w") {|f| f << "--drb"}
+        expect(config_options_object("--debug").drb_argv).not_to include("--debug")
+        expect(config_options_object("-d"     ).drb_argv).not_to include("--debug")
+      end
+
+      it "turns off the debugger option if --debug is specified in the options file" do
+        File.open("./.rspec", "w") {|f| f << "--debug"}
+        expect(config_options_object("--drb").drb_argv).not_to include("--debug")
+        expect(config_options_object("-X"   ).drb_argv).not_to include("--debug")
+      end
+    end
+
+    it "does not send --drb back to the parser after parsing options" do
+      expect(config_options_object("--drb", "--color").drb_argv).not_to include("--drb")
+    end
+
+  end
+
+  describe "--no-drb" do
+    it "disables drb" do
+      expect(parse_options("--no-drb")).to include(:drb => false)
+    end
+
+    it "overrides a previous drb => true" do
+      expect(parse_options("--drb", "--no-drb")).to include(:drb => false)
+    end
+
+    it "gets overriden by a subsquent drb => true" do
+      expect(parse_options("--no-drb", "--drb")).to include(:drb => true)
+    end
+  end
+
+
+  describe "files_or_directories_to_run" do
+    it "parses files from '-c file.rb dir/file.rb'" do
+      expect(parse_options("-c", "file.rb", "dir/file.rb")).to include(
+        :files_or_directories_to_run => ["file.rb", "dir/file.rb"]
+      )
+    end
+
+    it "parses dir from 'dir'" do
+      expect(parse_options("dir")).to include(:files_or_directories_to_run => ["dir"])
+    end
+
+    it "parses dir and files from 'spec/file1_spec.rb, spec/file2_spec.rb'" do
+      expect(parse_options("dir", "spec/file1_spec.rb", "spec/file2_spec.rb")).to include(
+        :files_or_directories_to_run => ["dir", "spec/file1_spec.rb", "spec/file2_spec.rb"]
+      )
+    end
+
+    it "provides no files or directories if spec directory does not exist" do
+      FileTest.stub(:directory?).with("spec").and_return false
+      expect(parse_options()).to include(:files_or_directories_to_run => [])
+    end
+  end
+
+  describe "default_path" do
+    it "gets set before files_or_directories_to_run" do
+      config = double("config").as_null_object
+      config.should_receive(:force).with(:default_path => 'foo').ordered
+      config.should_receive(:files_or_directories_to_run=).ordered
+      opts = config_options_object("--default_path", "foo")
+      opts.configure(config)
+    end
+  end
+
+  describe "#filter_manager" do
+    it "returns the same object as RSpec::configuration.filter_manager" do
+      expect(config_options_object.filter_manager).to be(RSpec::configuration.filter_manager)
+    end
+  end
+
+  describe "sources: ~/.rspec, ./.rspec, ./.rspec-local, custom, CLI, and SPEC_OPTS" do
+    it "merges global, local, SPEC_OPTS, and CLI" do
+      File.open("./.rspec", "w") {|f| f << "--line 37"}
+      File.open("./.rspec-local", "w") {|f| f << "--format global"}
+      File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--color"}
+      with_env_vars 'SPEC_OPTS' => "--debug --example 'foo bar'" do
+        options = parse_options("--drb")
+        expect(options[:color]).to be_true
+        expect(options[:line_numbers]).to eq(["37"])
+        expect(options[:debug]).to be_true
+        expect(options[:full_description]).to eq([/foo\ bar/])
+        expect(options[:drb]).to be_true
+        expect(options[:formatters]).to eq([['global']])
+      end
+    end
+
+    it "prefers SPEC_OPTS over CLI" do
+      with_env_vars 'SPEC_OPTS' => "--format spec_opts" do
+        expect(parse_options("--format", "cli")[:formatters]).to eq([['spec_opts']])
+      end
+    end
+
+    it "prefers CLI over file options" do
+      File.open("./.rspec", "w") {|f| f << "--format project"}
+      File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
+      expect(parse_options("--format", "cli")[:formatters]).to eq([['cli']])
+    end
+
+    it "prefers project file options over global file options" do
+      File.open("./.rspec", "w") {|f| f << "--format project"}
+      File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
+      expect(parse_options[:formatters]).to eq([['project']])
+    end
+
+    it "prefers local file options over project file options" do
+      File.open("./.rspec-local", "w") {|f| f << "--format local"}
+      File.open("./.rspec", "w") {|f| f << "--format global"}
+      expect(parse_options[:formatters]).to eq([['local']])
+    end
+
+    it "parses options file correctly if erb code has trimming options" do
+      File.open("./.rspec", "w") do |f|
+        f << "<% if true -%>\n"
+        f << "--format local\n"
+        f << "<%- end %>\n"
+      end
+
+      expect(parse_options[:formatters]).to eq([['local']])
+    end
+
+    context "with custom options file" do
+      it "ignores project and global options files" do
+        File.open("./.rspec", "w") {|f| f << "--format project"}
+        File.open(File.expand_path("~/.rspec"), "w") {|f| f << "--format global"}
+        File.open("./custom.opts", "w") {|f| f << "--color"}
+        options = parse_options("-O", "./custom.opts")
+        expect(options[:format]).to be_nil
+        expect(options[:color]).to be_true
+      end
+
+      it "parses -e 'full spec description'" do
+        File.open("./custom.opts", "w") {|f| f << "-e 'The quick brown fox jumps over the lazy dog'"}
+        options = parse_options("-O", "./custom.opts")
+        expect(options[:full_description]).to eq([/The\ quick\ brown\ fox\ jumps\ over\ the\ lazy\ dog/])
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/configuration_spec.rb b/rspec-core/spec/rspec/core/configuration_spec.rb
new file mode 100644
index 0000000..fd6c8a7
--- /dev/null
+++ b/rspec-core/spec/rspec/core/configuration_spec.rb
@@ -0,0 +1,1561 @@
+require 'spec_helper'
+require 'tmpdir'
+
+module RSpec::Core
+
+  describe Configuration do
+
+    let(:config) { Configuration.new }
+
+    describe "RSpec.configuration with a block" do
+      before { RSpec.stub(:warn_deprecation) }
+
+      it "is deprecated" do
+        RSpec.should_receive(:warn_deprecation)
+        RSpec.configuration {}
+      end
+    end
+
+    describe '#deprecation_stream' do
+      it 'defaults to standard error' do
+        expect(config.deprecation_stream).to eq $stderr
+      end
+
+      it 'is configurable' do
+        io = double 'deprecation io'
+        config.deprecation_stream = io
+        expect(config.deprecation_stream).to eq io
+      end
+    end
+
+    describe "#setup_load_path_and_require" do
+      include_context "isolate load path mutation"
+
+      def absolute_path_to(dir)
+        File.expand_path("../../../../#{dir}", __FILE__)
+      end
+
+      it 'adds `lib` to the load path' do
+        lib_dir = absolute_path_to("lib")
+        $LOAD_PATH.delete(lib_dir)
+
+        expect($LOAD_PATH).not_to include(lib_dir)
+        config.setup_load_path_and_require []
+        expect($LOAD_PATH).to include(lib_dir)
+      end
+
+      it 'adds the configured `default_path` to the load path' do
+        config.default_path = 'features'
+        foo_dir = absolute_path_to("features")
+
+        expect($LOAD_PATH).not_to include(foo_dir)
+        config.setup_load_path_and_require []
+        expect($LOAD_PATH).to include(foo_dir)
+      end
+
+      it 'stores the required files' do
+        config.should_receive(:require).with('a/path')
+        config.setup_load_path_and_require ['a/path']
+        expect(config.requires).to eq ['a/path']
+      end
+
+      context "when `default_path` refers to a file rather than a directory" do
+        it 'does not add it to the load path' do
+          config.default_path = 'Rakefile'
+          config.setup_load_path_and_require []
+          expect($LOAD_PATH).not_to include(match(/Rakefile/))
+        end
+      end
+    end
+
+    describe "#load_spec_files" do
+      it "loads files using load" do
+        config.files_to_run = ["foo.bar", "blah_spec.rb"]
+        config.should_receive(:load).twice
+        config.load_spec_files
+      end
+
+      it "loads each file once, even if duplicated in list" do
+        config.files_to_run = ["a_spec.rb", "a_spec.rb"]
+        config.should_receive(:load).once
+        config.load_spec_files
+      end
+
+      context "with rspec-1 loaded" do
+        before { stub_const("Spec::VERSION::MAJOR", 1) }
+
+        it "raises with a helpful message" do
+          expect {
+            config.load_spec_files
+          }.to raise_error(/rspec-1 has been loaded/)
+        end
+      end
+    end
+
+    describe "#treat_symbols_as_metadata_keys_with_true_values?" do
+      it 'defaults to false' do
+        expect(config.treat_symbols_as_metadata_keys_with_true_values?).to be_false
+      end
+
+      it 'can be set to true' do
+        config.treat_symbols_as_metadata_keys_with_true_values = true
+        expect(config.treat_symbols_as_metadata_keys_with_true_values?).to be_true
+      end
+    end
+
+    describe "#mock_framework" do
+      it "defaults to :rspec" do
+        config.should_receive(:require).with('rspec/core/mocking/with_rspec')
+        config.mock_framework
+      end
+    end
+
+    describe "#mock_framework="do
+      it "delegates to mock_with" do
+        config.should_receive(:mock_with).with(:rspec)
+        config.mock_framework = :rspec
+      end
+    end
+
+    shared_examples "a configurable framework adapter" do |m|
+      it "yields a config object if the framework_module supports it" do
+        custom_config = Struct.new(:custom_setting).new
+        mod = Module.new
+        mod.stub(:configuration => custom_config)
+
+        config.send m, mod do |mod_config|
+          mod_config.custom_setting = true
+        end
+
+        expect(custom_config.custom_setting).to be_true
+      end
+
+      it "raises if framework module doesn't support configuration" do
+        mod = Module.new
+
+        expect {
+          config.send m, mod do |mod_config|
+          end
+        }.to raise_error(/must respond to `configuration`/)
+      end
+    end
+
+    describe "#mock_with" do
+      before { config.stub(:require) }
+
+      it_behaves_like "a configurable framework adapter", :mock_with
+
+      [:rspec, :mocha, :rr, :flexmock].each do |framework|
+        context "with #{framework}" do
+          it "requires the adapter for #{framework}" do
+            config.should_receive(:require).with("rspec/core/mocking/with_#{framework}")
+            config.mock_with framework
+          end
+        end
+      end
+
+      it "allows rspec-mocks to be configured with a provided block" do
+        mod = Module.new
+
+        RSpec::Mocks.configuration.should_receive(:add_stub_and_should_receive_to).with(mod)
+
+        config.mock_with :rspec do |c|
+          c.add_stub_and_should_receive_to mod
+        end
+      end
+
+      context "with a module" do
+        it "sets the mock_framework_adapter to that module" do
+          mod = Module.new
+          config.mock_with mod
+          expect(config.mock_framework).to eq(mod)
+        end
+      end
+
+      it "uses the null adapter when set to any unknown key" do
+        config.should_receive(:require).with('rspec/core/mocking/with_absolutely_nothing')
+        config.mock_with :crazy_new_mocking_framework_ive_not_yet_heard_of
+      end
+
+      context 'when there are already some example groups defined' do
+        it 'raises an error since this setting must be applied before any groups are defined' do
+          RSpec.world.stub(:example_groups).and_return([double.as_null_object])
+          expect {
+            config.mock_with :mocha
+          }.to raise_error(/must be configured before any example groups are defined/)
+        end
+
+        it 'does not raise an error if the default `mock_with :rspec` is re-configured' do
+          config.mock_framework # called by RSpec when configuring the first example group
+          RSpec.world.stub(:example_groups).and_return([double.as_null_object])
+          config.mock_with :rspec
+        end
+
+        it 'does not raise an error if re-setting the same config' do
+          groups = []
+          RSpec.world.stub(:example_groups => groups)
+          config.mock_with :mocha
+          groups << double.as_null_object
+          config.mock_with :mocha
+        end
+      end
+    end
+
+    describe "#expectation_framework" do
+      it "defaults to :rspec" do
+        config.should_receive(:require).with('rspec/expectations')
+        config.expectation_frameworks
+      end
+    end
+
+    describe "#expectation_framework=" do
+      it "delegates to expect_with=" do
+        config.should_receive(:expect_with).with(:rspec)
+        config.expectation_framework = :rspec
+      end
+    end
+
+    describe "#expect_with" do
+      before do
+        stub_const("Test::Unit::Assertions", Module.new)
+        config.stub(:require)
+      end
+
+      it_behaves_like "a configurable framework adapter", :expect_with
+
+      [
+        [:rspec,  'rspec/expectations'],
+        [:stdlib, 'test/unit/assertions']
+      ].each do |framework, required_file|
+        context "with #{framework}" do
+          it "requires #{required_file}" do
+            config.should_receive(:require).with(required_file)
+            config.expect_with framework
+          end
+        end
+      end
+
+      it "supports multiple calls" do
+        config.expect_with :rspec
+        config.expect_with :stdlib
+        expect(config.expectation_frameworks).to eq [RSpec::Matchers, Test::Unit::Assertions]
+      end
+
+      it "raises if block given with multiple args" do
+        expect {
+          config.expect_with :rspec, :stdlib do |mod_config|
+          end
+        }.to raise_error(/expect_with only accepts/)
+      end
+
+      it "raises ArgumentError if framework is not supported" do
+        expect do
+          config.expect_with :not_supported
+        end.to raise_error(ArgumentError)
+      end
+
+      context 'when there are already some example groups defined' do
+        it 'raises an error since this setting must be applied before any groups are defined' do
+          RSpec.world.stub(:example_groups).and_return([double.as_null_object])
+          expect {
+            config.expect_with :rspec
+          }.to raise_error(/must be configured before any example groups are defined/)
+        end
+
+        it 'does not raise an error if the default `expect_with :rspec` is re-configured' do
+          config.expectation_frameworks # called by RSpec when configuring the first example group
+          RSpec.world.stub(:example_groups).and_return([double.as_null_object])
+          config.expect_with :rspec
+        end
+
+        it 'does not raise an error if re-setting the same config' do
+          groups = []
+          RSpec.world.stub(:example_groups => groups)
+          config.expect_with :stdlib
+          groups << double.as_null_object
+          config.expect_with :stdlib
+        end
+      end
+    end
+
+    describe "#expecting_with_rspec?" do
+      before do
+        stub_const("Test::Unit::Assertions", Module.new)
+        config.stub(:require)
+      end
+
+      it "returns false by default" do
+        expect(config).not_to be_expecting_with_rspec
+      end
+
+      it "returns true when `expect_with :rspec` has been configured" do
+        config.expect_with :rspec
+        expect(config).to be_expecting_with_rspec
+      end
+
+      it "returns true when `expect_with :rspec, :stdlib` has been configured" do
+        config.expect_with :rspec, :stdlib
+        expect(config).to be_expecting_with_rspec
+      end
+
+      it "returns true when `expect_with :stdlib, :rspec` has been configured" do
+        config.expect_with :stdlib, :rspec
+        expect(config).to be_expecting_with_rspec
+      end
+
+      it "returns false when `expect_with :stdlib` has been configured" do
+        config.expect_with :stdlib
+        expect(config).not_to be_expecting_with_rspec
+      end
+    end
+
+    describe "#files_to_run" do
+      it "loads files not following pattern if named explicitly" do
+        config.files_or_directories_to_run = "spec/rspec/core/resources/a_bar.rb"
+        expect(config.files_to_run).to eq([      "spec/rspec/core/resources/a_bar.rb"])
+      end
+
+      it "prevents repetition of dir when start of the pattern" do
+        config.pattern = "spec/**/a_spec.rb"
+        config.files_or_directories_to_run = "spec"
+        expect(config.files_to_run).to eq(["spec/rspec/core/resources/a_spec.rb"])
+      end
+
+      it "does not prevent repetition of dir when later of the pattern" do
+        config.pattern = "rspec/**/a_spec.rb"
+        config.files_or_directories_to_run = "spec"
+        expect(config.files_to_run).to eq(["spec/rspec/core/resources/a_spec.rb"])
+      end
+
+      context "with <path>:<line_number>" do
+        it "overrides inclusion filters set on config" do
+          config.filter_run_including :foo => :bar
+          config.files_or_directories_to_run = "path/to/file.rb:37"
+          expect(config.inclusion_filter.size).to eq(1)
+          expect(config.inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
+          expect(config.inclusion_filter[:locations].values.first).to eq([37])
+        end
+
+        it "overrides inclusion filters set before config" do
+          config.force(:inclusion_filter => {:foo => :bar})
+          config.files_or_directories_to_run = "path/to/file.rb:37"
+          expect(config.inclusion_filter.size).to eq(1)
+          expect(config.inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
+          expect(config.inclusion_filter[:locations].values.first).to eq([37])
+        end
+
+        it "clears exclusion filters set on config" do
+          config.exclusion_filter = { :foo => :bar }
+          config.files_or_directories_to_run = "path/to/file.rb:37"
+          expect(config.exclusion_filter).to be_empty,
+            "expected exclusion filter to be empty:\n#{config.exclusion_filter}"
+        end
+
+        it "clears exclusion filters set before config" do
+          config.force(:exclusion_filter => { :foo => :bar })
+          config.files_or_directories_to_run = "path/to/file.rb:37"
+          expect(config.exclusion_filter).to be_empty,
+            "expected exclusion filter to be empty:\n#{config.exclusion_filter}"
+        end
+      end
+
+      context "with default pattern" do
+        it "loads files named _spec.rb" do
+          config.files_or_directories_to_run = "spec/rspec/core/resources"
+          expect(config.files_to_run).to eq([      "spec/rspec/core/resources/a_spec.rb"])
+        end
+
+        it "loads files in Windows", :if => RSpec.windows_os? do
+          config.files_or_directories_to_run = "C:\\path\\to\\project\\spec\\sub\\foo_spec.rb"
+          expect(config.files_to_run).to eq([      "C:/path/to/project/spec/sub/foo_spec.rb"])
+        end
+
+        it "loads files in Windows when directory is specified", :if => RSpec.windows_os? do
+          config.files_or_directories_to_run = "spec\\rspec\\core\\resources"
+          expect(config.files_to_run).to eq([      "spec/rspec/core/resources/a_spec.rb"])
+        end
+      end
+
+      context "with default default_path" do
+        it "loads files in the default path when run by rspec" do
+          config.stub(:command) { 'rspec' }
+          config.files_or_directories_to_run = []
+          expect(config.files_to_run).not_to be_empty
+        end
+
+        it "loads files in the default path when run with DRB (e.g., spork)" do
+          config.stub(:command) { 'spork' }
+          RSpec::Core::Runner.stub(:running_in_drb?) { true }
+          config.files_or_directories_to_run = []
+          expect(config.files_to_run).not_to be_empty
+        end
+
+        it "does not load files in the default path when run by ruby" do
+          config.stub(:command) { 'ruby' }
+          config.files_or_directories_to_run = []
+          expect(config.files_to_run).to be_empty
+        end
+      end
+
+      def specify_consistent_ordering_of_files_to_run
+        File.stub(:directory?).with('a') { true }
+
+        orderings = [
+          %w[ a/1.rb a/2.rb a/3.rb ],
+          %w[ a/2.rb a/1.rb a/3.rb ],
+          %w[ a/3.rb a/2.rb a/1.rb ]
+        ].map do |files|
+          Dir.should_receive(:[]).with(/^\{?a/) { files }
+          yield
+          config.files_to_run
+        end
+
+        expect(orderings.uniq.size).to eq(1)
+      end
+
+      context 'when the given directories match the pattern' do
+        it 'orders the files in a consistent ordering, regardless of the underlying OS ordering' do
+          specify_consistent_ordering_of_files_to_run do
+            config.pattern = 'a/*.rb'
+            config.files_or_directories_to_run = 'a'
+          end
+        end
+      end
+
+      context 'when the pattern is given relative to the given directories' do
+        it 'orders the files in a consistent ordering, regardless of the underlying OS ordering' do
+          specify_consistent_ordering_of_files_to_run do
+            config.pattern = '*.rb'
+            config.files_or_directories_to_run = 'a'
+          end
+        end
+      end
+
+      context 'when given multiple file paths' do
+        it 'orders the files in a consistent ordering, regardless of the given order' do
+          File.stub(:directory?) { false } # fake it into thinking these a full file paths
+
+          files = ['a/b/c_spec.rb', 'c/b/a_spec.rb']
+          config.files_or_directories_to_run = *files
+          ordering_1 = config.files_to_run
+
+          config.files_or_directories_to_run = *(files.reverse)
+          ordering_2 = config.files_to_run
+
+          expect(ordering_1).to eq(ordering_2)
+        end
+      end
+    end
+
+    %w[pattern= filename_pattern=].each do |setter|
+      describe "##{setter}" do
+        context "with single pattern" do
+          before { config.send(setter, "**/*_foo.rb") }
+          it "loads files following pattern" do
+            file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
+            config.files_or_directories_to_run = file
+            expect(config.files_to_run).to include(file)
+          end
+
+          it "loads files in directories following pattern" do
+            dir = File.expand_path(File.dirname(__FILE__) + "/resources")
+            config.files_or_directories_to_run = dir
+            expect(config.files_to_run).to include("#{dir}/a_foo.rb")
+          end
+
+          it "does not load files in directories not following pattern" do
+            dir = File.expand_path(File.dirname(__FILE__) + "/resources")
+            config.files_or_directories_to_run = dir
+            expect(config.files_to_run).not_to include("#{dir}/a_bar.rb")
+          end
+        end
+
+        context "with multiple patterns" do
+          it "supports comma separated values" do
+            config.send(setter, "**/*_foo.rb,**/*_bar.rb")
+            dir = File.expand_path(File.dirname(__FILE__) + "/resources")
+            config.files_or_directories_to_run = dir
+            expect(config.files_to_run).to include("#{dir}/a_foo.rb")
+            expect(config.files_to_run).to include("#{dir}/a_bar.rb")
+          end
+
+          it "supports comma separated values with spaces" do
+            config.send(setter, "**/*_foo.rb, **/*_bar.rb")
+            dir = File.expand_path(File.dirname(__FILE__) + "/resources")
+            config.files_or_directories_to_run = dir
+            expect(config.files_to_run).to include("#{dir}/a_foo.rb")
+            expect(config.files_to_run).to include("#{dir}/a_bar.rb")
+          end
+
+          it "supports curly braces glob syntax" do
+            config.send(setter, "**/*_{foo,bar}.rb")
+            dir = File.expand_path(File.dirname(__FILE__) + "/resources")
+            config.files_or_directories_to_run = dir
+            expect(config.files_to_run).to include("#{dir}/a_foo.rb")
+            expect(config.files_to_run).to include("#{dir}/a_bar.rb")
+          end
+        end
+      end
+    end
+
+    describe "path with line number" do
+      it "assigns the line number as a location filter" do
+        config.files_or_directories_to_run = "path/to/a_spec.rb:37"
+        expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
+      end
+    end
+
+    context "with full_description set" do
+      it "overrides filters" do
+        config.filter_run :focused => true
+        config.full_description = "foo"
+        expect(config.filter).not_to have_key(:focused)
+      end
+
+      it 'is possible to access the full description regular expression' do
+        config.full_description = "foo"
+        expect(config.full_description).to eq(/foo/)
+      end
+    end
+
+    context "without full_description having been set" do
+      it 'returns nil from #full_description' do
+        expect(config.full_description).to eq nil
+      end
+    end
+
+    context "with line number" do
+      it "assigns the file and line number as a location filter" do
+        config.files_or_directories_to_run = "path/to/a_spec.rb:37"
+        expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
+      end
+
+      it "assigns multiple files with line numbers as location filters" do
+        config.files_or_directories_to_run = "path/to/a_spec.rb:37", "other_spec.rb:44"
+        expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37],
+                                                File.expand_path("other_spec.rb") => [44]}})
+      end
+
+      it "assigns files with multiple line numbers as location filters" do
+        config.files_or_directories_to_run = "path/to/a_spec.rb:37", "path/to/a_spec.rb:44"
+        expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37, 44]}})
+      end
+    end
+
+    context "with multiple line numbers" do
+      it "assigns the file and line numbers as a location filter" do
+        config.files_or_directories_to_run = "path/to/a_spec.rb:1:3:5:7"
+        expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [1,3,5,7]}})
+      end
+    end
+
+    it "assigns the example name as the filter on description" do
+      config.full_description = "foo"
+      expect(config.filter).to eq({:full_description => /foo/})
+    end
+
+    it "assigns the example names as the filter on description if description is an array" do
+      config.full_description = [ "foo", "bar" ]
+      expect(config.filter).to eq({:full_description => Regexp.union(/foo/, /bar/)})
+    end
+
+    it 'is possible to access the full description regular expression' do
+      config.full_description = "foo","bar"
+      expect(config.full_description).to eq Regexp.union(/foo/,/bar/)
+    end
+
+    describe "#default_path" do
+      it 'defaults to "spec"' do
+        expect(config.default_path).to eq('spec')
+      end
+    end
+
+    describe "#include" do
+
+      module InstanceLevelMethods
+        def you_call_this_a_blt?
+          "egad man, where's the mayo?!?!?"
+        end
+      end
+
+      it_behaves_like "metadata hash builder" do
+        def metadata_hash(*args)
+          config.include(InstanceLevelMethods, *args)
+          config.include_or_extend_modules.last.last
+        end
+      end
+
+      context "with no filter" do
+        it "includes the given module into each example group" do
+          RSpec.configure do |c|
+            c.include(InstanceLevelMethods)
+          end
+
+          group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
+          expect(group).not_to respond_to(:you_call_this_a_blt?)
+          expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
+        end
+      end
+
+      context "with a filter" do
+        it "includes the given module into each matching example group" do
+          RSpec.configure do |c|
+            c.include(InstanceLevelMethods, :magic_key => :include)
+          end
+
+          group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
+          expect(group).not_to respond_to(:you_call_this_a_blt?)
+          expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
+        end
+      end
+
+    end
+
+    describe "#extend" do
+
+      module ThatThingISentYou
+        def that_thing
+        end
+      end
+
+      it_behaves_like "metadata hash builder" do
+        def metadata_hash(*args)
+          config.extend(ThatThingISentYou, *args)
+          config.include_or_extend_modules.last.last
+        end
+      end
+
+      it "extends the given module into each matching example group" do
+        RSpec.configure do |c|
+          c.extend(ThatThingISentYou, :magic_key => :extend)
+        end
+
+        group = ExampleGroup.describe(ThatThingISentYou, :magic_key => :extend) { }
+        expect(group).to respond_to(:that_thing)
+      end
+
+    end
+
+    describe "#run_all_when_everything_filtered?" do
+
+      it "defaults to false" do
+        expect(config.run_all_when_everything_filtered?).to be_false
+      end
+
+      it "can be queried with question method" do
+        config.run_all_when_everything_filtered = true
+        expect(config.run_all_when_everything_filtered?).to be_true
+      end
+    end
+
+    %w[color color_enabled].each do |color_option|
+      describe "##{color_option}=" do
+        context "given true" do
+          before { config.send "#{color_option}=", true }
+
+          context "with config.tty? and output.tty?" do
+            it "does not set color_enabled" do
+              output = StringIO.new
+              config.output_stream = output
+
+              config.tty = true
+              config.output_stream.stub :tty? => true
+
+              expect(config.send(color_option)).to be_true
+              expect(config.send(color_option, output)).to be_true
+            end
+          end
+
+          context "with config.tty? and !output.tty?" do
+            it "sets color_enabled" do
+              output = StringIO.new
+              config.output_stream = output
+
+              config.tty = true
+              config.output_stream.stub :tty? => false
+
+              expect(config.send(color_option)).to be_true
+              expect(config.send(color_option, output)).to be_true
+            end
+          end
+
+          context "with config.tty? and !output.tty?" do
+            it "does not set color_enabled" do
+              output = StringIO.new
+              config.output_stream = output
+
+              config.tty = false
+              config.output_stream.stub :tty? => true
+
+              expect(config.send(color_option)).to be_true
+              expect(config.send(color_option, output)).to be_true
+            end
+          end
+
+          context "with !config.tty? and !output.tty?" do
+            it "does not set color_enabled" do
+              output = StringIO.new
+              config.output_stream = output
+
+              config.tty = false
+              config.output_stream.stub :tty? => false
+
+              expect(config.send(color_option)).to be_false
+              expect(config.send(color_option, output)).to be_false
+            end
+          end
+
+          context "on windows" do
+            before do
+              @original_host  = RbConfig::CONFIG['host_os']
+              RbConfig::CONFIG['host_os'] = 'mingw'
+              config.stub(:require)
+              config.stub(:warn)
+            end
+
+            after do
+              RbConfig::CONFIG['host_os'] = @original_host
+            end
+
+            context "with ANSICON available" do
+              around(:each) { |e| with_env_vars('ANSICON' => 'ANSICON', &e) }
+
+              it "enables colors" do
+                config.output_stream = StringIO.new
+                config.output_stream.stub :tty? => true
+                config.send "#{color_option}=", true
+                expect(config.send(color_option)).to be_true
+              end
+
+              it "leaves output stream intact" do
+                config.output_stream = $stdout
+                config.stub(:require) do |what|
+                  config.output_stream = 'foo' if what =~ /Win32/
+                end
+                config.send "#{color_option}=", true
+                expect(config.output_stream).to eq($stdout)
+              end
+            end
+
+            context "with ANSICON NOT available" do
+              it "warns to install ANSICON" do
+                config.stub(:require) { raise LoadError }
+                config.should_receive(:warn).
+                  with(/You must use ANSICON/)
+                config.send "#{color_option}=", true
+              end
+
+              it "sets color_enabled to false" do
+                config.stub(:require) { raise LoadError }
+                config.send "#{color_option}=", true
+                config.color_enabled = true
+                expect(config.send(color_option)).to be_false
+              end
+            end
+          end
+        end
+      end
+
+      it "prefers incoming cli_args" do
+        config.output_stream = StringIO.new
+        config.output_stream.stub :tty? => true
+        config.force :color => true
+        config.color = false
+        expect(config.color).to be_true
+      end
+    end
+
+    describe '#formatter=' do
+      it "delegates to add_formatter (better API for user-facing configuration)" do
+        config.should_receive(:add_formatter).with('these','options')
+        config.add_formatter('these','options')
+      end
+    end
+
+    describe "#add_formatter" do
+
+      it "adds to the list of formatters" do
+        config.add_formatter :documentation
+        expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
+      end
+
+      it "finds a formatter by name (w/ Symbol)" do
+        config.add_formatter :documentation
+        expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
+      end
+
+      it "finds a formatter by name (w/ String)" do
+        config.add_formatter 'documentation'
+        expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
+      end
+
+      it "finds a formatter by class" do
+        formatter_class = Class.new(Formatters::BaseTextFormatter)
+        config.add_formatter formatter_class
+        expect(config.formatters.first).to be_an_instance_of(formatter_class)
+      end
+
+      it "finds a formatter by class name" do
+        stub_const("CustomFormatter", Class.new(Formatters::BaseFormatter))
+        config.add_formatter "CustomFormatter"
+        expect(config.formatters.first).to be_an_instance_of(CustomFormatter)
+      end
+
+      it "finds a formatter by class fully qualified name" do
+        stub_const("RSpec::CustomFormatter", Class.new(Formatters::BaseFormatter))
+        config.add_formatter "RSpec::CustomFormatter"
+        expect(config.formatters.first).to be_an_instance_of(RSpec::CustomFormatter)
+      end
+
+      it "requires a formatter file based on its fully qualified name" do
+        config.should_receive(:require).with('rspec/custom_formatter') do
+          stub_const("RSpec::CustomFormatter", Class.new(Formatters::BaseFormatter))
+        end
+        config.add_formatter "RSpec::CustomFormatter"
+        expect(config.formatters.first).to be_an_instance_of(RSpec::CustomFormatter)
+      end
+
+      it "raises NameError if class is unresolvable" do
+        config.should_receive(:require).with('rspec/custom_formatter3')
+        expect(lambda { config.add_formatter "RSpec::CustomFormatter3" }).to raise_error(NameError)
+      end
+
+      it "raises ArgumentError if formatter is unknown" do
+        expect(lambda { config.add_formatter :progresss }).to raise_error(ArgumentError)
+      end
+
+      context "with a 2nd arg defining the output" do
+        it "creates a file at that path and sets it as the output" do
+          path = File.join(Dir.tmpdir, 'output.txt')
+          config.add_formatter('doc', path)
+          expect(config.formatters.first.output).to be_a(File)
+          expect(config.formatters.first.output.path).to eq(path)
+        end
+      end
+    end
+
+    describe "#filter_run_including" do
+      it_behaves_like "metadata hash builder" do
+        def metadata_hash(*args)
+          config.filter_run_including(*args)
+          config.inclusion_filter
+        end
+      end
+
+      it "sets the filter with a hash" do
+        config.filter_run_including :foo => true
+        expect(config.inclusion_filter[:foo]).to be(true)
+      end
+
+      it "sets the filter with a symbol" do
+        RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
+        config.filter_run_including :foo
+        expect(config.inclusion_filter[:foo]).to be(true)
+      end
+
+      it "merges with existing filters" do
+        config.filter_run_including :foo => true
+        config.filter_run_including :bar => false
+
+        expect(config.inclusion_filter[:foo]).to be(true)
+        expect(config.inclusion_filter[:bar]).to be(false)
+      end
+    end
+
+    describe "#filter_run_excluding" do
+      it_behaves_like "metadata hash builder" do
+        def metadata_hash(*args)
+          config.filter_run_excluding(*args)
+          config.exclusion_filter
+        end
+      end
+
+      it "sets the filter" do
+        config.filter_run_excluding :foo => true
+        expect(config.exclusion_filter[:foo]).to be(true)
+      end
+
+      it "sets the filter using a symbol" do
+        RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
+        config.filter_run_excluding :foo
+        expect(config.exclusion_filter[:foo]).to be(true)
+      end
+
+      it "merges with existing filters" do
+        config.filter_run_excluding :foo => true
+        config.filter_run_excluding :bar => false
+
+        expect(config.exclusion_filter[:foo]).to be(true)
+        expect(config.exclusion_filter[:bar]).to be(false)
+      end
+    end
+
+    describe "#inclusion_filter" do
+      it "returns {} even if set to nil" do
+        config.inclusion_filter = nil
+        expect(config.inclusion_filter).to eq({})
+      end
+    end
+
+    describe "#inclusion_filter=" do
+      it "treats symbols as hash keys with true values when told to" do
+        RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
+        config.inclusion_filter = :foo
+        expect(config.inclusion_filter).to eq({:foo => true})
+      end
+
+      it "overrides any inclusion filters set on the command line or in configuration files" do
+        config.force(:inclusion_filter => { :foo => :bar })
+        config.inclusion_filter = {:want => :this}
+        expect(config.inclusion_filter).to eq({:want => :this})
+      end
+    end
+
+    describe "#exclusion_filter" do
+      it "returns {} even if set to nil" do
+        config.exclusion_filter = nil
+        expect(config.exclusion_filter).to eq({})
+      end
+
+      describe "the default :if filter" do
+        it "does not exclude a spec with  { :if => true } metadata" do
+          expect(config.exclusion_filter[:if].call(true)).to be_false
+        end
+
+        it "excludes a spec with  { :if => false } metadata" do
+          expect(config.exclusion_filter[:if].call(false)).to be_true
+        end
+
+        it "excludes a spec with  { :if => nil } metadata" do
+          expect(config.exclusion_filter[:if].call(nil)).to be_true
+        end
+      end
+
+      describe "the default :unless filter" do
+        it "excludes a spec with  { :unless => true } metadata" do
+          expect(config.exclusion_filter[:unless].call(true)).to be_true
+        end
+
+        it "does not exclude a spec with { :unless => false } metadata" do
+          expect(config.exclusion_filter[:unless].call(false)).to be_false
+        end
+
+        it "does not exclude a spec with { :unless => nil } metadata" do
+          expect(config.exclusion_filter[:unless].call(nil)).to be_false
+        end
+      end
+    end
+
+    describe "#exclusion_filter=" do
+      it "treats symbols as hash keys with true values when told to" do
+        RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
+        config.exclusion_filter = :foo
+        expect(config.exclusion_filter).to eq({:foo => true})
+      end
+
+      it "overrides any exclusion filters set on the command line or in configuration files" do
+        config.force(:exclusion_filter => { :foo => :bar })
+        config.exclusion_filter = {:want => :this}
+        expect(config.exclusion_filter).to eq({:want => :this})
+      end
+    end
+
+    describe "line_numbers=" do
+      before { config.filter_manager.stub(:warn) }
+
+      it "sets the line numbers" do
+        config.line_numbers = ['37']
+        expect(config.filter).to eq({:line_numbers => [37]})
+      end
+
+      it "overrides filters" do
+        config.filter_run :focused => true
+        config.line_numbers = ['37']
+        expect(config.filter).to eq({:line_numbers => [37]})
+      end
+
+      it "prevents subsequent filters" do
+        config.line_numbers = ['37']
+        config.filter_run :focused => true
+        expect(config.filter).to eq({:line_numbers => [37]})
+      end
+    end
+
+    describe "line_numbers" do
+      it "returns the line numbers from the filter" do
+        config.line_numbers = ['42']
+        expect(config.line_numbers).to eq [42]
+      end
+
+      it "defaults to empty" do
+        expect(config.line_numbers).to eq []
+      end
+    end
+
+    describe "#full_backtrace=" do
+      context "given true" do
+        it "clears the backtrace exclusion patterns" do
+          config.full_backtrace = true
+          expect(config.backtrace_exclusion_patterns).to eq([])
+        end
+      end
+
+      context "given false" do
+        it "restores backtrace clean patterns" do
+          config.full_backtrace = false
+          expect(config.backtrace_exclusion_patterns).to eq(RSpec::Core::BacktraceCleaner::DEFAULT_EXCLUSION_PATTERNS)
+        end
+      end
+
+      it "doesn't impact other instances of config" do
+        config_1 = Configuration.new
+        config_2 = Configuration.new
+
+        config_1.full_backtrace = true
+        expect(config_2.backtrace_exclusion_patterns).not_to be_empty
+      end
+    end
+
+    describe "#backtrace_clean_patterns=" do
+      it "actually receives the new filter values" do
+        RSpec.stub(:deprecate)
+        config = Configuration.new
+        config.backtrace_clean_patterns = [/.*/]
+        expect(config.backtrace_cleaner.exclude? "this").to be_true
+      end
+    end
+
+    describe 'full_backtrace' do
+      it 'returns true when backtrace patterns is empty' do
+        config.backtrace_exclusion_patterns = []
+        expect(config.full_backtrace?).to eq true
+      end
+
+      it 'returns false when backtrace patterns isnt empty' do
+        config.backtrace_exclusion_patterns = [:lib]
+        expect(config.full_backtrace?).to eq false
+      end
+    end
+
+    describe "#backtrace_clean_patterns" do
+      before { allow(RSpec).to receive(:deprecate) }
+      it "is deprecated" do
+        RSpec.should_receive(:deprecate)
+        config = Configuration.new
+        config.backtrace_clean_patterns
+      end
+
+      it "can be appended to" do
+        config = Configuration.new
+        config.backtrace_clean_patterns << /.*/
+        expect(config.backtrace_cleaner.exclude? "this").to be_true
+      end
+    end
+
+    describe ".backtrace_cleaner#exclude? defaults" do
+      it "returns true for rspec files" do
+        expect(config.backtrace_cleaner.exclude?("lib/rspec/core.rb")).to be_true
+      end
+
+      it "returns true for spec_helper" do
+        expect(config.backtrace_cleaner.exclude?("spec/spec_helper.rb")).to be_true
+      end
+
+      it "returns true for java files (for JRuby)" do
+        expect(config.backtrace_cleaner.exclude?("org/jruby/RubyArray.java:2336")).to be_true
+      end
+
+      it "returns true for files within installed gems" do
+        expect(config.backtrace_cleaner.exclude?('ruby-1.8.7-p334/gems/mygem-2.3.0/lib/mygem.rb')).to be_true
+      end
+
+      it "returns false for files in projects containing 'gems' in the name" do
+        expect(config.backtrace_cleaner.exclude?('code/my-gems-plugin/lib/plugin.rb')).to be_false
+      end
+
+      it "returns false for something in the current working directory" do
+        expect(config.backtrace_cleaner.exclude?("#{Dir.getwd}/arbitrary")).to be_false
+      end
+    end
+
+    describe "#debug=true" do
+      before do
+        if defined?(Debugger)
+          @orig_debugger = Debugger
+          Object.send(:remove_const, :Debugger)
+        else
+          @orig_debugger = nil
+        end
+        config.stub(:require)
+        Object.const_set("Debugger", debugger)
+      end
+
+      after do
+        Object.send(:remove_const, :Debugger)
+        Object.const_set("Debugger", @orig_debugger) if @orig_debugger
+      end
+
+      let(:debugger) { double('Debugger').as_null_object }
+
+      it "requires 'ruby-debug'" do
+        config.should_receive(:require).with('ruby-debug')
+        config.debug = true
+      end
+
+      it "starts the debugger" do
+        debugger.should_receive(:start)
+        config.debug = true
+      end
+    end
+
+    describe "#debug=false" do
+      it "does not require 'ruby-debug'" do
+        config.should_not_receive(:require).with('ruby-debug')
+        config.debug = false
+      end
+    end
+
+    describe "#debug?" do
+      it 'returns true if the debugger has been loaded' do
+        stub_const("Debugger", Object.new)
+        expect(config.debug?).to be_true
+      end
+
+      it 'returns false if the debugger has not been loaded' do
+        hide_const("Debugger")
+        expect(config.debug?).to be_false
+      end
+    end
+
+    describe "#output=" do
+      it "sets the output" do
+        output = double("output")
+        config.output = output
+        expect(config.output).to equal(output)
+      end
+    end
+
+    describe "#libs=" do
+      include_context "isolate load path mutation"
+
+      it "adds directories to the LOAD_PATH" do
+        $LOAD_PATH.should_receive(:unshift).with("a/dir")
+        config.libs = ["a/dir"]
+      end
+    end
+
+    describe "libs" do
+      include_context "isolate load path mutation"
+
+      it 'records paths added to the load path' do
+        config.libs = ["a/dir"]
+        expect(config.libs).to eq ["a/dir"]
+      end
+    end
+
+    describe "#requires=" do
+      before { RSpec.should_receive :deprecate }
+
+      it "requires the configured files" do
+        config.should_receive(:require).with('foo').ordered
+        config.should_receive(:require).with('bar').ordered
+        config.requires = ['foo', 'bar']
+      end
+
+      it "stores require paths" do
+        config.should_receive(:require).with("a/path")
+        config.requires = ["a/path"]
+        expect(config.requires).to eq ['a/path']
+      end
+    end
+
+    describe "#add_setting" do
+      describe "with no modifiers" do
+        context "with no additional options" do
+          before do
+            config.add_setting :custom_option
+          end
+
+          it "defaults to nil" do
+            expect(config.custom_option).to be_nil
+          end
+
+          it "adds a predicate" do
+            expect(config.custom_option?).to be_false
+          end
+
+          it "can be overridden" do
+            config.custom_option = "a value"
+            expect(config.custom_option).to eq("a value")
+          end
+        end
+
+        context "with :default => 'a value'" do
+          before do
+            config.add_setting :custom_option, :default => 'a value'
+          end
+
+          it "defaults to 'a value'" do
+            expect(config.custom_option).to eq("a value")
+          end
+
+          it "returns true for the predicate" do
+            expect(config.custom_option?).to be_true
+          end
+
+          it "can be overridden with a truthy value" do
+            config.custom_option = "a new value"
+            expect(config.custom_option).to eq("a new value")
+          end
+
+          it "can be overridden with nil" do
+            config.custom_option = nil
+            expect(config.custom_option).to eq(nil)
+          end
+
+          it "can be overridden with false" do
+            config.custom_option = false
+            expect(config.custom_option).to eq(false)
+          end
+        end
+      end
+
+      context "with :alias => " do
+        it "is deprecated" do
+          RSpec::should_receive(:deprecate).with(/:alias option/, :replacement => ":alias_with")
+          config.add_setting :custom_option
+          config.add_setting :another_custom_option, :alias => :custom_option
+        end
+      end
+
+      context "with :alias_with => " do
+        before do
+          config.add_setting :custom_option, :alias_with => :another_custom_option
+        end
+
+        it "delegates the getter to the other option" do
+          config.another_custom_option = "this value"
+          expect(config.custom_option).to eq("this value")
+        end
+
+        it "delegates the setter to the other option" do
+          config.custom_option = "this value"
+          expect(config.another_custom_option).to eq("this value")
+        end
+
+        it "delegates the predicate to the other option" do
+          config.custom_option = true
+          expect(config.another_custom_option?).to be_true
+        end
+      end
+    end
+
+    describe "#configure_group" do
+      it "extends with 'extend'" do
+        mod = Module.new
+        group = ExampleGroup.describe("group", :foo => :bar)
+
+        config.extend(mod, :foo => :bar)
+        config.configure_group(group)
+        expect(group).to be_a(mod)
+      end
+
+      it "extends with 'module'" do
+        mod = Module.new
+        group = ExampleGroup.describe("group", :foo => :bar)
+
+        config.include(mod, :foo => :bar)
+        config.configure_group(group)
+        expect(group.included_modules).to include(mod)
+      end
+
+      it "requires only one matching filter" do
+        mod = Module.new
+        group = ExampleGroup.describe("group", :foo => :bar)
+
+        config.include(mod, :foo => :bar, :baz => :bam)
+        config.configure_group(group)
+        expect(group.included_modules).to include(mod)
+      end
+
+      it "includes each one before deciding whether to include the next" do
+        mod1 = Module.new do
+          def self.included(host)
+            host.metadata[:foo] = :bar
+          end
+        end
+        mod2 = Module.new
+
+        group = ExampleGroup.describe("group")
+
+        config.include(mod1)
+        config.include(mod2, :foo => :bar)
+        config.configure_group(group)
+        expect(group.included_modules).to include(mod1)
+        expect(group.included_modules).to include(mod2)
+      end
+
+      module IncludeOrExtendMeOnce
+        def self.included(host)
+          raise "included again" if host.instance_methods.include?(:foobar)
+          host.class_eval { def foobar; end }
+        end
+
+        def self.extended(host)
+          raise "extended again" if host.respond_to?(:foobar)
+          def host.foobar; end
+        end
+      end
+
+      it "doesn't include a module when already included in ancestor" do
+        config.include(IncludeOrExtendMeOnce, :foo => :bar)
+
+        group = ExampleGroup.describe("group", :foo => :bar)
+        child = group.describe("child")
+
+        config.configure_group(group)
+        config.configure_group(child)
+      end
+
+      it "doesn't extend when ancestor is already extended with same module" do
+        config.extend(IncludeOrExtendMeOnce, :foo => :bar)
+
+        group = ExampleGroup.describe("group", :foo => :bar)
+        child = group.describe("child")
+
+        config.configure_group(group)
+        config.configure_group(child)
+      end
+    end
+
+    describe "#alias_example_to" do
+      it_behaves_like "metadata hash builder" do
+        after do
+          RSpec::Core::ExampleGroup.module_eval do
+            class << self
+              undef :my_example_method if method_defined? :my_example_method
+            end
+          end
+        end
+        def metadata_hash(*args)
+          config.alias_example_to :my_example_method, *args
+          group = ExampleGroup.describe("group")
+          example = group.my_example_method("description")
+          example.metadata
+        end
+      end
+    end
+
+    describe "#reset" do
+      it "clears the reporter" do
+        expect(config.reporter).not_to be_nil
+        config.reset
+        expect(config.instance_variable_get("@reporter")).to be_nil
+      end
+
+      it "clears the formatters" do
+        config.add_formatter "doc"
+        config.reset
+        expect(config.formatters).to be_empty
+      end
+    end
+
+    describe "#force" do
+      it "forces order" do
+        config.force :order => "default"
+        config.order = "rand"
+        expect(config.order).to eq("default")
+      end
+
+      it "forces order and seed with :order => 'rand:37'" do
+        config.force :order => "rand:37"
+        config.order = "default"
+        expect(config.order).to eq("rand")
+        expect(config.seed).to eq(37)
+      end
+
+      it "forces order and seed with :seed => '37'" do
+        config.force :seed => "37"
+        config.order = "default"
+        expect(config.seed).to eq(37)
+        expect(config.order).to eq("rand")
+      end
+
+      it 'can set random ordering' do
+        config.force :seed => "rand:37"
+        RSpec.stub(:configuration => config)
+        list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
+        Kernel.should_receive(:rand).and_return(3, 1, 4, 2)
+        expect(list.ordered).to eq([2, 4, 1, 3])
+      end
+
+      it "forces 'false' value" do
+        config.add_setting :custom_option
+        config.custom_option = true
+        expect(config.custom_option?).to be_true
+        config.force :custom_option => false
+        expect(config.custom_option?).to be_false
+        config.custom_option = true
+        expect(config.custom_option?).to be_false
+      end
+    end
+
+    describe '#seed' do
+      it 'returns the seed as an int' do
+        config.seed = '123'
+        expect(config.seed).to eq(123)
+      end
+    end
+
+    describe '#randomize?' do
+      context 'with order set to :random' do
+        before { config.order = :random }
+
+        it 'returns true' do
+          expect(config.randomize?).to be_true
+        end
+      end
+
+      context 'with order set to nil' do
+        before { config.order = nil }
+
+        it 'returns false' do
+          expect(config.randomize?).to be_false
+        end
+      end
+    end
+
+    describe '#order=' do
+      context 'given "random:123"' do
+        before { config.order = 'random:123' }
+
+        it 'sets order to "random"' do
+          expect(config.order).to eq('random')
+        end
+
+        it 'sets seed to 123' do
+          expect(config.seed).to eq(123)
+        end
+
+        it 'sets up random ordering' do
+          RSpec.stub(:configuration => config)
+          list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
+          Kernel.should_receive(:rand).and_return(3, 1, 4, 2)
+          expect(list.ordered).to eq([2, 4, 1, 3])
+        end
+      end
+
+      context 'given "default"' do
+        before do
+          config.order = 'rand:123'
+          config.order = 'default'
+        end
+
+        it "sets the order to nil" do
+          expect(config.order).to be_nil
+        end
+
+        it "sets the seed to nil" do
+          expect(config.seed).to be_nil
+        end
+
+        it 'clears the random ordering' do
+          RSpec.stub(:configuration => config)
+          list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
+          Kernel.should_not_receive(:rand)
+          expect(list.ordered).to eq([1, 2, 3, 4])
+        end
+      end
+    end
+
+    describe "#order_examples" do
+      before { RSpec.stub(:configuration => config) }
+
+      it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::Examples' do
+        examples = [1, 2, 3, 4]
+        examples.extend Extensions::Ordered::Examples
+        config.order_examples { |examples_to_order| examples_to_order.reverse }
+        expect(examples.ordered).to eq([4, 3, 2, 1])
+      end
+
+      it 'sets #order to "custom"' do
+        config.order_examples { |examples| examples.reverse }
+        expect(config.order).to eq("custom")
+      end
+    end
+
+    describe "#example_ordering_block" do
+      it 'defaults to a block that returns the passed argument' do
+        expect(config.example_ordering_block.call([1, 2, 3])).to eq([1, 2, 3])
+      end
+    end
+
+    describe "#order_groups" do
+      before { RSpec.stub(:configuration => config) }
+
+      it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::ExampleGroups' do
+        groups = [1, 2, 3, 4]
+        groups.extend Extensions::Ordered::ExampleGroups
+        config.order_groups { |groups_to_order| groups_to_order.reverse }
+        expect(groups.ordered).to eq([4, 3, 2, 1])
+      end
+
+      it 'sets #order to "custom"' do
+        config.order_groups { |groups| groups.reverse }
+        expect(config.order).to eq("custom")
+      end
+    end
+
+    describe "#group_ordering_block" do
+      it 'defaults to a block that returns the passed argument' do
+        expect(config.group_ordering_block.call([1, 2, 3])).to eq([1, 2, 3])
+      end
+    end
+
+    describe "#order_groups_and_examples" do
+      let(:examples) { [1, 2, 3, 4].extend Extensions::Ordered::Examples }
+      let(:groups)   { [1, 2, 3, 4].extend Extensions::Ordered::ExampleGroups }
+
+      before do
+        RSpec.stub(:configuration => config)
+        config.order_groups_and_examples { |list| list.reverse }
+      end
+
+      it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::Examples' do
+        expect(examples.ordered).to eq([4, 3, 2, 1])
+      end
+
+      it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::ExampleGroups' do
+        expect(groups.ordered).to eq([4, 3, 2, 1])
+      end
+    end
+
+    describe '#warnings' do
+      around do |example|
+        @_original_setting = $VERBOSE
+        example.run
+        $VERBOSE = @_original_setting
+      end
+
+      it "sets verbose to true when true" do
+        config.warnings = true
+        expect($VERBOSE).to eq true
+      end
+
+      it "sets verbose to false when true" do
+        config.warnings = false
+        expect($VERBOSE).to eq false
+      end
+
+      it 'returns the verbosity setting' do
+        expect(config.warnings).to eq $VERBOSE
+      end
+
+      it 'is loaded from config by #force' do
+        config.force :warnings => true
+        expect($VERBOSE).to eq true
+      end
+    end
+
+  end
+end
diff --git a/rspec-core/spec/rspec/core/deprecation_spec.rb b/rspec-core/spec/rspec/core/deprecation_spec.rb
new file mode 100644
index 0000000..d062200
--- /dev/null
+++ b/rspec-core/spec/rspec/core/deprecation_spec.rb
@@ -0,0 +1,46 @@
+require "spec_helper"
+
+describe RSpec::Core::Deprecation do
+  describe "#deprecate" do
+    context "old API with individual args" do
+      it "includes the method to deprecate" do
+        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method")
+        RSpec.deprecate("deprecated_method")
+      end
+
+      it "includes the replacement when provided" do
+        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement")
+        RSpec.deprecate("deprecated_method", "replacement")
+      end
+
+      it "adds the call site" do
+        expect_deprecation_with_call_site(__FILE__, __LINE__ + 1)
+        RSpec.deprecate("deprecated_method")
+      end
+
+      it "doesn't override the existing callsite" do
+        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :call_site => "/path")
+        RSpec.deprecate("deprecated_method", :call_site => "/path")
+      end
+    end
+
+    context "new API with a hash after the first arg" do
+      it "passes the hash to the reporter" do
+        expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :deprecated => "deprecated_method", :replacement => "replacement")
+        RSpec.deprecate("deprecated_method", :replacement => "replacement")
+      end
+
+      it "adds the call site" do
+        expect_deprecation_with_call_site(__FILE__, __LINE__ + 1)
+        RSpec.deprecate("deprecated_method")
+      end
+    end
+  end
+
+  describe "#warn_deprecation" do
+    it "puts message in a hash" do
+      expect(RSpec.configuration.reporter).to receive(:deprecation).with(hash_including :message => "this is the message")
+      RSpec.warn_deprecation("this is the message")
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/deprecations_spec.rb b/rspec-core/spec/rspec/core/deprecations_spec.rb
new file mode 100644
index 0000000..bd8dbec
--- /dev/null
+++ b/rspec-core/spec/rspec/core/deprecations_spec.rb
@@ -0,0 +1,73 @@
+require "spec_helper"
+
+describe "deprecated methods" do
+  describe "Spec" do
+    it "is deprecated" do
+      RSpec.should_receive(:deprecate)
+      Spec
+    end
+
+    it "returns RSpec" do
+      RSpec.stub(:deprecate)
+      expect(Spec).to eq(RSpec)
+    end
+
+    it "doesn't include backward compatibility in const_missing backtrace" do
+      RSpec.stub(:deprecate)
+      exception = nil
+      begin
+        ConstantThatDoesNotExist
+      rescue Exception => exception
+      end
+      expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
+    end
+  end
+
+  describe RSpec::Core::ExampleGroup do
+    describe 'running_example' do
+      it 'is deprecated' do
+        RSpec.should_receive(:deprecate).at_least(:once)
+        self.running_example
+      end
+
+      it "delegates to example" do
+        RSpec.stub(:deprecate)
+        expect(running_example).to eq(example)
+      end
+    end
+  end
+
+  describe RSpec::Core::SharedExampleGroup do
+    describe 'share_as' do
+      it 'is deprecated' do
+        RSpec.should_receive(:deprecate).at_least(:once)
+        RSpec::Core::SharedExampleGroup.share_as(:DeprecatedSharedConst) {}
+      end
+    end
+  end
+
+  describe "Spec::Runner.configure" do
+    it "is deprecated" do
+      RSpec.should_receive(:deprecate).at_least(:once)
+      Spec::Runner.configure
+    end
+  end
+
+  describe "Spec::Rake::SpecTask" do
+    it "is deprecated" do
+      RSpec.should_receive(:deprecate).at_least(:once)
+      Spec::Rake::SpecTask
+    end
+
+    it "doesn't include backward compatibility in const_missing backtrace" do
+      RSpec.stub(:deprecate)
+      exception = nil
+      begin
+        Spec::Rake::ConstantThatDoesNotExist
+      rescue Exception => exception
+      end
+      expect(exception.backtrace.find { |l| l =~ /lib\/rspec\/core\/backward_compatibility/ }).to be_nil
+    end
+  end
+
+end
diff --git a/rspec-core/spec/rspec/core/drb_command_line_spec.rb b/rspec-core/spec/rspec/core/drb_command_line_spec.rb
new file mode 100644
index 0000000..a03944e
--- /dev/null
+++ b/rspec-core/spec/rspec/core/drb_command_line_spec.rb
@@ -0,0 +1,102 @@
+require "spec_helper"
+require 'rspec/core/drb_command_line'
+
+describe "::DRbCommandLine", :type => :drb, :unless => RUBY_PLATFORM == 'java' do
+  let(:config) { RSpec::Core::Configuration.new }
+  let(:out)    { StringIO.new }
+  let(:err)    { StringIO.new }
+
+  include_context "spec files"
+
+  def command_line(*args)
+    RSpec::Core::DRbCommandLine.new(config_options(*args))
+  end
+
+  def config_options(*args)
+    options = RSpec::Core::ConfigurationOptions.new(args)
+    options.parse_options
+    options
+  end
+
+  context "without server running" do
+    it "raises an error" do
+      expect { command_line.run(err, out) }.to raise_error(DRb::DRbConnError)
+    end
+  end
+
+  describe "--drb-port" do
+    def with_RSPEC_DRB_set_to(val)
+      with_env_vars('RSPEC_DRB' => val) { yield }
+    end
+
+    context "without RSPEC_DRB environment variable set" do
+      it "defaults to 8989" do
+        with_RSPEC_DRB_set_to(nil) do
+          expect(command_line.drb_port).to eq(8989)
+        end
+      end
+
+      it "sets the DRb port" do
+        with_RSPEC_DRB_set_to(nil) do
+          expect(command_line("--drb-port", "1234").drb_port).to eq(1234)
+          expect(command_line("--drb-port", "5678").drb_port).to eq(5678)
+        end
+      end
+    end
+
+    context "with RSPEC_DRB environment variable set" do
+      context "without config variable set" do
+        it "uses RSPEC_DRB value" do
+          with_RSPEC_DRB_set_to('9000') do
+            expect(command_line.drb_port).to eq("9000")
+          end
+        end
+      end
+
+      context "and config variable set" do
+        it "uses configured value" do
+          with_RSPEC_DRB_set_to('9000') do
+            expect(command_line(*%w[--drb-port 5678]).drb_port).to eq(5678)
+          end
+        end
+      end
+    end
+  end
+
+  context "with server running" do
+    class SimpleDRbSpecServer
+      def self.run(argv, err, out)
+        options = RSpec::Core::ConfigurationOptions.new(argv)
+        options.parse_options
+        RSpec::Core::CommandLine.new(options, RSpec::Core::Configuration.new).run(err, out)
+      end
+    end
+
+    before(:all) do
+      @drb_port = '8990'
+      @drb_example_file_counter = 0
+      DRb::start_service("druby://127.0.0.1:#{@drb_port}", SimpleDRbSpecServer)
+    end
+
+    after(:all) do
+      DRb::stop_service
+    end
+
+    it "returns 0 if spec passes" do
+      result = command_line("--drb-port", @drb_port, passing_spec_filename).run(err, out)
+      expect(result).to be(0)
+    end
+
+    it "returns 1 if spec fails" do
+      result = command_line("--drb-port", @drb_port, failing_spec_filename).run(err, out)
+      expect(result).to be(1)
+    end
+
+    it "outputs colorized text when running with --colour option" do
+      pending "figure out a way to tell the output to say it's tty"
+      command_line(failing_spec_filename, "--color", "--drb-port", @drb_port).run(err, out)
+      out.rewind
+      expect(out.read).to match(/\e\[31m/m)
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/drb_options_spec.rb b/rspec-core/spec/rspec/core/drb_options_spec.rb
new file mode 100644
index 0000000..f00ab78
--- /dev/null
+++ b/rspec-core/spec/rspec/core/drb_options_spec.rb
@@ -0,0 +1,193 @@
+require "spec_helper"
+require 'rspec/core/drb_options'
+
+describe RSpec::Core::DrbOptions, :isolated_directory => true, :isolated_home => true do
+  include ConfigOptionsHelper
+
+  describe "#drb_argv" do
+    it "preserves extra arguments" do
+      File.stub(:exist?) { false }
+      expect(config_options_object(*%w[ a --drb b --color c ]).drb_argv).to match_array %w[ --color a b c ]
+    end
+
+    %w(--color --fail-fast --profile --backtrace --tty).each do |option|
+      it "includes #{option}" do
+        expect(config_options_object("#{option}").drb_argv).to include("#{option}")
+      end
+    end
+
+    it "includes --failure-exit-code" do
+      expect(config_options_object(*%w[--failure-exit-code 2]).drb_argv).to include("--failure-exit-code", "2")
+    end
+
+    it "includes --options" do
+      expect(config_options_object(*%w[--options custom.opts]).drb_argv).to include("--options", "custom.opts")
+    end
+
+    it "includes --order" do
+      expect(config_options_object(*%w[--order random]).drb_argv).to include('--order', 'random')
+    end
+
+    context "with --example" do
+      it "includes --example" do
+        expect(config_options_object(*%w[--example foo]).drb_argv).to include("--example", "foo")
+      end
+
+      it "unescapes characters which were escaped upon storing --example originally" do
+        expect(config_options_object("--example", "foo\\ bar").drb_argv).to include("--example", "foo bar")
+      end
+    end
+
+    context "with tags" do
+      it "includes the inclusion tags" do
+        coo = config_options_object("--tag", "tag")
+        expect(coo.drb_argv).to eq(["--tag", "tag"])
+      end
+
+      it "includes the inclusion tags with values" do
+        coo = config_options_object("--tag", "tag:foo")
+        expect(coo.drb_argv).to eq(["--tag", "tag:foo"])
+      end
+
+      it "leaves inclusion tags intact" do
+        coo = config_options_object("--tag", "tag")
+        coo.drb_argv
+        expect(coo.filter_manager.inclusions).to eq( {:tag=>true} )
+      end
+
+      it "leaves inclusion tags with values intact" do
+        coo = config_options_object("--tag", "tag:foo")
+        coo.drb_argv
+        expect(coo.filter_manager.inclusions).to eq( {:tag=>'foo'} )
+      end
+
+      it "includes the exclusion tags" do
+        coo = config_options_object("--tag", "~tag")
+        expect(coo.drb_argv).to eq(["--tag", "~tag"])
+      end
+
+      it "includes the exclusion tags with values" do
+        coo = config_options_object("--tag", "~tag:foo")
+        expect(coo.drb_argv).to eq(["--tag", "~tag:foo"])
+      end
+
+      it "leaves exclusion tags intact" do
+        coo = config_options_object("--tag", "~tag")
+        coo.drb_argv
+        expect(coo.filter_manager.exclusions).to include(:tag=>true)
+      end
+
+      it "leaves exclusion tags with values intact" do
+        coo = config_options_object("--tag", "~tag:foo")
+        coo.drb_argv
+        expect(coo.filter_manager.exclusions).to include(:tag=>'foo')
+      end
+    end
+
+    context "with formatters" do
+      it "includes the formatters" do
+        coo = config_options_object("--format", "d")
+        expect(coo.drb_argv).to eq(["--format", "d"])
+      end
+
+      it "leaves formatters intact" do
+        coo = config_options_object("--format", "d")
+        coo.drb_argv
+        expect(coo.options[:formatters]).to eq([["d"]])
+      end
+
+      it "leaves output intact" do
+        coo = config_options_object("--format", "p", "--out", "foo.txt", "--format", "d")
+        coo.drb_argv
+        expect(coo.options[:formatters]).to eq([["p","foo.txt"],["d"]])
+      end
+    end
+
+    context "with --out" do
+      it "combines with formatters" do
+        coo = config_options_object(*%w[--format h --out report.html])
+        expect(coo.drb_argv).to       eq(%w[--format h --out report.html])
+      end
+    end
+
+    context "with --line_number" do
+      it "includes --line_number" do
+        expect(config_options_object(*%w[--line_number 35]).drb_argv).to eq(%w[--line_number 35])
+      end
+
+      it "includes multiple lines" do
+        expect(config_options_object(*%w[-l 90 -l 4 -l 55]).drb_argv).to eq(
+          %w[--line_number 90 --line_number 4 --line_number 55]
+        )
+      end
+    end
+
+    context "with -I libs" do
+      it "includes -I" do
+        expect(config_options_object(*%w[-I a_dir]).drb_argv).to eq(%w[-I a_dir])
+      end
+
+      it "includes multiple paths" do
+        expect(config_options_object(*%w[-I dir_1 -I dir_2 -I dir_3]).drb_argv).to eq(
+                               %w[-I dir_1 -I dir_2 -I dir_3]
+        )
+      end
+    end
+
+    context "with --require" do
+      it "includes --require" do
+        expect(config_options_object(*%w[--require a_path]).drb_argv).to eq(%w[--require a_path])
+      end
+
+      it "includes multiple paths" do
+        expect(config_options_object(*%w[--require dir/ --require file.rb]).drb_argv).to eq(
+                               %w[--require dir/ --require file.rb]
+        )
+      end
+    end
+
+    context "--drb specified in ARGV" do
+      it "renders all the original arguments except --drb" do
+        drb_argv = config_options_object(*%w[ --drb --color --format s --example pattern
+                                              --line_number 1 --profile --backtrace -I
+                                              path/a -I path/b --require path/c --require
+                                              path/d]).drb_argv
+        expect(drb_argv).to eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s -I path/a -I path/b --require path/c --require path/d])
+      end
+    end
+
+    context "--drb specified in the options file" do
+      it "renders all the original arguments except --drb" do
+        File.open("./.rspec", "w") {|f| f << "--drb --color"}
+        drb_argv = config_options_object(*%w[ --tty --format s --example
+                                         pattern --line_number 1 --profile
+                                         --backtrace ]).drb_argv
+
+        expect(drb_argv).to eq(%w[ --color --profile --backtrace --tty
+                               --example pattern --line_number 1 --format s])
+      end
+    end
+
+    context "--drb specified in ARGV and the options file" do
+      it "renders all the original arguments except --drb" do
+        File.open("./.rspec", "w") {|f| f << "--drb --color"}
+        drb_argv = config_options_object(*%w[ --drb --format s --example
+                                         pattern --line_number 1 --profile
+                                         --backtrace]).drb_argv
+
+        expect(drb_argv).to eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s])
+      end
+    end
+
+    context "--drb specified in ARGV and in as ARGV-specified --options file" do
+      it "renders all the original arguments except --drb and --options" do
+        File.open("./.rspec", "w") {|f| f << "--drb --color"}
+        drb_argv = config_options_object(*%w[ --drb --format s --example
+                                         pattern --line_number 1 --profile
+                                         --backtrace]).drb_argv
+
+        expect(drb_argv).to eq(%w[ --color --profile --backtrace --example pattern --line_number 1 --format s ])
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/dsl_spec.rb b/rspec-core/spec/rspec/core/dsl_spec.rb
new file mode 100644
index 0000000..d657c82
--- /dev/null
+++ b/rspec-core/spec/rspec/core/dsl_spec.rb
@@ -0,0 +1,25 @@
+require 'spec_helper'
+
+main = self
+
+describe "The RSpec DSL" do
+  methods = [
+    :describe,
+    :share_examples_for,
+    :shared_examples_for,
+    :shared_examples,
+    :shared_context,
+    :share_as
+  ]
+
+  methods.each do |method_name|
+    describe "##{method_name}" do
+      it "is not added to every object in the system" do
+        expect(main).to respond_to(method_name)
+        expect(Module.new).to respond_to(method_name)
+        expect(Object.new).not_to respond_to(method_name)
+      end
+    end
+  end
+end
+
diff --git a/rspec-core/spec/rspec/core/example_group_spec.rb b/rspec-core/spec/rspec/core/example_group_spec.rb
new file mode 100644
index 0000000..42538ee
--- /dev/null
+++ b/rspec-core/spec/rspec/core/example_group_spec.rb
@@ -0,0 +1,1187 @@
+require 'spec_helper'
+
+class SelfObserver
+  def self.cache
+    @cache ||= []
+  end
+
+  def initialize
+    self.class.cache << self
+  end
+end
+
+module RSpec::Core
+  describe ExampleGroup do
+    it_behaves_like "metadata hash builder" do
+      def metadata_hash(*args)
+        group = ExampleGroup.describe('example description', *args)
+        group.metadata
+      end
+    end
+
+    context "when RSpec.configuration.format_docstrings is set to a block" do
+      it "formats the description with that block" do
+        RSpec.configuration.format_docstrings { |s| s.upcase }
+        group = ExampleGroup.describe(' an example ')
+        expect(group.description).to eq(' AN EXAMPLE ')
+      end
+    end
+
+    context 'when RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values is set to false' do
+      before(:each) do
+        RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = false }
+      end
+
+      it 'processes string args as part of the description' do
+        group = ExampleGroup.describe("some", "separate", "strings")
+        expect(group.description).to eq("some separate strings")
+      end
+
+      it 'processes symbol args as part of the description' do
+        Kernel.stub(:warn) # to silence Symbols as args warning
+        group = ExampleGroup.describe(:some, :separate, :symbols)
+        expect(group.description).to eq("some separate symbols")
+      end
+    end
+
+    context 'when RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values is set to true' do
+      let(:group) { ExampleGroup.describe(:symbol) }
+
+      before(:each) do
+        RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = true }
+      end
+
+      it 'does not treat the first argument as a metadata key even if it is a symbol' do
+        expect(group.metadata).not_to include(:symbol)
+      end
+
+      it 'treats the first argument as part of the description when it is a symbol' do
+        expect(group.description).to eq("symbol")
+      end
+    end
+
+    describe "top level group" do
+      it "runs its children" do
+        examples_run = []
+        group = ExampleGroup.describe("parent") do
+          describe("child") do
+            it "does something" do
+              examples_run << example
+            end
+          end
+        end
+
+        group.run
+        expect(examples_run).to have(1).example
+      end
+
+      context "with a failure in the top level group" do
+        it "runs its children " do
+          examples_run = []
+          group = ExampleGroup.describe("parent") do
+            it "fails" do
+              examples_run << example
+              raise "fail"
+            end
+            describe("child") do
+              it "does something" do
+                examples_run << example
+              end
+            end
+          end
+
+          group.run
+          expect(examples_run).to have(2).examples
+        end
+      end
+
+      describe "descendants" do
+        it "returns self + all descendants" do
+          group = ExampleGroup.describe("parent") do
+            describe("child") do
+              describe("grandchild 1") {}
+              describe("grandchild 2") {}
+            end
+          end
+          expect(group.descendants.size).to eq(4)
+        end
+      end
+    end
+
+    describe "child" do
+      it "is known by parent" do
+        parent = ExampleGroup.describe
+        child = parent.describe
+        expect(parent.children).to eq([child])
+      end
+
+      it "is not registered in world" do
+        world = RSpec::Core::World.new
+        parent = ExampleGroup.describe
+        world.register(parent)
+        parent.describe
+        expect(world.example_groups).to eq([parent])
+      end
+    end
+
+    describe "filtering" do
+      let(:world) { World.new }
+
+      shared_examples "matching filters" do
+        context "inclusion" do
+          before do
+            filter_manager = FilterManager.new
+            filter_manager.include filter_metadata
+            world.stub(:filter_manager => filter_manager)
+          end
+
+          it "includes examples in groups matching filter" do
+            group = ExampleGroup.describe("does something", spec_metadata)
+            group.stub(:world) { world }
+            all_examples = [ group.example("first"), group.example("second") ]
+
+            expect(group.filtered_examples).to eq(all_examples)
+          end
+
+          it "includes examples directly matching filter" do
+            group = ExampleGroup.describe("does something")
+            group.stub(:world) { world }
+            filtered_examples = [
+              group.example("first", spec_metadata),
+              group.example("second", spec_metadata)
+            ]
+            group.example("third (not-filtered)")
+
+            expect(group.filtered_examples).to eq(filtered_examples)
+          end
+        end
+
+        context "exclusion" do
+          before do
+            filter_manager = FilterManager.new
+            filter_manager.exclude filter_metadata
+            world.stub(:filter_manager => filter_manager)
+          end
+
+          it "excludes examples in groups matching filter" do
+            group = ExampleGroup.describe("does something", spec_metadata)
+            group.stub(:world) { world }
+            [ group.example("first"), group.example("second") ]
+
+            expect(group.filtered_examples).to be_empty
+          end
+
+          it "excludes examples directly matching filter" do
+            group = ExampleGroup.describe("does something")
+            group.stub(:world) { world }
+            [
+              group.example("first", spec_metadata),
+              group.example("second", spec_metadata)
+            ]
+            unfiltered_example = group.example("third (not-filtered)")
+
+            expect(group.filtered_examples).to eq([unfiltered_example])
+          end
+        end
+      end
+
+      context "matching false" do
+        let(:spec_metadata)    { { :awesome => false }}
+
+        context "against false" do
+          let(:filter_metadata)  { { :awesome => false }}
+          include_examples "matching filters"
+        end
+
+        context "against 'false'" do
+          let(:filter_metadata)  { { :awesome => 'false' }}
+          include_examples "matching filters"
+        end
+
+        context "against :false" do
+          let(:filter_metadata)  { { :awesome => :false }}
+          include_examples "matching filters"
+        end
+      end
+
+      context "matching true" do
+        let(:spec_metadata)    { { :awesome => true }}
+
+        context "against true" do
+          let(:filter_metadata)  { { :awesome => true }}
+          include_examples "matching filters"
+        end
+
+        context "against 'true'" do
+          let(:filter_metadata)  { { :awesome => 'true' }}
+          include_examples "matching filters"
+        end
+
+        context "against :true" do
+          let(:filter_metadata)  { { :awesome => :true }}
+          include_examples "matching filters"
+        end
+      end
+
+      context "matching a string" do
+        let(:spec_metadata)    { { :type => 'special' }}
+
+        context "against a string" do
+          let(:filter_metadata)  { { :type => 'special' }}
+          include_examples "matching filters"
+        end
+
+        context "against a symbol" do
+          let(:filter_metadata)  { { :type => :special }}
+          include_examples "matching filters"
+        end
+      end
+
+      context "matching a symbol" do
+        let(:spec_metadata)    { { :type => :special }}
+
+        context "against a string" do
+          let(:filter_metadata)  { { :type => 'special' }}
+          include_examples "matching filters"
+        end
+
+        context "against a symbol" do
+          let(:filter_metadata)  { { :type => :special }}
+          include_examples "matching filters"
+        end
+      end
+
+      context "with no filters" do
+        it "returns all" do
+          group = ExampleGroup.describe
+          group.stub(:world) { world }
+          example = group.example("does something")
+          expect(group.filtered_examples).to eq([example])
+        end
+      end
+
+      context "with no examples or groups that match filters" do
+        it "returns none" do
+          filter_manager = FilterManager.new
+          filter_manager.include :awesome => false
+          world.stub(:filter_manager => filter_manager)
+          group = ExampleGroup.describe
+          group.stub(:world) { world }
+          group.example("does something")
+          expect(group.filtered_examples).to eq([])
+        end
+      end
+    end
+
+    describe '#described_class' do
+
+      context "with a constant as the first parameter" do
+        it "is that constant" do
+          expect(ExampleGroup.describe(Object) { }.described_class).to eq(Object)
+        end
+      end
+
+      context "with a string as the first parameter" do
+        it "is nil" do
+          expect(ExampleGroup.describe("i'm a computer") { }.described_class).to be_nil
+        end
+      end
+
+      context "with a constant in an outer group" do
+        context "and a string in an inner group" do
+          it "is the top level constant" do
+            group = ExampleGroup.describe(String) do
+              describe :symbol do
+                example "described_class is String" do
+                  expect(described_class).to eq(String)
+                end
+              end
+            end
+
+            expect(group.run).to be_true
+          end
+        end
+
+        context "and metadata redefinition after `described_class` call" do
+          it "is the redefined level constant" do
+            group = ExampleGroup.describe(String) do
+              described_class
+              metadata[:example_group][:described_class] = Object
+              describe :symbol do
+                example "described_class is Object" do
+                  expect(described_class).to eq(Object)
+                end
+              end
+            end
+
+            expect(group.run).to be_true
+          end
+        end
+      end
+
+      context "in a nested group" do
+        it "inherits the described class/module from the outer group" do
+          group = ExampleGroup.describe(String) do
+            describe Array do
+              example "describes is String" do
+                expect(described_class).to eq(String)
+              end
+            end
+          end
+
+          expect(group.run).to be_true, "expected examples in group to pass"
+        end
+      end
+
+      context "for `describe(SomeClass)` within a `describe 'some string' group" do
+        def define_and_run_group(define_outer_example = false)
+          outer_described_class = inner_described_class = nil
+
+          ExampleGroup.describe("some string") do
+            example { outer_described_class = described_class } if define_outer_example
+
+            describe Array do
+              example { inner_described_class = described_class }
+            end
+          end.run
+
+          return outer_described_class, inner_described_class
+        end
+
+        it "has a `nil` described_class in the outer group" do
+          outer_described_class, _ = define_and_run_group(:define_outer_example)
+          expect(outer_described_class).to be(nil)
+        end
+
+        it "has the inner described class as the described_class of the inner group" do
+          _, inner_described_class = define_and_run_group
+          expect(inner_described_class).to be(Array)
+
+          # This is weird, but in RSpec 2.12 (and before, presumably),
+          # the `described_class` value would be incorrect if there was an
+          # example in the outer group, and correct if there was not one.
+          _, inner_described_class = define_and_run_group(:define_outer_example)
+          expect(inner_described_class).to be(Array)
+        end
+      end
+    end
+
+    describe '#described_class' do
+      it "is the same as described_class" do
+        expect(self.class.described_class).to eq(self.class.described_class)
+      end
+    end
+
+    describe '#description' do
+      it "grabs the description from the metadata" do
+        group = ExampleGroup.describe(Object, "my desc") { }
+        expect(group.description).to eq(group.metadata[:example_group][:description])
+      end
+    end
+
+    describe '#metadata' do
+      it "adds the third parameter to the metadata" do
+        expect(ExampleGroup.describe(Object, nil, 'foo' => 'bar') { }.metadata).to include({ "foo" => 'bar' })
+      end
+
+      it "adds the the file_path to metadata" do
+        expect(ExampleGroup.describe(Object) { }.metadata[:example_group][:file_path]).to eq(relative_path(__FILE__))
+      end
+
+      it "has a reader for file_path" do
+        expect(ExampleGroup.describe(Object) { }.file_path).to eq(relative_path(__FILE__))
+      end
+
+      it "adds the line_number to metadata" do
+        expect(ExampleGroup.describe(Object) { }.metadata[:example_group][:line_number]).to eq(__LINE__)
+      end
+    end
+
+    [:focus, :focused, :fit].each do |example_alias|
+      describe "##{example_alias}" do
+        let(:focused_example) { ExampleGroup.describe.send example_alias, "a focused example" }
+
+        it 'defines an example that can be filtered with :focused => true' do
+          expect(focused_example.metadata[:focused]).to be_true
+        end
+
+        it 'defines an example that can be filtered with :focus => true' do
+          expect(focused_example.metadata[:focus]).to be_true
+        end
+      end
+    end
+
+    describe "#before, after, and around hooks" do
+      it "runs the before alls in order" do
+        group = ExampleGroup.describe
+        order = []
+        group.before(:all) { order << 1 }
+        group.before(:all) { order << 2 }
+        group.before(:all) { order << 3 }
+        group.example("example") {}
+
+        group.run
+
+        expect(order).to eq([1,2,3])
+      end
+
+      it "does not set RSpec.wants_to_quit in case of an error in before all (without fail_fast?)" do
+        group = ExampleGroup.describe
+        group.before(:all) { raise "error in before all" }
+        group.example("example") {}
+
+        group.run
+        expect(RSpec.wants_to_quit).to be_false
+      end
+
+      it "runs the before eachs in order" do
+        group = ExampleGroup.describe
+        order = []
+        group.before(:each) { order << 1 }
+        group.before(:each) { order << 2 }
+        group.before(:each) { order << 3 }
+        group.example("example") {}
+
+        group.run
+
+        expect(order).to eq([1,2,3])
+      end
+
+      it "runs the after eachs in reverse order" do
+        group = ExampleGroup.describe
+        order = []
+        group.after(:each) { order << 1 }
+        group.after(:each) { order << 2 }
+        group.after(:each) { order << 3 }
+        group.example("example") {}
+
+        group.run
+
+        expect(order).to eq([3,2,1])
+      end
+
+      it "runs the after alls in reverse order" do
+        group = ExampleGroup.describe
+        order = []
+        group.after(:all) { order << 1 }
+        group.after(:all) { order << 2 }
+        group.after(:all) { order << 3 }
+        group.example("example") {}
+
+        group.run
+
+        expect(order).to eq([3,2,1])
+      end
+
+      it "only runs before/after(:all) hooks from example groups that have specs that run" do
+        hooks_run = []
+
+        RSpec.configure do |c|
+          c.filter_run :focus => true
+        end
+
+        unfiltered_group = ExampleGroup.describe "unfiltered" do
+          before(:all) { hooks_run << :unfiltered_before_all }
+          after(:all)  { hooks_run << :unfiltered_after_all  }
+
+          context "a subcontext" do
+            it("has an example") { }
+          end
+        end
+
+        filtered_group = ExampleGroup.describe "filtered", :focus => true do
+          before(:all) { hooks_run << :filtered_before_all }
+          after(:all)  { hooks_run << :filtered_after_all  }
+
+          context "a subcontext" do
+            it("has an example") { }
+          end
+        end
+
+        unfiltered_group.run
+        filtered_group.run
+
+        expect(hooks_run).to eq([:filtered_before_all, :filtered_after_all])
+      end
+
+      it "runs before_all_defined_in_config, before all, before each, example, after each, after all, after_all_defined_in_config in that order" do
+        order = []
+
+        RSpec.configure do |c|
+          c.before(:all) { order << :before_all_defined_in_config }
+          c.after(:all) { order << :after_all_defined_in_config }
+        end
+
+        group = ExampleGroup.describe
+        group.before(:all)  { order << :top_level_before_all  }
+        group.before(:each) { order << :before_each }
+        group.after(:each)  { order << :after_each  }
+        group.after(:all)   { order << :top_level_after_all   }
+        group.example("top level example") { order << :top_level_example }
+
+        context1 = group.describe("context 1")
+        context1.before(:all) { order << :nested_before_all }
+        context1.example("nested example 1") { order << :nested_example_1 }
+
+        context2 = group.describe("context 2")
+        context2.after(:all) { order << :nested_after_all }
+        context2.example("nested example 2") { order << :nested_example_2 }
+
+        group.run
+
+        expect(order).to eq([
+          :before_all_defined_in_config,
+          :top_level_before_all,
+          :before_each,
+          :top_level_example,
+          :after_each,
+          :nested_before_all,
+          :before_each,
+          :nested_example_1,
+          :after_each,
+          :before_each,
+          :nested_example_2,
+          :after_each,
+          :nested_after_all,
+          :top_level_after_all,
+          :after_all_defined_in_config
+        ])
+      end
+
+      context "after(:all)" do
+        let(:outer) { ExampleGroup.describe }
+        let(:inner) { outer.describe }
+
+        it "has access to state defined before(:all)" do
+          outer.before(:all) { @outer = "outer" }
+          inner.before(:all) { @inner = "inner" }
+
+          outer.after(:all) do
+            expect(@outer).to eq("outer")
+            expect(@inner).to eq("inner")
+          end
+          inner.after(:all) do
+            expect(@inner).to eq("inner")
+            expect(@outer).to eq("outer")
+          end
+
+          outer.run
+        end
+
+        it "cleans up ivars in after(:all)" do
+          outer.before(:all) { @outer = "outer" }
+          inner.before(:all) { @inner = "inner" }
+
+          outer.run
+
+          expect(inner.before_all_ivars[:@inner]).to be_nil
+          expect(inner.before_all_ivars[:@outer]).to be_nil
+          expect(outer.before_all_ivars[:@inner]).to be_nil
+          expect(outer.before_all_ivars[:@outer]).to be_nil
+        end
+      end
+
+      it "treats an error in before(:each) as a failure" do
+        group = ExampleGroup.describe
+        group.before(:each) { raise "error in before each" }
+        example = group.example("equality") { expect(1).to eq(2) }
+        expect(group.run).to be(false)
+
+        expect(example.metadata[:execution_result][:exception].message).to eq("error in before each")
+      end
+
+      it "treats an error in before(:all) as a failure" do
+        group = ExampleGroup.describe
+        group.before(:all) { raise "error in before all" }
+        example = group.example("equality") { expect(1).to eq(2) }
+        expect(group.run).to be_false
+
+        expect(example.metadata).not_to be_nil
+        expect(example.metadata[:execution_result]).not_to be_nil
+        expect(example.metadata[:execution_result][:exception]).not_to be_nil
+        expect(example.metadata[:execution_result][:exception].message).to eq("error in before all")
+      end
+
+      it "exposes instance variables set in before(:all) from after(:all) even if a before(:all) error occurs" do
+        ivar_value_in_after_hook = nil
+
+        group = ExampleGroup.describe do
+          before(:all) do
+            @an_ivar = :set_in_before_all
+            raise "fail"
+          end
+
+          after(:all) { ivar_value_in_after_hook = @an_ivar }
+
+          it("has a spec") { }
+        end
+
+        group.run
+        expect(ivar_value_in_after_hook).to eq(:set_in_before_all)
+      end
+
+      it "treats an error in before(:all) as a failure for a spec in a nested group" do
+        example = nil
+        group = ExampleGroup.describe do
+          before(:all) { raise "error in before all" }
+
+          describe "nested" do
+            example = it("equality") { expect(1).to eq(2) }
+          end
+        end
+        group.run
+
+        expect(example.metadata).not_to be_nil
+        expect(example.metadata[:execution_result]).not_to be_nil
+        expect(example.metadata[:execution_result][:exception]).not_to be_nil
+        expect(example.metadata[:execution_result][:exception].message).to eq("error in before all")
+      end
+
+      context "when an error occurs in an after(:all) hook" do
+        hooks_run = []
+
+        before(:each) do
+          hooks_run = []
+          RSpec.configuration.reporter.stub(:message)
+        end
+
+        let(:group) do
+          ExampleGroup.describe do
+            after(:all) { hooks_run << :one; raise "An error in an after(:all) hook" }
+            after(:all) { hooks_run << :two; raise "A different hook raising an error" }
+            it("equality") { expect(1).to eq(1) }
+          end
+        end
+
+        it "allows the example to pass" do
+          group.run
+          example = group.examples.first
+          expect(example.metadata).not_to be_nil
+          expect(example.metadata[:execution_result]).not_to be_nil
+          expect(example.metadata[:execution_result][:status]).to eq("passed")
+        end
+
+        it "rescues any error(s) and prints them out" do
+          RSpec.configuration.reporter.should_receive(:message).with(/An error in an after\(:all\) hook/)
+          RSpec.configuration.reporter.should_receive(:message).with(/A different hook raising an error/)
+          group.run
+        end
+
+        it "still runs both after blocks" do
+          group.run
+          expect(hooks_run).to eq [:two,:one]
+        end
+      end
+
+      it "has no 'running example' within before(:all)" do
+        group = ExampleGroup.describe
+        running_example = :none
+        group.before(:all) { running_example = example }
+        group.example("no-op") { }
+        group.run
+        expect(running_example).to be(nil)
+      end
+
+      it "has access to example options within before(:each)" do
+        group = ExampleGroup.describe
+        option = nil
+        group.before(:each) { option = example.options[:data] }
+        group.example("no-op", :data => :sample) { }
+        group.run
+        expect(option).to eq(:sample)
+      end
+
+      it "has access to example options within after(:each)" do
+        group = ExampleGroup.describe
+        option = nil
+        group.after(:each) { option = example.options[:data] }
+        group.example("no-op", :data => :sample) { }
+        group.run
+        expect(option).to eq(:sample)
+      end
+
+      it "has no 'running example' within after(:all)" do
+        group = ExampleGroup.describe
+        running_example = :none
+        group.after(:all) { running_example = example }
+        group.example("no-op") { }
+        group.run
+        expect(running_example).to be(nil)
+      end
+    end
+
+    %w[pending xit xspecify xexample].each do |method_name|
+      describe "::#{method_name}" do
+        before do
+          @group = ExampleGroup.describe
+          @group.send(method_name, "is pending") { }
+        end
+
+        it "generates a pending example" do
+          @group.run
+          expect(@group.examples.first).to be_pending
+        end
+
+        it "sets the pending message", :if => method_name == 'pending' do
+          @group.run
+          expect(@group.examples.first.metadata[:execution_result][:pending_message]).to eq(RSpec::Core::Pending::NO_REASON_GIVEN)
+        end
+
+        it "sets the pending message", :unless => method_name == 'pending' do
+          @group.run
+          expect(@group.examples.first.metadata[:execution_result][:pending_message]).to eq("Temporarily disabled with #{method_name}")
+        end
+      end
+    end
+
+    describe "adding examples" do
+
+      it "allows adding an example using 'it'" do
+        group = ExampleGroup.describe
+        group.it("should do something") { }
+        expect(group.examples.size).to eq(1)
+      end
+
+      it "exposes all examples at examples" do
+        group = ExampleGroup.describe
+        group.it("should do something 1") { }
+        group.it("should do something 2") { }
+        group.it("should do something 3") { }
+        expect(group).to have(3).examples
+      end
+
+      it "maintains the example order" do
+        group = ExampleGroup.describe
+        group.it("should 1") { }
+        group.it("should 2") { }
+        group.it("should 3") { }
+        expect(group.examples[0].description).to eq('should 1')
+        expect(group.examples[1].description).to eq('should 2')
+        expect(group.examples[2].description).to eq('should 3')
+      end
+
+    end
+
+    describe Object, "describing nested example_groups", :little_less_nested => 'yep' do
+
+      describe "A sample nested group", :nested_describe => "yep" do
+        it "sets the described class to the described class of the outer most group" do
+          expect(example.example_group.described_class).to eq(ExampleGroup)
+        end
+
+        it "sets the description to 'A sample nested describe'" do
+          expect(example.example_group.description).to eq('A sample nested group')
+        end
+
+        it "has top level metadata from the example_group and its parent groups" do
+          expect(example.example_group.metadata).to include(:little_less_nested => 'yep', :nested_describe => 'yep')
+        end
+
+        it "exposes the parent metadata to the contained examples" do
+          expect(example.metadata).to include(:little_less_nested => 'yep', :nested_describe => 'yep')
+        end
+      end
+
+    end
+
+    describe "#run_examples" do
+
+      let(:reporter) { double("reporter").as_null_object }
+
+      it "returns true if all examples pass" do
+        group = ExampleGroup.describe('group') do
+          example('ex 1') { expect(1).to eq(1) }
+          example('ex 2') { expect(1).to eq(1) }
+        end
+        group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered::Examples) }
+        expect(group.run(reporter)).to be_true
+      end
+
+      it "returns false if any of the examples fail" do
+        group = ExampleGroup.describe('group') do
+          example('ex 1') { expect(1).to eq(1) }
+          example('ex 2') { expect(1).to eq(2) }
+        end
+        group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered::Examples) }
+        expect(group.run(reporter)).to be_false
+      end
+
+      it "runs all examples, regardless of any of them failing" do
+        group = ExampleGroup.describe('group') do
+          example('ex 1') { expect(1).to eq(2) }
+          example('ex 2') { expect(1).to eq(1) }
+        end
+        group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered::Examples) }
+        group.filtered_examples.each do |example|
+          example.should_receive(:run)
+        end
+        expect(group.run(reporter)).to be_false
+      end
+    end
+
+    describe "how instance variables are inherited" do
+      before(:all) do
+        @before_all_top_level = 'before_all_top_level'
+      end
+
+      before(:each) do
+        @before_each_top_level = 'before_each_top_level'
+      end
+
+      it "can access a before each ivar at the same level" do
+        expect(@before_each_top_level).to eq('before_each_top_level')
+      end
+
+      it "can access a before all ivar at the same level" do
+        expect(@before_all_top_level).to eq('before_all_top_level')
+      end
+
+      it "can access the before all ivars in the before_all_ivars hash", :ruby => 1.8 do
+        expect(example.example_group.before_all_ivars).to include('@before_all_top_level' => 'before_all_top_level')
+      end
+
+      it "can access the before all ivars in the before_all_ivars hash", :ruby => 1.9 do
+        expect(example.example_group.before_all_ivars).to include(:@before_all_top_level => 'before_all_top_level')
+      end
+
+      describe "but now I am nested" do
+        it "can access a parent example groups before each ivar at a nested level" do
+          expect(@before_each_top_level).to eq('before_each_top_level')
+        end
+
+        it "can access a parent example groups before all ivar at a nested level" do
+          expect(@before_all_top_level).to eq("before_all_top_level")
+        end
+
+        it "changes to before all ivars from within an example do not persist outside the current describe" do
+          @before_all_top_level = "ive been changed"
+        end
+
+        describe "accessing a before_all ivar that was changed in a parent example_group" do
+          it "does not have access to the modified version" do
+            expect(@before_all_top_level).to eq('before_all_top_level')
+          end
+        end
+      end
+
+    end
+
+    describe "ivars are not shared across examples" do
+      it "(first example)" do
+        @a = 1
+        expect(defined?(@b)).to be_false
+      end
+
+      it "(second example)" do
+        @b = 2
+        expect(defined?(@a)).to be_false
+      end
+    end
+
+
+    describe "#top_level_description" do
+      it "returns the description from the outermost example group" do
+        group = nil
+        ExampleGroup.describe("top") do
+          context "middle" do
+            group = describe "bottom" do
+            end
+          end
+        end
+
+        expect(group.top_level_description).to eq("top")
+      end
+    end
+
+    describe "#run" do
+      let(:reporter) { double("reporter").as_null_object }
+
+      context "with fail_fast? => true" do
+        let(:group) do
+          group = RSpec::Core::ExampleGroup.describe
+          group.stub(:fail_fast?) { true }
+          group
+        end
+
+        it "does not run examples after the failed example" do
+          examples_run = []
+          group.example('example 1') { examples_run << self }
+          group.example('example 2') { examples_run << self; fail; }
+          group.example('example 3') { examples_run << self }
+
+          group.run
+
+          expect(examples_run.length).to eq(2)
+        end
+
+        it "sets RSpec.wants_to_quit flag if encountering an exception in before(:all)" do
+          group.before(:all) { raise "error in before all" }
+          group.example("equality") { expect(1).to eq(2) }
+          expect(group.run).to be_false
+          expect(RSpec.wants_to_quit).to be_true
+        end
+      end
+
+      context "with RSpec.wants_to_quit=true" do
+        let(:group) { RSpec::Core::ExampleGroup.describe }
+
+        before do
+          RSpec.stub(:wants_to_quit) { true }
+          RSpec.stub(:clear_remaining_example_groups)
+        end
+
+        it "returns without starting the group" do
+          reporter.should_not_receive(:example_group_started)
+          group.run(reporter)
+        end
+
+        context "at top level" do
+          it "purges remaining groups" do
+            RSpec.should_receive(:clear_remaining_example_groups)
+            group.run(reporter)
+          end
+        end
+
+        context "in a nested group" do
+          it "does not purge remaining groups" do
+            nested_group = group.describe
+            RSpec.should_not_receive(:clear_remaining_example_groups)
+            nested_group.run(reporter)
+          end
+        end
+      end
+
+      context "with all examples passing" do
+        it "returns true" do
+          group = RSpec::Core::ExampleGroup.describe("something") do
+            it "does something" do
+              # pass
+            end
+            describe "nested" do
+              it "does something else" do
+                # pass
+              end
+            end
+          end
+
+          expect(group.run(reporter)).to be_true
+        end
+      end
+
+      context "with top level example failing" do
+        it "returns false" do
+          group = RSpec::Core::ExampleGroup.describe("something") do
+            it "does something (wrong - fail)" do
+              raise "fail"
+            end
+            describe "nested" do
+              it "does something else" do
+                # pass
+              end
+            end
+          end
+
+          expect(group.run(reporter)).to be_false
+        end
+      end
+
+      context "with nested example failing" do
+        it "returns true" do
+          group = RSpec::Core::ExampleGroup.describe("something") do
+            it "does something" do
+              # pass
+            end
+            describe "nested" do
+              it "does something else (wrong -fail)" do
+                raise "fail"
+              end
+            end
+          end
+
+          expect(group.run(reporter)).to be_false
+        end
+      end
+    end
+
+    %w[include_examples include_context].each do |name|
+      describe "##{name}" do
+        let(:group) { ExampleGroup.describe }
+        before do
+          group.shared_examples "named this" do
+            example("does something") {}
+          end
+        end
+
+        it "includes the named examples" do
+          group.send(name, "named this")
+          expect(group.examples.first.description).to eq("does something")
+        end
+
+        it "raises a helpful error message when shared content is not found" do
+          expect do
+            group.send(name, "shared stuff")
+          end.to raise_error(ArgumentError, /Could not find .* "shared stuff"/)
+        end
+
+        it "passes parameters to the shared content" do
+          passed_params = {}
+          group = ExampleGroup.describe
+
+          group.shared_examples "named this with params" do |param1, param2|
+            it("has access to the given parameters") do
+              passed_params[:param1] = param1
+              passed_params[:param2] = param2
+            end
+          end
+
+          group.send(name, "named this with params", :value1, :value2)
+          group.run
+
+          expect(passed_params).to eq({ :param1 => :value1, :param2 => :value2 })
+        end
+
+        it "adds shared instance methods to the group" do
+          group = ExampleGroup.describe('fake group')
+          group.shared_examples "named this with params" do |param1|
+            def foo; end
+          end
+          group.send(name, "named this with params", :a)
+          expect(group.public_instance_methods.map{|m| m.to_s}).to include("foo")
+        end
+
+        it "evals the shared example group only once" do
+          eval_count = 0
+          group = ExampleGroup.describe('fake group')
+          group.shared_examples("named this with params") { |p| eval_count += 1 }
+          group.send(name, "named this with params", :a)
+          expect(eval_count).to eq(1)
+        end
+
+        it "evals the block when given" do
+          key = "#{__FILE__}:#{__LINE__}"
+          group = ExampleGroup.describe do
+            shared_examples(key) do
+              it("does something") do
+                expect(foo).to eq("bar")
+              end
+            end
+
+            send name, key do
+              def foo; "bar"; end
+            end
+          end
+          expect(group.run).to be_true
+        end
+      end
+    end
+
+    describe "#it_should_behave_like" do
+      it "creates a nested group" do
+        group = ExampleGroup.describe('fake group')
+        group.shared_examples_for("thing") {}
+        group.it_should_behave_like("thing")
+        expect(group).to have(1).children
+      end
+
+      it "creates a nested group for a class" do
+        klass = Class.new
+        group = ExampleGroup.describe('fake group')
+        group.shared_examples_for(klass) {}
+        group.it_should_behave_like(klass)
+        expect(group).to have(1).children
+      end
+
+      it "adds shared examples to nested group" do
+        group = ExampleGroup.describe('fake group')
+        group.shared_examples_for("thing") do
+          it("does something")
+        end
+        shared_group = group.it_should_behave_like("thing")
+        expect(shared_group).to have(1).examples
+      end
+
+      it "adds shared instance methods to nested group" do
+        group = ExampleGroup.describe('fake group')
+        group.shared_examples_for("thing") do
+          def foo; end
+        end
+        shared_group = group.it_should_behave_like("thing")
+        expect(shared_group.public_instance_methods.map{|m| m.to_s}).to include("foo")
+      end
+
+      it "adds shared class methods to nested group" do
+        group = ExampleGroup.describe('fake group')
+        group.shared_examples_for("thing") do
+          def self.foo; end
+        end
+        shared_group = group.it_should_behave_like("thing")
+        expect(shared_group.methods.map{|m| m.to_s}).to include("foo")
+      end
+
+      it "passes parameters to the shared example group" do
+        passed_params = {}
+
+        group = ExampleGroup.describe("group") do
+          shared_examples_for("thing") do |param1, param2|
+            it("has access to the given parameters") do
+              passed_params[:param1] = param1
+              passed_params[:param2] = param2
+            end
+          end
+
+          it_should_behave_like "thing", :value1, :value2
+        end
+
+        group.run
+
+        expect(passed_params).to eq({ :param1 => :value1, :param2 => :value2 })
+      end
+
+      it "adds shared instance methods to nested group" do
+        group = ExampleGroup.describe('fake group')
+        group.shared_examples_for("thing") do |param1|
+          def foo; end
+        end
+        shared_group = group.it_should_behave_like("thing", :a)
+        expect(shared_group.public_instance_methods.map{|m| m.to_s}).to include("foo")
+      end
+
+      it "evals the shared example group only once" do
+        eval_count = 0
+        group = ExampleGroup.describe('fake group')
+        group.shared_examples_for("thing") { |p| eval_count += 1 }
+        group.it_should_behave_like("thing", :a)
+        expect(eval_count).to eq(1)
+      end
+
+      context "given a block" do
+        it "evaluates the block in nested group" do
+          scopes = []
+          group = ExampleGroup.describe("group") do
+            shared_examples_for("thing") do
+              it("gets run in the nested group") do
+                scopes << self.class
+              end
+            end
+            it_should_behave_like "thing" do
+              it("gets run in the same nested group") do
+                scopes << self.class
+              end
+            end
+          end
+          group.run
+
+          expect(scopes[0]).to be(scopes[1])
+        end
+      end
+
+      it "raises a helpful error message when shared context is not found" do
+        expect do
+          ExampleGroup.describe do
+            it_should_behave_like "shared stuff"
+          end
+        end.to raise_error(ArgumentError,%q|Could not find shared examples "shared stuff"|)
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/example_spec.rb b/rspec-core/spec/rspec/core/example_spec.rb
new file mode 100644
index 0000000..abce779
--- /dev/null
+++ b/rspec-core/spec/rspec/core/example_spec.rb
@@ -0,0 +1,439 @@
+require 'spec_helper'
+require 'pp'
+require 'stringio'
+
+describe RSpec::Core::Example, :parent_metadata => 'sample' do
+  let(:example_group) do
+    RSpec::Core::ExampleGroup.describe('group description')
+  end
+
+  let(:example_instance) do
+    example_group.example('example description') { }
+  end
+
+  it_behaves_like "metadata hash builder" do
+    def metadata_hash(*args)
+      example = example_group.example('example description', *args)
+      example.metadata
+    end
+  end
+
+  def capture_stdout
+    orig_stdout = $stdout
+    $stdout = StringIO.new
+    yield
+    $stdout.string
+  ensure
+    $stdout = orig_stdout
+  end
+
+  it 'can be pretty printed' do
+    output = ignoring_warnings { capture_stdout { pp example_instance } }
+    expect(output).to include("RSpec::Core::Example")
+  end
+
+  describe "#exception" do
+    it "supplies the first exception raised, if any" do
+      example = example_group.example { raise "first" }
+      example_group.after { raise "second" }
+      example_group.run
+      expect(example.exception.message).to eq("first")
+    end
+
+    it "returns nil if there is no exception" do
+      example = example_group.example('example') { }
+      example_group.run
+      expect(example.exception).to be_nil
+    end
+
+    it "returns false for pending_fixed? if not pending fixed" do
+      example = example_group.example { fail }
+      example_group.run
+      expect(example.exception).not_to be_pending_fixed
+    end
+
+    it "returns true for pending_fixed? if pending fixed" do
+      example = example_group.example do
+        pending("fixed") {}
+      end
+      example_group.run
+      expect(example.exception).to be_pending_fixed
+    end
+  end
+
+  describe "when there is an explicit description" do
+    context "when RSpec.configuration.format_docstrings is set to a block" do
+      it "formats the description using the block" do
+        RSpec.configuration.format_docstrings { |s| s.strip }
+        example = example_group.example(' an example with whitespace ') {}
+        example_group.run
+        expect(example.description).to eql('an example with whitespace')
+      end
+    end
+  end
+
+  describe "when there is no explicit description" do
+    def expect_with(*frameworks)
+      RSpec.configuration.stub(:expecting_with_rspec?).and_return(frameworks.include?(:rspec))
+
+      if frameworks.include?(:stdlib)
+        example_group.class_eval do
+          def assert(val)
+            raise "Expected #{val} to be true" unless val
+          end
+        end
+      end
+    end
+
+    context "when RSpec.configuration.format_docstrings is set to a block" do
+      it "formats the description using the block" do
+        RSpec.configuration.format_docstrings { |s| s.upcase }
+        example_group.example { expect(5).to eq(5) }
+        example_group.run
+        pattern = /EXAMPLE AT #{relative_path(__FILE__).upcase}:#{__LINE__ - 2}/
+        expect(example_group.examples.first.description).to match(pattern)
+      end
+    end
+
+    context "when `expect_with :rspec` is configured" do
+      before(:each) { expect_with :rspec }
+
+      it "uses the matcher-generated description" do
+        example_group.example { expect(5).to eq(5) }
+        example_group.run
+        expect(example_group.examples.first.description).to eq("should eq 5")
+      end
+
+      it "uses the matcher-generated description in the full description" do
+        example_group.example { expect(5).to eq(5) }
+        example_group.run
+        expect(example_group.examples.first.full_description).to eq("group description should eq 5")
+      end
+
+      it "uses the file and line number if there is no matcher-generated description" do
+        example = example_group.example {}
+        example_group.run
+        expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 2}/)
+      end
+
+      it "uses the file and line number if there is an error before the matcher" do
+        example = example_group.example { expect(5).to eq(5) }
+        example_group.before { raise }
+        example_group.run
+        expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 3}/)
+      end
+    end
+
+    context "when `expect_with :rspec, :stdlib` is configured" do
+      before(:each) { expect_with :rspec, :stdlib }
+
+      it "uses the matcher-generated description" do
+        example_group.example { expect(5).to eq(5) }
+        example_group.run
+        expect(example_group.examples.first.description).to eq("should eq 5")
+      end
+
+      it "uses the file and line number if there is no matcher-generated description" do
+        example = example_group.example {}
+        example_group.run
+        expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 2}/)
+      end
+
+      it "uses the file and line number if there is an error before the matcher" do
+        example = example_group.example { expect(5).to eq(5) }
+        example_group.before { raise }
+        example_group.run
+        expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 3}/)
+      end
+    end
+
+    context "when `expect_with :stdlib` is configured" do
+      before(:each) { expect_with :stdlib }
+
+      it "does not attempt to get the generated description from RSpec::Matchers" do
+        RSpec::Matchers.should_not_receive(:generated_description)
+        example_group.example { assert 5 == 5 }
+        example_group.run
+      end
+
+      it "uses the file and line number" do
+        example = example_group.example { assert 5 == 5 }
+        example_group.run
+        expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 2}/)
+      end
+    end
+  end
+
+  describe '#described_class' do
+    it "returns the class (if any) of the outermost example group" do
+      expect(described_class).to eq(RSpec::Core::Example)
+    end
+  end
+
+  describe "accessing metadata within a running example" do
+    it "has a reference to itself when running" do
+      expect(example.description).to eq("has a reference to itself when running")
+    end
+
+    it "can access the example group's top level metadata as if it were its own" do
+      expect(example.example_group.metadata).to include(:parent_metadata => 'sample')
+      expect(example.metadata).to include(:parent_metadata => 'sample')
+    end
+  end
+
+  describe "accessing options within a running example" do
+    it "can look up option values by key", :demo => :data do
+      expect(example.metadata[:demo]).to eq(:data)
+    end
+  end
+
+  describe "#run" do
+    it "sets its reference to the example group instance to nil" do
+      group = RSpec::Core::ExampleGroup.describe do
+        example('example') { expect(1).to eq(1) }
+      end
+      group.run
+      expect(group.examples.first.instance_variable_get("@example_group_instance")).to be_nil
+    end
+
+    it "runs after(:each) when the example passes" do
+      after_run = false
+      group = RSpec::Core::ExampleGroup.describe do
+        after(:each) { after_run = true }
+        example('example') { expect(1).to eq(1) }
+      end
+      group.run
+      expect(after_run).to be_true, "expected after(:each) to be run"
+    end
+
+    it "runs after(:each) when the example fails" do
+      after_run = false
+      group = RSpec::Core::ExampleGroup.describe do
+        after(:each) { after_run = true }
+        example('example') { expect(1).to eq(2) }
+      end
+      group.run
+      expect(after_run).to be_true, "expected after(:each) to be run"
+    end
+
+    it "runs after(:each) when the example raises an Exception" do
+      after_run = false
+      group = RSpec::Core::ExampleGroup.describe do
+        after(:each) { after_run = true }
+        example('example') { raise "this error" }
+      end
+      group.run
+      expect(after_run).to be_true, "expected after(:each) to be run"
+    end
+
+    context "with an after(:each) that raises" do
+      it "runs subsequent after(:each)'s" do
+        after_run = false
+        group = RSpec::Core::ExampleGroup.describe do
+          after(:each) { after_run = true }
+          after(:each) { raise "FOO" }
+          example('example') { expect(1).to eq(1) }
+        end
+        group.run
+        expect(after_run).to be_true, "expected after(:each) to be run"
+      end
+
+      it "stores the exception" do
+        group = RSpec::Core::ExampleGroup.describe
+        group.after(:each) { raise "FOO" }
+        example = group.example('example') { expect(1).to eq(1) }
+
+        group.run
+
+        expect(example.metadata[:execution_result][:exception].message).to eq("FOO")
+      end
+    end
+
+    it "wraps before/after(:each) inside around" do
+      results = []
+      group = RSpec::Core::ExampleGroup.describe do
+        around(:each) do |e|
+          results << "around (before)"
+          e.run
+          results << "around (after)"
+        end
+        before(:each) { results << "before" }
+        after(:each) { results << "after" }
+        example { results << "example" }
+      end
+
+      group.run
+      expect(results).to eq([
+                          "around (before)",
+                          "before",
+                          "example",
+                          "after",
+                          "around (after)"
+                        ])
+    end
+
+    context "clearing ivars" do
+      it "sets ivars to nil to prep them for GC" do
+        group = RSpec::Core::ExampleGroup.describe do
+          before(:all)  { @before_all  = :before_all }
+          before(:each) { @before_each = :before_each }
+          after(:each)  { @after_each = :after_each }
+          after(:all)   { @after_all  = :after_all }
+        end
+        group.example("does something") do
+          expect(@before_all).to eq(:before_all)
+          expect(@before_each).to eq(:before_each)
+        end
+        expect(group.run(double.as_null_object)).to be_true
+        group.new do |example|
+          %w[@before_all @before_each @after_each @after_all].each do |ivar|
+            expect(example.instance_variable_get(ivar)).to be_nil
+          end
+        end
+      end
+
+      it "does not impact the before_all_ivars which are copied to each example" do
+        group = RSpec::Core::ExampleGroup.describe do
+          before(:all) { @before_all = "abc" }
+          example("first") { expect(@before_all).not_to be_nil }
+          example("second") { expect(@before_all).not_to be_nil }
+        end
+        expect(group.run).to be_true
+      end
+    end
+
+    context 'when the example raises an error' do
+      def run_and_capture_reported_message(group)
+        reported_msg = nil
+        # We can't use should_receive(:message).with(/.../) here,
+        # because if that fails, it would fail within our example-under-test,
+        # and since there's already two errors, it would just be reported again.
+        RSpec.configuration.reporter.stub(:message) { |msg| reported_msg = msg }
+        group.run
+        reported_msg
+      end
+
+      it "prints any around hook errors rather than silencing them" do
+        group = RSpec::Core::ExampleGroup.describe do
+          around(:each) { |e| e.run; raise "around" }
+          example("e") { raise "example" }
+        end
+
+        message = run_and_capture_reported_message(group)
+        expect(message).to match(/An error occurred in an around.* hook/i)
+      end
+
+      it "prints any after hook errors rather than silencing them" do
+        group = RSpec::Core::ExampleGroup.describe do
+          after(:each) { raise "after" }
+          example("e") { raise "example" }
+        end
+
+        message = run_and_capture_reported_message(group)
+        expect(message).to match(/An error occurred in an after.* hook/i)
+      end
+
+      it 'does not print mock expectation errors' do
+        group = RSpec::Core::ExampleGroup.describe do
+          example do
+            foo = double
+            foo.should_receive(:bar)
+            raise "boom"
+          end
+        end
+
+        message = run_and_capture_reported_message(group)
+        expect(message).to be_nil
+      end
+    end
+  end
+
+  describe "#pending" do
+    context "in the example" do
+      it "sets the example to pending" do
+        group = RSpec::Core::ExampleGroup.describe do
+          example { pending }
+        end
+        group.run
+        expect(group.examples.first).to be_pending
+      end
+
+      it "allows post-example processing in around hooks (see https://github.com/rspec/rspec-core/issues/322)" do
+        blah = nil
+        group = RSpec::Core::ExampleGroup.describe do
+          around do |example|
+            example.run
+            blah = :success
+          end
+          example { pending }
+        end
+        group.run
+        expect(blah).to be(:success)
+      end
+    end
+
+    context "in before(:each)" do
+      it "sets each example to pending" do
+        group = RSpec::Core::ExampleGroup.describe do
+          before(:each) { pending }
+          example {}
+          example {}
+        end
+        group.run
+        expect(group.examples.first).to be_pending
+        expect(group.examples.last).to be_pending
+      end
+    end
+
+    context "in before(:all)" do
+      it "sets each example to pending" do
+        group = RSpec::Core::ExampleGroup.describe do
+          before(:all) { pending }
+          example {}
+          example {}
+        end
+        group.run
+        expect(group.examples.first).to be_pending
+        expect(group.examples.last).to be_pending
+      end
+    end
+
+    context "in around(:each)" do
+      it "sets the example to pending" do
+        group = RSpec::Core::ExampleGroup.describe do
+          around(:each) { pending }
+          example {}
+        end
+        group.run
+        expect(group.examples.first).to be_pending
+      end
+    end
+  end
+
+  describe "timing" do
+    it "uses RSpec::Core::Time as to not be affected by changes to time in examples" do
+      reporter = double(:reporter).as_null_object
+      group = RSpec::Core::ExampleGroup.describe
+      example = group.example
+      example.__send__ :start, reporter
+      Time.stub(:now => Time.utc(2012, 10, 1))
+      example.__send__ :finish, reporter
+      expect(example.metadata[:execution_result][:run_time]).to be < 0.2
+    end
+  end
+
+  it 'does not interfere with per-example randomness when running examples in a random order' do
+    values = []
+
+    RSpec.configuration.order = :random
+
+    RSpec::Core::ExampleGroup.describe do
+      # The bug was only triggered when the examples
+      # were in nested contexts; see https://github.com/rspec/rspec-core/pull/837
+      context { example { values << rand } }
+      context { example { values << rand } }
+    end.run
+
+    expect(values.uniq).to have(2).values
+  end
+end
diff --git a/rspec-core/spec/rspec/core/filter_manager_spec.rb b/rspec-core/spec/rspec/core/filter_manager_spec.rb
new file mode 100644
index 0000000..e22a1e1
--- /dev/null
+++ b/rspec-core/spec/rspec/core/filter_manager_spec.rb
@@ -0,0 +1,246 @@
+require 'spec_helper'
+
+module RSpec::Core
+  describe FilterManager do
+    def opposite(name)
+      name =~ /^in/ ? name.sub(/^(in)/,'ex') : name.sub(/^(ex)/,'in')
+    end
+
+    %w[include inclusions exclude exclusions].each_slice(2) do |name, type|
+      describe "##{name}" do
+        it "merges #{type}" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send name, :foo => :bar
+          filter_manager.send name, :baz => :bam
+          expect(filter_manager.send(type)).to eq(:foo => :bar, :baz => :bam)
+        end
+
+        it "overrides previous #{type} with (via merge)" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send name, :foo => 1
+          filter_manager.send name, :foo => 2
+          expect(filter_manager.send(type)).to eq(:foo => 2)
+        end
+
+        it "deletes matching opposites" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send opposite(name), :foo => 1
+          filter_manager.send name, :foo => 2
+          expect(filter_manager.send(type)).to eq(:foo => 2)
+          expect(filter_manager.send(opposite(type))).to be_empty
+        end
+
+        if name == "include"
+          [:locations, :line_numbers, :full_description].each do |filter|
+            context "with :#{filter}" do
+              it "clears previous inclusions" do
+                filter_manager = FilterManager.new
+                filter_manager.include :foo => :bar
+                filter_manager.include filter => "value"
+                expect(filter_manager.inclusions).to eq({filter => "value"})
+              end
+
+              it "does nothing when :#{filter} previously set" do
+                filter_manager = FilterManager.new
+                filter_manager.include filter => "a_value"
+                filter_manager.include :foo => :bar
+                expect(filter_manager.inclusions).to eq(filter => "a_value")
+              end
+            end
+          end
+        end
+      end
+
+      describe "##{name}!" do
+        it "replaces existing #{type}" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send name, :foo => 1, :bar => 2
+          filter_manager.send "#{name}!", :foo => 3
+          expect(filter_manager.send(type)).to eq(:foo => 3)
+        end
+
+        it "deletes matching opposites" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send opposite(name), :foo => 1
+          filter_manager.send "#{name}!", :foo => 2
+          expect(filter_manager.send(type)).to eq(:foo => 2)
+          expect(filter_manager.send(opposite(type))).to be_empty
+        end
+      end
+
+      describe "##{name}_with_low_priority" do
+        it "ignores new #{type} if same key exists" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send name, :foo => 1
+          filter_manager.send "#{name}_with_low_priority", :foo => 2
+          expect(filter_manager.send(type)).to eq(:foo => 1)
+        end
+
+        it "ignores new #{type} if same key exists in opposite" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send opposite(name), :foo => 1
+          filter_manager.send "#{name}_with_low_priority", :foo => 1
+          expect(filter_manager.send(type)).to be_empty
+          expect(filter_manager.send(opposite(type))).to eq(:foo => 1)
+        end
+
+        it "keeps new #{type} if same key exists in opposite but values are different" do
+          filter_manager = FilterManager.new
+          filter_manager.exclusions.clear # defaults
+          filter_manager.send opposite(name), :foo => 1
+          filter_manager.send "#{name}_with_low_priority", :foo => 2
+          expect(filter_manager.send(type)).to eq(:foo => 2)
+          expect(filter_manager.send(opposite(type))).to eq(:foo => 1)
+        end
+      end
+    end
+
+    describe "#prune" do
+      def filterable_object_with(args = {})
+        object = double('a filterable object')
+        object.stub(:any_apply?) { |f| Metadata.new(args).any_apply?(f) }
+        object
+      end
+
+      it "includes objects with tags matching inclusions" do
+        included = filterable_object_with({:foo => :bar})
+        excluded = filterable_object_with
+        filter_manager = FilterManager.new
+        filter_manager.include :foo => :bar
+        expect(filter_manager.prune([included, excluded])).to eq([included])
+      end
+
+      it "excludes objects with tags matching exclusions" do
+        included = filterable_object_with
+        excluded = filterable_object_with({:foo => :bar})
+        filter_manager = FilterManager.new
+        filter_manager.exclude :foo => :bar
+        expect(filter_manager.prune([included, excluded])).to eq([included])
+      end
+
+      it "prefers exclusion when matches previously set inclusion" do
+        included = filterable_object_with
+        excluded = filterable_object_with({:foo => :bar})
+        filter_manager = FilterManager.new
+        filter_manager.include :foo => :bar
+        filter_manager.exclude :foo => :bar
+        expect(filter_manager.prune([included, excluded])).to eq([included])
+      end
+
+      it "prefers inclusion when matches previously set exclusion" do
+        included = filterable_object_with({:foo => :bar})
+        excluded = filterable_object_with
+        filter_manager = FilterManager.new
+        filter_manager.exclude :foo => :bar
+        filter_manager.include :foo => :bar
+        expect(filter_manager.prune([included, excluded])).to eq([included])
+      end
+
+      it "prefers previously set inclusion when exclusion matches but has lower priority" do
+        included = filterable_object_with({:foo => :bar})
+        excluded = filterable_object_with
+        filter_manager = FilterManager.new
+        filter_manager.include :foo => :bar
+        filter_manager.exclude_with_low_priority :foo => :bar
+        expect(filter_manager.prune([included, excluded])).to eq([included])
+      end
+
+      it "prefers previously set exclusion when inclusion matches but has lower priority" do
+        included = filterable_object_with
+        excluded = filterable_object_with({:foo => :bar})
+        filter_manager = FilterManager.new
+        filter_manager.exclude :foo => :bar
+        filter_manager.include_with_low_priority :foo => :bar
+        expect(filter_manager.prune([included, excluded])).to eq([included])
+      end
+    end
+
+    describe "#inclusions#description" do
+      it 'cleans up the description' do
+        project_dir = File.expand_path('.')
+        expect(lambda { }.inspect).to include(project_dir)
+        expect(lambda { }.inspect).to include(' (lambda)') if RUBY_VERSION > '1.9'
+        expect(lambda { }.inspect).to include('0x')
+
+        filter_manager = FilterManager.new
+        filter_manager.include :foo => lambda { }
+
+        expect(filter_manager.inclusions.description).not_to include(project_dir)
+        expect(filter_manager.inclusions.description).not_to include(' (lambda)')
+        expect(filter_manager.inclusions.description).not_to include('0x')
+      end
+    end
+
+    describe "#exclusions#description" do
+      it 'cleans up the description' do
+        project_dir = File.expand_path('.')
+        expect(lambda { }.inspect).to include(project_dir)
+        expect(lambda { }.inspect).to include(' (lambda)') if RUBY_VERSION > '1.9'
+        expect(lambda { }.inspect).to include('0x')
+
+        filter_manager = FilterManager.new
+        filter_manager.exclude :foo => lambda { }
+
+        expect(filter_manager.exclusions.description).not_to include(project_dir)
+        expect(filter_manager.exclusions.description).not_to include(' (lambda)')
+        expect(filter_manager.exclusions.description).not_to include('0x')
+      end
+
+      it 'returns `{}` when it only contains the default filters' do
+        filter_manager = FilterManager.new
+        expect(filter_manager.exclusions.description).to eq({}.inspect)
+      end
+
+      it 'includes other filters' do
+        filter_manager = FilterManager.new
+        filter_manager.exclude :foo => :bar
+        expect(filter_manager.exclusions.description).to eq({ :foo => :bar }.inspect)
+      end
+
+      it 'deprecates an overridden :if filter' do
+        expect(RSpec).to receive(:deprecate).with(/exclude\(:if/)
+        filter_manager = FilterManager.new
+        filter_manager.exclude :if => :custom_filter
+      end
+
+      it 'deprecates an :if filter overridden with low priority' do
+        expect(RSpec).to receive(:deprecate).with(/exclude\(:if/)
+        filter_manager = FilterManager.new
+        filter_manager.exclude_with_low_priority :if => :custom_filter
+      end
+
+      it 'deprecates an overridden :unless filter' do
+        expect(RSpec).to receive(:deprecate).with(/exclude\(:unless/)
+        filter_manager = FilterManager.new
+        filter_manager.exclude :unless => :custom_filter
+      end
+
+      it 'deprecates an :unless filter overridden with low priority' do
+        expect(RSpec).to receive(:deprecate).with(/exclude\(:unless/)
+        filter_manager = FilterManager.new
+        filter_manager.exclude_with_low_priority :unless => :custom_filter
+      end
+
+      it 'includes an overriden :if filter' do
+        allow(RSpec).to receive(:deprecate)
+        filter_manager = FilterManager.new
+        filter_manager.exclude :if => :custom_filter
+        expect(filter_manager.exclusions.description).to eq({ :if => :custom_filter }.inspect)
+      end
+
+      it 'includes an overriden :unless filter' do
+        allow(RSpec).to receive(:deprecate)
+        filter_manager = FilterManager.new
+        filter_manager.exclude :unless => :custom_filter
+        expect(filter_manager.exclusions.description).to eq({ :unless => :custom_filter }.inspect)
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/formatters/base_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/base_formatter_spec.rb
new file mode 100644
index 0000000..638b37b
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/base_formatter_spec.rb
@@ -0,0 +1,108 @@
+require 'spec_helper'
+require 'rspec/core/formatters/base_formatter'
+
+describe RSpec::Core::Formatters::BaseFormatter do
+
+  let(:output)    { StringIO.new }
+  let(:formatter) { RSpec::Core::Formatters::BaseFormatter.new(output) }
+
+  describe "backtrace_line" do
+    it "trims current working directory" do
+      expect(formatter.__send__(:backtrace_line, File.expand_path(__FILE__))).to eq("./spec/rspec/core/formatters/base_formatter_spec.rb")
+    end
+
+    it "leaves the original line intact" do
+      original_line = File.expand_path(__FILE__)
+      formatter.__send__(:backtrace_line, original_line)
+      expect(original_line).to eq(File.expand_path(__FILE__))
+    end
+
+    it "deals gracefully with a security error" do
+      safely do
+        formatter.__send__(:backtrace_line, __FILE__)
+        # on some rubies, this doesn't raise a SecurityError; this test just
+        # assures that if it *does* raise an error, the error is caught inside
+      end
+    end
+  end
+
+  describe "read_failed_line" do
+    it "deals gracefully with a heterogeneous language stack trace" do
+      exception = double(:Exception, :backtrace => [
+        "at Object.prototypeMethod (foo:331:18)",
+        "at Array.forEach (native)",
+        "at a_named_javascript_function (/some/javascript/file.js:39:5)",
+        "/some/line/of/ruby.rb:14"
+      ])
+      example = double(:Example, :file_path => __FILE__)
+      expect {
+        formatter.send(:read_failed_line, exception, example)
+      }.not_to raise_error
+    end
+
+    it "deals gracefully with a security error" do
+      exception = double(:Exception, :backtrace => [ "#{__FILE__}:#{__LINE__}"])
+      example = double(:Example, :file_path => __FILE__)
+      safely do
+        expect {
+          formatter.send(:read_failed_line, exception, example)
+        }.not_to raise_error
+      end
+    end
+
+    context "when ruby reports a bogus line number in the stack trace" do
+      it "reports the filename and that it was unable to find the matching line" do
+        exception = double(:Exception, :backtrace => [ "#{__FILE__}:10000000" ])
+        example = double(:Example, :file_path => __FILE__)
+
+        msg = formatter.send(:read_failed_line, exception, example)
+        expect(msg).to include("Unable to find matching line")
+      end
+    end
+
+    context "when String alias to_int to_i" do
+      before do
+        String.class_eval do
+          alias :to_int :to_i
+        end
+      end
+
+      after do
+        String.class_eval do
+          undef to_int
+        end
+      end
+
+      it "doesn't hang when file exists" do
+        pending("This issue still exists on JRuby, but should be resolved shortly: https://github.com/rspec/rspec-core/issues/295", :if => RUBY_PLATFORM == 'java')
+        exception = double(:Exception, :backtrace => [ "#{__FILE__}:#{__LINE__}"])
+
+        example = double(:Example, :file_path => __FILE__)
+        expect(formatter.send(:read_failed_line, exception, example)).to eql(
+          %Q{        exception = double(:Exception, :backtrace => [ "\#{__FILE__}:\#{__LINE__}"])\n})
+      end
+
+    end
+  end
+
+  describe "#format_backtrace" do
+    let(:rspec_expectations_dir) { "/path/to/rspec-expectations/lib" }
+    let(:rspec_core_dir) { "/path/to/rspec-core/lib" }
+    let(:backtrace) do
+      [
+        "#{rspec_expectations_dir}/rspec/matchers/operator_matcher.rb:51:in `eval_match'",
+        "#{rspec_expectations_dir}/rspec/matchers/operator_matcher.rb:29:in `=='",
+        "./my_spec.rb:5",
+        "#{rspec_core_dir}/rspec/core/example.rb:52:in `run'",
+        "#{rspec_core_dir}/rspec/core/runner.rb:37:in `run'",
+        RSpec::Core::Runner::AT_EXIT_HOOK_BACKTRACE_LINE,
+        "./my_spec.rb:3"
+      ]
+    end
+
+    it "removes lines from rspec and lines that come before the invocation of the at_exit autorun hook" do
+      expect(formatter.format_backtrace(backtrace, double.as_null_object)).to eq(["./my_spec.rb:5"])
+    end
+  end
+
+end
diff --git a/rspec-core/spec/rspec/core/formatters/base_text_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/base_text_formatter_spec.rb
new file mode 100644
index 0000000..c046415
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/base_text_formatter_spec.rb
@@ -0,0 +1,494 @@
+require 'spec_helper'
+require 'rspec/core/formatters/base_text_formatter'
+
+describe RSpec::Core::Formatters::BaseTextFormatter do
+  let(:output) { StringIO.new }
+  let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
+
+  describe "#summary_line" do
+    it "with 0s outputs pluralized (excluding pending)" do
+      expect(formatter.summary_line(0,0,0)).to eq("0 examples, 0 failures")
+    end
+
+    it "with 1s outputs singular (including pending)" do
+      expect(formatter.summary_line(1,1,1)).to eq("1 example, 1 failure, 1 pending")
+    end
+
+    it "with 2s outputs pluralized (including pending)" do
+      expect(formatter.summary_line(2,2,2)).to eq("2 examples, 2 failures, 2 pending")
+    end
+  end
+
+  describe "#dump_commands_to_rerun_failed_examples" do
+    it "includes command to re-run each failed example" do
+      group = RSpec::Core::ExampleGroup.describe("example group") do
+        it("fails") { fail }
+      end
+      line = __LINE__ - 2
+      group.run(formatter)
+      formatter.dump_commands_to_rerun_failed_examples
+      expect(output.string).to include("rspec #{RSpec::Core::Metadata::relative_path("#{__FILE__}:#{line}")} # example group fails")
+    end
+  end
+
+  describe "#dump_failures" do
+    let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
+
+    before { RSpec.configuration.stub(:color_enabled?) { false } }
+
+    def run_all_and_dump_failures
+      group.run(formatter)
+      formatter.dump_failures
+    end
+
+    it "preserves formatting" do
+      group.example("example name") { expect("this").to eq("that") }
+
+      run_all_and_dump_failures
+
+      expect(output.string).to match(/group name example name/m)
+      expect(output.string).to match(/(\s+)expected: \"that\"\n\1     got: \"this\"/m)
+    end
+
+    context "with an exception without a message" do
+      it "does not throw NoMethodError" do
+        exception_without_message = Exception.new()
+        exception_without_message.stub(:message) { nil }
+        group.example("example name") { raise exception_without_message }
+        expect { run_all_and_dump_failures }.not_to raise_error
+      end
+
+      it "preserves ancestry" do
+        example = group.example("example name") { raise "something" }
+        run_all_and_dump_failures
+        expect(example.example_group.parent_groups.size).to eq 1
+      end
+    end
+
+    context "with an exception that has an exception instance as its message" do
+      it "does not raise NoMethodError" do
+        gonzo_exception = RuntimeError.new
+        gonzo_exception.stub(:message) { gonzo_exception }
+        group.example("example name") { raise gonzo_exception }
+        expect { run_all_and_dump_failures }.not_to raise_error
+      end
+    end
+
+    context "with an instance of an anonymous exception class" do
+      it "substitutes '(anonymous error class)' for the missing class name" do
+        exception = Class.new(StandardError).new
+        group.example("example name") { raise exception }
+        run_all_and_dump_failures
+        expect(output.string).to include('(anonymous error class)')
+      end
+    end
+
+    context "with an exception class other than RSpec" do
+      it "does not show the error class" do
+        group.example("example name") { raise NameError.new('foo') }
+        run_all_and_dump_failures
+        expect(output.string).to match(/NameError/m)
+      end
+    end
+
+    context "with a failed expectation (rspec-expectations)" do
+      it "does not show the error class" do
+        group.example("example name") { expect("this").to eq("that") }
+        run_all_and_dump_failures
+        expect(output.string).not_to match(/RSpec/m)
+      end
+    end
+
+    context "with a failed message expectation (rspec-mocks)" do
+      it "does not show the error class" do
+        group.example("example name") { "this".should_receive("that") }
+        run_all_and_dump_failures
+        expect(output.string).not_to match(/RSpec/m)
+      end
+    end
+
+    context 'for #share_examples_for' do
+      it 'outputs the name and location' do
+
+        group.share_examples_for 'foo bar' do
+          it("example name") { expect("this").to eq("that") }
+        end
+
+        line = __LINE__.next
+        group.it_should_behave_like('foo bar')
+
+        run_all_and_dump_failures
+
+        expect(output.string).to include(
+          'Shared Example Group: "foo bar" called from ' +
+            "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+        )
+      end
+
+      context 'that contains nested example groups' do
+        it 'outputs the name and location' do
+          group.share_examples_for 'foo bar' do
+            describe 'nested group' do
+              it("example name") { expect("this").to eq("that") }
+            end
+          end
+
+          line = __LINE__.next
+          group.it_should_behave_like('foo bar')
+
+          run_all_and_dump_failures
+
+          expect(output.string).to include(
+            'Shared Example Group: "foo bar" called from ' +
+              "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+          )
+        end
+      end
+    end
+
+    context 'for #share_as' do
+      before { allow(RSpec).to receive(:deprecate) }
+
+      it 'outputs the name and location' do
+
+        group.share_as :FooBar do
+          it("example name") { expect("this").to eq("that") }
+        end
+
+        line = __LINE__.next
+        group.send(:include, FooBar)
+
+        run_all_and_dump_failures
+
+        expect(output.string).to include(
+          'Shared Example Group: "FooBar" called from ' +
+            "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+        )
+      end
+
+      context 'that contains nested example groups' do
+        it 'outputs the name and location' do
+
+          group.share_as :NestedFoo do
+            describe 'nested group' do
+              describe 'hell' do
+                it("example name") { expect("this").to eq("that") }
+              end
+            end
+          end
+
+          line = __LINE__.next
+          group.send(:include, NestedFoo)
+
+          run_all_and_dump_failures
+
+          expect(output.string).to include(
+            'Shared Example Group: "NestedFoo" called from ' +
+              "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+          )
+        end
+      end
+    end
+  end
+
+  describe "#dump_pending" do
+    let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
+
+    before { RSpec.configuration.stub(:color_enabled?) { false } }
+
+    def run_all_and_dump_pending
+      group.run(formatter)
+      formatter.dump_pending
+    end
+
+    context "with show_failures_in_pending_blocks setting enabled" do
+      before { RSpec.configuration.stub(:show_failures_in_pending_blocks?) { true } }
+
+      it "preserves formatting" do
+        group.example("example name") { pending { expect("this").to eq("that") } }
+
+        run_all_and_dump_pending
+
+        expect(output.string).to match(/group name example name/m)
+        expect(output.string).to match(/(\s+)expected: \"that\"\n\1     got: \"this\"/m)
+      end
+
+      context "with an exception without a message" do
+        it "does not throw NoMethodError" do
+          exception_without_message = Exception.new()
+          exception_without_message.stub(:message) { nil }
+          group.example("example name") { pending { raise exception_without_message } }
+          expect { run_all_and_dump_pending }.not_to raise_error
+        end
+      end
+
+      context "with an exception class other than RSpec" do
+        it "does not show the error class" do
+          group.example("example name") { pending { raise NameError.new('foo') } }
+          run_all_and_dump_pending
+          expect(output.string).to match(/NameError/m)
+        end
+      end
+
+      context "with a failed expectation (rspec-expectations)" do
+        it "does not show the error class" do
+          group.example("example name") { pending { expect("this").to eq("that") } }
+          run_all_and_dump_pending
+          expect(output.string).not_to match(/RSpec/m)
+        end
+      end
+
+      context "with a failed message expectation (rspec-mocks)" do
+        it "does not show the error class" do
+          group.example("example name") { pending { "this".should_receive("that") } }
+          run_all_and_dump_pending
+          expect(output.string).not_to match(/RSpec/m)
+        end
+      end
+
+      context 'for #share_examples_for' do
+        it 'outputs the name and location' do
+
+          group.share_examples_for 'foo bar' do
+            it("example name") { pending { expect("this").to eq("that") } }
+          end
+
+          line = __LINE__.next
+          group.it_should_behave_like('foo bar')
+
+          run_all_and_dump_pending
+
+          expect(output.string).to include(
+            'Shared Example Group: "foo bar" called from ' +
+            "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+          )
+        end
+
+        context 'that contains nested example groups' do
+          it 'outputs the name and location' do
+            group.share_examples_for 'foo bar' do
+              describe 'nested group' do
+                it("example name") { pending { expect("this").to eq("that") } }
+              end
+            end
+
+            line = __LINE__.next
+            group.it_should_behave_like('foo bar')
+
+            run_all_and_dump_pending
+
+            expect(output.string).to include(
+              'Shared Example Group: "foo bar" called from ' +
+              "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+            )
+          end
+        end
+      end
+
+      context 'for #share_as' do
+        before { allow(RSpec).to receive(:deprecate) }
+
+        it 'outputs the name and location' do
+
+          group.share_as :FooBar2 do
+            it("example name") { pending { expect("this").to eq("that") } }
+          end
+
+          line = __LINE__.next
+          group.send(:include, FooBar2)
+
+          run_all_and_dump_pending
+
+          expect(output.string).to include(
+            'Shared Example Group: "FooBar2" called from ' +
+            "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+          )
+        end
+
+        context 'that contains nested example groups' do
+          it 'outputs the name and location' do
+
+            group.share_as :NestedFoo2 do
+              describe 'nested group' do
+                describe 'hell' do
+                  it("example name") { pending { expect("this").to eq("that") } }
+                end
+              end
+            end
+
+            line = __LINE__.next
+            group.send(:include, NestedFoo2)
+
+            run_all_and_dump_pending
+
+            expect(output.string).to include(
+              'Shared Example Group: "NestedFoo2" called from ' +
+              "./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
+            )
+          end
+        end
+      end
+    end
+
+    context "with show_failures_in_pending_blocks setting disabled" do
+      before { RSpec.configuration.stub(:show_failures_in_pending_blocks?) { false } }
+
+      it "does not output the failure information" do
+        group.example("example name") { pending { expect("this").to eq("that") } }
+        run_all_and_dump_pending
+        expect(output.string).not_to match(/(\s+)expected: \"that\"\n\1     got: \"this\"/m)
+      end
+    end
+  end
+
+  describe "#dump_profile_slowest_examples" do
+    example_line_number = nil
+
+    before do
+      group = RSpec::Core::ExampleGroup.describe("group") do
+        # Use a sleep so there is some measurable time, to ensure
+        # the reported percent is 100%, not 0%.
+        example("example") { sleep 0.001 }
+        example_line_number = __LINE__ - 1
+      end
+      group.run(double('reporter').as_null_object)
+
+      formatter.stub(:examples) { group.examples }
+      RSpec.configuration.stub(:profile_examples) { 10 }
+    end
+
+    it "names the example" do
+      formatter.dump_profile_slowest_examples
+      expect(output.string).to match(/group example/m)
+    end
+
+    it "prints the time" do
+      formatter.dump_profile_slowest_examples
+      expect(output.string).to match(/0(\.\d+)? seconds/)
+    end
+
+    it "prints the path" do
+      formatter.dump_profile_slowest_examples
+      filename = __FILE__.split(File::SEPARATOR).last
+
+      expect(output.string).to match(/#{filename}\:#{example_line_number}/)
+    end
+
+    it "prints the percentage taken from the total runtime" do
+      formatter.dump_profile_slowest_examples
+      expect(output.string).to match(/, 100.0% of total time\):/)
+    end
+  end
+
+  describe "#dump_profile_slowest_example_groups" do
+    let(:group) do 
+      RSpec::Core::ExampleGroup.describe("slow group") do
+        # Use a sleep so there is some measurable time, to ensure
+        # the reported percent is 100%, not 0%.
+        example("example") { sleep 0.01 }
+      end 
+    end
+    let(:rpt) { double('reporter').as_null_object }
+
+    before do
+      group.run(rpt)
+      RSpec.configuration.stub(:profile_examples) { 10 }
+    end
+
+    context "with one example group" do
+      before { formatter.stub(:examples) { group.examples } }
+
+      it "doesn't profile a single example group" do
+        formatter.dump_profile_slowest_example_groups
+        expect(output.string).not_to match(/slowest example groups/)
+      end
+    end
+
+    context "with multiple example groups" do
+      before do
+        group2 = RSpec::Core::ExampleGroup.describe("fast group") do
+          example("example 1") { sleep 0.004 }
+          example("example 2") { sleep 0.007 }
+        end
+        group2.run(rpt)
+
+        formatter.stub(:examples) { group.examples + group2.examples }
+      end
+
+      it "prints the slowest example groups" do
+        formatter.dump_profile_slowest_example_groups
+        expect(output.string).to match(/slowest example groups/)
+      end
+
+      it "prints the time" do
+        formatter.dump_profile_slowest_example_groups
+        expect(output.string).to match(/0(\.\d+)? seconds/)
+      end
+
+      it "ranks the example groups by average time" do
+        formatter.dump_profile_slowest_example_groups
+        expect(output.string).to match(/slow group(.*)fast group/m)
+      end
+    end
+
+    it "depends on parent_groups to get the top level example group" do
+      ex = ""
+      group.describe("group 2") do 
+        describe "group 3" do
+          ex = example("nested example 1") 
+        end
+      end
+
+      expect(ex.example_group.parent_groups.last).to eq(group)
+    end
+  end
+
+  describe "custom_colors" do
+    it "uses the custom success color" do
+      RSpec.configure do |config|
+        config.color_enabled = true
+        config.tty = true
+        config.success_color = :cyan
+      end
+      formatter.dump_summary(0,1,0,0)
+      expect(output.string).to include("\e[36m")
+    end
+  end
+
+  describe "#colorize" do
+    it "accepts a VT100 integer code and formats the text with it" do
+       expect(formatter.colorize('abc', 32)).to eq "\e[32mabc\e[0m"
+    end
+
+    it "accepts a symbol as a color parameter and translates it to the correct integer code, then formats the text with it" do
+       expect(formatter.colorize('abc', :green)).to eq "\e[32mabc\e[0m"
+    end
+
+    it "accepts a non-default color symbol as a parameter and translates it to the correct integer code, then formats the text with it" do
+       expect(formatter.colorize('abc', :cyan)).to eq "\e[36mabc\e[0m"
+    end
+  end
+
+  described_class::VT100_COLORS.each do |name, number|
+    next if name == :black
+
+    describe "##{name}" do
+      before do
+        allow(RSpec.configuration).to receive(:color_enabled?) { true }
+        allow(RSpec).to receive(:deprecate)
+      end
+
+      it "prints the text using the color code for #{name}" do
+        expect(formatter.send(name, "text")).to eq("\e[#{number}mtext\e[0m")
+      end
+
+      it "prints a deprecation warning" do
+        expect(RSpec).to receive(:deprecate) {|*args|
+          expect(args.first).to match(/#{name}/)
+        }
+        formatter.send(name, "text")
+      end
+    end
+  end
+
+end
diff --git a/rspec-core/spec/rspec/core/formatters/deprecation_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/deprecation_formatter_spec.rb
new file mode 100644
index 0000000..86c3dc9
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/deprecation_formatter_spec.rb
@@ -0,0 +1,96 @@
+require 'spec_helper'
+require 'rspec/core/formatters/deprecation_formatter'
+require 'tempfile'
+
+module RSpec::Core::Formatters
+  describe DeprecationFormatter do
+    let(:deprecation_stream) { StringIO.new }
+    let(:summary_stream)     { StringIO.new }
+    let(:formatter) { DeprecationFormatter.new deprecation_stream, summary_stream }
+
+    def with_start_defined_on_kernel
+      return yield if ::Kernel.method_defined?(:start)
+
+      begin
+        ::Kernel.module_eval { def start(*); raise "boom"; end }
+        yield
+      ensure
+        ::Kernel.module_eval { undef start }
+      end
+    end
+
+    it 'does not blow up when `Kernel` defines `start`' do
+      with_start_defined_on_kernel do
+        reporter = ::RSpec::Core::Reporter.new(formatter)
+        reporter.start(3)
+      end
+    end
+
+    describe "#deprecation" do
+      it "includes the method" do
+        formatter.deprecation(:deprecated => "i_am_deprecated")
+        deprecation_stream.rewind
+        expect(deprecation_stream.read).to match(/i_am_deprecated is deprecated/)
+      end
+
+      it "includes the replacement" do
+        formatter.deprecation(:replacement => "use_me")
+        deprecation_stream.rewind
+        expect(deprecation_stream.read).to match(/Use use_me instead/)
+      end
+
+      it "includes the call site if provided" do
+        formatter.deprecation(:call_site => "somewhere")
+        deprecation_stream.rewind
+        expect(deprecation_stream.read).to match(/Called from somewhere/)
+      end
+
+      it "prints a message if provided, ignoring other data" do
+        formatter.deprecation(:message => "this message", :deprecated => "x", :replacement => "y", :call_site => "z")
+        deprecation_stream.rewind
+        expect(deprecation_stream.read).to eq "this message"
+      end
+    end
+
+    describe "#deprecation_summary" do
+      it "is printed when deprecations go to a file" do
+        file = File.open("#{Dir.tmpdir}/deprecation_summary_example_output", "w")
+        summary_stream = StringIO.new
+        formatter = DeprecationFormatter.new file, summary_stream
+        formatter.deprecation(:deprecated => 'i_am_deprecated')
+        formatter.deprecation_summary
+        summary_stream.rewind
+        expect(summary_stream.read).to match(/1 deprecation logged to .*deprecation_summary_example_output/)
+      end
+
+      it "pluralizes for more than one deprecation" do
+        file = File.open("#{Dir.tmpdir}/deprecation_summary_example_output", "w")
+        summary_stream = StringIO.new
+        formatter = DeprecationFormatter.new file, summary_stream
+        formatter.deprecation(:deprecated => 'i_am_deprecated')
+        formatter.deprecation(:deprecated => 'i_am_deprecated_also')
+        formatter.deprecation_summary
+        summary_stream.rewind
+        expect(summary_stream.read).to match(/2 deprecations/)
+      end
+
+      it "is not printed when there are no deprecations" do
+        file = File.open("#{Dir.tmpdir}/deprecation_summary_example_output", "w")
+        summary_stream = StringIO.new
+        formatter = DeprecationFormatter.new file, summary_stream
+        formatter.deprecation_summary
+        summary_stream.rewind
+        expect(summary_stream.read).to eq ""
+      end
+
+      it "is not printed when deprecations go to an IO instance" do
+        summary_stream = StringIO.new
+        formatter = DeprecationFormatter.new StringIO.new, summary_stream
+        formatter.deprecation(:deprecated => 'i_am_deprecated')
+        formatter.deprecation_summary
+        summary_stream.rewind
+        expect(summary_stream.read).to eq ""
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/formatters/documentation_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/documentation_formatter_spec.rb
new file mode 100644
index 0000000..3d7ff51
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/documentation_formatter_spec.rb
@@ -0,0 +1,88 @@
+require 'spec_helper'
+require 'rspec/core/formatters/documentation_formatter'
+
+module RSpec::Core::Formatters
+  describe DocumentationFormatter do
+    it "numbers the failures" do
+
+      examples = [
+        double("example 1",
+               :description => "first example",
+               :execution_result => {:status => 'failed', :exception => Exception.new }
+              ),
+        double("example 2",
+               :description => "second example",
+               :execution_result => {:status => 'failed', :exception => Exception.new }
+              )
+      ]
+
+      output = StringIO.new
+      RSpec.configuration.stub(:color_enabled?) { false }
+
+      formatter = RSpec::Core::Formatters::DocumentationFormatter.new(output)
+
+      examples.each {|e| formatter.example_failed(e) }
+
+      expect(output.string).to match(/first example \(FAILED - 1\)/m)
+      expect(output.string).to match(/second example \(FAILED - 2\)/m)
+    end
+
+    it "represents nested group using hierarchy tree" do
+      output = StringIO.new
+      RSpec.configuration.stub(:color_enabled?) { false }
+
+      formatter = RSpec::Core::Formatters::DocumentationFormatter.new(output)
+
+      group = RSpec::Core::ExampleGroup.describe("root")
+      context1 = group.describe("context 1")
+      context1.example("nested example 1.1"){}
+      context1.example("nested example 1.2"){}
+
+      context11 = context1.describe("context 1.1")
+      context11.example("nested example 1.1.1"){}
+      context11.example("nested example 1.1.2"){}
+
+      context2 = group.describe("context 2")
+      context2.example("nested example 2.1"){}
+      context2.example("nested example 2.2"){}
+
+      group.run(RSpec::Core::Reporter.new(formatter))
+
+      expect(output.string).to eql("
+root
+  context 1
+    nested example 1.1
+    nested example 1.2
+    context 1.1
+      nested example 1.1.1
+      nested example 1.1.2
+  context 2
+    nested example 2.1
+    nested example 2.2
+")
+    end
+
+    it "strips whitespace for each row" do
+      output = StringIO.new
+      RSpec.configuration.stub(:color_enabled?) { false }
+
+      formatter = RSpec::Core::Formatters::DocumentationFormatter.new(output)
+
+      group = RSpec::Core::ExampleGroup.describe(" root ")
+      context1 = group.describe(" nested ")
+      context1.example(" example 1 ") {}
+      context1.example(" example 2 ", :pending => true){}
+      context1.example(" example 3 ") { fail }
+
+      group.run(RSpec::Core::Reporter.new(formatter))
+
+      expect(output.string).to eql("
+root
+  nested
+    example 1
+    example 2 (PENDING: No reason given)
+    example 3 (FAILED - 1)
+")
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/formatters/helpers_spec.rb b/rspec-core/spec/rspec/core/formatters/helpers_spec.rb
new file mode 100644
index 0000000..7027e1f
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/helpers_spec.rb
@@ -0,0 +1,94 @@
+require 'spec_helper'
+require 'rspec/core/formatters/helpers'
+
+describe RSpec::Core::Formatters::Helpers do
+  let(:helper) { Object.new.extend(RSpec::Core::Formatters::Helpers) }
+
+  describe "format duration" do
+    context '< 1' do
+      it "returns '0.xxxxx seconds' formatted string" do
+        expect(helper.format_duration(0.123456)).to eq("0.12346 seconds")
+      end
+    end
+
+    context '> 1 and < 60' do
+      it "returns 'xx.xx seconds' formatted string" do
+        expect(helper.format_duration(45.51)).to eq("45.51 seconds")
+      end
+    end
+
+    context '> 60 and < 120' do
+      it "returns 'x minute xx.xx seconds' formatted string" do
+        expect(helper.format_duration(70.14)).to eq("1 minute 10.14 seconds")
+      end
+    end
+
+    context '> 120 and < 300' do
+      it "returns 'x minutes xx.x seconds' formatted string" do
+        expect(helper.format_duration(135.14)).to eq("2 minutes 15.1 seconds")
+      end
+    end
+
+    context '> 300' do
+      it "returns 'x minutes xx seconds' formatted string" do
+        expect(helper.format_duration(335.14)).to eq("5 minutes 35 seconds")
+      end
+    end
+
+    context '= 61' do
+      it "returns 'x minute x second' formatted string" do
+        expect(helper.format_duration(61)).to eq("1 minute 1 second")
+      end
+    end
+
+    context '= 1' do
+      it "returns 'x second' formatted string" do
+        expect(helper.format_duration(1)).to eq("1 second")
+      end
+    end
+  end
+
+  describe "format seconds" do
+    it "uses passed in precision if specified unless result is 0" do
+      expect(helper.format_seconds(0.01234, 2)).to eq("0.01")
+    end
+
+    context "sub second times" do
+      it "returns 5 digits of precision" do
+        expect(helper.format_seconds(0.000006)).to eq("0.00001")
+      end
+
+      it "strips off trailing zeroes beyond sub-second precision" do
+        expect(helper.format_seconds(0.020000)).to eq("0.02")
+      end
+
+      context "0" do
+        it "strips off trailing zeroes" do
+          expect(helper.format_seconds(0.00000000001)).to eq("0")
+        end
+      end
+
+      context "> 1" do
+        it "strips off trailing zeroes" do
+          expect(helper.format_seconds(1.00000000001)).to eq("1")
+        end
+      end
+    end
+
+    context "second and greater times" do
+
+      it "returns 2 digits of precision" do
+        expect(helper.format_seconds(50.330340)).to eq("50.33")
+      end
+
+      it "returns human friendly elasped time" do
+        expect(helper.format_seconds(50.1)).to eq("50.1")
+        expect(helper.format_seconds(5)).to eq("5")
+        expect(helper.format_seconds(5.0)).to eq("5")
+      end
+
+    end
+  end
+
+
+end
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html b/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html
new file mode 100644
index 0000000..d433161
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html
@@ -0,0 +1,404 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `(root)'
+./spec/support/sandboxed_mock_space.rb:33:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `(root)'
+./spec/support/sandboxed_mock_space.rb:33:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `result'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `(root)'
+./spec/support/sandboxed_mock_space.rb:33:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html b/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html
new file mode 100644
index 0000000..8d7e4d9
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html
@@ -0,0 +1,477 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `__script__'
+kernel/common/eval18.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `Formatters'
+kernel/common/hash18.rb:195:in `fetch'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/io.rb:217:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/dir.rb:92:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `Formatters'
+kernel/common/eval18.rb:45:in `instance_eval'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/common/eval18.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'
+kernel/common/eval18.rb:104:in `instance_exec'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/loader.rb:698:in `run_at_exits'
+kernel/loader.rb:718:in `epilogue'
+kernel/loader.rb:851:in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `__script__'
+kernel/common/eval18.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `Formatters'
+kernel/common/hash18.rb:195:in `fetch'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/io.rb:217:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/dir.rb:92:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `Formatters'
+kernel/common/eval18.rb:45:in `instance_eval'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/common/eval18.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'
+kernel/common/eval18.rb:104:in `instance_exec'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/loader.rb:698:in `run_at_exits'
+kernel/loader.rb:718:in `epilogue'
+kernel/loader.rb:851:in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `__script__'
+kernel/common/block_environment.rb:75:in `call_on_instance'
+kernel/common/eval.rb:75:in `eval'
+/Users/jon/.rvm/rubies/rbx-head/lib/18/erb.rb:719:in `result'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `__script__'
+kernel/common/eval18.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `Formatters'
+kernel/common/hash18.rb:195:in `fetch'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/io.rb:217:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/dir.rb:92:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `Formatters'
+kernel/common/eval18.rb:45:in `instance_eval'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/common/eval18.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'
+kernel/common/eval18.rb:104:in `instance_exec'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/array18.rb:18:in `map'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/loader.rb:698:in `run_at_exits'
+kernel/loader.rb:718:in `epilogue'
+kernel/loader.rb:851:in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7.html b/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7.html
new file mode 100644
index 0000000..3ce203b
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-1.8.7.html
@@ -0,0 +1,414 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `generated_html'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `generated_html'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.2.html b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.2.html
new file mode 100644
index 0000000..966c95c
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.2.html
@@ -0,0 +1,425 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `block (3 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `block (2 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `<main>'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `block (2 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html
new file mode 100644
index 0000000..fa1486d
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html
@@ -0,0 +1,404 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `(root)'
+././spec/support/sandboxed_mock_space.rb:33:in `sandboxed'
+././spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+././spec/support/sandboxed_mock_space.rb:32:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `(root)'
+././spec/support/sandboxed_mock_space.rb:33:in `sandboxed'
+././spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+././spec/support/sandboxed_mock_space.rb:32:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `result'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `(root)'
+././spec/support/sandboxed_mock_space.rb:33:in `sandboxed'
+././spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+././spec/support/sandboxed_mock_space.rb:32:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html
new file mode 100644
index 0000000..9ac5be1
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html
@@ -0,0 +1,477 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `__script__'
+kernel/common/eval19.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `Formatters'
+kernel/common/hash19.rb:256:in `fetch'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/io.rb:217:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/dir.rb:92:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `Formatters'
+kernel/common/eval19.rb:45:in `instance_eval'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/common/eval19.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'
+kernel/common/eval19.rb:103:in `instance_exec'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/loader.rb:698:in `run_at_exits'
+kernel/loader.rb:718:in `epilogue'
+kernel/loader.rb:851:in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `__script__'
+kernel/common/eval19.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `Formatters'
+kernel/common/hash19.rb:256:in `fetch'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/io.rb:217:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/dir.rb:92:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `Formatters'
+kernel/common/eval19.rb:45:in `instance_eval'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/common/eval19.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'
+kernel/common/eval19.rb:103:in `instance_exec'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/loader.rb:698:in `run_at_exits'
+kernel/loader.rb:718:in `epilogue'
+kernel/loader.rb:851:in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `__script__'
+kernel/common/block_environment.rb:75:in `call_on_instance'
+kernel/common/eval.rb:75:in `eval'
+/Users/jon/.rvm/rubies/rbx-head/lib/19/erb.rb:838:in `result'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `__script__'
+kernel/common/eval19.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:33:in `run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `Formatters'
+kernel/common/hash19.rb:256:in `fetch'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/io.rb:217:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `Formatters'
+kernel/common/dir.rb:92:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `Formatters'
+kernel/common/eval19.rb:45:in `instance_eval'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/common/eval19.rb:45:in `instance_eval'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'
+kernel/common/eval19.rb:103:in `instance_exec'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/array19.rb:18:in `map'
+kernel/bootstrap/proc.rb:22:in `call'
+kernel/loader.rb:698:in `run_at_exits'
+kernel/loader.rb:718:in `epilogue'
+kernel/loader.rb:851:in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3.html b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3.html
new file mode 100644
index 0000000..966c95c
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-1.9.3.html
@@ -0,0 +1,425 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `block (3 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `block (2 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `<main>'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `block (2 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatted-2.0.0.html b/rspec-core/spec/rspec/core/formatters/html_formatted-2.0.0.html
new file mode 100644
index 0000000..5081928
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatted-2.0.0.html
@@ -0,0 +1,425 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `block (3 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `block (2 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `<main>'
+./spec/rspec/core/resources/formatter_specs.rb:41:in `block (2 levels) in <top (required)>'
+./spec/support/sandboxed_mock_space.rb:33:in `block in run'
+./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
+./spec/support/sandboxed_mock_space.rb:32:in `run'
+./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `block (2 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (5 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
+./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `block (4 levels) in <module:Formatters>'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
+./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `block (3 levels) in <module:Formatters>'
+./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/html_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/html_formatter_spec.rb
new file mode 100644
index 0000000..cdfe5d3
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/html_formatter_spec.rb
@@ -0,0 +1,95 @@
+# encoding: utf-8
+require 'spec_helper'
+require 'rspec/core/formatters/html_formatter'
+require 'nokogiri'
+
+module RSpec
+  module Core
+    module Formatters
+      describe HtmlFormatter, :if => RUBY_VERSION =~ /^(1.8.7|1.9.2|1.9.3|2.0.0)$/ do
+        let(:suffix) {
+          if ::RUBY_PLATFORM == 'java'
+            "-jruby"
+          elsif defined?(Rubinius)
+            "-rbx"
+          else
+            ""
+          end
+        }
+
+        let(:root) { File.expand_path("#{File.dirname(__FILE__)}/../../../..") }
+        let(:expected_file) do
+          "#{File.dirname(__FILE__)}/html_formatted-#{::RUBY_VERSION}#{suffix}.html"
+        end
+
+        let(:generated_html) do
+          options = RSpec::Core::ConfigurationOptions.new(
+            %w[spec/rspec/core/resources/formatter_specs.rb --format html --order default]
+          )
+          options.parse_options
+
+          err, out = StringIO.new, StringIO.new
+          err.set_encoding("utf-8") if err.respond_to?(:set_encoding)
+          out.set_encoding("utf-8") if out.respond_to?(:set_encoding)
+
+          command_line = RSpec::Core::CommandLine.new(options)
+          command_line.instance_variable_get("@configuration").backtrace_cleaner.inclusion_patterns = []
+          command_line.run(err, out)
+          out.string.gsub(/\d+\.\d+(s| seconds)/, "n.nnnn\\1")
+        end
+
+        let(:expected_html) do
+          unless File.file?(expected_file)
+            raise "There is no HTML file with expected content for this platform: #{expected_file}"
+          end
+          File.read(expected_file)
+        end
+
+        before do
+          RSpec.configuration.stub(:load_spec_files) do
+            RSpec.configuration.files_to_run.map {|f| load File.expand_path(f) }
+          end
+        end
+
+        # Uncomment this group temporarily in order to overwrite the expected
+        # with actual.  Use with care!!!
+        describe "file generator", :if => ENV['GENERATE'] do
+          it "generates a new comparison file" do
+            Dir.chdir(root) do
+              File.open(expected_file, 'w') {|io| io.write(generated_html)}
+            end
+          end
+        end
+
+        def extract_backtrace_from(doc)
+          doc.search("div.backtrace").
+            collect {|e| e.at("pre").inner_html}.
+            collect {|e| e.split("\n")}.flatten.
+            select  {|e| e =~ /formatter_specs\.rb/}
+        end
+
+        it "produces HTML identical to the one we designed manually" do
+          Dir.chdir(root) do
+            actual_doc = Nokogiri::HTML(generated_html)
+            actual_backtraces = extract_backtrace_from(actual_doc)
+            actual_doc.css("div.backtrace").remove
+
+            expected_doc = Nokogiri::HTML(expected_html)
+            expected_backtraces = extract_backtrace_from(expected_doc)
+            expected_doc.search("div.backtrace").remove
+
+            expect(actual_doc.inner_html).to eq(expected_doc.inner_html)
+
+            expected_backtraces.each_with_index do |expected_line, i|
+              expected_path, expected_line_number, expected_suffix = expected_line.split(':')
+              actual_path, actual_line_number, actual_suffix = actual_backtraces[i].split(':')
+              expect(File.expand_path(actual_path)).to eq(File.expand_path(expected_path))
+              expect(actual_line_number).to eq(expected_line_number)
+              expect(actual_suffix).to eq(expected_suffix)
+            end
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/formatters/json_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/json_formatter_spec.rb
new file mode 100644
index 0000000..52a176a
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/json_formatter_spec.rb
@@ -0,0 +1,115 @@
+require 'spec_helper'
+require 'rspec/core/formatters/json_formatter'
+require 'json'
+require 'rspec/core/reporter'
+
+# todo, someday:
+# it "lists the groups (describe and context) separately"
+# it "includes full 'execution_result'"
+# it "relativizes backtrace paths"
+# it "includes profile information (implements dump_profile)"
+# it "shows the pending message if one was given"
+# it "shows the seed if run was randomized"
+# it "lists pending specs that were fixed"
+describe RSpec::Core::Formatters::JsonFormatter do
+  let(:output) { StringIO.new }
+  let(:formatter) { RSpec::Core::Formatters::JsonFormatter.new(output) }
+  let(:reporter) { RSpec::Core::Reporter.new(formatter) }
+
+  it "outputs json (brittle high level functional test)" do
+    group = RSpec::Core::ExampleGroup.describe("one apiece") do
+      it("succeeds") { expect(1).to eq 1 }
+      it("fails") { fail "eek" }
+      it("pends") { pending "world peace" }
+    end
+    succeeding_line = __LINE__ - 4
+    failing_line = __LINE__ - 4
+    pending_line = __LINE__ - 4
+
+    now = Time.now
+    Time.stub(:now).and_return(now)
+    reporter.report(2) do |r|
+      group.run(r)
+    end
+
+    # grab the actual backtrace -- kind of a cheat
+    failing_backtrace = formatter.output_hash[:examples][1][:exception][:backtrace]
+    this_file = relative_path(__FILE__)
+
+    expected = {
+      :examples => [
+        {
+          :description => "succeeds",
+          :full_description => "one apiece succeeds",
+          :status => "passed",
+          :file_path => this_file,
+          :line_number => succeeding_line,
+        },
+        {
+          :description => "fails",
+          :full_description => "one apiece fails",
+          :status => "failed",
+          :file_path => this_file,
+          :line_number => failing_line,
+          :exception => {:class => "RuntimeError", :message => "eek", :backtrace => failing_backtrace}
+        },
+        {
+          :description => "pends",
+          :full_description => "one apiece pends",
+          :status => "pending",
+          :file_path => this_file,
+          :line_number => pending_line,
+        },
+      ],
+      :summary => {
+        :duration => formatter.output_hash[:summary][:duration],
+        :example_count => 3,
+        :failure_count => 1,
+        :pending_count => 1,
+      },
+      :summary_line => "3 examples, 1 failure, 1 pending"
+    }
+    expect(formatter.output_hash).to eq expected
+    expect(output.string).to eq expected.to_json
+  end
+
+  describe "#stop" do
+    it "adds all examples to the output hash" do
+      formatter.stop
+      expect(formatter.output_hash[:examples]).not_to be_nil
+    end
+  end
+
+  describe "#close" do
+    it "outputs the results as a JSON string" do
+      expect(output.string).to eq ""
+      formatter.close
+      expect(output.string).to eq({}.to_json)
+    end
+  end
+
+  describe "#message" do
+    it "adds a message to the messages list" do
+      formatter.message("good job")
+      expect(formatter.output_hash[:messages]).to eq ["good job"]
+    end
+  end
+
+  describe "#dump_summary" do
+    it "adds summary info to the output hash" do
+      duration, example_count, failure_count, pending_count = 1.0, 2, 1, 1
+      formatter.dump_summary(duration, example_count, failure_count, pending_count)
+      summary = formatter.output_hash[:summary]
+      %w(duration example_count failure_count pending_count).each do |key|
+        expect(summary[key.to_sym]).to eq eval(key)
+      end
+      summary_line = formatter.output_hash[:summary_line]
+      expect(summary_line).to eq "2 examples, 1 failure, 1 pending"
+    end
+
+    it "ignores --profile" do
+      allow(RSpec.configuration).to receive(:profile_examples).and_return(true)
+      formatter.dump_summary(1.0, 2, 1, 1)
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/formatters/progress_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/progress_formatter_spec.rb
new file mode 100644
index 0000000..d9477d5
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/progress_formatter_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper'
+require 'rspec/core/formatters/progress_formatter'
+
+describe RSpec::Core::Formatters::ProgressFormatter do
+
+   before do
+     @output = StringIO.new
+     @formatter = RSpec::Core::Formatters::ProgressFormatter.new(@output)
+     @formatter.start(2)
+     @formatter.stub(:color_enabled?).and_return(false)
+   end
+
+   it "produces line break on start dump" do
+     @formatter.start_dump
+     expect(@output.string).to eq("\n")
+   end
+
+   it "produces standard summary without pending when pending has a 0 count" do
+     @formatter.start_dump
+     @formatter.dump_summary(0.00001, 2, 0, 0)
+     expect(@output.string).to match(/2 examples, 0 failures/i)
+     expect(@output.string).not_to match(/0 pending/i)
+   end
+
+   it "pushes nothing on start" do
+     @formatter.start(4)
+     expect(@output.string).to eq("")
+   end
+
+end
diff --git a/rspec-core/spec/rspec/core/formatters/snippet_extractor_spec.rb b/rspec-core/spec/rspec/core/formatters/snippet_extractor_spec.rb
new file mode 100644
index 0000000..5898f14
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/snippet_extractor_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+require 'rspec/core/formatters/snippet_extractor'
+
+module RSpec
+  module Core
+    module Formatters
+      describe SnippetExtractor do
+        it "falls back on a default message when it doesn't understand a line" do
+          expect(RSpec::Core::Formatters::SnippetExtractor.new.snippet_for("blech")).to eq(["# Couldn't get snippet for blech", 1])
+        end
+
+        it "falls back on a default message when it doesn't find the file" do
+         expect(RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8)).to eq("# Couldn't get snippet for blech")
+        end
+
+        it "falls back on a default message when it gets a security error" do
+          message = nil
+          safely do
+            message = RSpec::Core::Formatters::SnippetExtractor.new.lines_around("blech", 8)
+          end
+          expect(message).to eq("# Couldn't get snippet for blech")
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html
new file mode 100644
index 0000000..0f633cf
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html
@@ -0,0 +1,395 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `(root)'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `(root)'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `result'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `(root)'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html
new file mode 100644
index 0000000..9caef6e
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html
@@ -0,0 +1,477 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/hash18.rb&amp;line=195">kernel/common/hash18.rb:195</a> :in `fetch'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/io.rb&amp;line=217">kernel/common/io.rb:217</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/dir.rb&amp;line=92">kernel/common/dir.rb:92</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=104">kernel/common/eval18.rb:104</a> :in `instance_exec'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=698">kernel/loader.rb:698</a> :in `run_at_exits'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=718">kernel/loader.rb:718</a> :in `epilogue'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=851">kernel/loader.rb:851</a> :in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/hash18.rb&amp;line=195">kernel/common/hash18.rb:195</a> :in `fetch'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/io.rb&amp;line=217">kernel/common/io.rb:217</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/dir.rb&amp;line=92">kernel/common/dir.rb:92</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=104">kernel/common/eval18.rb:104</a> :in `instance_exec'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=698">kernel/loader.rb:698</a> :in `run_at_exits'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=718">kernel/loader.rb:718</a> :in `epilogue'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=851">kernel/loader.rb:851</a> :in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/block_environment.rb&amp;line=75">kernel/common/block_environment.rb:75</a> :in `call_on_instance'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval.rb&amp;line=75">kernel/common/eval.rb:75</a> :in `eval'
+<a href="txmt://open?url=file:///Users/jon/.rvm/rubies/rbx-head/lib/18/erb.rb&amp;line=719">/Users/jon/.rvm/rubies/rbx-head/lib/18/erb.rb:719</a> :in `result'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/hash18.rb&amp;line=195">kernel/common/hash18.rb:195</a> :in `fetch'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/io.rb&amp;line=217">kernel/common/io.rb:217</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/dir.rb&amp;line=92">kernel/common/dir.rb:92</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=45">kernel/common/eval18.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval18.rb&amp;line=104">kernel/common/eval18.rb:104</a> :in `instance_exec'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array18.rb&amp;line=18">kernel/bootstrap/array18.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=698">kernel/loader.rb:698</a> :in `run_at_exits'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=718">kernel/loader.rb:718</a> :in `epilogue'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=851">kernel/loader.rb:851</a> :in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html
new file mode 100644
index 0000000..a3f9140
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html
@@ -0,0 +1,414 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `generated_html'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `generated_html'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> 
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html
new file mode 100644
index 0000000..db65158
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html
@@ -0,0 +1,425 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in &lt;top (required)&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in &lt;top (required)&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `&lt;main&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in &lt;top (required)&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html
new file mode 100644
index 0000000..20d1c7b
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html
@@ -0,0 +1,404 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `(root)'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">././spec/support/sandboxed_mock_space.rb:33</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">././spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">././spec/support/sandboxed_mock_space.rb:32</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `(root)'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">././spec/support/sandboxed_mock_space.rb:33</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">././spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">././spec/support/sandboxed_mock_space.rb:32</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `result'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `(root)'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">././spec/support/sandboxed_mock_space.rb:33</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">././spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">././spec/support/sandboxed_mock_space.rb:32</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html
new file mode 100644
index 0000000..8bae841
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html
@@ -0,0 +1,477 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/hash19.rb&amp;line=256">kernel/common/hash19.rb:256</a> :in `fetch'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/io.rb&amp;line=217">kernel/common/io.rb:217</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/dir.rb&amp;line=92">kernel/common/dir.rb:92</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=103">kernel/common/eval19.rb:103</a> :in `instance_exec'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=698">kernel/loader.rb:698</a> :in `run_at_exits'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=718">kernel/loader.rb:718</a> :in `epilogue'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=851">kernel/loader.rb:851</a> :in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/hash19.rb&amp;line=256">kernel/common/hash19.rb:256</a> :in `fetch'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/io.rb&amp;line=217">kernel/common/io.rb:217</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/dir.rb&amp;line=92">kernel/common/dir.rb:92</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=103">kernel/common/eval19.rb:103</a> :in `instance_exec'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=698">kernel/loader.rb:698</a> :in `run_at_exits'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=718">kernel/loader.rb:718</a> :in `epilogue'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=851">kernel/loader.rb:851</a> :in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/block_environment.rb&amp;line=75">kernel/common/block_environment.rb:75</a> :in `call_on_instance'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval.rb&amp;line=75">kernel/common/eval.rb:75</a> :in `eval'
+<a href="txmt://open?url=file:///Users/jon/.rvm/rubies/rbx-head/lib/19/erb.rb&amp;line=838">/Users/jon/.rvm/rubies/rbx-head/lib/19/erb.rb:838</a> :in `result'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `__script__'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/hash19.rb&amp;line=256">kernel/common/hash19.rb:256</a> :in `fetch'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/io.rb&amp;line=217">kernel/common/io.rb:217</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/dir.rb&amp;line=92">kernel/common/dir.rb:92</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `Formatters'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=45">kernel/common/eval19.rb:45</a> :in `instance_eval'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/common/eval19.rb&amp;line=103">kernel/common/eval19.rb:103</a> :in `instance_exec'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/array19.rb&amp;line=18">kernel/bootstrap/array19.rb:18</a> :in `map'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/bootstrap/proc.rb&amp;line=22">kernel/bootstrap/proc.rb:22</a> :in `call'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=698">kernel/loader.rb:698</a> :in `run_at_exits'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=718">kernel/loader.rb:718</a> :in `epilogue'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/kernel/loader.rb&amp;line=851">kernel/loader.rb:851</a> :in `main'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html
new file mode 100644
index 0000000..db65158
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html
@@ -0,0 +1,425 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in &lt;top (required)&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in &lt;top (required)&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `&lt;main&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in &lt;top (required)&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;'
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed'</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;': foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatted-2.0.0.html b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-2.0.0.html
new file mode 100644
index 0000000..a6c9619
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatted-2.0.0.html
@@ -0,0 +1,425 @@
+<!DOCTYPE html>
+<html lang='en'>
+<head>
+  <title>RSpec results</title>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <meta http-equiv="Expires" content="-1" />
+  <meta http-equiv="Pragma" content="no-cache" />
+  <style type="text/css">
+  body {
+    margin: 0;
+    padding: 0;
+    background: #fff;
+    font-size: 80%;
+  }
+  </style>
+  <script type="text/javascript">
+    // <![CDATA[
+
+function addClass(element_id, classname) {
+  document.getElementById(element_id).className += (" " + classname);
+}
+
+function removeClass(element_id, classname) {
+  var elem = document.getElementById(element_id);
+  var classlist = elem.className.replace(classname,'');
+  elem.className = classlist;
+}
+
+function moveProgressBar(percentDone) {
+  document.getElementById("rspec-header").style.width = percentDone +"%";
+}
+
+function makeRed(element_id) {
+  removeClass(element_id, 'passed');
+  removeClass(element_id, 'not_implemented');
+  addClass(element_id,'failed');
+}
+
+function makeYellow(element_id) {
+  var elem = document.getElementById(element_id);
+  if (elem.className.indexOf("failed") == -1) {  // class doesn't includes failed
+    if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
+      removeClass(element_id, 'passed');
+      addClass(element_id,'not_implemented');
+    }
+  }
+}
+
+function apply_filters() {
+  var passed_filter = document.getElementById('passed_checkbox').checked;
+  var failed_filter = document.getElementById('failed_checkbox').checked;
+  var pending_filter = document.getElementById('pending_checkbox').checked;
+
+  assign_display_style("example passed", passed_filter);
+  assign_display_style("example failed", failed_filter);
+  assign_display_style("example not_implemented", pending_filter);
+
+  assign_display_style_for_group("example_group passed", passed_filter);
+  assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
+  assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
+}
+
+function get_display_style(display_flag) {
+  var style_mode = 'none';
+  if (display_flag == true) {
+    style_mode = 'block';
+  }
+  return style_mode;
+}
+
+function assign_display_style(classname, display_flag) {
+  var style_mode = get_display_style(display_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    elems[i].style.display = style_mode;
+  }
+}
+
+function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
+  var display_style_mode = get_display_style(display_flag);
+  var subgroup_style_mode = get_display_style(subgroup_flag);
+  var elems = document.getElementsByClassName(classname)
+  for (var i=0; i<elems.length;i++) {
+    var style_mode = display_style_mode;
+    if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
+      elems[i].style.display = subgroup_style_mode;
+    } else {
+      elems[i].style.display = display_style_mode;
+    }
+  }
+}
+
+    // ]]>
+  </script>
+  <style type="text/css">
+#rspec-header {
+  background: #65C400; color: #fff; height: 4em;
+}
+
+.rspec-report h1 {
+  margin: 0px 10px 0px 10px;
+  padding: 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  font-size: 1.8em;
+  position: absolute;
+}
+
+#label {
+  float:left;
+}
+
+#display-filters {
+  float:left;
+  padding: 28px 0 0 40%;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+}
+
+#summary {
+  float:right;
+  padding: 5px 10px;
+  font-family: "Lucida Grande", Helvetica, sans-serif;
+  text-align: right;
+}
+
+#summary p {
+  margin: 0 0 0 2px;
+}
+
+#summary #totals {
+  font-size: 1.2em;
+}
+
+.example_group {
+  margin: 0 10px 5px;
+  background: #fff;
+}
+
+dl {
+  margin: 0; padding: 0 0 5px;
+  font: normal 11px "Lucida Grande", Helvetica, sans-serif;
+}
+
+dt {
+  padding: 3px;
+  background: #65C400;
+  color: #fff;
+  font-weight: bold;
+}
+
+dd {
+  margin: 5px 0 5px 5px;
+  padding: 3px 3px 3px 18px;
+}
+
+dd .duration {
+  padding-left: 5px;
+  text-align: right;
+  right: 0px;
+  float:right;
+}
+
+dd.example.passed {
+  border-left: 5px solid #65C400;
+  border-bottom: 1px solid #65C400;
+  background: #DBFFB4; color: #3D7700;
+}
+
+dd.example.not_implemented {
+  border-left: 5px solid #FAF834;
+  border-bottom: 1px solid #FAF834;
+  background: #FCFB98; color: #131313;
+}
+
+dd.example.pending_fixed {
+  border-left: 5px solid #0000C2;
+  border-bottom: 1px solid #0000C2;
+  color: #0000C2; background: #D3FBFF;
+}
+
+dd.example.failed {
+  border-left: 5px solid #C20000;
+  border-bottom: 1px solid #C20000;
+  color: #C20000; background: #FFFBD3;
+}
+
+
+dt.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+dt.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+dt.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+#rspec-header.not_implemented {
+  color: #000000; background: #FAF834;
+}
+
+#rspec-header.pending_fixed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+#rspec-header.failed {
+  color: #FFFFFF; background: #C40D0D;
+}
+
+
+.backtrace {
+  color: #000;
+  font-size: 12px;
+}
+
+a {
+  color: #BE5C00;
+}
+
+/* Ruby code, style similar to vibrant ink */
+.ruby {
+  font-size: 12px;
+  font-family: monospace;
+  color: white;
+  background-color: black;
+  padding: 0.1em 0 0.2em 0;
+}
+
+.ruby .keyword { color: #FF6600; }
+.ruby .constant { color: #339999; }
+.ruby .attribute { color: white; }
+.ruby .global { color: white; }
+.ruby .module { color: white; }
+.ruby .class { color: white; }
+.ruby .string { color: #66FF00; }
+.ruby .ident { color: white; }
+.ruby .method { color: #FFCC00; }
+.ruby .number { color: white; }
+.ruby .char { color: white; }
+.ruby .comment { color: #9933CC; }
+.ruby .symbol { color: white; }
+.ruby .regex { color: #44B4CC; }
+.ruby .punct { color: white; }
+.ruby .escape { color: white; }
+.ruby .interp { color: white; }
+.ruby .expr { color: white; }
+
+.ruby .offending { background-color: gray; }
+.ruby .linenum {
+  width: 75px;
+  padding: 0.1em 1em 0.2em 0;
+  color: #000000;
+  background-color: #FFFBD3;
+}
+
+  </style>
+</head>
+<body>
+<div class="rspec-report">
+
+<div id="rspec-header">
+  <div id="label">
+    <h1>RSpec Code Examples</h1>
+  </div>
+
+  <div id="display-filters">
+    <input id="passed_checkbox"  name="passed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="1" /> <label for="passed_checkbox">Passed</label>
+    <input id="failed_checkbox"  name="failed_checkbox"  type="checkbox" checked="checked" onchange="apply_filters()" value="2" /> <label for="failed_checkbox">Failed</label>
+    <input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked="checked" onchange="apply_filters()" value="3" /> <label for="pending_checkbox">Pending</label>
+  </div>
+
+  <div id="summary">
+    <p id="totals"> </p>
+    <p id="duration"> </p>
+  </div>
+</div>
+
+
+<div class="results">
+<div id="div_group_1" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_1" class="passed">pending spec with no implementation</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_1');</script>
+    <script type="text/javascript">makeYellow('example_group_1');</script>
+    <script type="text/javascript">moveProgressBar('14.2');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
+  </dl>
+</div>
+<div id="div_group_2" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_2" class="passed">pending command with block format</dt>
+  </dl>
+</div>
+<div id="div_group_3" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_3" class="passed">with content that would fail</dt>
+    <script type="text/javascript">makeYellow('rspec-header');</script>
+    <script type="text/javascript">makeYellow('div_group_3');</script>
+    <script type="text/javascript">makeYellow('example_group_3');</script>
+    <script type="text/javascript">moveProgressBar('28.5');</script>
+    <dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
+  </dl>
+</div>
+<div id="div_group_4" class="example_group passed">
+  <dl style="margin-left: 15px;">
+  <dt id="example_group_4" class="passed">with content that would pass</dt>
+    <script type="text/javascript">makeRed('rspec-header');</script>
+    <script type="text/javascript">makeRed('div_group_4');</script>
+    <script type="text/javascript">makeRed('example_group_4');</script>
+    <script type="text/javascript">moveProgressBar('42.8');</script>
+    <dd class="example pending_fixed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_1">
+        <div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=18">./spec/rspec/core/resources/formatter_specs.rb:18</a> :in `block (3 levels) in &lt;top (required)&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed&#39;</pre></div>
+    <pre class="ruby"><code><span class="linenum">16</span>  <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">17</span>    <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">18</span>      <span class="ident">pending</span> <span class="keyword">do</span></span>
+<span class="linenum">19</span>        <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
+<span class="linenum">20</span>      <span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_5" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_5" class="passed">passing spec</dt>
+    <script type="text/javascript">moveProgressBar('57.1');</script>
+    <dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
+  </dl>
+</div>
+<div id="div_group_6" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_6" class="passed">failing spec</dt>
+    <script type="text/javascript">makeRed('div_group_6');</script>
+    <script type="text/javascript">makeRed('example_group_6');</script>
+    <script type="text/javascript">moveProgressBar('71.4');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_2">
+        <div class="message"><pre>
+expected: 2
+     got: 1
+
+(compared using ==)
+</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=33">./spec/rspec/core/resources/formatter_specs.rb:33</a> :in `block (2 levels) in &lt;top (required)&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed&#39;</pre></div>
+    <pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="linenum">32</span>  <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
+<span class="offending"><span class="linenum">33</span>    <span class="ident">expect</span><span class="punct">(</span><span class="number">1</span><span class="punct">).</span><span class="ident">to</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
+<span class="linenum">34</span>  <span class="keyword">end</span>
+<span class="linenum">35</span><span class="keyword">end</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<div id="div_group_7" class="example_group passed">
+  <dl style="margin-left: 0px;">
+  <dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
+    <script type="text/javascript">makeRed('div_group_7');</script>
+    <script type="text/javascript">makeRed('example_group_7');</script>
+    <script type="text/javascript">moveProgressBar('85.7');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace that has no file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_3">
+        <div class="message"><pre>foo</pre></div>
+        <div class="backtrace"><pre>(erb):1:in `&lt;main&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/resources/formatter_specs.rb&amp;line=41">./spec/rspec/core/resources/formatter_specs.rb:41</a> :in `block (2 levels) in &lt;top (required)&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=33">./spec/support/sandboxed_mock_space.rb:33</a> :in `block in run&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=72">./spec/support/sandboxed_mock_space.rb:72</a> :in `sandboxed&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=32">./spec/support/sandboxed_mock_space.rb:32</a> :in `run&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=37">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:37</a> :in `block (2 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (5 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `open&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=59">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:59</a> :in `block (4 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `chdir&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb&amp;line=58">./spec/rspec/core/formatters/text_mate_formatter_spec.rb:58</a> :in `block (3 levels) in &lt;module:Formatters&gt;&#39;
+<a href="txmt://open?url=file:///Users/jon/Code/Scratch/rspec-core/spec/support/sandboxed_mock_space.rb&amp;line=38">./spec/support/sandboxed_mock_space.rb:38</a> :in `sandboxed&#39;</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
+      </div>
+    </dd>
+    <script type="text/javascript">moveProgressBar('100.0');</script>
+    <dd class="example failed">
+      <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
+      <span class="duration">n.nnnns</span>
+      <div class="failure" id="failure_4">
+        <div class="message"><pre>Exception</pre></div>
+        <div class="backtrace"><pre><a href="txmt://open?url=file:///foo.html.erb&amp;line=1">/foo.html.erb:1</a> :in `&lt;main&gt;&#39;: foo (RuntimeError)</pre></div>
+    <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
+      </div>
+    </dd>
+  </dl>
+</div>
+<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
+<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
+</div>
+</div>
+</body>
+</html>
diff --git a/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb b/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb
new file mode 100644
index 0000000..e564045
--- /dev/null
+++ b/rspec-core/spec/rspec/core/formatters/text_mate_formatter_spec.rb
@@ -0,0 +1,96 @@
+# encoding: utf-8
+require 'spec_helper'
+require 'rspec/core/formatters/text_mate_formatter'
+require 'nokogiri'
+
+module RSpec
+  module Core
+    module Formatters
+      describe TextMateFormatter do
+        let(:suffix) {
+          if ::RUBY_PLATFORM == 'java'
+            "-jruby"
+          elsif defined?(Rubinius)
+            "-rbx"
+          else
+            ""
+          end
+        }
+
+        let(:root) { File.expand_path("#{File.dirname(__FILE__)}/../../../..") }
+        let(:expected_file) do
+          "#{File.dirname(__FILE__)}/text_mate_formatted-#{::RUBY_VERSION}#{suffix}.html"
+        end
+
+        let(:generated_html) do
+          options = RSpec::Core::ConfigurationOptions.new(
+            %w[spec/rspec/core/resources/formatter_specs.rb --format textmate --order default]
+          )
+          options.parse_options
+
+          err, out = StringIO.new, StringIO.new
+          err.set_encoding("utf-8") if err.respond_to?(:set_encoding)
+          out.set_encoding("utf-8") if out.respond_to?(:set_encoding)
+
+          command_line = RSpec::Core::CommandLine.new(options)
+          command_line.instance_variable_get("@configuration").backtrace_cleaner.inclusion_patterns = []
+          command_line.run(err, out)
+          out.string.gsub(/\d+\.\d+(s| seconds)/, "n.nnnn\\1")
+        end
+
+        let(:expected_html) do
+          unless File.file?(expected_file)
+            raise "There is no HTML file with expected content for this platform: #{expected_file}"
+          end
+          File.read(expected_file)
+        end
+
+        before do
+          RSpec.configuration.stub(:load_spec_files) do
+            RSpec.configuration.files_to_run.map {|f| load File.expand_path(f) }
+          end
+        end
+
+        # Uncomment this group temporarily in order to overwrite the expected
+        # with actual.  Use with care!!!
+        describe "file generator", :if => ENV['GENERATE'] do
+          it "generates a new comparison file" do
+            Dir.chdir(root) do
+              File.open(expected_file, 'w') {|io| io.write(generated_html)}
+            end
+          end
+        end
+
+        it "produces HTML identical to the one we designed manually" do
+          Dir.chdir(root) do
+            actual_doc = Nokogiri::HTML(generated_html)
+            backtrace_lines = actual_doc.search("div.backtrace a")
+            actual_doc.search("div.backtrace").remove
+
+            expected_doc = Nokogiri::HTML(expected_html)
+            expected_doc.search("div.backtrace").remove
+
+            expect(actual_doc.inner_html).to eq(expected_doc.inner_html)
+
+            backtrace_lines.each do |backtrace_line|
+              expect(backtrace_line['href']).to include("txmt://open?url=")
+            end
+          end
+        end
+
+        it "has a backtrace line from the raw erb evaluation" do
+          Dir.chdir(root) do
+            actual_doc = Nokogiri::HTML(generated_html)
+
+            expect(actual_doc.inner_html).to include('(erb):1')
+          end
+        end
+
+        it "has a backtrace line from a erb source file we forced to appear" do
+          expect(generated_html).to include('open?url=file:///foo.html.erb')
+        end
+
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/hooks_filtering_spec.rb b/rspec-core/spec/rspec/core/hooks_filtering_spec.rb
new file mode 100644
index 0000000..2eda0b4
--- /dev/null
+++ b/rspec-core/spec/rspec/core/hooks_filtering_spec.rb
@@ -0,0 +1,227 @@
+require "spec_helper"
+
+module RSpec::Core
+  describe "config block hook filtering" do
+    describe "unfiltered hooks" do
+      it "is run" do
+        filters = []
+        RSpec.configure do |c|
+          c.before(:all) { filters << "before all in config"}
+          c.around(:each) {|example| filters << "around each in config"; example.run}
+          c.before(:each) { filters << "before each in config"}
+          c.after(:each) { filters << "after each in config"}
+          c.after(:all) { filters << "after all in config"}
+        end
+        group = ExampleGroup.describe
+        group.example("example") {}
+        group.run
+        expect(filters).to eq([
+          "before all in config",
+          "around each in config",
+          "before each in config",
+          "after each in config",
+          "after all in config"
+        ])
+      end
+    end
+
+    describe "hooks with single filters" do
+
+      context "with no scope specified" do
+        it "is run around|before|after :each if the filter matches the example group's filter" do
+          filters = []
+          RSpec.configure do |c|
+            c.around(:match => true) {|example| filters << "around each in config"; example.run}
+            c.before(:match => true) { filters << "before each in config"}
+            c.after(:match => true)  { filters << "after each in config"}
+          end
+          group = ExampleGroup.describe(:match => true)
+          group.example("example") {}
+          group.run
+          expect(filters).to eq([
+            "around each in config",
+            "before each in config",
+            "after each in config"
+          ])
+        end
+      end
+
+      it "is run if the filter matches the example group's filter" do
+        filters = []
+        RSpec.configure do |c|
+          c.before(:all,  :match => true) { filters << "before all in config"}
+          c.around(:each, :match => true) {|example| filters << "around each in config"; example.run}
+          c.before(:each, :match => true) { filters << "before each in config"}
+          c.after(:each,  :match => true) { filters << "after each in config"}
+          c.after(:all,   :match => true) { filters << "after all in config"}
+        end
+        group = ExampleGroup.describe(:match => true)
+        group.example("example") {}
+        group.run
+        expect(filters).to eq([
+          "before all in config",
+          "around each in config",
+          "before each in config",
+          "after each in config",
+          "after all in config"
+        ])
+      end
+
+      it "runs before|after :all hooks on matching nested example groups" do
+        filters = []
+        RSpec.configure do |c|
+          c.before(:all, :match => true) { filters << :before_all }
+          c.after(:all, :match => true)  { filters << :after_all }
+        end
+
+        example_1_filters = example_2_filters = nil
+
+        group = ExampleGroup.describe "group" do
+          it("example 1") { example_1_filters = filters.dup }
+          describe "subgroup", :match => true do
+            it("example 2") { example_2_filters = filters.dup }
+          end
+        end
+        group.run
+
+        expect(example_1_filters).to be_empty
+        expect(example_2_filters).to eq([:before_all])
+        expect(filters).to eq([:before_all, :after_all])
+      end
+
+      it "runs before|after :all hooks only on the highest level group that matches the filter" do
+        filters = []
+        RSpec.configure do |c|
+          c.before(:all, :match => true) { filters << :before_all }
+          c.after(:all, :match => true)  { filters << :after_all }
+        end
+
+        example_1_filters = example_2_filters = example_3_filters = nil
+
+        group = ExampleGroup.describe "group", :match => true do
+          it("example 1") { example_1_filters = filters.dup }
+          describe "subgroup", :match => true do
+            it("example 2") { example_2_filters = filters.dup }
+            describe "sub-subgroup", :match => true do
+              it("example 3") { example_3_filters = filters.dup }
+            end
+          end
+        end
+        group.run
+
+        expect(example_1_filters).to eq([:before_all])
+        expect(example_2_filters).to eq([:before_all])
+        expect(example_3_filters).to eq([:before_all])
+
+        expect(filters).to eq([:before_all, :after_all])
+      end
+
+      it "does not run if the filter doesn't match the example group's filter" do
+        filters = []
+        RSpec.configure do |c|
+          c.before(:all,  :match => false) { filters << "before all in config"}
+          c.around(:each, :match => false) {|example| filters << "around each in config"; example.run}
+          c.before(:each, :match => false) { filters << "before each in config"}
+          c.after(:each,  :match => false) { filters << "after each in config"}
+          c.after(:all,   :match => false) { filters << "after all in config"}
+        end
+        group = ExampleGroup.describe(:match => true)
+        group.example("example") {}
+        group.run
+        expect(filters).to eq([])
+      end
+
+      context "when the hook filters apply to individual examples instead of example groups" do
+        let(:each_filters) { [] }
+        let(:all_filters) { [] }
+
+        let(:group) do
+          md = example_metadata
+          ExampleGroup.describe do
+            it("example", md) { }
+          end
+        end
+
+        def filters
+          each_filters + all_filters
+        end
+
+        before(:each) do
+          af, ef = all_filters, each_filters
+
+          RSpec.configure do |c|
+            c.before(:all,  :foo => :bar) { af << "before all in config"}
+            c.around(:each, :foo => :bar) {|example| ef << "around each in config"; example.run}
+            c.before(:each, :foo => :bar) { ef << "before each in config"}
+            c.after(:each,  :foo => :bar) { ef << "after each in config"}
+            c.after(:all,   :foo => :bar) { af << "after all in config"}
+          end
+
+          group.run
+        end
+
+        describe 'an example with matching metadata' do
+          let(:example_metadata) { { :foo => :bar } }
+
+          it "runs the `:each` hooks" do
+            expect(each_filters).to eq([
+              'around each in config',
+              'before each in config',
+              'after each in config'
+            ])
+          end
+
+          it "does not run the `:all` hooks" do
+            expect(all_filters).to be_empty
+          end
+        end
+
+        describe 'an example without matching metadata' do
+          let(:example_metadata) { { :foo => :bazz } }
+
+          it "does not run any of the hooks" do
+            expect(filters).to be_empty
+          end
+        end
+      end
+    end
+
+    describe "hooks with multiple filters" do
+      it "is run if all hook filters match the group's filters" do
+        filters = []
+        RSpec.configure do |c|
+          c.before(:all,  :one => 1)                         { filters << "before all in config"}
+          c.around(:each, :two => 2, :one => 1)              {|example| filters << "around each in config"; example.run}
+          c.before(:each, :one => 1, :two => 2)              { filters << "before each in config"}
+          c.after(:each,  :one => 1, :two => 2, :three => 3) { filters << "after each in config"}
+          c.after(:all,   :one => 1, :three => 3)            { filters << "after all in config"}
+        end
+        group = ExampleGroup.describe(:one => 1, :two => 2, :three => 3)
+        group.example("example") {}
+        group.run
+        expect(filters).to eq([
+          "before all in config",
+          "around each in config",
+          "before each in config",
+          "after each in config",
+          "after all in config"
+        ])
+      end
+
+      it "does not run if some hook filters don't match the group's filters" do
+        filters = []
+        RSpec.configure do |c|
+          c.before(:all,  :one => 1, :four => 4)                         { filters << "before all in config"}
+          c.around(:each, :two => 2, :four => 4)                         {|example| filters << "around each in config"; example.run}
+          c.before(:each, :one => 1, :two => 2, :four => 4)              { filters << "before each in config"}
+          c.after(:each,  :one => 1, :two => 2, :three => 3, :four => 4) { filters << "after each in config"}
+          c.after(:all,   :one => 1, :three => 3, :four => 4)            { filters << "after all in config"}
+        end
+        group = ExampleGroup.describe(:one => 1, :two => 2, :three => 3)
+        group.example("example") {}
+        group.run
+        expect(filters).to eq([])
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/hooks_spec.rb b/rspec-core/spec/rspec/core/hooks_spec.rb
new file mode 100644
index 0000000..6e4a839
--- /dev/null
+++ b/rspec-core/spec/rspec/core/hooks_spec.rb
@@ -0,0 +1,267 @@
+require "spec_helper"
+
+module RSpec::Core
+  describe Hooks do
+    class HooksHost
+      include Hooks
+    end
+
+    [:before, :after, :around].each do |type|
+      [:each, :all].each do |scope|
+        next if type == :around && scope == :all
+
+        describe "##{type}(#{scope})" do
+          it_behaves_like "metadata hash builder" do
+            define_method :metadata_hash do |*args|
+              instance = HooksHost.new
+              args.unshift scope if scope
+              hooks = instance.send(type, *args) {}
+              hooks.first.options
+            end
+          end
+        end
+      end
+
+      [true, false].each do |config_value|
+        context "when RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values is set to #{config_value}" do
+          before(:each) do
+            Kernel.stub(:warn)
+            RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = config_value }
+          end
+
+          describe "##{type}(no scope)" do
+            let(:instance) { HooksHost.new }
+
+            it "defaults to :each scope if no arguments are given" do
+              hooks = instance.send(type) {}
+              hook = hooks.first
+              expect(instance.hooks[type][:each]).to include(hook)
+            end
+
+            it "defaults to :each scope if the only argument is a metadata hash" do
+              hooks = instance.send(type, :foo => :bar) {}
+              hook = hooks.first
+              expect(instance.hooks[type][:each]).to include(hook)
+            end
+
+            it "raises an error if only metadata symbols are given as arguments" do
+              expect { instance.send(type, :foo, :bar) {} }.to raise_error(ArgumentError)
+            end
+          end
+        end
+      end
+    end
+
+    [:before, :after].each do |type|
+      [:each, :all, :suite].each do |scope|
+        [true, false].each do |config_value|
+          context "when RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values is set to #{config_value}" do
+            before(:each) do
+              RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = config_value }
+            end
+
+            describe "##{type}(#{scope.inspect})" do
+              let(:instance) { HooksHost.new }
+              let!(:hook) do
+                hooks = instance.send(type, scope) {}
+                hooks.first
+              end
+
+              it "does not make #{scope.inspect} a metadata key" do
+                expect(hook.options).to be_empty
+              end
+
+              it "is scoped to #{scope.inspect}" do
+                expect(instance.hooks[type][scope]).to include(hook)
+              end
+            end
+          end
+        end
+      end
+    end
+
+    describe "#around" do
+      context "when not running the example within the around block" do
+        it "does not run the example" do
+          examples = []
+          group = ExampleGroup.describe do
+            around do |example|
+            end
+            it "foo" do
+              examples << self
+            end
+          end
+          group.run
+          expect(examples).to have(0).example
+        end
+      end
+
+      context "when running the example within the around block" do
+        it "runs the example" do
+          examples = []
+          group = ExampleGroup.describe do
+            around do |example|
+              example.run
+            end
+            it "foo" do
+              examples << self
+            end
+          end
+          group.run
+          expect(examples).to have(1).example
+        end
+      end
+
+      context "when running the example within a block passed to a method" do
+        it "runs the example" do
+          examples = []
+          group = ExampleGroup.describe do
+            def yielder
+              yield
+            end
+
+            around do |example|
+              yielder { example.run }
+            end
+            it "foo" do
+              examples << self
+            end
+          end
+          group.run
+          expect(examples).to have(1).example
+        end
+      end
+    end
+
+    [:all, :each].each do |scope|
+      describe "prepend_before(#{scope})" do
+        it "adds to the front of the list of before(:#{scope}) hooks" do
+          messages = []
+
+          RSpec.configure { |config| config.before(scope)         { messages << "config 3" } }
+          RSpec.configure { |config| config.prepend_before(scope) { messages << "config 2" } }
+          RSpec.configure { |config| config.before(scope)         { messages << "config 4" } }
+          RSpec.configure { |config| config.prepend_before(scope) { messages << "config 1" } }
+
+          group = ExampleGroup.describe { example {} }
+          group.before(scope)         { messages << "group 3" }
+          group.prepend_before(scope) { messages << "group 2" }
+          group.before(scope)         { messages << "group 4" }
+          group.prepend_before(scope) { messages << "group 1" }
+
+          group.run
+
+          expect(messages).to eq([
+            'group 1',
+            'group 2',
+            'config 1',
+            'config 2',
+            'config 3',
+            'config 4',
+            'group 3',
+            'group 4'
+          ])
+        end
+      end
+
+      describe "append_before(#{scope})" do
+        it "adds to the back of the list of before(:#{scope}) hooks (same as `before`)" do
+          messages = []
+
+          RSpec.configure { |config| config.before(scope)        { messages << "config 1" } }
+          RSpec.configure { |config| config.append_before(scope) { messages << "config 2" } }
+          RSpec.configure { |config| config.before(scope)        { messages << "config 3" } }
+
+          group = ExampleGroup.describe { example {} }
+          group.before(scope)        { messages << "group 1" }
+          group.append_before(scope) { messages << "group 2" }
+          group.before(scope)        { messages << "group 3" }
+
+          group.run
+
+          expect(messages).to eq([
+            'config 1',
+            'config 2',
+            'config 3',
+            'group 1',
+            'group 2',
+            'group 3'
+          ])
+        end
+      end
+
+      describe "prepend_after(#{scope})" do
+        it "adds to the front of the list of after(:#{scope}) hooks (same as `after`)" do
+          messages = []
+
+          RSpec.configure { |config| config.after(scope)         { messages << "config 3" } }
+          RSpec.configure { |config| config.prepend_after(scope) { messages << "config 2" } }
+          RSpec.configure { |config| config.after(scope)         { messages << "config 1" } }
+
+          group = ExampleGroup.describe { example {} }
+          group.after(scope)         { messages << "group 3" }
+          group.prepend_after(scope) { messages << "group 2" }
+          group.after(scope)         { messages << "group 1" }
+
+          group.run
+
+          expect(messages).to eq([
+            'group 1',
+            'group 2',
+            'group 3',
+            'config 1',
+            'config 2',
+            'config 3'
+          ])
+        end
+      end
+
+      describe "append_after(#{scope})" do
+        it "adds to the back of the list of after(:#{scope}) hooks" do
+          messages = []
+
+          RSpec.configure { |config| config.after(scope)        { messages << "config 2" } }
+          RSpec.configure { |config| config.append_after(scope) { messages << "config 3" } }
+          RSpec.configure { |config| config.after(scope)        { messages << "config 1" } }
+          RSpec.configure { |config| config.append_after(scope) { messages << "config 4" } }
+
+          group = ExampleGroup.describe { example {} }
+          group.after(scope)        { messages << "group 2" }
+          group.append_after(scope) { messages << "group 3" }
+          group.after(scope)        { messages << "group 1" }
+          group.append_after(scope) { messages << "group 4" }
+
+          group.run
+
+          expect(messages).to eq([
+            'group 1',
+            'group 2',
+            'config 1',
+            'config 2',
+            'config 3',
+            'config 4',
+            'group 3',
+            'group 4'
+          ])
+        end
+      end
+    end
+
+    describe "lambda" do
+      it "can be used as a hook" do
+        messages = []
+        count = 0
+        hook = lambda {|e| messages << "hook #{count = count + 1}"; e.run }
+
+        RSpec.configure do |c|
+          c.around(:each, &hook)
+          c.around(:each, &hook)
+        end
+
+        group = ExampleGroup.describe { example { messages << "example" } }
+        group.run
+        expect(messages).to eq ["hook 1", "hook 2", "example"]
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/kernel_extensions_spec.rb b/rspec-core/spec/rspec/core/kernel_extensions_spec.rb
new file mode 100644
index 0000000..68badf1
--- /dev/null
+++ b/rspec-core/spec/rspec/core/kernel_extensions_spec.rb
@@ -0,0 +1,9 @@
+require 'spec_helper'
+
+describe "extensions" do
+  describe "debugger" do
+    it "is defined on Kernel" do
+      expect(Kernel).to respond_to(:debugger)
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/memoized_helpers_spec.rb b/rspec-core/spec/rspec/core/memoized_helpers_spec.rb
new file mode 100644
index 0000000..5ae67bb
--- /dev/null
+++ b/rspec-core/spec/rspec/core/memoized_helpers_spec.rb
@@ -0,0 +1,688 @@
+require 'spec_helper'
+
+module RSpec::Core
+  describe MemoizedHelpers do
+    before(:each) { RSpec.configuration.configure_expectation_framework }
+
+    def subject_value_for(describe_arg, &block)
+      group = ExampleGroup.describe(describe_arg, &block)
+      subject_value = nil
+      group.example { subject_value = subject }
+      group.run
+      subject_value
+    end
+
+    describe "implicit subject" do
+      describe "with a class" do
+        it "returns an instance of the class" do
+          expect(subject_value_for(Array)).to eq([])
+        end
+      end
+
+      describe "with a Module" do
+        it "returns the Module" do
+          expect(subject_value_for(Enumerable)).to eq(Enumerable)
+        end
+      end
+
+      describe "with a string" do
+        it "returns the string" do
+          expect(subject_value_for("Foo")).to eq("Foo")
+        end
+      end
+
+      describe "with a number" do
+        it "returns the number" do
+          expect(subject_value_for(15)).to eq(15)
+        end
+      end
+
+      it "can be overriden and super'd to from a nested group" do
+        outer_subject_value = inner_subject_value = nil
+
+        ExampleGroup.describe(Array) do
+          subject { super() << :parent_group }
+          example { outer_subject_value = subject }
+
+          context "nested" do
+            subject { super() << :child_group }
+            example { inner_subject_value = subject }
+          end
+        end.run
+
+        expect(outer_subject_value).to eq([:parent_group])
+        expect(inner_subject_value).to eq([:parent_group, :child_group])
+      end
+    end
+
+    describe "explicit subject" do
+      [false, nil].each do |falsy_value|
+        context "with a value of #{falsy_value.inspect}" do
+          it "is evaluated once per example" do
+            group = ExampleGroup.describe(Array)
+            group.before do
+              Object.should_receive(:this_question?).once.and_return(falsy_value)
+            end
+            group.subject do
+              Object.this_question?
+            end
+            group.example do
+              subject
+              subject
+            end
+            expect(group.run).to be_true, "expected subject block to be evaluated only once"
+          end
+        end
+      end
+
+      describe "defined in a top level group" do
+        it "replaces the implicit subject in that group" do
+          subject_value = subject_value_for(Array) do
+            subject { [1, 2, 3] }
+          end
+          expect(subject_value).to eq([1, 2, 3])
+        end
+      end
+
+      describe "defined in a top level group" do
+        let(:group) do
+          ExampleGroup.describe do
+            subject{ [4, 5, 6] }
+          end
+        end
+
+        it "is available in a nested group (subclass)" do
+          subject_value = nil
+          group.describe("I'm nested!") do
+            example { subject_value = subject }
+          end.run
+
+          expect(subject_value).to eq([4, 5, 6])
+        end
+
+        it "is available in a doubly nested group (subclass)" do
+          subject_value = nil
+          group.describe("Nesting level 1") do
+            describe("Nesting level 2") do
+              example { subject_value = subject }
+            end
+          end.run
+
+          expect(subject_value).to eq([4, 5, 6])
+        end
+
+        it "can be overriden and super'd to from a nested group" do
+          subject_value = nil
+          group.describe("Nested") do
+            subject { super() + [:override] }
+            example { subject_value = subject }
+          end.run
+
+          expect(subject_value).to eq([4, 5, 6, :override])
+        end
+
+        context 'when referenced in a `before(:all)` hook' do
+          before do
+            expect(::RSpec).to respond_to(:warn_deprecation)
+            ::RSpec.stub(:warn_deprecation)
+          end
+
+          def define_and_run_group
+            values = { :reference_lines => [] }
+
+            ExampleGroup.describe do
+              subject { [1, 2] }
+              let(:list) { %w[ a b ] }
+
+              before(:all) do
+                subject << 3; values[:reference_lines] << __LINE__
+                values[:final_subject_value_in_before_all] = subject; values[:reference_lines] << __LINE__
+              end
+
+              example do
+                list << '1'
+                values[:list_in_ex_1] = list
+                values[:subject_value_in_example] = subject
+              end
+
+              example do
+                list << '2'
+                values[:list_in_ex_2] = list
+              end
+            end.run
+
+            values
+          end
+
+          it 'memoizes the value within the before(:all) hook' do
+            values = define_and_run_group
+            expect(values.fetch(:final_subject_value_in_before_all)).to eq([1, 2, 3])
+          end
+
+          it 'preserves the memoization into the individual examples' do
+            values = define_and_run_group
+            expect(values.fetch(:subject_value_in_example)).to eq([1, 2, 3])
+          end
+
+          it 'does not cause other lets to be shared across examples' do
+            values = define_and_run_group
+            expect(values.fetch(:list_in_ex_1)).to eq(%w[ a b 1 ])
+            expect(values.fetch(:list_in_ex_2)).to eq(%w[ a b 2 ])
+          end
+
+          it 'prints a warning since `subject` declarations are not intended to be used in :all hooks' do
+            msgs = []
+            ::RSpec.stub(:warn_deprecation) { |msg| msgs << msg }
+
+            values = define_and_run_group
+
+            expect(msgs).to include(*values[:reference_lines].map { |line|
+              match(/subject accessed.*#{__FILE__}:#{line}/m)
+            })
+          end
+        end
+      end
+
+      describe "with a name" do
+        it "defines a method that returns the memoized subject" do
+          list_value_1 = list_value_2 = subject_value_1 = subject_value_2 = nil
+
+          ExampleGroup.describe do
+            subject(:list) { [1, 2, 3] }
+            example do
+              list_value_1 = list
+              list_value_2 = list
+              subject_value_1 = subject
+              subject_value_2 = subject
+            end
+          end.run
+
+          expect(list_value_1).to eq([1, 2, 3])
+          expect(list_value_1).to equal(list_value_2)
+
+          expect(subject_value_1).to equal(subject_value_2)
+          expect(subject_value_1).to equal(list_value_1)
+        end
+
+        it "is referred from inside subject by the name" do
+          inner_subject_value = nil
+
+          ExampleGroup.describe do
+            subject(:list) { [1, 2, 3] }
+            describe 'first' do
+              subject(:first_element) { list.first }
+              example { inner_subject_value = subject }
+            end
+          end.run
+
+          expect(inner_subject_value).to eq(1)
+        end
+
+        it 'can continue to be referenced by the name even when an inner group redefines the subject' do
+          named_value = nil
+
+          ExampleGroup.describe do
+            subject(:named) { :outer }
+
+            describe "inner" do
+              subject { :inner }
+              example do
+                subject # so the inner subject method is run and memoized
+                named_value = self.named
+              end
+            end
+          end.run
+
+          expect(named_value).to eq(:outer)
+        end
+
+        it 'can continue to reference an inner subject after the outer subject name is referenced' do
+          subject_value = nil
+
+          ExampleGroup.describe do
+            subject(:named) { :outer }
+
+            describe "inner" do
+              subject { :inner }
+              example do
+                named # so the outer subject method is run and memoized
+                subject_value = self.subject
+              end
+            end
+          end.run
+
+          expect(subject_value).to eq(:inner)
+        end
+
+        it 'is not overriden when an inner group defines a new method with the same name' do
+          subject_value = nil
+
+          ExampleGroup.describe do
+            subject(:named) { :outer_subject }
+
+            describe "inner" do
+              let(:named) { :inner_named }
+              example { subject_value = self.subject }
+            end
+          end.run
+
+          expect(subject_value).to be(:outer_subject)
+        end
+
+        context 'when `super` is used' do
+          def should_raise_not_supported_error(&block)
+            ex = nil
+
+            ExampleGroup.describe do
+              let(:list) { ["a", "b", "c"] }
+              subject { [1, 2, 3] }
+
+              describe 'first' do
+                module_eval(&block) if block
+
+                subject(:list) { super().first(2) }
+                ex = example { subject }
+              end
+            end.run
+
+            expect(ex.execution_result[:status]).to eq("failed")
+            expect(ex.execution_result[:exception].message).to match(/super.*not supported/)
+          end
+
+          it 'raises a "not supported" error' do
+            should_raise_not_supported_error
+          end
+
+          context 'with a `let` definition before the named subject' do
+            it 'raises a "not supported" error' do
+              should_raise_not_supported_error do
+                # My first pass implementation worked unless there was a `let`
+                # declared before the named subject -- this let is in place to
+                # ensure that bug doesn't return.
+                let(:foo) { 3 }
+              end
+            end
+          end
+        end
+      end
+    end
+
+    context "using 'self' as an explicit subject" do
+      it "delegates matcher to the ExampleGroup" do
+        group = ExampleGroup.describe("group") do
+          subject { self }
+          def ok?; true; end
+          def not_ok?; false; end
+
+          it { should eq(self) }
+          it { should be_ok }
+          it { should_not be_not_ok }
+        end
+
+        expect(group.run).to be_true
+      end
+    end
+
+    describe "#its" do
+      subject do
+        Class.new do
+          def initialize
+            @call_count = 0
+          end
+
+          def call_count
+            @call_count += 1
+          end
+        end.new
+      end
+
+      context "with a call counter" do
+        its(:call_count) { should eq(1) }
+      end
+
+      context "with nil value" do
+        subject do
+          Class.new do
+            def nil_value
+              nil
+            end
+          end.new
+        end
+        its(:nil_value) { should be_nil }
+      end
+
+      context "with nested attributes" do
+        subject do
+          Class.new do
+            def name
+              "John"
+            end
+          end.new
+        end
+        its("name")            { should eq("John") }
+        its("name.size")       { should eq(4) }
+        its("name.size.class") { should eq(Fixnum) }
+      end
+
+      context "when it responds to #[]" do
+        subject do
+          Class.new do
+            def [](*objects)
+              objects.map do |object|
+                "#{object.class}: #{object.to_s}"
+              end.join("; ")
+            end
+
+            def name
+              "George"
+            end
+          end.new
+        end
+        its([:a]) { should eq("Symbol: a") }
+        its(['a']) { should eq("String: a") }
+        its([:b, 'c', 4]) { should eq("Symbol: b; String: c; Fixnum: 4") }
+        its(:name) { should eq("George") }
+        context "when referring to an attribute without the proper array syntax" do
+          context "it raises an error" do
+            its(:age) do
+              expect do
+                should eq(64)
+              end.to raise_error(NoMethodError)
+            end
+          end
+        end
+      end
+
+      context "when it does not respond to #[]" do
+        subject { Object.new }
+
+        context "it raises an error" do
+          its([:a]) do
+            expect do
+              should eq("Symbol: a")
+            end.to raise_error(NoMethodError)
+          end
+        end
+      end
+
+      context "calling and overriding super" do
+        it "calls to the subject defined in the parent group" do
+          group = ExampleGroup.describe(Array) do
+            subject { [1, 'a'] }
+
+            its(:last) { should eq("a") }
+
+            describe '.first' do
+              def subject; super().first; end
+
+              its(:next) { should eq(2) }
+            end
+          end
+
+          expect(group.run).to be_true
+        end
+      end
+
+      context "with nil subject" do
+        subject do
+          Class.new do
+            def initialize
+              @counter = -1
+            end
+            def nil_if_first_time
+              @counter += 1
+              @counter == 0 ? nil : true
+            end
+          end.new
+        end
+        its(:nil_if_first_time) { should be(nil) }
+      end
+
+      context "with false subject" do
+        subject do
+          Class.new do
+            def initialize
+              @counter = -1
+            end
+            def false_if_first_time
+              @counter += 1
+              @counter > 0
+            end
+          end.new
+        end
+        its(:false_if_first_time) { should be(false) }
+      end
+
+      describe 'accessing `subject` in `before` and `let`' do
+        subject { 'my subject' }
+        before { @subject_in_before = subject }
+        let(:subject_in_let) { subject }
+        let!(:eager_loaded_subject_in_let) { subject }
+
+        # These examples read weird, because we're actually
+        # specifying the behaviour of `its` itself
+        its(nil) { expect(subject).to eq('my subject') }
+        its(nil) { expect(@subject_in_before).to eq('my subject') }
+        its(nil) { expect(subject_in_let).to eq('my subject') }
+        its(nil) { expect(eager_loaded_subject_in_let).to eq('my subject') }
+      end
+    end
+
+    describe '#subject!' do
+      let(:prepared_array) { [1,2,3] }
+      subject! { prepared_array.pop }
+
+      it "evaluates subject before example" do
+        expect(prepared_array).to eq([1,2])
+      end
+
+      it "returns memoized value from first invocation" do
+        expect(subject).to eq(3)
+      end
+    end
+  end
+
+  describe "#let" do
+    let(:counter) do
+      Class.new do
+        def initialize
+          @count = 0
+        end
+        def count
+          @count += 1
+        end
+      end.new
+    end
+
+    let(:nil_value) do
+      @nil_value_count += 1
+      nil
+    end
+
+    it "generates an instance method" do
+      expect(counter.count).to eq(1)
+    end
+
+    it "caches the value" do
+      expect(counter.count).to eq(1)
+      expect(counter.count).to eq(2)
+    end
+
+    it "caches a nil value" do
+      @nil_value_count = 0
+      nil_value
+      nil_value
+
+      expect(@nil_value_count).to eq(1)
+    end
+
+    let(:regex_with_capture) { %r[RegexWithCapture(\d)] }
+
+    it 'does not pass the block up the ancestor chain' do
+      # Test for Ruby bug http://bugs.ruby-lang.org/issues/8059
+      expect("RegexWithCapture1".match(regex_with_capture)[1]).to eq('1')
+    end
+
+    it 'raises a useful error when called without a block' do
+      expect do
+        ExampleGroup.describe { let(:list) }
+      end.to raise_error(/#let or #subject called without a block/)
+    end
+
+    let(:a_value) { "a string" }
+
+    context 'when overriding let in a nested context' do
+      let(:a_value) { super() + " (modified)" }
+
+      it 'can use `super` to reference the parent context value' do
+        expect(a_value).to eq("a string (modified)")
+      end
+    end
+
+    context 'when the declaration uses `return`' do
+      let(:value) do
+        return :early_exit if @early_exit
+        :late_exit
+      end
+
+      it 'can exit the let declaration early' do
+        @early_exit = true
+        expect(value).to eq(:early_exit)
+      end
+
+      it 'can get past a conditional `return` statement' do
+        @early_exit = false
+        expect(value).to eq(:late_exit)
+      end
+    end
+
+    context 'when referenced in a `before(:all)` hook' do
+      before do
+        expect(::RSpec).to respond_to(:warn_deprecation)
+        ::RSpec.stub(:warn_deprecation)
+      end
+
+      def define_and_run_group
+        values = { :reference_lines => [] }
+
+        ExampleGroup.describe do
+          let(:list) { [1, 2] }
+          subject { %w[ a b ] }
+
+          before(:all) do
+            list << 3; values[:reference_lines] << __LINE__
+            values[:final_list_value_in_before_all] = list; values[:reference_lines] << __LINE__
+          end
+
+          example do
+            subject << "1"
+            values[:subject_in_ex_1] = subject
+            values[:list_value_in_example] = list
+          end
+
+          example do
+            subject << "2"
+            values[:subject_in_ex_2] = subject
+          end
+        end.run
+
+        values
+      end
+
+      it 'memoizes the value within the before(:all) hook' do
+        values = define_and_run_group
+        expect(values.fetch(:final_list_value_in_before_all)).to eq([1, 2, 3])
+      end
+
+      it 'preserves the memoized value into the examples' do
+        values = define_and_run_group
+        expect(values.fetch(:list_value_in_example)).to eq([1, 2, 3])
+      end
+
+      it 'does not cause the subject to be shared across examples' do
+        values = define_and_run_group
+        expect(values.fetch(:subject_in_ex_1)).to eq(%w[ a b 1 ])
+        expect(values.fetch(:subject_in_ex_2)).to eq(%w[ a b 2 ])
+      end
+
+      it 'prints a warning since `let` declarations are not intended to be used in :all hooks' do
+        msgs = []
+        ::RSpec.stub(:warn_deprecation) { |msg| msgs << msg }
+
+        values = define_and_run_group
+
+        expect(msgs).to include(*values[:reference_lines].map { |line|
+          match(/let declaration `list` accessed.*#{__FILE__}:#{line}/m)
+        })
+      end
+    end
+
+    context "when included modules have hooks that define memoized helpers" do
+      it "allows memoized helpers to override methods in previously included modules" do
+        group = ExampleGroup.describe do
+          include Module.new {
+            def self.included(m); m.let(:unrelated) { :unrelated }; end
+          }
+
+          include Module.new {
+            def hello_message; "Hello from module"; end
+          }
+
+          let(:hello_message) { "Hello from let" }
+        end
+
+        expect(group.new.hello_message).to eq("Hello from let")
+      end
+    end
+  end
+
+  describe "#let!" do
+    subject { [1,2,3] }
+    let!(:popped) { subject.pop }
+
+    it "evaluates the value non-lazily" do
+      expect(subject).to eq([1,2])
+    end
+
+    it "returns memoized value from first invocation" do
+      expect(popped).to eq(3)
+    end
+  end
+
+  describe 'using subject in before and let blocks' do
+    shared_examples_for 'a subject' do
+      let(:subject_id_in_let) { subject.object_id }
+      before { @subject_id_in_before = subject.object_id }
+
+      it 'should be memoized' do
+        expect(subject_id_in_let).to eq(@subject_id_in_before)
+      end
+
+      it { should eq(subject) }
+    end
+
+    describe Object do
+      context 'with implicit subject' do
+        it_should_behave_like 'a subject'
+      end
+
+      context 'with explicit subject' do
+        subject { Object.new }
+        it_should_behave_like 'a subject'
+      end
+
+      context 'with a constant subject'do
+        subject { 123 }
+        it_should_behave_like 'a subject'
+      end
+    end
+  end
+
+  describe 'Module#define_method' do
+    it 'is still a private method' do
+      a_module = Module.new
+      expect { a_module.define_method(:name) { "implementation" } }.to raise_error NoMethodError
+    end
+  end
+end
+
diff --git a/rspec-core/spec/rspec/core/metadata_spec.rb b/rspec-core/spec/rspec/core/metadata_spec.rb
new file mode 100644
index 0000000..c128a49
--- /dev/null
+++ b/rspec-core/spec/rspec/core/metadata_spec.rb
@@ -0,0 +1,491 @@
+require 'spec_helper'
+
+module RSpec
+  module Core
+    describe Metadata do
+
+      describe '.relative_path' do
+        let(:here) { File.expand_path(".") }
+        it "transforms absolute paths to relative paths" do
+          expect(Metadata.relative_path(here)).to eq "."
+        end
+        it "transforms absolute paths to relative paths anywhere in its argument" do
+          expect(Metadata.relative_path("foo #{here} bar")).to eq "foo . bar"
+        end
+        it "returns nil if passed an unparseable file:line combo" do
+          expect(Metadata.relative_path("-e:1")).to be_nil
+        end
+        # I have no idea what line = line.sub(/\A([^:]+:\d+)$/, '\\1') is supposed to do
+        it "gracefully returns nil if run in a secure thread" do
+          safely do
+            value = Metadata.relative_path(".")
+            # on some rubies, File.expand_path is not a security error, so accept "." as well
+            expect([nil, "."]).to include(value)
+          end
+        end
+
+      end
+
+      describe "#process" do
+        Metadata::RESERVED_KEYS.each do |key|
+          it "prohibits :#{key} as a hash key" do
+            m = Metadata.new
+            expect do
+              m.process('group', key => {})
+            end.to raise_error(/:#{key} is not allowed/)
+          end
+        end
+
+        it "uses :caller if passed as part of the user metadata" do
+          m = Metadata.new
+          m.process('group', :caller => ['example_file:42'])
+          expect(m[:example_group][:location]).to eq("example_file:42")
+        end
+      end
+
+      describe "#filter_applies?" do
+        let(:parent_group_metadata) { Metadata.new.process('parent group', :caller => ["foo_spec.rb:#{__LINE__}"]) }
+        let(:group_metadata) { Metadata.new(parent_group_metadata).process('group', :caller => ["foo_spec.rb:#{__LINE__}"]) }
+        let(:example_metadata) { group_metadata.for_example('example', :caller => ["foo_spec.rb:#{__LINE__}"], :if => true) }
+        let(:next_example_metadata) { group_metadata.for_example('next_example', :caller => ["foo_spec.rb:#{example_line_number + 2}"]) }
+        let(:world) { World.new }
+
+        before { RSpec.stub(:world) { world } }
+
+        shared_examples_for "matching by line number" do
+          let(:preceeding_declaration_lines) {{
+            parent_group_metadata[:example_group][:line_number] => parent_group_metadata[:example_group][:line_number],
+            group_metadata[:example_group][:line_number] => group_metadata[:example_group][:line_number],
+            example_metadata[:line_number] => example_metadata[:line_number],
+            (example_metadata[:line_number] + 1) => example_metadata[:line_number],
+            (example_metadata[:line_number] + 2) => example_metadata[:line_number] + 2,
+          }}
+          before do
+            world.should_receive(:preceding_declaration_line).at_least(:once).and_return do |v|
+              preceeding_declaration_lines[v]
+            end
+          end
+
+          it "matches the group when the line_number is the example group line number" do
+            # this call doesn't really make sense since filter_applies? is only called
+            # for example metadata not group metadata
+            expect(group_metadata.filter_applies?(condition_key, group_condition)).to be_true
+          end
+
+          it "matches the example when the line_number is the grandparent example group line number" do
+            expect(example_metadata.filter_applies?(condition_key, parent_group_condition)).to be_true
+          end
+
+          it "matches the example when the line_number is the parent example group line number" do
+            expect(example_metadata.filter_applies?(condition_key, group_condition)).to be_true
+          end
+
+          it "matches the example when the line_number is the example line number" do
+            expect(example_metadata.filter_applies?(condition_key, example_condition)).to be_true
+          end
+
+          it "matches when the line number is between this example and the next" do
+            expect(example_metadata.filter_applies?(condition_key, between_examples_condition)).to be_true
+          end
+
+          it "does not match when the line number matches the next example" do
+            expect(example_metadata.filter_applies?(condition_key, next_example_condition)).to be_false
+          end
+        end
+
+        context "with a single line number" do
+          let(:condition_key){ :line_numbers }
+          let(:parent_group_condition) { [parent_group_metadata[:example_group][:line_number]] }
+          let(:group_condition) { [group_metadata[:example_group][:line_number]] }
+          let(:example_condition) { [example_metadata[:line_number]] }
+          let(:between_examples_condition) { [group_metadata[:example_group][:line_number] + 1] }
+          let(:next_example_condition) { [example_metadata[:line_number] + 2] }
+
+          it_has_behavior "matching by line number"
+        end
+
+        context "with multiple line numbers" do
+          let(:condition_key){ :line_numbers }
+          let(:parent_group_condition) { [-1, parent_group_metadata[:example_group][:line_number]] }
+          let(:group_condition) { [-1, group_metadata[:example_group][:line_number]] }
+          let(:example_condition) { [-1, example_metadata[:line_number]] }
+          let(:between_examples_condition) { [-1, group_metadata[:example_group][:line_number] + 1] }
+          let(:next_example_condition) { [-1, example_metadata[:line_number] + 2] }
+
+          it_has_behavior "matching by line number"
+        end
+
+        context "with locations" do
+          let(:condition_key){ :locations }
+          let(:parent_group_condition) do
+            {File.expand_path(parent_group_metadata[:example_group][:file_path]) => [parent_group_metadata[:example_group][:line_number]]}
+          end
+          let(:group_condition) do
+            {File.expand_path(group_metadata[:example_group][:file_path]) => [group_metadata[:example_group][:line_number]]}
+          end
+          let(:example_condition) do
+            {File.expand_path(example_metadata[:file_path]) => [example_metadata[:line_number]]}
+          end
+          let(:between_examples_condition) do
+            {File.expand_path(group_metadata[:example_group][:file_path]) => [group_metadata[:example_group][:line_number] + 1]}
+          end
+          let(:next_example_condition) do
+            {File.expand_path(example_metadata[:file_path]) => [example_metadata[:line_number] + 2]}
+          end
+
+          it_has_behavior "matching by line number"
+
+          it "ignores location filters for other files" do
+            expect(example_metadata.filter_applies?(:locations, {"/path/to/other_spec.rb" => [3,5,7]})).to be_true
+          end
+        end
+
+        it "matches a proc with no arguments that evaluates to true" do
+          expect(example_metadata.filter_applies?(:if, lambda { true })).to be_true
+        end
+
+        it "matches a proc that evaluates to true" do
+          expect(example_metadata.filter_applies?(:if, lambda { |v| v })).to be_true
+        end
+
+        it "does not match a proc that evaluates to false" do
+          expect(example_metadata.filter_applies?(:if, lambda { |v| !v })).to be_false
+        end
+
+        it "matches a proc with an arity of 2" do
+          example_metadata[:foo] = nil
+          expect(example_metadata.filter_applies?(:foo, lambda { |v, m| m == example_metadata })).to be_true
+        end
+
+        it "raises an error when the proc has an incorrect arity" do
+          expect {
+            example_metadata.filter_applies?(:if, lambda { |a,b,c| true })
+          }.to raise_error(ArgumentError)
+        end
+
+        context "with an Array" do
+          let(:metadata_with_array) {
+            group_metadata.for_example('example_with_array', :tag => [:one, 2, 'three', /four/])
+          }
+
+          it "matches a symbol" do
+            expect(metadata_with_array.filter_applies?(:tag, 'one')).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, :one)).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, 'two')).to be_false
+          end
+
+          it "matches a string" do
+            expect(metadata_with_array.filter_applies?(:tag, 'three')).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, :three)).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, 'tree')).to be_false
+          end
+
+          it "matches an integer" do
+            expect(metadata_with_array.filter_applies?(:tag, '2')).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, 2)).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, 3)).to be_false
+          end
+
+          it "matches a regexp" do
+            expect(metadata_with_array.filter_applies?(:tag, 'four')).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, 'fourtune')).to be_true
+            expect(metadata_with_array.filter_applies?(:tag, 'fortune')).to be_false
+          end
+
+          it "matches a proc that evaluates to true" do
+            expect(metadata_with_array.filter_applies?(:tag, lambda { |values| values.include? 'three' })).to be_true
+          end
+
+          it "does not match a proc that evaluates to false" do
+            expect(metadata_with_array.filter_applies?(:tag, lambda { |values| values.include? 'nothing' })).to be_false
+          end
+        end
+      end
+
+      describe "#for_example" do
+        let(:metadata)           { Metadata.new.process("group description") }
+        let(:mfe)                { metadata.for_example("example description", {:arbitrary => :options}) }
+        let(:line_number)        { __LINE__ - 1 }
+
+        it "stores the description args" do
+          expect(mfe.fetch(:description_args)).to eq ["example description"]
+          expect(mfe[:description_args]).to eq ["example description"]
+        end
+
+        it "ignores nil description args" do
+          expect(metadata.for_example(nil, {}).fetch(:description_args)).to eq []
+          expect(metadata.for_example(nil, {})[:description_args]).to eq []
+        end
+
+        it "stores the full_description (group description + example description)" do
+          expect(mfe.fetch(:full_description)).to eq("group description example description")
+          expect(mfe[:full_description]).to eq("group description example description")
+        end
+
+        it "creates an empty execution result" do
+          expect(mfe.fetch(:execution_result)).to eq({})
+          expect(mfe[:execution_result]).to eq({})
+        end
+
+        it "extracts file path from caller" do
+          expect(mfe.fetch(:file_path)).to eq(relative_path(__FILE__))
+          expect(mfe[:file_path]).to eq(relative_path(__FILE__))
+        end
+
+        it "extracts line number from caller" do
+          expect(mfe.fetch(:line_number)).to eq(line_number)
+          expect(mfe[:line_number]).to eq(line_number)
+        end
+
+        it "extracts location from caller" do
+          expect(mfe.fetch(:location)).to eq("#{relative_path(__FILE__)}:#{line_number}")
+          expect(mfe[:location]).to eq("#{relative_path(__FILE__)}:#{line_number}")
+        end
+
+        it "uses :caller if passed as an option" do
+          example_metadata = metadata.for_example('example description', {:caller => ['example_file:42']})
+          expect(example_metadata[:location]).to eq("example_file:42")
+        end
+
+        it "merges arbitrary options" do
+          expect(mfe.fetch(:arbitrary)).to eq(:options)
+          expect(mfe[:arbitrary]).to eq(:options)
+        end
+
+        it "points :example_group to the same hash object" do
+          a = metadata.for_example("foo", {})[:example_group]
+          b = metadata.for_example("bar", {})[:example_group]
+          a[:description] = "new description"
+          expect(b[:description]).to eq("new description")
+        end
+      end
+
+      [:described_class, :describes].each do |key|
+        describe key do
+          context "with a String" do
+            it "returns nil" do
+              m = Metadata.new
+              m.process('group')
+
+              expect(m[:example_group][key]).to be_nil
+            end
+          end
+
+          context "with a Symbol" do
+            it "returns nil" do
+              m = Metadata.new
+              m.process(:group)
+
+              expect(m[:example_group][key]).to be_nil
+            end
+          end
+
+          context "with a class" do
+            it "returns the class" do
+              m = Metadata.new
+              m.process(String)
+
+              expect(m[:example_group][key]).to be(String)
+            end
+          end
+
+          context "in a nested group" do
+            it "returns the parent group's described class" do
+              sm = Metadata.new
+              sm.process(String)
+
+              m = Metadata.new(sm)
+              m.process(Array)
+
+              expect(m[:example_group][key]).to be(String)
+            end
+
+            it "returns own described class if parent doesn't have one" do
+              sm = Metadata.new
+              sm.process("foo")
+
+              m = Metadata.new(sm)
+              m.process(Array)
+
+              expect(m[:example_group][key]).to be(Array)
+            end
+
+            it "can override a parent group's described class" do
+              parent = Metadata.new
+              parent.process(String)
+
+              child = Metadata.new(parent)
+              child.process(Fixnum)
+              child[:example_group][key] = Hash
+
+              grandchild = Metadata.new(child)
+              grandchild.process(Array)
+
+              expect(grandchild[:example_group][key]).to be(Hash)
+              expect(child[:example_group][key]).to be(Hash)
+              expect(parent[:example_group][key]).to be(String)
+            end
+          end
+        end
+      end
+
+      describe ":description" do
+        it "just has the example description" do
+          m = Metadata.new
+          m.process("group")
+
+          m = m.for_example("example", {})
+          expect(m[:description]).to eq("example")
+        end
+
+        context "with a string" do
+          it "provides the submitted description" do
+            m = Metadata.new
+            m.process("group")
+
+            expect(m[:example_group][:description]).to eq("group")
+          end
+        end
+
+        context "with a non-string" do
+          it "provides the submitted description" do
+            m = Metadata.new
+            m.process("group")
+
+            expect(m[:example_group][:description]).to eq("group")
+          end
+        end
+
+        context "with a non-string and a string" do
+          it "concats the args" do
+            m = Metadata.new
+            m.process(Object, 'group')
+
+            expect(m[:example_group][:description]).to eq("Object group")
+          end
+        end
+
+        context "with empty args" do
+          it "returns empty string for [:example_group][:description]" do
+            m = Metadata.new
+            m.process()
+
+            expect(m[:example_group][:description]).to eq("")
+          end
+        end
+      end
+
+      describe ":full_description" do
+        it "concats example group name and description" do
+          group_metadata = Metadata.new
+          group_metadata.process('group')
+
+          example_metadata = group_metadata.for_example("example", {})
+          expect(example_metadata[:full_description]).to eq("group example")
+        end
+
+        it "concats nested example group descriptions" do
+          parent = Metadata.new
+          parent.process('parent')
+
+          child = Metadata.new(parent)
+          child.process('child')
+
+          expect(child[:example_group][:full_description]).to eq("parent child")
+          expect(child.for_example('example', child)[:full_description]).to eq("parent child example")
+        end
+
+        it "concats nested example group descriptions three deep" do
+          grandparent = Metadata.new
+          grandparent.process('grandparent')
+
+          parent = Metadata.new(grandparent)
+          parent.process('parent')
+
+          child = Metadata.new(parent)
+          child.process('child')
+
+          expect(grandparent[:example_group][:full_description]).to eq("grandparent")
+          expect(parent[:example_group][:full_description]).to eq("grandparent parent")
+          expect(child[:example_group][:full_description]).to eq("grandparent parent child")
+          expect(child.for_example('example', child)[:full_description]).to eq("grandparent parent child example")
+        end
+
+        %w[# . ::].each do |char|
+          context "with a 2nd arg starting with #{char}" do
+            it "removes the space" do
+              m = Metadata.new
+              m.process(Array, "#{char}method")
+              expect(m[:example_group][:full_description]).to eq("Array#{char}method")
+            end
+          end
+
+          context "with a description starting with #{char} nested under a module" do
+            it "removes the space" do
+              parent = Metadata.new
+              parent.process(Object)
+              child = Metadata.new(parent)
+              child.process("#{char}method")
+              expect(child[:example_group][:full_description]).to eq("Object#{char}method")
+            end
+          end
+
+          context "with a description starting with #{char} nested under a context string" do
+            it "does not remove the space" do
+              grandparent = Metadata.new
+              grandparent.process(Array)
+              parent = Metadata.new(grandparent)
+              parent.process("with 2 items")
+              child = Metadata.new(parent)
+              child.process("#{char}method")
+              expect(child[:example_group][:full_description]).to eq("Array with 2 items #{char}method")
+            end
+          end
+        end
+      end
+
+      describe ":file_path" do
+        it "finds the first non-rspec lib file in the caller array" do
+          m = Metadata.new
+          m.process(:caller => [
+                    "./lib/rspec/core/foo.rb",
+                    "#{__FILE__}:#{__LINE__}"
+          ])
+          expect(m[:example_group][:file_path]).to eq(relative_path(__FILE__))
+        end
+      end
+
+      describe ":line_number" do
+        it "finds the line number with the first non-rspec lib file in the backtrace" do
+          m = Metadata.new
+          m.process({})
+          expect(m[:example_group][:line_number]).to eq(__LINE__ - 1)
+        end
+
+        it "finds the line number with the first spec file with drive letter" do
+          m = Metadata.new
+          m.process(:caller => [ "C:/path/to/file_spec.rb:#{__LINE__}" ])
+          expect(m[:example_group][:line_number]).to eq(__LINE__ - 1)
+        end
+
+        it "uses the number after the first : for ruby 1.9" do
+          m = Metadata.new
+          m.process(:caller => [ "#{__FILE__}:#{__LINE__}:999" ])
+          expect(m[:example_group][:line_number]).to eq(__LINE__ - 1)
+        end
+      end
+
+      describe "child example group" do
+        it "nests the parent's example group metadata" do
+          parent = Metadata.new
+          parent.process(Object, 'parent')
+
+          child = Metadata.new(parent)
+          child.process()
+
+          expect(child[:example_group][:example_group]).to eq(parent[:example_group])
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/option_parser_spec.rb b/rspec-core/spec/rspec/core/option_parser_spec.rb
new file mode 100644
index 0000000..8894b36
--- /dev/null
+++ b/rspec-core/spec/rspec/core/option_parser_spec.rb
@@ -0,0 +1,242 @@
+require "spec_helper"
+
+module RSpec::Core
+  describe OptionParser do
+    let(:output_file){ mock File }
+
+    before do
+      RSpec.stub(:deprecate)
+      File.stub(:open).with("foo.txt",'w') { (output_file) }
+    end
+
+    it "does not parse empty args" do
+      parser = Parser.new
+      OptionParser.should_not_receive(:new)
+      parser.parse!([])
+    end
+
+    it "proposes you to use --help and returns an error on incorrect argument" do
+      parser = Parser.new
+      option = "--my_wrong_arg"
+
+      parser.should_receive(:abort) do |msg|
+        expect(msg).to include('use --help', option)
+      end
+
+      parser.parse!([option])
+    end
+
+    describe "--formatter" do
+      it "is deprecated" do
+        RSpec.should_receive(:deprecate)
+        Parser.parse!(%w[--formatter doc])
+      end
+
+      it "gets converted to --format" do
+        options = Parser.parse!(%w[--formatter doc])
+        expect(options[:formatters].first).to eq(["doc"])
+      end
+    end
+
+    describe "--default_path" do
+      it "gets converted to --default-path" do
+        options = Parser.parse!(%w[--default_path foo])
+        expect(options[:default_path]).to eq "foo"
+      end
+    end
+
+    describe "--line_number" do
+      it "gets converted to --line-number" do
+        options = Parser.parse!(%w[--line_number 3])
+        expect(options[:line_numbers]).to eq ["3"]
+      end
+    end
+
+
+    describe "--default-path" do
+      it "sets the default path where RSpec looks for examples" do
+        options = Parser.parse!(%w[--default-path foo])
+        expect(options[:default_path]).to eq "foo"
+      end
+    end
+
+    %w[--line-number -l].each do |option|
+      describe option do
+        it "sets the line number of an example to run" do
+          options = Parser.parse!([option, "3"])
+          expect(options[:line_numbers]).to eq ["3"]
+        end
+      end
+    end
+
+    %w[--format -f].each do |option|
+      describe option do
+        it "defines the formatter" do
+          options = Parser.parse!([option, 'doc'])
+          expect(options[:formatters].first).to eq(["doc"])
+        end
+      end
+    end
+
+    %w[--out -o].each do |option|
+      describe option do
+        let(:options) { Parser.parse!([option, 'out.txt']) }
+
+        it "sets the output stream for the formatter" do
+          expect(options[:formatters].last).to eq(['progress', 'out.txt'])
+        end
+
+        context "with multiple formatters" do
+          context "after last formatter" do
+            it "sets the output stream for the last formatter" do
+              options = Parser.parse!(['-f', 'progress', '-f', 'doc', option, 'out.txt'])
+              expect(options[:formatters][0]).to eq(['progress'])
+              expect(options[:formatters][1]).to eq(['doc', 'out.txt'])
+            end
+          end
+
+          context "after first formatter" do
+            it "sets the output stream for the first formatter" do
+              options = Parser.parse!(['-f', 'progress', option, 'out.txt', '-f', 'doc'])
+              expect(options[:formatters][0]).to eq(['progress', 'out.txt'])
+              expect(options[:formatters][1]).to eq(['doc'])
+            end
+          end
+        end
+      end
+    end
+
+    %w[--example -e].each do |option|
+      describe option do
+        it "escapes the arg" do
+          options = Parser.parse!([option, "this (and that)"])
+          expect(options[:full_description].length).to eq(1)
+          expect("this (and that)").to match(options[:full_description].first)
+        end
+      end
+    end
+
+    %w[--pattern -P].each do |option|
+      describe option do
+        it "sets the filename pattern" do
+          options = Parser.parse!([option, 'spec/**/*.spec'])
+          expect(options[:pattern]).to eq('spec/**/*.spec')
+        end
+      end
+    end
+
+    %w[--tag -t].each do |option|
+      describe option do
+        context "without ~" do
+          it "treats no value as true" do
+            options = Parser.parse!([option, 'foo'])
+            expect(options[:inclusion_filter]).to eq(:foo => true)
+          end
+
+          it "treats 'true' as true" do
+            options = Parser.parse!([option, 'foo:true'])
+            expect(options[:inclusion_filter]).to eq(:foo => true)
+          end
+
+          it "treats 'nil' as nil" do
+            options = Parser.parse!([option, 'foo:nil'])
+            expect(options[:inclusion_filter]).to eq(:foo => nil)
+          end
+
+          it "treats 'false' as false" do
+            options = Parser.parse!([option, 'foo:false'])
+            expect(options[:inclusion_filter]).to eq(:foo => false)
+          end
+
+          it "merges muliple invocations" do
+            options = Parser.parse!([option, 'foo:false', option, 'bar:true', option, 'foo:true'])
+            expect(options[:inclusion_filter]).to eq(:foo => true, :bar => true)
+          end
+
+          it "treats 'any_string' as 'any_string'" do
+            options = Parser.parse!([option, 'foo:any_string'])
+            expect(options[:inclusion_filter]).to eq(:foo => 'any_string')
+          end
+        end
+
+        context "with ~" do
+          it "treats no value as true" do
+            options = Parser.parse!([option, '~foo'])
+            expect(options[:exclusion_filter]).to eq(:foo => true)
+          end
+
+          it "treats 'true' as true" do
+            options = Parser.parse!([option, '~foo:true'])
+            expect(options[:exclusion_filter]).to eq(:foo => true)
+          end
+
+          it "treats 'nil' as nil" do
+            options = Parser.parse!([option, '~foo:nil'])
+            expect(options[:exclusion_filter]).to eq(:foo => nil)
+          end
+
+          it "treats 'false' as false" do
+            options = Parser.parse!([option, '~foo:false'])
+            expect(options[:exclusion_filter]).to eq(:foo => false)
+          end
+        end
+      end
+    end
+
+    describe "--order" do
+      it "is nil by default" do
+        expect(Parser.parse!([])[:order]).to be_nil
+      end
+
+      %w[rand random].each do |option|
+        context "with #{option}" do
+          it "defines the order as random" do
+            options = Parser.parse!(['--order', option])
+            expect(options[:order]).to eq(option)
+          end
+        end
+      end
+    end
+
+    describe "--seed" do
+      it "sets the order to rand:SEED" do
+        options = Parser.parse!(%w[--seed 123])
+        expect(options[:order]).to eq("rand:123")
+      end
+    end
+
+    describe '--profile' do
+      it 'sets profile_examples to true by default' do
+        options = Parser.parse!(%w[--profile])
+        expect(options[:profile_examples]).to eq true
+      end
+
+      it 'sets profile_examples to supplied int' do
+        options = Parser.parse!(%w[--profile 10])
+        expect(options[:profile_examples]).to eq 10
+      end
+
+      it 'sets profile_examples to true when accidentally combined with path' do
+        allow(Kernel).to receive(:warn)
+        options = Parser.parse!(%w[--profile some/path])
+        expect(options[:profile_examples]).to eq true
+      end
+
+      it 'warns when accidentally combined with path' do
+        expect(Kernel).to receive(:warn) do |msg|
+          expect(msg).to match "Non integer specified as profile count"
+        end
+        options = Parser.parse!(%w[--profile some/path])
+        expect(options[:profile_examples]).to eq true
+      end
+    end
+
+    describe '--warning' do
+      it 'enables warnings' do
+        options = Parser.parse!(%w[--warnings])
+        expect(options[:warnings]).to eq true
+      end
+    end
+
+  end
+end
diff --git a/rspec-core/spec/rspec/core/pending_example_spec.rb b/rspec-core/spec/rspec/core/pending_example_spec.rb
new file mode 100644
index 0000000..c755470
--- /dev/null
+++ b/rspec-core/spec/rspec/core/pending_example_spec.rb
@@ -0,0 +1,220 @@
+require 'spec_helper'
+
+describe "an example" do
+  matcher :be_pending_with do |message|
+    match do |example|
+      example.pending? && example.metadata[:execution_result][:pending_message] == message
+    end
+
+    failure_message_for_should do |example|
+      "expected: example pending with #{message.inspect}\n     got: #{example.metadata[:execution_result][:pending_message].inspect}"
+    end
+  end
+
+  context "declared pending with metadata" do
+    it "uses the value assigned to :pending as the message" do
+      group = RSpec::Core::ExampleGroup.describe('group') do
+        example "example", :pending => 'just because' do
+        end
+      end
+      example = group.examples.first
+      example.run(group.new, double.as_null_object)
+      expect(example).to be_pending_with('just because')
+    end
+
+    it "sets the message to 'No reason given' if :pending => true" do
+      group = RSpec::Core::ExampleGroup.describe('group') do
+        example "example", :pending => true do
+        end
+      end
+      example = group.examples.first
+      example.run(group.new, double.as_null_object)
+      expect(example).to be_pending_with('No reason given')
+    end
+  end
+
+  context "with no block" do
+    it "is listed as pending with 'Not yet implemented'" do
+      group = RSpec::Core::ExampleGroup.describe('group') do
+        it "has no block"
+      end
+      example = group.examples.first
+      example.run(group.new, double.as_null_object)
+      expect(example).to be_pending_with('Not yet implemented')
+    end
+  end
+
+  context "with no args" do
+    it "is listed as pending with the default message" do
+      group = RSpec::Core::ExampleGroup.describe('group') do
+        it "does something" do
+          pending
+        end
+      end
+      example = group.examples.first
+      example.run(group.new, double.as_null_object)
+      expect(example).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
+    end
+  end
+
+  context "with no docstring" do
+    context "declared with the pending method" do
+      it "does not have an auto-generated description" do
+        group = RSpec::Core::ExampleGroup.describe('group') do
+          it "checks something" do
+            expect((3+4)).to eq(7)
+          end
+          pending do
+            expect("string".reverse).to eq("gnirts")
+          end
+        end
+        example = group.examples.last
+        example.run(group.new, double.as_null_object)
+        expect(example.description).to match(/example at/)
+      end
+    end
+
+    context "after another example with some assertion" do
+      it "does not show any message" do
+        group = RSpec::Core::ExampleGroup.describe('group') do
+          it "checks something" do
+            expect((3+4)).to eq(7)
+          end
+          specify do
+            pending
+          end
+        end
+        example = group.examples.last
+        example.run(group.new, double.as_null_object)
+        expect(example.description).to match(/example at/)
+      end
+    end
+  end
+
+  context "with a message" do
+    it "is listed as pending with the supplied message" do
+      group = RSpec::Core::ExampleGroup.describe('group') do
+        it "does something" do
+          pending("just because")
+        end
+      end
+      example = group.examples.first
+      example.run(group.new, double.as_null_object)
+      expect(example).to be_pending_with('just because')
+    end
+  end
+
+  context "with a block" do
+    def run_example(*pending_args, &block)
+      group = RSpec::Core::ExampleGroup.describe('group') do
+        it "does something" do
+          pending(*pending_args) { block.call if block }
+        end
+      end
+      example = group.examples.first
+      example.run(group.new, double.as_null_object)
+      example
+    end
+
+    context "that fails" do
+      def run_example(*pending_args)
+        super(*pending_args) { raise ArgumentError.new }
+      end
+
+      context "when given no options" do
+        it "is listed as pending with the supplied message" do
+          expect(run_example("just because")).to be_pending_with("just because")
+        end
+
+        it "is listed as pending with the default message when no message is given" do
+          expect(run_example).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
+        end
+      end
+
+      context "when given a truthy :if option" do
+        it "is listed as pending with the supplied message" do
+          expect(run_example("just because", :if => true)).to be_pending_with("just because")
+        end
+
+        it "is listed as pending with the default message when no message is given" do
+          expect(run_example(:if => true)).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
+        end
+      end
+
+      context "when given a falsey :if option" do
+        it "runs the example and fails" do
+          expect(run_example(                :if => false)).to fail_with(ArgumentError)
+          expect(run_example("just because", :if => false)).to fail_with(ArgumentError)
+        end
+      end
+
+      context "when given a truthy :unless option" do
+        it "runs the example and fails" do
+          expect(run_example(                :unless => true)).to fail_with(ArgumentError)
+          expect(run_example("just because", :unless => true)).to fail_with(ArgumentError)
+        end
+      end
+
+      context "when given a falsey :unless option" do
+        it "is listed as pending with the supplied message" do
+          expect(run_example("just because", :unless => false)).to be_pending_with("just because")
+        end
+
+        it "is listed as pending with the default message when no message is given" do
+          expect(run_example(:unless => false)).to be_pending_with(RSpec::Core::Pending::NO_REASON_GIVEN)
+        end
+      end
+    end
+
+    context "that fails due to a failed message expectation" do
+      def run_example(*pending_args)
+        super(*pending_args) { "foo".should_receive(:bar) }
+      end
+
+      it "passes" do
+        expect(run_example("just because")).to be_pending
+      end
+    end
+
+    context "that passes" do
+      def run_example(*pending_args)
+        super(*pending_args) { expect(3).to eq(3) }
+      end
+
+      context "when given no options" do
+        it "fails with a PendingExampleFixedError" do
+          expect(run_example("just because")).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+          expect(run_example).to                 fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+        end
+      end
+
+      context "when given a truthy :if option" do
+        it "fails with a PendingExampleFixedError" do
+          expect(run_example("just because", :if => true)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+          expect(run_example(                :if => true)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+        end
+      end
+
+      context "when given a falsey :if option" do
+        it "runs the example and it passes" do
+          expect(run_example(                :if => false)).to pass
+          expect(run_example("just because", :if => false)).to pass
+        end
+      end
+
+      context "when given a truthy :unless option" do
+        it "runs the example and it passes" do
+          expect(run_example(                :unless => true)).to pass
+          expect(run_example("just because", :unless => true)).to pass
+        end
+      end
+
+      context "when given a falsey :unless option" do
+        it "fails with a PendingExampleFixedError" do
+          expect(run_example("just because", :unless => false)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+          expect(run_example(                :unless => false)).to fail_with(RSpec::Core::Pending::PendingExampleFixedError)
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/project_initializer_spec.rb b/rspec-core/spec/rspec/core/project_initializer_spec.rb
new file mode 100644
index 0000000..d211672
--- /dev/null
+++ b/rspec-core/spec/rspec/core/project_initializer_spec.rb
@@ -0,0 +1,130 @@
+require "spec_helper"
+
+module RSpec::Core
+  describe ProjectInitializer, :isolated_directory => true do
+
+    describe "#run" do
+      context "with no args" do
+        let(:command_line_config) { ProjectInitializer.new }
+
+        before do
+          command_line_config.stub(:warn)
+          command_line_config.stub(:puts)
+          command_line_config.stub(:gets => 'no')
+        end
+
+        context "with no .rspec file" do
+          it "says it's creating .rspec " do
+            command_line_config.should_receive(:puts).with(/create\s+\.rspec/)
+            command_line_config.run
+          end
+
+          it "generates a .rspec" do
+            command_line_config.run
+            expect(File.read('.rspec')).to match(/--color\n--format progress/m)
+          end
+        end
+
+        context "with a .rspec file" do
+          it "says .rspec exists" do
+            FileUtils.touch('.rspec')
+            command_line_config.should_receive(:puts).with(/exist\s+\.rspec/)
+            command_line_config.run
+          end
+
+          it "doesn't create a new one" do
+            File.open('.rspec', 'w') {|f| f << '--color'}
+            command_line_config.run
+            expect(File.read('.rspec')).to eq('--color')
+          end
+        end
+
+        context "with no spec/spec_helper.rb file" do
+          it "says it's creating spec/spec_helper.rb " do
+            command_line_config.should_receive(:puts).with(/create\s+spec\/spec_helper.rb/)
+            command_line_config.run
+          end
+
+          it "generates a spec/spec_helper.rb" do
+            command_line_config.run
+            expect(File.read('spec/spec_helper.rb')).to match(/RSpec\.configure do \|config\|/m)
+          end
+        end
+
+        context "with a spec/spec_helper.rb file" do
+          before { FileUtils.mkdir('spec') }
+
+          it "says spec/spec_helper.rb exists" do
+            FileUtils.touch('spec/spec_helper.rb')
+            command_line_config.should_receive(:puts).with(/exist\s+spec\/spec_helper.rb/)
+            command_line_config.run
+          end
+
+          it "doesn't create a new one" do
+            random_content = "content #{rand}"
+            File.open('spec/spec_helper.rb', 'w') {|f| f << random_content}
+            command_line_config.run
+            expect(File.read('spec/spec_helper.rb')).to eq(random_content)
+          end
+        end
+
+        context "with autotest/discover.rb" do
+          before do
+            FileUtils.mkdir('autotest')
+            FileUtils.touch 'autotest/discover.rb'
+          end
+
+          it "asks whether to delete the file" do
+            command_line_config.should_receive(:puts).with(/delete/)
+            command_line_config.run
+          end
+
+          it "removes it if confirmed" do
+            command_line_config.stub(:gets => 'yes')
+            command_line_config.run
+            expect(File.exist?('autotest/discover.rb')).to be_false
+          end
+
+          it "leaves it if not confirmed" do
+            command_line_config.stub(:gets => 'no')
+            command_line_config.run
+            expect(File.exist?('autotest/discover.rb')).to be_true
+          end
+        end
+
+        context "with lib/tasks/rspec.rake" do
+          before do
+            FileUtils.mkdir_p('lib/tasks')
+            FileUtils.touch 'lib/tasks/rspec.rake'
+          end
+
+          it "asks whether to delete the file" do
+            command_line_config.should_receive(:puts).with(/delete/)
+            command_line_config.run
+          end
+
+          it "removes it if confirmed" do
+            command_line_config.stub(:gets => 'yes')
+            command_line_config.run
+            expect(File.exist?('lib/tasks/rspec.rake')).to be_false
+          end
+
+          it "leaves it if not confirmed" do
+            command_line_config.stub(:gets => 'no')
+            command_line_config.run
+            expect(File.exist?('lib/tasks/rspec.rake')).to be_true
+          end
+        end
+      end
+
+      context "given an arg" do
+        it "warns if arg received (no longer necessary)" do
+          config = ProjectInitializer.new("another_arg")
+          config.stub(:puts)
+          config.stub(:gets => 'no')
+          config.run
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/rake_task_spec.rb b/rspec-core/spec/rspec/core/rake_task_spec.rb
new file mode 100644
index 0000000..d411ae5
--- /dev/null
+++ b/rspec-core/spec/rspec/core/rake_task_spec.rb
@@ -0,0 +1,181 @@
+require "spec_helper"
+require "rspec/core/rake_task"
+require 'tempfile'
+
+module RSpec::Core
+  describe RakeTask do
+    let(:task) { RakeTask.new }
+
+    def ruby
+      FileUtils::RUBY
+    end
+
+    def with_rcov
+      task.rcov = true
+      yield
+    end
+
+    def spec_command
+      task.__send__(:spec_command)
+    end
+
+    context "with a name passed to the constructor" do
+      let(:task) { RakeTask.new(:task_name) }
+
+      it "correctly sets the name" do
+        expect(task.name).to eq :task_name
+      end
+    end
+
+    context "with args passed to the rake task" do
+      it "correctly passes along task arguments" do
+        task = RakeTask.new(:rake_task_args, :files) do |t, args|
+          expect(args[:files]).to eq "first_spec.rb"
+        end
+
+        task.should_receive(:run_task) { true }
+        expect(Rake.application.invoke_task("rake_task_args[first_spec.rb]")).to be_true
+      end
+    end
+
+    context "default" do
+      it "renders rspec" do
+        expect(spec_command).to match(/^#{ruby} -S rspec/)
+      end
+    end
+
+    context "with rcov" do
+      it "renders rcov" do
+        with_rcov do
+          expect(spec_command).to match(/^#{ruby} -S rcov/)
+        end
+      end
+    end
+
+    context "with ruby options" do
+      it "renders them before -S" do
+          task.ruby_opts = "-w"
+          expect(spec_command).to match(/^#{ruby} -w -S rspec/)
+      end
+    end
+
+    context "with rcov_opts" do
+      context "with rcov=false (default)" do
+        it "does not add the rcov options to the command" do
+          task.rcov_opts = '--exclude "mocks"'
+          expect(spec_command).not_to match(/--exclude "mocks"/)
+        end
+      end
+
+      context "with rcov=true" do
+        it "renders them after rcov" do
+          task.rcov = true
+          task.rcov_opts = '--exclude "mocks"'
+          expect(spec_command).to match(/rcov.*--exclude "mocks"/)
+        end
+
+        it "ensures that -Ispec:lib is in the resulting command" do
+          task.rcov = true
+          task.rcov_opts = '--exclude "mocks"'
+          expect(spec_command).to match(/rcov.*-Ispec:lib/)
+        end
+      end
+    end
+
+    context "with rspec_opts" do
+      context "with rcov=true" do
+        it "adds the rspec_opts after the rcov_opts and files" do
+          task.stub(:files_to_run) { "this.rb that.rb" }
+          task.rcov = true
+          task.rspec_opts = "-Ifoo"
+          expect(spec_command).to match(/this.rb that.rb -- -Ifoo/)
+        end
+      end
+      context "with rcov=false (default)" do
+        it "adds the rspec_opts" do
+          task.rspec_opts = "-Ifoo"
+          expect(spec_command).to match(/rspec.*-Ifoo/)
+        end
+      end
+    end
+
+    def specify_consistent_ordering_of_files_to_run(pattern, task)
+      orderings = [
+        %w[ a/1.rb a/2.rb a/3.rb ],
+        %w[ a/2.rb a/1.rb a/3.rb ],
+        %w[ a/3.rb a/2.rb a/1.rb ]
+      ].map do |files|
+        FileList.should_receive(:[]).with(pattern) { files }
+        task.__send__(:files_to_run)
+      end
+
+      expect(orderings.uniq.size).to eq(1)
+    end
+
+    context "with SPEC env var set" do
+      it "sets files to run" do
+        with_env_vars 'SPEC' => 'path/to/file' do
+          expect(task.__send__(:files_to_run)).to eq(["path/to/file"])
+        end
+      end
+
+      it "sets the files to run in a consistent order, regardless of the underlying FileList ordering" do
+        with_env_vars 'SPEC' => 'a/*.rb' do
+          specify_consistent_ordering_of_files_to_run('a/*.rb', task)
+        end
+      end
+    end
+
+    it "sets the files to run in a consistent order, regardless of the underlying FileList ordering" do
+      task = RakeTask.new(:consistent_file_order) do |t|
+        t.pattern = 'a/*.rb'
+      end
+
+      # since the config block is deferred til task invocation, must fake
+      # calling the task so the expected pattern is picked up
+      task.should_receive(:run_task) { true }
+      expect(Rake.application.invoke_task(task.name)).to be_true
+
+      specify_consistent_ordering_of_files_to_run('a/*.rb', task)
+    end
+
+    context "with paths with quotes or spaces" do
+      it "escapes the quotes and spaces" do
+        task.pattern = File.join(Dir.tmpdir, "*spec.rb")
+        ["first_spec.rb", "second_\"spec.rb", "third_\'spec.rb", "fourth spec.rb"].each do |file_name|
+          FileUtils.touch(File.join(Dir.tmpdir, file_name))
+        end
+        expect(task.__send__(:files_to_run).sort).to eq([
+          File.join(Dir.tmpdir, "first_spec.rb"),
+          File.join(Dir.tmpdir, "fourth\\ spec.rb"),
+          File.join(Dir.tmpdir, "second_\\\"spec.rb"),
+          File.join(Dir.tmpdir, "third_\\\'spec.rb")
+        ])
+      end
+    end
+
+    context "with paths including symlinked directories" do
+      it "finds the files" do
+        project_dir = File.join(Dir.tmpdir, "project")
+        FileUtils.rm_rf project_dir
+
+        foos_dir = File.join(project_dir, "spec/foos")
+        FileUtils.mkdir_p foos_dir
+        FileUtils.touch(File.join(foos_dir, "foo_spec.rb"))
+
+        bars_dir = File.join(Dir.tmpdir, "shared/spec/bars")
+        FileUtils.mkdir_p bars_dir
+        FileUtils.touch(File.join(bars_dir, "bar_spec.rb"))
+
+        FileUtils.ln_s bars_dir, File.join(project_dir, "spec/bars")
+
+        FileUtils.cd(project_dir) do
+          expect(RakeTask.new.__send__(:files_to_run).sort).to eq([
+            "./spec/bars/bar_spec.rb",
+            "./spec/foos/foo_spec.rb"
+          ])
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/reporter_spec.rb b/rspec-core/spec/rspec/core/reporter_spec.rb
new file mode 100644
index 0000000..218457e
--- /dev/null
+++ b/rspec-core/spec/rspec/core/reporter_spec.rb
@@ -0,0 +1,141 @@
+require "spec_helper"
+
+module RSpec::Core
+  describe Reporter do
+    describe "abort" do
+      let(:formatter) { double("formatter") }
+      let(:example)   { double("example") }
+      let(:reporter)  { Reporter.new(formatter) }
+
+      %w[start_dump dump_pending dump_failures dump_summary close].each do |message|
+        it "sends #{message} to the formatter(s) that respond to message" do
+          formatter.should_receive(message)
+          reporter.abort(nil)
+        end
+
+        it "doesnt notify formatters about messages they dont implement" do
+          expect { reporter.abort(nil) }.to_not raise_error
+        end
+      end
+    end
+
+    context "given one formatter" do
+      it "passes messages to that formatter" do
+        formatter = double("formatter", :example_started => nil)
+        example = double("example")
+        reporter = Reporter.new(formatter)
+
+        formatter.should_receive(:example_started).
+          with(example)
+
+        reporter.example_started(example)
+      end
+
+      it "passes example_group_started and example_group_finished messages to that formatter in that order" do
+        order = []
+
+        formatter = double("formatter")
+        formatter.stub(:example_group_started) { |group| order << "Started: #{group.description}" }
+        formatter.stub(:example_group_finished) { |group| order << "Finished: #{group.description}" }
+
+        group = ExampleGroup.describe("root")
+        group.describe("context 1") do
+          example("ignore") {}
+        end
+        group.describe("context 2") do
+          example("ignore") {}
+        end
+
+        group.run(Reporter.new(formatter))
+
+        expect(order).to eq([
+           "Started: root",
+           "Started: context 1",
+           "Finished: context 1",
+           "Started: context 2",
+           "Finished: context 2",
+           "Finished: root"
+        ])
+      end
+    end
+
+    context "given an example group with no examples" do
+      it "does not pass example_group_started or example_group_finished to formatter" do
+        formatter = double("formatter")
+        formatter.should_not_receive(:example_group_started)
+        formatter.should_not_receive(:example_group_finished)
+
+        group = ExampleGroup.describe("root")
+
+        group.run(Reporter.new(formatter))
+      end
+    end
+
+    context "given multiple formatters" do
+      it "passes messages to all formatters" do
+        formatters = (1..2).map { double("formatter", :example_started => nil) }
+        example = double("example")
+        reporter = Reporter.new(*formatters)
+
+        formatters.each do |formatter|
+          formatter.
+            should_receive(:example_started).
+            with(example)
+        end
+
+        reporter.example_started(example)
+      end
+    end
+
+    describe "#report" do
+      it "supports one arg (count)" do
+        Reporter.new.report(1) {}
+      end
+
+      it "supports two args (count, seed)" do
+        Reporter.new.report(1, 2) {}
+      end
+
+      it "yields itself" do
+        reporter = Reporter.new
+        yielded = nil
+        reporter.report(3) {|r| yielded = r}
+        expect(yielded).to eq(reporter)
+      end
+    end
+
+    describe "#register_listener" do
+      let(:reporter) { Reporter.new }
+      let(:listener) { double("listener", :start => nil) }
+
+      before { reporter.register_listener listener, :start }
+
+      it 'will register the listener to specified notifications' do
+        expect(reporter.registered_listeners :start).to eq [listener]
+      end
+
+      it 'will send notifications when a subscribed event is triggered' do
+        listener.should_receive(:start).with(42)
+        reporter.start 42
+      end
+    end
+
+    describe "timing" do
+      it "uses RSpec::Core::Time as to not be affected by changes to time in examples" do
+        formatter = double(:formatter)
+        duration = nil
+        formatter.stub(:dump_summary) do |dur, _, _, _|
+          duration = dur
+        end
+
+        reporter = Reporter.new formatter
+        reporter.start 1
+        Time.stub(:now => ::Time.utc(2012, 10, 1))
+
+
+        reporter.finish 1234
+        expect(duration).to be < 0.2
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/resources/a_bar.rb b/rspec-core/spec/rspec/core/resources/a_bar.rb
new file mode 100644
index 0000000..e69de29
diff --git a/rspec-core/spec/rspec/core/resources/a_foo.rb b/rspec-core/spec/rspec/core/resources/a_foo.rb
new file mode 100644
index 0000000..e69de29
diff --git a/rspec-core/spec/rspec/core/resources/a_spec.rb b/rspec-core/spec/rspec/core/resources/a_spec.rb
new file mode 100644
index 0000000..6503624
--- /dev/null
+++ b/rspec-core/spec/rspec/core/resources/a_spec.rb
@@ -0,0 +1 @@
+# Empty - used by ../options_spec.rb
diff --git a/rspec-core/spec/rspec/core/resources/custom_example_group_runner.rb b/rspec-core/spec/rspec/core/resources/custom_example_group_runner.rb
new file mode 100644
index 0000000..40e4c2b
--- /dev/null
+++ b/rspec-core/spec/rspec/core/resources/custom_example_group_runner.rb
@@ -0,0 +1,14 @@
+module Custom
+  class ExampleGroupRunner
+    attr_reader :options, :arg
+    def initialize(options, arg)
+      @options, @arg = options, arg
+    end
+
+    def load_files(files)
+    end
+
+    def run
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/resources/formatter_specs.rb b/rspec-core/spec/rspec/core/resources/formatter_specs.rb
new file mode 100644
index 0000000..88a3ccd
--- /dev/null
+++ b/rspec-core/spec/rspec/core/resources/formatter_specs.rb
@@ -0,0 +1,60 @@
+# Deliberately named _specs.rb to avoid being loaded except when specified
+
+describe "pending spec with no implementation" do
+  it "is pending"
+end
+
+describe "pending command with block format" do
+  context "with content that would fail" do
+    it "is pending" do
+      pending do
+        expect(1).to eq(2)
+      end
+    end
+  end
+
+  context "with content that would pass" do
+    it "fails" do
+      pending do
+        expect(1).to eq(1)
+      end
+    end
+  end
+end
+
+describe "passing spec" do
+  it "passes" do
+    expect(1).to eq(1)
+  end
+end
+
+describe "failing spec" do
+  it "fails" do
+    expect(1).to eq(2)
+  end
+end
+
+describe "a failing spec with odd backtraces" do
+  it "fails with a backtrace that has no file" do
+    require 'erb'
+
+    ERB.new("<%= raise 'foo' %>").result
+  end
+
+  it "fails with a backtrace containing an erb file" do
+    e = Exception.new
+
+    def e.backtrace
+      ["/foo.html.erb:1:in `<main>': foo (RuntimeError)",
+        "   from /lib/ruby/1.9.1/erb.rb:753:in `eval'"]
+    end
+
+    def e.message
+      # Redefining message steps around this behaviour
+      # on JRuby: http://jira.codehaus.org/browse/JRUBY-5637
+      self.class.name
+    end
+
+    raise e
+  end
+end
diff --git a/rspec-core/spec/rspec/core/resources/utf8_encoded.rb b/rspec-core/spec/rspec/core/resources/utf8_encoded.rb
new file mode 100644
index 0000000..7cbdd69
--- /dev/null
+++ b/rspec-core/spec/rspec/core/resources/utf8_encoded.rb
@@ -0,0 +1,8 @@
+# encoding: utf-8
+module Custom
+  class ExampleUTF8ClassNameVarietà
+    def self.è
+      così = :però
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/rspec_matchers_spec.rb b/rspec-core/spec/rspec/core/rspec_matchers_spec.rb
new file mode 100644
index 0000000..128de47
--- /dev/null
+++ b/rspec-core/spec/rspec/core/rspec_matchers_spec.rb
@@ -0,0 +1,45 @@
+require 'spec_helper'
+
+module RSpec::Matchers
+  def __method_with_super
+    super
+  end
+
+  module ModThatIncludesMatchers
+    include RSpec::Matchers
+  end
+
+  RSpec.configure do |c|
+    c.include RSpec::Matchers, :include_rspec_matchers => true
+    c.include ModThatIncludesMatchers, :include_mod_that_includes_rspec_matchers => true
+  end
+
+  describe self do
+    shared_examples_for "a normal module with a method that supers" do
+      it "raises the expected error (and not SystemStackError)" do
+        expect { __method_with_super }.to raise_error(NoMethodError) # there is no __method_with_super in an ancestor
+      end
+    end
+
+    it_behaves_like "a normal module with a method that supers"
+
+    context "when RSpec::Matchers has been included in an example group" do
+      include RSpec::Matchers
+      it_behaves_like "a normal module with a method that supers"
+    end
+
+    context "when a module that includes RSpec::Matchers has been included in an example group" do
+      include RSpec::Matchers::ModThatIncludesMatchers
+      it_behaves_like "a normal module with a method that supers"
+    end
+
+    context "when RSpec::Matchers is included via configuration", :include_rspec_matchers => true do
+      it_behaves_like "a normal module with a method that supers"
+    end
+
+    context "when RSpec::Matchers is included in a module that is included via configuration", :include_mod_that_includes_rspec_matchers => true do
+      it_behaves_like "a normal module with a method that supers"
+    end
+  end
+end
+
diff --git a/rspec-core/spec/rspec/core/ruby_project_spec.rb b/rspec-core/spec/rspec/core/ruby_project_spec.rb
new file mode 100644
index 0000000..c2096b3
--- /dev/null
+++ b/rspec-core/spec/rspec/core/ruby_project_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+module RSpec
+  module Core
+    describe RubyProject do
+
+      describe "#determine_root" do
+
+        context "with ancestor containing spec directory" do
+          it "returns ancestor containing the spec directory" do
+            RubyProject.stub(:ascend_until).and_return('foodir')
+            expect(RubyProject.determine_root).to eq("foodir")
+          end
+        end
+
+        context "without ancestor containing spec directory" do
+          it "returns current working directory" do
+            RubyProject.stub(:find_first_parent_containing).and_return(nil)
+            expect(RubyProject.determine_root).to eq(".")
+          end
+        end
+
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/runner_spec.rb b/rspec-core/spec/rspec/core/runner_spec.rb
new file mode 100644
index 0000000..91ba0b7
--- /dev/null
+++ b/rspec-core/spec/rspec/core/runner_spec.rb
@@ -0,0 +1,82 @@
+require 'spec_helper'
+require 'rspec/core/drb_command_line'
+
+module RSpec::Core
+  describe Runner do
+    describe 'at_exit' do
+      it 'sets an at_exit hook if none is already set' do
+        RSpec::Core::Runner.stub(:installed_at_exit?).and_return(false)
+        RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
+        RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
+        RSpec::Core::Runner.stub(:run).and_return(-1)
+        RSpec::Core::Runner.should_receive(:at_exit)
+        RSpec::Core::Runner.autorun
+      end
+
+      it 'does not set the at_exit hook if it is already set' do
+        RSpec::Core::Runner.stub(:installed_at_exit?).and_return(true)
+        RSpec::Core::Runner.stub(:running_in_drb?).and_return(false)
+        RSpec::Core::Runner.stub(:at_exit_hook_disabled?).and_return(false)
+        RSpec::Core::Runner.should_receive(:at_exit).never
+        RSpec::Core::Runner.autorun
+      end
+    end
+
+    describe "#run" do
+      let(:err) { StringIO.new }
+      let(:out) { StringIO.new }
+
+      it "tells RSpec to reset" do
+        RSpec.configuration.stub(:files_to_run => [])
+        RSpec.should_receive(:reset)
+        RSpec::Core::Runner.run([], err, out)
+      end
+
+      context "with --drb or -X" do
+
+        before(:each) do
+          @options = RSpec::Core::ConfigurationOptions.new(%w[--drb --drb-port 8181 --color])
+          RSpec::Core::ConfigurationOptions.stub(:new) { @options }
+        end
+
+        def run_specs
+          RSpec::Core::Runner.run(%w[ --drb ], err, out)
+        end
+
+        context 'and a DRb server is running' do
+          it "builds a DRbCommandLine and runs the specs" do
+            drb_proxy = double(RSpec::Core::DRbCommandLine, :run => true)
+            drb_proxy.should_receive(:run).with(err, out)
+
+            RSpec::Core::DRbCommandLine.should_receive(:new).and_return(drb_proxy)
+
+            run_specs
+          end
+        end
+
+        context 'and a DRb server is not running' do
+          before(:each) do
+            RSpec::Core::DRbCommandLine.should_receive(:new).and_raise(DRb::DRbConnError)
+          end
+
+          it "outputs a message" do
+            RSpec.configuration.stub(:files_to_run) { [] }
+            err.should_receive(:puts).with(
+              "No DRb server is running. Running in local process instead ..."
+            )
+            run_specs
+          end
+
+          it "builds a CommandLine and runs the specs" do
+            process_proxy = double(RSpec::Core::CommandLine, :run => 0)
+            process_proxy.should_receive(:run).with(err, out)
+
+            RSpec::Core::CommandLine.should_receive(:new).and_return(process_proxy)
+
+            run_specs
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/shared_context_spec.rb b/rspec-core/spec/rspec/core/shared_context_spec.rb
new file mode 100644
index 0000000..f2df09f
--- /dev/null
+++ b/rspec-core/spec/rspec/core/shared_context_spec.rb
@@ -0,0 +1,114 @@
+require "spec_helper"
+
+describe RSpec::SharedContext do
+  it "is accessible as RSpec::Core::SharedContext" do
+    RSpec::Core::SharedContext
+  end
+
+  it "is accessible as RSpec::SharedContext" do
+    RSpec::SharedContext
+  end
+
+  it "supports before and after hooks" do
+    before_all_hook = false
+    before_each_hook = false
+    after_each_hook = false
+    after_all_hook = false
+    shared = Module.new do
+      extend RSpec::SharedContext
+      before(:all) { before_all_hook = true }
+      before(:each) { before_each_hook = true }
+      after(:each)  { after_each_hook = true }
+      after(:all)  { after_all_hook = true }
+    end
+    group = RSpec::Core::ExampleGroup.describe do
+      include shared
+      example { }
+    end
+
+    group.run
+
+    expect(before_all_hook).to be_true
+    expect(before_each_hook).to be_true
+    expect(after_each_hook).to be_true
+    expect(after_all_hook).to be_true
+  end
+
+  it "runs the before each hooks in configuration before those of the shared context" do
+    ordered_hooks = []
+    RSpec.configure do |c|
+      c.before(:each) { ordered_hooks << "config" }
+    end
+
+    shared_context("before each stuff", :example => :before_each_hook_order) do
+      before(:each) { ordered_hooks << "shared_context"}
+    end
+
+    group = RSpec::Core::ExampleGroup.describe :example => :before_each_hook_order do
+      before(:each) { ordered_hooks << "example_group" }
+      example {}
+    end
+
+    group.run
+
+    expect(ordered_hooks).to be == ["config", "shared_context", "example_group"]
+  end
+
+  it "supports let" do
+    shared = Module.new do
+      extend RSpec::SharedContext
+      let(:foo) { 'foo' }
+    end
+    group = RSpec::Core::ExampleGroup.describe do
+      include shared
+    end
+
+    expect(group.new.foo).to eq('foo')
+  end
+
+  it 'supports explicit subjects' do
+    shared = Module.new do
+      extend RSpec::SharedContext
+      subject { 17 }
+    end
+
+    group = RSpec::Core::ExampleGroup.describe do
+      include shared
+    end
+
+    expect(group.new.subject).to eq(17)
+  end
+
+  it 'supports `its` with an implicit subject' do
+    shared = Module.new do
+      extend RSpec::SharedContext
+      its(:size) { should eq 0 }
+    end
+
+    group = RSpec::Core::ExampleGroup.describe(Array) do
+      include shared
+    end
+
+    group.run
+    expect(group.children.first.examples.first.execution_result).to include(:status => "passed")
+  end
+
+  %w[describe context].each do |method_name|
+    it "supports nested example groups using #{method_name}" do
+      shared = Module.new do
+        extend RSpec::SharedContext
+        send(method_name, "nested using describe") do
+          example {}
+        end
+      end
+      group = RSpec::Core::ExampleGroup.describe do
+        include shared
+      end
+
+      group.run
+
+      expect(group.children.length).to eq(1)
+      expect(group.children.first.examples.length).to eq(1)
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/shared_example_group/collection_spec.rb b/rspec-core/spec/rspec/core/shared_example_group/collection_spec.rb
new file mode 100644
index 0000000..09ca5fd
--- /dev/null
+++ b/rspec-core/spec/rspec/core/shared_example_group/collection_spec.rb
@@ -0,0 +1,70 @@
+require 'spec_helper'
+
+module RSpec::Core::SharedExampleGroup
+  describe Collection do
+
+    # this represents:
+    #
+    # shared_examples "top level group"
+    #
+    # context do
+    #   shared_examples "nested level one"
+    # end
+    #
+    # context do
+    #   shared_examples "nested level two"
+    # end
+    #
+    let(:examples) do
+      Hash.new { |hash,k| hash[k] = Hash.new }.tap do |hash|
+        hash["main"]     = { "top level group"  => example_1 }
+        hash["nested 1"] = { "nested level one" => example_2 }
+        hash["nested 2"] = { "nested level two" => example_3 }
+      end
+    end
+    (1..3).each { |num| let("example_#{num}") { double "example #{num}" } }
+
+    context 'setup with one source, which is the top level' do
+
+      let(:collection) { Collection.new ['main'], examples }
+
+      it 'fetches examples from the top level' do
+        expect(collection['top level group']).to eq example_1
+      end
+
+      it 'fetches examples across the nested context' do
+        RSpec.stub(:warn_deprecation)
+        expect(collection['nested level two']).to eq example_3
+      end
+
+      it 'warns about deprecation when you fetch across nested contexts' do
+        RSpec.should_receive(:warn_deprecation)
+        collection['nested level two']
+      end
+    end
+
+    context 'setup with multiple sources' do
+
+      let(:collection) { Collection.new ['main','nested 1'], examples }
+
+      it 'fetches examples from the context' do
+        expect(collection['nested level one']).to eq example_2
+      end
+
+      it 'fetches examples from main' do
+        expect(collection['top level group']).to eq example_1
+      end
+
+      it 'fetches examples across the nested context' do
+        RSpec.stub(:warn_deprecation)
+        expect(collection['nested level two']).to eq example_3
+      end
+
+      it 'warns about deprecation when you fetch across nested contexts' do
+        RSpec.should_receive(:warn_deprecation)
+        collection['nested level two']
+      end
+
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/shared_example_group_spec.rb b/rspec-core/spec/rspec/core/shared_example_group_spec.rb
new file mode 100644
index 0000000..a9ec543
--- /dev/null
+++ b/rspec-core/spec/rspec/core/shared_example_group_spec.rb
@@ -0,0 +1,120 @@
+require 'spec_helper'
+
+module RandomTopLevelModule
+  def self.setup!
+    shared_examples_for("top level in module") {}
+  end
+end
+
+module RSpec::Core
+  describe SharedExampleGroup do
+
+    ExampleModule = Module.new
+    ExampleClass = Class.new
+
+    it 'does not add a bunch of private methods to Module' do
+      seg_methods = RSpec::Core::SharedExampleGroup.private_instance_methods
+      expect(Module.private_methods & seg_methods).to eq([])
+    end
+
+    module SharedExampleGroup
+      describe Registry do
+        it "can safely be reset when there aren't any shared groups" do
+          expect { Registry.new.clear }.to_not raise_error
+        end
+      end
+    end
+
+    before(:all) do
+      # this is a work around as SharedExampleGroup is not world safe
+      RandomTopLevelModule.setup!
+    end
+
+    %w[share_examples_for shared_examples_for shared_examples shared_context].each do |shared_method_name|
+      describe shared_method_name do
+        it "is exposed to the global namespace" do
+          expect(Kernel).to respond_to(shared_method_name)
+        end
+
+        it "displays a warning when adding a second shared example group with the same name" do
+          group = ExampleGroup.describe('example group')
+          group.send(shared_method_name, 'some shared group') {}
+          original_declaration = [__FILE__, __LINE__ - 1].join(':')
+
+          warning = nil
+          Kernel.stub(:warn) { |msg| warning = msg }
+
+          group.send(shared_method_name, 'some shared group') {}
+          second_declaration = [__FILE__, __LINE__ - 1].join(':')
+          expect(warning).to include('some shared group', original_declaration, second_declaration)
+        end
+
+        it 'works with top level defined examples in modules' do
+          expect(RSpec::configuration.reporter).to_not receive(:deprecation)
+          group = ExampleGroup.describe('example group') { include_context 'top level in module' }
+        end
+
+        ["name", :name, ExampleModule, ExampleClass].each do |object|
+          type = object.class.name.downcase
+          context "given a #{type}" do
+            it "captures the given #{type} and block in the collection of shared example groups" do
+              implementation = lambda {}
+              send(shared_method_name, object, &implementation)
+              expect(SharedExampleGroup.registry.shared_example_groups[self][object]).to eq implementation
+            end
+          end
+        end
+
+        context "given a hash" do
+          it "delegates extend on configuration" do
+            implementation = Proc.new { def bar; 'bar'; end }
+            send(shared_method_name, :foo => :bar, &implementation)
+            a = RSpec.configuration.include_or_extend_modules.first
+            expect(a[0]).to eq(:extend)
+            expect(Class.new.extend(a[1]).new.bar).to eq('bar')
+            expect(a[2]).to eq(:foo => :bar)
+          end
+        end
+
+        context "given a string and a hash" do
+          it "captures the given string and block in the World's collection of shared example groups" do
+            implementation = lambda {}
+            send(shared_method_name, "name", :foo => :bar, &implementation)
+            expect(SharedExampleGroup.registry.shared_example_groups[self]["name"]).to eq implementation
+          end
+
+          it "delegates extend on configuration" do
+            implementation = Proc.new { def bar; 'bar'; end }
+            send(shared_method_name, "name", :foo => :bar, &implementation)
+            a = RSpec.configuration.include_or_extend_modules.first
+            expect(a[0]).to eq(:extend)
+            expect(Class.new.extend(a[1]).new.bar).to eq('bar')
+            expect(a[2]).to eq(:foo => :bar)
+          end
+        end
+      end
+    end
+
+    describe "#share_as" do
+      before { allow(RSpec).to receive(:deprecate) }
+
+      it "is exposed to the global namespace" do
+        expect(Kernel).to respond_to("share_as")
+      end
+
+      it "adds examples to current example_group using include", :compat => 'rspec-1.2' do
+        share_as('Cornucopia') do
+          it "is plentiful" do
+            expect(5).to eq(4)
+          end
+        end
+        group = ExampleGroup.describe('group') { include Cornucopia }
+        phantom_group = group.children.first
+        expect(phantom_group.description).to eql("")
+        expect(phantom_group.metadata[:shared_group_name]).to eql('Cornucopia')
+        expect(phantom_group.examples.length).to eq(1)
+        expect(phantom_group.examples.first.metadata[:description]).to eq("is plentiful")
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core/world_spec.rb b/rspec-core/spec/rspec/core/world_spec.rb
new file mode 100644
index 0000000..bd9654f
--- /dev/null
+++ b/rspec-core/spec/rspec/core/world_spec.rb
@@ -0,0 +1,142 @@
+require 'spec_helper'
+
+class Bar; end
+class Foo; end
+
+module RSpec::Core
+
+  describe RSpec::Core::World do
+    let(:configuration) { RSpec::Core::Configuration.new }
+    let(:world) { RSpec::Core::World.new(configuration) }
+
+    describe '#reset' do
+      it 'clears #example_groups' do
+        world.example_groups << :example_group
+        world.reset
+        expect(world.example_groups).to be_empty
+      end
+    end
+
+    describe "#example_groups" do
+      it "contains all registered example groups" do
+        group = RSpec::Core::ExampleGroup.describe("group"){}
+        world.register(group)
+        expect(world.example_groups).to include(group)
+      end
+    end
+
+    describe "#preceding_declaration_line (again)" do
+      let(:group) do
+        RSpec::Core::ExampleGroup.describe("group") do
+
+          example("example") {}
+
+        end
+      end
+
+      let(:second_group) do
+        RSpec::Core::ExampleGroup.describe("second_group") do
+
+          example("second_example") {}
+
+        end
+      end
+
+      let(:group_declaration_line) { group.metadata[:example_group][:line_number] }
+      let(:example_declaration_line) { group_declaration_line + 2 }
+
+      context "with one example" do
+        before { world.register(group) }
+
+        it "returns nil if no example or group precedes the line" do
+          expect(world.preceding_declaration_line(group_declaration_line - 1)).to be_nil
+        end
+
+        it "returns the argument line number if a group starts on that line" do
+          expect(world.preceding_declaration_line(group_declaration_line)).to eq(group_declaration_line)
+        end
+
+        it "returns the argument line number if an example starts on that line" do
+          expect(world.preceding_declaration_line(example_declaration_line)).to eq(example_declaration_line)
+        end
+
+        it "returns line number of a group that immediately precedes the argument line" do
+          expect(world.preceding_declaration_line(group_declaration_line + 1)).to eq(group_declaration_line)
+        end
+
+        it "returns line number of an example that immediately precedes the argument line" do
+          expect(world.preceding_declaration_line(example_declaration_line + 1)).to eq(example_declaration_line)
+        end
+      end
+
+      context "with two exaples and the second example is registre first" do
+        let(:second_group_declaration_line) { second_group.metadata[:example_group][:line_number] }
+
+        before do
+          world.register(second_group)
+          world.register(group)
+        end
+
+        it 'return line number of group if a group start on that line' do
+          expect(world.preceding_declaration_line(second_group_declaration_line)).to eq(second_group_declaration_line)
+        end
+      end
+    end
+
+    describe "#announce_filters" do
+      let(:reporter) { double('reporter').as_null_object }
+      before { world.stub(:reporter) { reporter } }
+
+      context "with no examples" do
+        before { world.stub(:example_count) { 0 } }
+
+        context "with no filters" do
+          it "announces" do
+            reporter.should_receive(:message).
+              with("No examples found.")
+            world.announce_filters
+          end
+        end
+
+        context "with an inclusion filter" do
+          it "announces" do
+            configuration.filter_run_including :foo => 'bar'
+            reporter.should_receive(:message).
+              with(/All examples were filtered out/)
+            world.announce_filters
+          end
+        end
+
+        context "with an inclusion filter and run_all_when_everything_filtered" do
+          it "announces" do
+            configuration.stub(:run_all_when_everything_filtered?) { true }
+            configuration.filter_run_including :foo => 'bar'
+            reporter.should_receive(:message).
+              with(/All examples were filtered out/)
+            world.announce_filters
+          end
+        end
+
+        context "with an exclusion filter" do
+          it "announces" do
+            configuration.filter_run_excluding :foo => 'bar'
+            reporter.should_receive(:message).
+              with(/All examples were filtered out/)
+            world.announce_filters
+          end
+        end
+      end
+
+      context "with examples" do
+        before { world.stub(:example_count) { 1 } }
+
+        context "with no filters" do
+          it "does not announce" do
+            reporter.should_not_receive(:message)
+            world.announce_filters
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/rspec/core_spec.rb b/rspec-core/spec/rspec/core_spec.rb
new file mode 100644
index 0000000..e6a5c7d
--- /dev/null
+++ b/rspec-core/spec/rspec/core_spec.rb
@@ -0,0 +1,74 @@
+require 'spec_helper'
+
+describe RSpec do
+  describe "::configuration" do
+    it "returns the same object every time" do
+      expect(RSpec.configuration).to equal(RSpec.configuration)
+    end
+  end
+
+  describe "::configuration=" do
+    it "sets the configuration object" do
+      configuration = RSpec::Core::Configuration.new
+
+      RSpec.configuration = configuration
+
+      expect(RSpec.configuration).to equal(configuration)
+    end
+  end
+
+  describe "::configure" do
+    it "yields the current configuration" do
+      RSpec.configure do |config|
+        expect(config).to equal(RSpec::configuration)
+      end
+    end
+  end
+
+  describe "::world" do
+    it "returns the same object every time" do
+      expect(RSpec.world).to equal(RSpec.world)
+    end
+  end
+
+  describe "::world=" do
+    it "sets the world object" do
+      world = RSpec::Core::World.new
+
+      RSpec.world = world
+
+      expect(RSpec.world).to equal(world)
+    end
+  end
+
+  describe "::reset" do
+    it "resets the configuration and world objects" do
+      config_before_reset = RSpec.configuration
+      world_before_reset  = RSpec.world
+
+      RSpec.reset
+
+      expect(RSpec.configuration).not_to equal(config_before_reset)
+      expect(RSpec.world).not_to equal(world_before_reset)
+    end
+  end
+
+  # This is hard to test :(. Best way I could come up with was starting
+  # fresh ruby process w/o this stuff already loaded.
+  it "loads mocks and expectations when the constants are referenced" do
+    code = "$LOAD_PATH.replace(#{$LOAD_PATH.inspect}); " +
+           'require "rspec"; ' +
+           "puts RSpec::Mocks.name; " +
+           "puts RSpec::Expectations.name"
+
+    result = `ruby -e '#{code}'`.chomp
+    expect(result.split("\n")).to eq(%w[ RSpec::Mocks RSpec::Expectations ])
+  end
+
+  it 'correctly raises an error when an invalid const is referenced' do
+    expect {
+      RSpec::NotAConst
+    }.to raise_error(NameError, /uninitialized constant RSpec::NotAConst/)
+  end
+end
+
diff --git a/rspec-core/spec/spec_helper.rb b/rspec-core/spec/spec_helper.rb
new file mode 100644
index 0000000..5c4ed0e
--- /dev/null
+++ b/rspec-core/spec/spec_helper.rb
@@ -0,0 +1,132 @@
+require 'rubygems'
+
+begin
+  require 'spork'
+rescue LoadError
+  module Spork
+    def self.prefork
+      yield
+    end
+
+    def self.each_run
+      yield
+    end
+  end
+end
+
+Spork.prefork do
+  require 'rspec/autorun'
+  require 'autotest/rspec2'
+  require 'aruba/api'
+
+  if RUBY_PLATFORM == 'java'
+    # Works around https://jira.codehaus.org/browse/JRUBY-5678
+    require 'fileutils'
+    ENV['TMPDIR'] = File.expand_path('../../tmp', __FILE__)
+    FileUtils.mkdir_p(ENV['TMPDIR'])
+  end
+
+  Dir['./spec/support/**/*.rb'].map {|f| require f}
+
+  class NullObject
+    private
+    def method_missing(method, *args, &block)
+      # ignore
+    end
+  end
+
+  module Sandboxing
+    def self.sandboxed(&block)
+      @orig_config = RSpec.configuration
+      @orig_world  = RSpec.world
+      new_config = RSpec::Core::Configuration.new
+      new_world  = RSpec::Core::World.new(new_config)
+      RSpec.configuration = new_config
+      RSpec.world = new_world
+      object = Object.new
+      object.extend(RSpec::Core::SharedExampleGroup)
+
+      (class << RSpec::Core::ExampleGroup; self; end).class_eval do
+        alias_method :orig_run, :run
+        def run(reporter=nil)
+          orig_run(reporter || NullObject.new)
+        end
+      end
+
+      RSpec::Core::SandboxedMockSpace.sandboxed do
+        object.instance_eval(&block)
+      end
+    ensure
+      (class << RSpec::Core::ExampleGroup; self; end).class_eval do
+        remove_method :run
+        alias_method :run, :orig_run
+        remove_method :orig_run
+      end
+
+      RSpec.configuration = @orig_config
+      RSpec.world = @orig_world
+    end
+  end
+
+  def in_editor?
+    ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
+  end
+
+  module EnvHelpers
+    def with_env_vars(vars)
+      original = ENV.to_hash
+      vars.each { |k, v| ENV[k] = v }
+
+      begin
+        yield
+      ensure
+        ENV.replace(original)
+      end
+    end
+
+    def without_env_vars(*vars)
+      original = ENV.to_hash
+      vars.each { |k| ENV.delete(k) }
+
+      begin
+        yield
+      ensure
+        ENV.replace(original)
+      end
+    end
+  end
+
+  RSpec.configure do |c|
+    # structural
+    c.alias_it_behaves_like_to 'it_has_behavior'
+    c.around {|example| Sandboxing.sandboxed { example.run }}
+    c.include(RSpecHelpers)
+    c.include Aruba::Api, :example_group => {
+      :file_path => /spec\/command_line/
+    }
+
+    c.expect_with :rspec do |expectations|
+      expectations.syntax = :expect
+    end
+
+    # runtime options
+    c.treat_symbols_as_metadata_keys_with_true_values = true
+    c.color = !in_editor?
+    c.filter_run :focus
+    c.include EnvHelpers
+    c.run_all_when_everything_filtered = true
+    c.filter_run_excluding :ruby => lambda {|version|
+      case version.to_s
+      when "!jruby"
+        RUBY_ENGINE == "jruby"
+      when /^> (.*)/
+        !(RUBY_VERSION.to_s > $1)
+      else
+        !(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
+      end
+    }
+  end
+end
+
+Spork.each_run do
+end
diff --git a/rspec-core/spec/support/config_options_helper.rb b/rspec-core/spec/support/config_options_helper.rb
new file mode 100644
index 0000000..2f987a5
--- /dev/null
+++ b/rspec-core/spec/support/config_options_helper.rb
@@ -0,0 +1,15 @@
+module ConfigOptionsHelper
+  extend RSpec::SharedContext
+
+  around(:each) { |e| without_env_vars('SPEC_OPTS', &e) }
+
+  def config_options_object(*args)
+    coo = RSpec::Core::ConfigurationOptions.new(args)
+    coo.parse_options
+    coo
+  end
+
+  def parse_options(*args)
+    config_options_object(*args).options
+  end
+end
diff --git a/rspec-core/spec/support/helper_methods.rb b/rspec-core/spec/support/helper_methods.rb
new file mode 100644
index 0000000..97ee565
--- /dev/null
+++ b/rspec-core/spec/support/helper_methods.rb
@@ -0,0 +1,36 @@
+module RSpecHelpers
+  def relative_path(path)
+    RSpec::Core::Metadata.relative_path(path)
+  end
+
+  def ignoring_warnings
+    original = $VERBOSE
+    $VERBOSE = nil
+    result = yield
+    $VERBOSE = original
+    result
+  end
+
+  def safely
+    Thread.new do
+      ignoring_warnings { $SAFE = 3 }
+      yield
+    end.join
+
+    # $SAFE is not supported on Rubinius
+    unless defined?(Rubinius)
+      expect($SAFE).to eql 0 # $SAFE should not have changed in this thread.
+    end
+  end
+
+  def expect_deprecation_with_call_site(file, line)
+    expect(RSpec.configuration.reporter).to receive(:deprecation) do |options|
+      expect(options[:call_site]).to include([file, line].join(':'))
+    end
+  end
+
+  def allow_deprecation
+    allow(RSpec.configuration.reporter).to receive(:deprecation)
+  end
+
+end
diff --git a/rspec-core/spec/support/isolate_load_path_mutation.rb b/rspec-core/spec/support/isolate_load_path_mutation.rb
new file mode 100644
index 0000000..98184cc
--- /dev/null
+++ b/rspec-core/spec/support/isolate_load_path_mutation.rb
@@ -0,0 +1,6 @@
+shared_context "isolate load path mutation" do
+  original_load_path = nil
+  before { original_load_path = $LOAD_PATH.dup }
+  after  { $LOAD_PATH.replace(original_load_path) }
+end
+
diff --git a/rspec-core/spec/support/isolated_directory.rb b/rspec-core/spec/support/isolated_directory.rb
new file mode 100644
index 0000000..b01c2b9
--- /dev/null
+++ b/rspec-core/spec/support/isolated_directory.rb
@@ -0,0 +1,10 @@
+require 'tmpdir'
+require 'fileutils'
+
+shared_context "isolated directory", :isolated_directory => true do
+  around do |ex|
+    Dir.mktmpdir do |tmp_dir|
+      Dir.chdir(tmp_dir, &ex)
+    end
+  end
+end
diff --git a/rspec-core/spec/support/isolated_home_directory.rb b/rspec-core/spec/support/isolated_home_directory.rb
new file mode 100644
index 0000000..b66f606
--- /dev/null
+++ b/rspec-core/spec/support/isolated_home_directory.rb
@@ -0,0 +1,16 @@
+require 'tmpdir'
+require 'fileutils'
+
+shared_context "isolated home directory", :isolated_home => true do
+  around do |ex|
+    Dir.mktmpdir do |tmp_dir|
+      original_home = ENV['HOME']
+      begin
+        ENV['HOME'] = tmp_dir
+        ex.call
+      ensure
+        ENV['HOME'] = original_home
+      end
+    end
+  end
+end
diff --git a/rspec-core/spec/support/matchers.rb b/rspec-core/spec/support/matchers.rb
new file mode 100644
index 0000000..060a9fd
--- /dev/null
+++ b/rspec-core/spec/support/matchers.rb
@@ -0,0 +1,65 @@
+RSpec::Matchers.define :map_specs do |specs|
+  match do |autotest|
+    @specs = specs
+    @autotest = prepare(autotest)
+    autotest.test_files_for(@file) == specs
+  end
+
+  chain :to do |file|
+    @file = file
+  end
+
+  failure_message_for_should do
+    "expected #{@autotest.class} to map #{@specs.inspect} to #{@file.inspect}\ngot #{@actual.inspect}"
+  end
+
+  def prepare(autotest)
+    find_order = @specs.dup << @file
+    autotest.instance_eval { @find_order = find_order }
+    autotest
+  end
+end
+
+RSpec::Matchers.define :fail_with do |exception_klass|
+  match do |example|
+    failure_reason(example, exception_klass).nil?
+  end
+
+  failure_message_for_should do |example|
+    "expected example to fail with a #{exception_klass} exception, but #{failure_reason(example, exception_klass)}"
+  end
+
+  def failure_reason(example, exception_klass)
+    result = example.metadata[:execution_result]
+    case
+      when example.metadata[:pending] then "was pending"
+      when result[:status] != 'failed' then result[:status]
+      when !result[:exception].is_a?(exception_klass) then "failed with a #{result[:exception].class}"
+      else nil
+    end
+  end
+end
+
+RSpec::Matchers.define :pass do
+  match do |example|
+    failure_reason(example).nil?
+  end
+
+  failure_message_for_should do |example|
+    "expected example to pass, but #{failure_reason(example)}"
+  end
+
+  def failure_reason(example)
+    result = example.metadata[:execution_result]
+    case
+      when example.metadata[:pending] then "was pending"
+      when result[:status] != 'passed' then result[:status]
+      else nil
+    end
+  end
+end
+
+RSpec::Matchers.module_eval do
+  alias_method :have_failed_with, :fail_with
+  alias_method :have_passed, :pass
+end
diff --git a/rspec-core/spec/support/sandboxed_mock_space.rb b/rspec-core/spec/support/sandboxed_mock_space.rb
new file mode 100644
index 0000000..2176089
--- /dev/null
+++ b/rspec-core/spec/support/sandboxed_mock_space.rb
@@ -0,0 +1,100 @@
+require 'rspec/mocks'
+
+module RSpec
+  module Core
+    # Because rspec-core dog-foods itself, rspec-core's spec suite has
+    # examples that define example groups and examples and run them. The
+    # usual lifetime of an RSpec::Mocks::Proxy is for one example
+    # (the proxy cache gets cleared between each example), but since the
+    # specs in rspec-core's suite sometimes create test doubles and pass
+    # them to examples a spec defines and runs, the test double's proxy
+    # must live beyond the inner example: it must live for the scope
+    # of wherever it got defined. Here we implement the necessary semantics
+    # for rspec-core's specs:
+    #
+    # - #verify_all and #reset_all affect only mocks that were created
+    #   within the current scope.
+    # - Mock proxies live for the duration of the scope in which they are
+    #   created.
+    #
+    # Thus, mock proxies created in an inner example live for only that
+    # example, but mock proxies created in an outer example can be used
+    # in an inner example but will only be reset/verified when the outer
+    # example completes.
+    class SandboxedMockSpace < ::RSpec::Mocks::Space
+      def self.sandboxed
+        orig_space = RSpec::Mocks.space
+        RSpec::Mocks.space = RSpec::Core::SandboxedMockSpace.new
+
+        RSpec::Core::Example.class_eval do
+          alias_method :orig_run, :run
+          def run(*args)
+            RSpec::Mocks.space.sandboxed do
+              orig_run(*args)
+            end
+          end
+        end
+
+        yield
+      ensure
+        RSpec::Core::Example.class_eval do
+          remove_method :run
+          alias_method :run, :orig_run
+          remove_method :orig_run
+        end
+
+        RSpec::Mocks.space = orig_space
+      end
+
+      class Sandbox
+        attr_reader :proxies
+
+        def initialize
+          @proxies = Set.new
+        end
+
+        def verify_all
+          @proxies.each { |p| p.verify }
+        end
+
+        def reset_all
+          @proxies.each { |p| p.reset }
+        end
+      end
+
+      def initialize
+        @sandbox_stack = []
+        super
+      end
+
+      def sandboxed
+        @sandbox_stack << Sandbox.new
+        yield
+      ensure
+        @sandbox_stack.pop
+      end
+
+      def verify_all
+        return super unless sandbox = @sandbox_stack.last
+        sandbox.verify_all
+      end
+
+      def reset_all
+        return super unless sandbox = @sandbox_stack.last
+        sandbox.reset_all
+      end
+
+      def proxy_for(object)
+        new_proxy = !proxies.has_key?(object.__id__)
+        proxy = super
+
+        if new_proxy && sandbox = @sandbox_stack.last
+          sandbox.proxies << proxy
+        end
+
+        proxy
+      end
+    end
+  end
+end
+
diff --git a/rspec-core/spec/support/shared_example_groups.rb b/rspec-core/spec/support/shared_example_groups.rb
new file mode 100644
index 0000000..6b913a3
--- /dev/null
+++ b/rspec-core/spec/support/shared_example_groups.rb
@@ -0,0 +1,41 @@
+shared_examples_for "metadata hash builder" do
+  context "when RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values is set to true" do
+    let(:hash) { metadata_hash(:foo, :bar, :bazz => 23) }
+
+    before(:each) do
+      RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = true }
+    end
+
+    it 'treats symbols as metadata keys with a true value' do
+      expect(hash[:foo]).to be(true)
+      expect(hash[:bar]).to be(true)
+    end
+
+    it 'still processes hash values normally' do
+      expect(hash[:bazz]).to be(23)
+    end
+  end
+
+  context "when RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values is set to false" do
+    let(:warning_receiver) { Kernel }
+
+    before(:each) do
+      RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = false }
+      warning_receiver.stub(:warn)
+    end
+
+    it 'prints a deprecation warning about any symbols given as arguments' do
+      warning_receiver.should_receive(:warn).with(/In RSpec 3, these symbols will be treated as metadata keys/)
+      metadata_hash(:foo, :bar, :key => 'value')
+    end
+
+    it 'does not treat symbols as metadata keys' do
+      expect(metadata_hash(:foo, :bar, :key => 'value')).not_to include(:foo, :bar)
+    end
+
+    it 'does not print a warning if there are no symbol arguments' do
+      warning_receiver.should_not_receive(:warn)
+      metadata_hash(:foo => 23, :bar => 17)
+    end
+  end
+end
diff --git a/rspec-core/spec/support/spec_files.rb b/rspec-core/spec/support/spec_files.rb
new file mode 100644
index 0000000..c2724f7
--- /dev/null
+++ b/rspec-core/spec/support/spec_files.rb
@@ -0,0 +1,44 @@
+shared_context "spec files" do
+  def failing_spec_filename
+    @failing_spec_filename ||= File.expand_path(File.dirname(__FILE__)) + "/_failing_spec.rb"
+  end
+
+  def passing_spec_filename
+    @passing_spec_filename ||= File.expand_path(File.dirname(__FILE__)) + "/_passing_spec.rb"
+  end
+
+  def create_passing_spec_file
+    File.open(passing_spec_filename, 'w') do |f|
+      f.write %q{
+        describe "passing spec" do
+          it "passes" do
+            expect(1).to eq(1)
+          end
+        end
+      }
+    end
+  end
+
+  def create_failing_spec_file
+    File.open(failing_spec_filename, 'w') do |f|
+      f.write %q{
+        describe "failing spec" do
+          it "fails" do
+            expect(1).to eq(2)
+          end
+        end
+      }
+    end
+  end
+
+  before(:all) do
+    create_passing_spec_file
+    create_failing_spec_file
+  end
+
+  after(:all) do
+    File.delete(passing_spec_filename)
+    File.delete(failing_spec_filename)
+  end
+
+end
diff --git a/rspec-expectations/Changelog.md b/rspec-expectations/Changelog.md
new file mode 100644
index 0000000..d233ea6
--- /dev/null
+++ b/rspec-expectations/Changelog.md
@@ -0,0 +1,399 @@
+### 2.14.2 / 2013-08-14
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.1...v2.14.2)
+
+Bug fixes
+
+* Fix `be_<predicate>` matcher to not support operator chaining like the
+  `be` matcher does (e.g. `be == 5`). This led to some odd behaviors
+  since `be_<predicate> == anything` returned a `BeComparedTo` matcher
+  and was thus always truthy. This was a consequence of the implementation
+  (e.g. subclassing the basic `Be` matcher) and was not intended behavior.
+  (Myron Marston).
+* Fix `change` matcher to compare using `==` in addition to `===`. This
+  is important for an expression like:
+  `expect {}.to change { a.class }.from(ClassA).to(ClassB)` because
+  `SomeClass === SomeClass` returns false. (Myron Marston)
+
+### 2.14.1 / 2013-08-08
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0...2.14.1)
+
+Bug fixes
+
+* Ensure diff output uses the same encoding as the encoding of
+  the string being diff'd to prevent `Encoding::UndefinedConversionError`
+  errors (Jon Rowe).
+
+### 2.14.0 / 2013-07-06
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.14.0.rc1...v2.14.0)
+
+Bug fixes
+
+* Values that are not matchers use `#inspect`, rather than `#description` for
+  documentation output (Andy Lindeman, Sam Phippen).
+* Make `expect(a).to be_within(x).percent_of(y)` work with negative y
+  (Katsuhiko Nishimra).
+* Make the `be_predicate` matcher work as expected used with `expect{...}.to
+  change...`  (Sam Phippen).
+
+### 2.14.0.rc1 / 2013-05-27
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.13.0...v2.14.0.rc1)
+
+Enhancements
+
+* Enhance `yield_control` so that you can specify an exact or relative
+  number of times: `expect { }.to yield_control.exactly(3).times`,
+  `expect { }.to yield_control.at_least(2).times`, etc (Bartek
+  Borkowski).
+* Make the differ that is used when an expectation fails better handle arrays
+  by splitting each element of the array onto its own line. (Sam Phippen)
+* Accept duck-typed strings that respond to `:to_str` as expectation messages.
+  (Toby Ovod-Everett)
+
+Bug fixes
+
+* Fix differ to not raise errors when dealing with differently-encoded
+  strings (Jon Rowe).
+* Fix `expect(something).to be_within(x).percent_of(y)` where x and y are both
+  integers (Sam Phippen).
+* Fix `have` matcher to handle the fact that on ruby 2.0,
+  `Enumerator#size` may return nil (Kenta Murata).
+* Fix `expect { raise s }.to raise_error(s)` where s is an error instance
+  on ruby 2.0 (Sam Phippen).
+* Fix `expect(object).to raise_error` passing. This now warns the user and
+  fails the spec (tomykaira).
+
+Deprecations
+
+* Deprecate `expect { }.not_to raise_error(SpecificErrorClass)` or
+  `expect { }.not_to raise_error("some specific message")`. Using
+  these was prone to hiding failures as they would allow _any other
+  error_ to pass. (Sam Phippen and David Chelimsky)
+
+### 2.13.0 / 2013-02-23
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.1...v2.13.0)
+
+Enhancements
+
+* Add support for percent deltas to `be_within` matcher:
+  `expect(value).to be_within(10).percent_of(expected)`
+  (Myron Marston).
+* Add support to `include` matcher to allow it to be given a list
+  of matchers as the expecteds to match against (Luke Redpath).
+
+Bug fixes
+
+* Fix `change` matcher so that it dups strings in order to handle
+  mutated strings (Myron Marston).
+* Fix `should be =~ /some regex/` / `expect(...).to be =~ /some regex/`.
+  Previously, these either failed with a confusing `undefined method
+  matches?' for false:FalseClass` error or were no-ops that didn't
+  actually verify anything (Myron Marston).
+* Add compatibility for diff-lcs 1.2 and relax the version
+  constraint (Peter Goldstein).
+* Fix DSL-generated matchers to allow multiple instances of the
+  same matcher in the same example to have different description
+  and failure messages based on the expected value (Myron Marston).
+* Prevent `undefined method #split for Array` error when dumping
+  the diff of an array of multiline strings (Myron Marston).
+* Don't blow up when comparing strings that are in an encoding
+  that is not ASCII compatible (Myron Marston).
+* Remove confusing "Check the implementation of #==" message
+  printed for empty diffs (Myron Marston).
+
+### 2.12.1 / 2012-12-15
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.12.0...v2.12.1)
+
+Bug fixes
+
+* Improve the failure message for an expression like
+  `{}.should =~ {}`. (Myron Marston and Andy Lindeman)
+* Provide a `match_regex` alias so that custom matchers
+  built using the matcher DSL can use it (since `match`
+  is a different method in that context).
+  (Steven Harman)
+
+### 2.12.0 / 2012-11-12
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.3...v2.12.0)
+
+Enhancements
+
+* Colorize diffs if the `--color` option is configured. (Alex Coplan)
+* Include backtraces in unexpected errors handled by `raise_error`
+  matcher (Myron Marston)
+* Print a warning when users accidentally pass a non-string argument
+  as an expectation message (Sam Phippen)
+* `=~` and `match_array` matchers output a more useful error message when
+  the actual value is not an array (or an object that responds to `#to_ary`)
+  (Sam Phippen)
+
+Bug fixes
+
+* Fix `include` matcher so that `expect({}).to include(:a => nil)`
+  fails as it should (Sam Phippen).
+* Fix `be_an_instance_of` matcher so that `Class#to_s` is used in the
+  description rather than `Class#inspect`, since some classes (like
+  `ActiveRecord::Base`) define a long, verbose `#inspect`.
+  (Tom Stuart)
+
+### 2.11.3 / 2012-09-04
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.2...v2.11.3)
+
+Bug fixes
+
+* Fix (and deprecate) `expect { }.should` syntax so that it works even
+  though it was never a documented or intended syntax. It worked as a
+  consequence of the implementation of `expect` in RSpec 2.10 and
+  earlier. (Myron Marston)
+* Ensure #== is defined on built in matchers so that they can be composed.
+  For example:
+
+    expect {
+      user.emailed!
+    }.to change { user.last_emailed_at }.to be_within(1.second).of(Time.zone.now)
+
+### 2.11.2 / 2012-07-25
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.1...v2.11.2)
+
+Bug fixes
+
+* Define `should` and `should_not` on `Object` rather than `BasicObject`
+  on MacRuby. On MacRuby, `BasicObject` is defined but is not the root
+  of the object hierarchy. (Gabriel Gilder)
+
+### 2.11.1 / 2012-07-08
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.11.0...v2.11.1)
+
+Bug fixes
+
+* Constrain `actual` in `be_within` matcher to values that respond to `-` instead
+  of requiring a specific type.
+    * `Time`, for example, is a legit alternative.
+
+### 2.11.0 / 2012-07-07
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.10.0...v2.11.0)
+
+Enhancements
+
+* Expand `expect` syntax so that it supports expections on bare values
+  in addition to blocks (Myron Marston).
+* Add configuration options to control available expectation syntaxes
+  (Myron Marston):
+  * `RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :expect }`
+  * `RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :should }`
+  * `RSpec.configuration.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }`
+  * `RSpec.configuration.add_should_and_should_not_to Delegator`
+
+Bug fixes
+
+* Allow only `Numeric` values to be the "actual" in the `be_within` matcher.
+  This prevents confusing error messages. (Su Zhang @zhangsu)
+* Define `should` and `should_not` on `BasicObject` rather than `Kernel`
+  on 1.9. This makes `should` and `should_not` work properly with
+  `BasicObject`-subclassed proxy objects like `Delegator`. (Myron
+  Marston)
+
+### 2.10.0 / 2012-05-03
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.1...v2.10.0)
+
+Enhancements
+
+* Add new `start_with` and `end_with` matchers (Jeremy Wadsack)
+* Add new matchers for specifying yields (Myron Marston):
+    * `expect {...}.to yield_control`
+    * `expect {...}.to yield_with_args(1, 2, 3)`
+    * `expect {...}.to yield_with_no_args`
+    * `expect {...}.to yield_successive_args(1, 2, 3)`
+* `match_unless_raises` takes multiple exception args
+
+Bug fixes
+
+* Fix `be_within` matcher to be inclusive of delta.
+* Fix message-specific specs to pass on Rubinius (John Firebaugh)
+
+### 2.9.1 / 2012-04-03
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.9.0...v2.9.1)
+
+Bug fixes
+
+* Provide a helpful message if the diff between two objects is empty.
+* Fix bug diffing single strings with multiline strings.
+* Fix for error with using custom matchers inside other custom matchers
+  (mirasrael)
+* Fix using execution context methods in nested DSL matchers (mirasrael)
+
+### 2.9.0 / 2012-03-17
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0...v2.9.0)
+
+Enhancements
+
+* Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution
+  of RSpec::Matchers (which is included in every example).
+* Autoload files with matcher classes to improve load time.
+
+Bug fixes
+
+* Align `respond_to?` and `method_missing` in DSL-defined matchers.
+* Clear out user-defined instance variables between invocations of DSL-defined
+  matchers.
+* Dup the instance of a DSL generated matcher so its state is not changed by
+  subsequent invocations.
+* Treat expected args consistently across positive and negative expectations
+  (thanks to Ralf Kistner for the heads up)
+
+### 2.8.0 / 2012-01-04
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc2...v2.8.0)
+
+Enhancements
+
+* Better diff output for Hash (Philippe Creux)
+* Eliminate Ruby warnings (Olek Janiszewski)
+
+### 2.8.0.rc2 / 2011-12-19
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.8.0.rc1...v2.8.0.rc2)
+
+No changes for this release. Just releasing with the other rspec gems.
+
+### 2.8.0.rc1 / 2011-11-06
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.7.0...v2.8.0.rc1)
+
+Enhancements
+
+* Use classes for the built-in matchers (they're faster).
+* Eliminate Ruby warnings (Matijs van Zuijlen)
+
+### 2.7.0 / 2011-10-16
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.6.0...v2.7.0)
+
+Enhancements
+
+* `HaveMatcher` converts argument using `to_i` (Alex Bepple & Pat Maddox)
+* Improved failure message for the `have_xxx` matcher (Myron Marston)
+* `HaveMatcher` supports `count` (Matthew Bellantoni)
+* Change matcher dups `Enumerable` before the action, supporting custom
+  `Enumerable` types like `CollectionProxy` in Rails (David Chelimsky)
+
+Bug fixes
+
+* Fix typo in `have(n).xyz` documentation (Jean Boussier)
+* fix `safe_sort` for ruby 1.9.2 (`Kernel` now defines `<=>` for Object) (Peter
+  van Hardenberg)
+
+### 2.6.0 / 2011-05-12
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.5.0...v2.6.0)
+
+Enhancements
+
+* `change` matcher accepts regexps (Robert Davis)
+* better descriptions for `have_xxx` matchers (Magnus Bergmark)
+* `range.should cover(*values)` (Anders Furseth)
+
+Bug fixes
+
+* Removed non-ascii characters that were choking rcov (Geoffrey Byers)
+* change matcher dups arrays and hashes so their before/after states can be
+  compared correctly.
+* Fix the order of inclusion of RSpec::Matchers in Test::Unit::TestCase and
+  MiniTest::Unit::TestCase to prevent a SystemStackError (Myron Marston)
+
+### 2.5.0 / 2011-02-05
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.4.0...v2.5.0)
+
+Enhancements
+
+* `should exist` works with `exist?` or `exists?` (Myron Marston)
+* `expect { ... }.not_to do_something` (in addition to `to_not`)
+
+Documentation
+
+* improved docs for raise_error matcher (James Almond)
+
+### 2.4.0 / 2011-01-02
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.3.0...v2.4.0)
+
+No functional changes in this release, which was made to align with the
+rspec-core-2.4.0 release.
+
+Enhancements
+
+* improved RDoc for change matcher (Jo Liss)
+
+### 2.3.0 / 2010-12-12
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.2.1...v2.3.0)
+
+Enhancements
+
+* diff strings when include matcher fails (Mike Sassak)
+
+### 2.2.0 / 2010-11-28
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.1.0...v2.2.0)
+
+### 2.1.0 / 2010-11-07
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.1...v2.1.0)
+
+Enhancements
+
+* `be_within(delta).of(expected)` matcher (Myron Marston)
+* Lots of new Cucumber features (Myron Marston)
+* Raise error if you try `should != expected` on Ruby-1.9 (Myron Marston)
+* Improved failure messages from `throw_symbol` (Myron Marston)
+
+Bug fixes
+
+* Eliminate hard dependency on `RSpec::Core` (Myron Marston)
+* `have_matcher` - use pluralize only when ActiveSupport inflections are indeed
+  defined (Josep M Bach)
+* throw_symbol matcher no longer swallows exceptions (Myron Marston)
+* fix matcher chaining to avoid name collisions (Myron Marston)
+
+### 2.0.0 / 2010-10-10
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.rc...v2.0.0)
+
+Enhancements
+
+* Add match_for_should_not method to matcher DSL (Myron Marston)
+
+Bug fixes
+
+* `respond_to` matcher works correctly with `should_not` with multiple methods
+  (Myron Marston)
+* `include` matcher works correctly with `should_not` with multiple values
+  (Myron Marston)
+
+### 2.0.0.rc / 2010-10-05
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.22...v2.0.0.rc)
+
+Enhancements
+
+* `require 'rspec/expectations'` in a T::U or MiniUnit suite (Josep M. Bach)
+
+Bug fixes
+
+* change by 0 passes/fails correctly (Len Smith)
+* Add description to satisfy matcher
+
+### 2.0.0.beta.22 / 2010-09-12
+
+[full changelog](http://github.com/rspec/rspec-expectations/compare/v2.0.0.beta.20...v2.0.0.beta.22)
+
+Enhancements
+
+* diffing improvements
+    * diff multiline strings
+    * don't diff single line strings
+    * don't diff numbers (silly)
+    * diff regexp + multiline string
+
+Bug fixes
+    * `should[_not]` change now handles boolean values correctly
diff --git a/License.txt b/rspec-expectations/License.txt
similarity index 95%
copy from License.txt
copy to rspec-expectations/License.txt
index 02bc06c..84edafa 100644
--- a/License.txt
+++ b/rspec-expectations/License.txt
@@ -1,6 +1,5 @@
 (The MIT License)
 
-Copyright (c) 2009 Chad Humphries, David Chelimsky
 Copyright (c) 2006 David Chelimsky, The RSpec Development Team
 Copyright (c) 2005 Steven Baker
 
diff --git a/rspec-expectations/README.md b/rspec-expectations/README.md
new file mode 100644
index 0000000..1d375d4
--- /dev/null
+++ b/rspec-expectations/README.md
@@ -0,0 +1,184 @@
+# RSpec Expectations [![Build Status](https://secure.travis-ci.org/rspec/rspec-expectations.png?branch=master)](http://travis-ci.org/rspec/rspec-expectations) [![Code Climate](https://codeclimate.com/github/rspec/rspec-expectations.png)](https://codeclimate.com/github/rspec/rspec-expectations)
+
+RSpec::Expectations lets you express expected outcomes on an object in an
+example.
+
+    expect(account.balance).to eq(Money.new(37.42, :USD))
+
+## Install
+
+If you want to use rspec-expectations with rspec, just install the rspec gem
+and RubyGems will also install rspec-expectations for you (along with
+rspec-core and rspec-mocks):
+
+    gem install rspec
+
+If you want to use rspec-expectations with another tool, like Test::Unit,
+Minitest, or Cucumber, you can install it directly:
+
+    gem install rspec-expectations
+
+## Basic usage
+
+Here's an example using rspec-core:
+
+```ruby
+describe Order do
+  it "sums the prices of the items in its line items" do
+    order = Order.new
+    order.add_entry(LineItem.new(:item => Item.new(
+      :price => Money.new(1.11, :USD)
+    )))
+    order.add_entry(LineItem.new(:item => Item.new(
+      :price => Money.new(2.22, :USD),
+      :quantity => 2
+    )))
+    expect(order.total).to eq(Money.new(5.55, :USD))
+  end
+end
+```
+
+The `describe` and `it` methods come from rspec-core.  The `Order`, `LineItem`, `Item` and `Money` classes would be from _your_ code. The last line of the example
+expresses an expected outcome. If `order.total == Money.new(5.55, :USD)`, then
+the example passes. If not, it fails with a message like:
+
+    expected: #<Money @value=5.55 @currency=:USD>
+         got: #<Money @value=1.11 @currency=:USD>
+
+## Built-in matchers
+
+### Equivalence
+
+```ruby
+expect(actual).to eq(expected)  # passes if actual == expected
+expect(actual).to eql(expected) # passes if actual.eql?(expected)
+```
+
+Note: The new `expect` syntax no longer supports `==` matcher.
+
+### Identity
+
+```ruby
+expect(actual).to be(expected)    # passes if actual.equal?(expected)
+expect(actual).to equal(expected) # passes if actual.equal?(expected)
+```
+
+### Comparisons
+
+```ruby
+expect(actual).to be >  expected
+expect(actual).to be >= expected
+expect(actual).to be <= expected
+expect(actual).to be <  expected
+expect(actual).to be_within(delta).of(expected)
+```
+
+### Regular expressions
+
+```ruby
+expect(actual).to match(/expression/)
+```
+
+Note: The new `expect` syntax no longer supports `=~` matcher.
+
+### Types/classes
+
+```ruby
+expect(actual).to be_an_instance_of(expected)
+expect(actual).to be_a_kind_of(expected)
+```
+
+### Truthiness
+
+```ruby
+expect(actual).to be_true  # passes if actual is truthy (not nil or false)
+expect(actual).to be_false # passes if actual is falsy (nil or false)
+expect(actual).to be_nil   # passes if actual is nil
+```
+
+### Expecting errors
+
+```ruby
+expect { ... }.to raise_error
+expect { ... }.to raise_error(ErrorClass)
+expect { ... }.to raise_error("message")
+expect { ... }.to raise_error(ErrorClass, "message")
+```
+
+### Expecting throws
+
+```ruby
+expect { ... }.to throw_symbol
+expect { ... }.to throw_symbol(:symbol)
+expect { ... }.to throw_symbol(:symbol, 'value')
+```
+
+### Yielding
+
+```ruby
+expect { |b| 5.tap(&b) }.to yield_control # passes regardless of yielded args
+
+expect { |b| yield_if_true(true, &b) }.to yield_with_no_args # passes only if no args are yielded
+
+expect { |b| 5.tap(&b) }.to yield_with_args(5)
+expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum)
+expect { |b| "a string".tap(&b) }.to yield_with_args(/str/)
+
+expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
+expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+```
+
+### Predicate matchers
+
+```ruby
+expect(actual).to be_xxx         # passes if actual.xxx?
+expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
+```
+
+### Ranges (Ruby >= 1.9 only)
+
+```ruby
+expect(1..10).to cover(3)
+```
+
+### Collection membership
+
+```ruby
+expect(actual).to include(expected)
+expect(actual).to start_with(expected)
+expect(actual).to end_with(expected)
+```
+
+#### Examples
+
+```ruby
+expect([1,2,3]).to include(1)
+expect([1,2,3]).to include(1, 2)
+expect([1,2,3]).to start_with(1)
+expect([1,2,3]).to start_with(1,2)
+expect([1,2,3]).to end_with(3)
+expect([1,2,3]).to end_with(2,3)
+expect({:a => 'b'}).to include(:a => 'b')
+expect("this string").to include("is str")
+expect("this string").to start_with("this")
+expect("this string").to end_with("ring")
+```
+
+## `should` syntax
+
+In addition to the `expect` syntax, rspec-expectations continues to support the
+`should` syntax:
+
+```ruby
+actual.should eq expected
+actual.should be > 3
+[1, 2, 3].should_not include 4
+```
+
+See [detailed information on the `should` syntax and its usage.](https://github.com/rspec/rspec-expectations/blob/master/Should.md)
+
+## Also see
+
+* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
+* [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)
+* [http://github.com/rspec/rspec-mocks](http://github.com/rspec/rspec-mocks)
diff --git a/rspec-expectations/features/README.md b/rspec-expectations/features/README.md
new file mode 100644
index 0000000..ee19128
--- /dev/null
+++ b/rspec-expectations/features/README.md
@@ -0,0 +1,48 @@
+rspec-expectations is used to define expected outcomes.
+
+    describe Account do
+      it "has a balance of zero when first created" do
+        expect(Account.new.balance).to eq(Money.new(0))
+      end
+    end
+
+## Basic structure
+
+The basic structure of an rspec expectation is:
+
+    expect(actual).to matcher(expected)
+    expect(actual).not_to matcher(expected)
+
+Note: You can also use `expect(..).to_not` instead of `expect(..).not_to`.
+      One is an alias to the other, so you can use whichever reads better to you.
+
+#### Examples
+
+    expect(5).to eq(5)
+    expect(5).not_to eq(4)
+
+## What is a matcher?
+
+A Matcher is any object that responds to the following methods:
+
+    matches?(actual)
+    failure_message_for_should
+
+These methods are also part of the matcher protocol, but are optional:
+
+    does_not_match?(actual)
+    failure_message_for_should_not
+    description
+
+RSpec ships with a number of built-in matchers and a DSL for writing custom
+matchers.
+
+## Issues
+
+The documentation for rspec-expectations is a work in progress. We'll be adding
+Cucumber features over time, and clarifying existing ones.  If you have
+specific features you'd like to see added, find the existing documentation
+incomplete or confusing, or, better yet, wish to write a missing Cucumber
+feature yourself, please [submit an
+issue](http://github.com/rspec/rspec-expectations/issues) or a [pull
+request](http://github.com/rspec/rspec-expectations).
diff --git a/rspec-expectations/features/Upgrade.md b/rspec-expectations/features/Upgrade.md
new file mode 100644
index 0000000..d45cf39
--- /dev/null
+++ b/rspec-expectations/features/Upgrade.md
@@ -0,0 +1,53 @@
+# Upgrade to rspec-expectations-2.0
+
+## What's new
+
+### New `eq` matcher.
+
+`RSpec::Matchers` now offers you two approaches to differentiating between
+object identity. You can use the rspec-1 approach:
+
+    actual.should == expected     # object equality
+    actual.should equal(expected) # object identity
+
+... or, if you prefer:
+
+    actual.should eq(expected) # object equality
+    actual.should be(expected) # object identity
+
+## What's been removed
+
+### simple_matcher
+
+Use RSpec::Matchers.define instead. For example, if you had:
+
+    def eat_cheese
+      simple_matcher("eat cheese") do |actual|
+        actual.eat?(:cheese)
+      end
+    end
+
+Change it to:
+
+    RSpec::Matchers.define :eat_cheese do
+      match do |actual|
+        actual.eat?(:cheese)
+      end
+    end
+
+### wrap_expectation
+
+Use RSpec::Matchers.define instead.
+
+    RSpec::Matchers.define :eat_cheese do
+      match do |actual|
+        actual.should eat?(:cheese)
+      end
+    end
+
+    RSpec::Matchers.define :eat_cheese do
+      include MyCheesyAssertions
+      match_unless_raises Test::Unit::AssertionFailedError do |actual|
+        assert_eats_chesse actual
+      end
+    end
diff --git a/rspec-expectations/features/built_in_matchers/README.md b/rspec-expectations/features/built_in_matchers/README.md
new file mode 100644
index 0000000..6c654cc
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/README.md
@@ -0,0 +1,90 @@
+# Built-in Matchers
+
+rspec-expectations ships with a number of built-in matchers.
+Each matcher can be used with `expect(..).to` or `expect(..).not_to` to define
+positive and negative expectations respectively on an object. Most matchers can
+also be accessed using the `(...).should` and `(...).should_not` syntax, see
+[using should syntax](https://github.com/rspec/rspec-expectations/blob/master/Should.md)
+for why we recommend using `expect`.
+
+e.g.
+
+    expect(result).to   eq(3)
+    expect(list).not_to be_empty
+    pi.should be > 3
+
+## Object identity
+
+    expect(actual).to be(expected) # passes if actual.equal?(expected)
+
+## Object equivalence
+
+    expect(actual).to eq(expected) # passes if actual == expected
+
+## Optional APIs for identity/equivalence
+
+    expect(actual).to eql(expected)   # passes if actual.eql?(expected)
+    expect(actual).to equal(expected) # passes if actual.equal?(expected)
+
+    # NOTE: `expect` does not support `==` matcher.
+
+## Comparisons
+
+    expect(actual).to be >  expected
+    expect(actual).to be >= expected
+    expect(actual).to be <= expected
+    expect(actual).to be <  expected
+    expect(actual).to match(/expression/)
+    expect(actual).to be_within(delta).of(expected)
+
+    # NOTE: `expect` does not support `=~` matcher.
+
+## Types/classes
+
+    expect(actual).to be_instance_of(expected)
+    expect(actual).to be_kind_of(expected)
+
+## Truthiness and existentialism
+
+    expect(actual).to be_true  # passes if actual is truthy (not nil or false)
+    expect(actual).to be_false # passes if actual is falsy (nil or false)
+    expect(actual).to be_nil   # passes if actual is nil
+    expect(actual).to be       # passes if actual is truthy (not nil or false)
+
+## Expecting errors
+
+    expect { ... }.to raise_error
+    expect { ... }.to raise_error(ErrorClass)
+    expect { ... }.to raise_error("message")
+    expect { ... }.to raise_error(ErrorClass, "message")
+
+## Expecting throws
+
+    expect { ... }.to throw_symbol
+    expect { ... }.to throw_symbol(:symbol)
+    expect { ... }.to throw_symbol(:symbol, 'value')
+
+## Predicate matchers
+
+    expect(actual).to be_xxx         # passes if actual.xxx?
+    expect(actual).to have_xxx(:arg) # passes if actual.has_xxx?(:arg)
+
+### Examples
+
+    expect([]).to      be_empty
+    expect(:a => 1).to have_key(:a)
+
+## Collection membership
+
+    expect(actual).to include(expected)
+
+### Examples
+
+    expect([1,2,3]).to       include(1)
+    expect([1,2,3]).to       include(1, 2)
+    expect(:a => 'b').to     include(:a => 'b')
+    expect("this string").to include("is str")
+
+## Ranges (1.9 only)
+
+    expect(1..10).to cover(3)
diff --git a/rspec-expectations/features/built_in_matchers/be.feature b/rspec-expectations/features/built_in_matchers/be.feature
new file mode 100644
index 0000000..b138a30
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/be.feature
@@ -0,0 +1,175 @@
+Feature: "be" matchers
+
+  There are several related "be" matchers:
+
+    ```ruby
+    obj.should be_true  # passes if obj is truthy (not nil or false)
+    obj.should be_false # passes if obj is falsy (nil or false)
+    obj.should be_nil   # passes if obj is nil
+    obj.should be       # passes if obj is truthy (not nil or false)
+    ```
+
+  Scenario: be_true matcher
+    Given a file named "be_true_spec.rb" with:
+      """ruby
+      describe "be_true matcher" do
+        specify { true.should be_true }
+        specify { 7.should be_true }
+        specify { "foo".should be_true }
+        specify { nil.should_not be_true }
+        specify { false.should_not be_true }
+
+        # deliberate failures
+        specify { true.should_not be_true }
+        specify { 7.should_not be_true }
+        specify { "foo".should_not be_true }
+        specify { nil.should be_true }
+        specify { false.should be_true }
+      end
+      """
+    When I run `rspec be_true_spec.rb`
+    Then the output should contain "10 examples, 5 failures"
+    And the output should contain:
+      """
+             expected: non-true value
+                  got: true
+      """
+    And the output should contain:
+      """
+             expected: non-true value
+                  got: 7
+      """
+    And the output should contain:
+      """
+             expected: non-true value
+                  got: "foo"
+      """
+    And the output should contain:
+      """
+             expected: true value
+                  got: nil
+      """
+    And the output should contain:
+      """
+             expected: true value
+                  got: false
+      """
+
+  Scenario: be_false matcher
+    Given a file named "be_false_spec.rb" with:
+      """ruby
+      describe "be_false matcher" do
+        specify { nil.should be_false }
+        specify { false.should be_false }
+        specify { true.should_not be_false }
+        specify { 7.should_not be_false }
+        specify { "foo".should_not be_false }
+
+        # deliberate failures
+        specify { nil.should_not be_false }
+        specify { false.should_not be_false }
+        specify { true.should be_false }
+        specify { 7.should be_false }
+        specify { "foo".should be_false }
+      end
+      """
+    When I run `rspec be_false_spec.rb`
+    Then the output should contain "10 examples, 5 failures"
+    And the output should contain:
+      """
+             expected: non-false value
+                  got: nil
+      """
+    And the output should contain:
+      """
+             expected: non-false value
+                  got: false
+      """
+    And the output should contain:
+      """
+             expected: false value
+                  got: true
+      """
+    And the output should contain:
+      """
+             expected: false value
+                  got: 7
+      """
+    And the output should contain:
+      """
+             expected: false value
+                  got: "foo"
+      """
+
+  Scenario: be_nil matcher
+    Given a file named "be_nil_spec.rb" with:
+      """ruby
+      describe "be_nil matcher" do
+        specify { nil.should be_nil }
+        specify { false.should_not be_nil }
+        specify { true.should_not be_nil }
+        specify { 7.should_not be_nil }
+        specify { "foo".should_not be_nil }
+
+        # deliberate failures
+        specify { nil.should_not be_nil }
+        specify { false.should be_nil }
+        specify { true.should be_nil }
+        specify { 7.should be_nil }
+        specify { "foo".should be_nil }
+      end
+      """
+    When I run `rspec be_nil_spec.rb`
+    Then the output should contain "10 examples, 5 failures"
+    And the output should contain:
+      """
+             expected: not nil
+                  got: nil
+      """
+    And the output should contain:
+      """
+             expected: nil
+                  got: false
+      """
+    And the output should contain:
+      """
+             expected: nil
+                  got: true
+      """
+    And the output should contain:
+      """
+             expected: nil
+                  got: 7
+      """
+    And the output should contain:
+      """
+             expected: nil
+                  got: "foo"
+      """
+
+  Scenario: be matcher
+    Given a file named "be_spec.rb" with:
+      """ruby
+      describe "be_matcher" do
+        specify { true.should be }
+        specify { 7.should be }
+        specify { "foo".should be }
+        specify { nil.should_not be }
+        specify { false.should_not be }
+
+        # deliberate failures
+        specify { true.should_not be }
+        specify { 7.should_not be }
+        specify { "foo".should_not be }
+        specify { nil.should be }
+        specify { false.should be }
+      end
+      """
+    When I run `rspec be_spec.rb`
+    Then the output should contain all of these:
+      | 10 examples, 5 failures             |
+      | expected true to evaluate to false  |
+      | expected 7 to evaluate to false     |
+      | expected "foo" to evaluate to false |
+      | expected nil to evaluate to true    |
+      | expected false to evaluate to true  |
diff --git a/rspec-expectations/features/built_in_matchers/be_within.feature b/rspec-expectations/features/built_in_matchers/be_within.feature
new file mode 100644
index 0000000..c9d5ada
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/be_within.feature
@@ -0,0 +1,48 @@
+Feature: be_within matcher
+
+  Normal equality expectations do not work well for floating point values.
+  Consider this irb session:
+
+      > radius = 3
+        => 3
+      > area_of_circle = radius * radius * Math::PI
+        => 28.2743338823081
+      > area_of_circle == 28.2743338823081
+        => false
+
+  Instead, you should use the be_within matcher to check that the value
+  is within a delta of your expected value:
+
+    ```ruby
+    area_of_circle.should be_within(0.1).of(28.3)
+    ```
+
+  Note that the difference between the actual and expected values must be
+  smaller than your delta; if it is equal, the matcher will fail.
+
+  Scenario: basic usage
+    Given a file named "be_within_matcher_spec.rb" with:
+      """ruby
+      describe 27.5 do
+        it { should be_within(0.5).of(27.9) }
+        it { should be_within(0.5).of(28.0) }
+        it { should be_within(0.5).of(27.1) }
+        it { should be_within(0.5).of(27.0) }
+
+        it { should_not be_within(0.5).of(28.1) }
+        it { should_not be_within(0.5).of(26.9) }
+
+        # deliberate failures
+        it { should_not be_within(0.5).of(28) }
+        it { should_not be_within(0.5).of(27) }
+        it { should be_within(0.5).of(28.1) }
+        it { should be_within(0.5).of(26.9) }
+      end
+      """
+    When I run `rspec be_within_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 10 examples, 4 failures                     |
+      | expected 27.5 not to be within 0.5 of 28   |
+      | expected 27.5 not to be within 0.5 of 27   |
+      | expected 27.5 to be within 0.5 of 28.1     |
+      | expected 27.5 to be within 0.5 of 26.9     |
diff --git a/rspec-expectations/features/built_in_matchers/cover.feature b/rspec-expectations/features/built_in_matchers/cover.feature
new file mode 100644
index 0000000..c4d6815
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/cover.feature
@@ -0,0 +1,47 @@
+ at ruby-1.9
+Feature: cover matcher
+
+  Use the cover matcher to specify that a range covers one or more
+  expected objects.  This works on any object that responds to #cover?  (such
+  as a Range):
+
+    ```ruby
+    (1..10).should cover(5)
+    (1..10).should cover(4, 6)
+    (1..10).should_not cover(11)
+    ```
+
+  Scenario: range usage
+    Given a file named "range_cover_matcher_spec.rb" with:
+      """ruby
+      describe (1..10) do
+        it { should cover(4) }
+        it { should cover(6) }
+        it { should cover(8) }
+        it { should cover(4, 6) }
+        it { should cover(4, 6, 8) }
+        it { should_not cover(11) }
+        it { should_not cover(11, 12) }
+
+        # deliberate failures
+        it { should cover(11) }
+        it { should_not cover(4) }
+        it { should_not cover(6) }
+        it { should_not cover(8) }
+        it { should_not cover(4, 6, 8) }
+
+        # both of these should fail since it covers 5 but not 11
+        it { should cover(5, 11) }
+        it { should_not cover(5, 11) }
+      end
+      """
+    When I run `rspec range_cover_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 14 examples, 7 failures                 |
+      | expected 1..10 to cover 11              |
+      | expected 1..10 not to cover 4           |
+      | expected 1..10 not to cover 6           |
+      | expected 1..10 not to cover 8           |
+      | expected 1..10 not to cover 4, 6, and 8 |
+      | expected 1..10 to cover 5 and 11        |
+      | expected 1..10 not to cover 5 and 11    |
diff --git a/rspec-expectations/features/built_in_matchers/end_with.feature b/rspec-expectations/features/built_in_matchers/end_with.feature
new file mode 100644
index 0000000..b4a6d06
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/end_with.feature
@@ -0,0 +1,48 @@
+Feature: end_with matcher
+
+  Use the `end_with` matcher to specify that a string or array ends with the
+  expected characters or elements.
+
+    ```ruby
+    "this string".should end_with "string"
+    "this string".should_not end_with "stringy"
+    [0, 1, 2].should end_with 1, 2
+    ```
+
+  Scenario: string usage
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "this string" do
+        it { should end_with "string" }
+        it { should_not end_with "stringy" }
+
+        # deliberate failures
+        it { should_not end_with "string" }
+        it { should end_with "stringy" }
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures                          |
+      | expected "this string" not to end with "string" |
+      | expected "this string" to end with "stringy"    |
+
+  Scenario: array usage
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe [0, 1, 2, 3, 4] do
+        it { should end_with 4 }
+        it { should end_with 3, 4 }
+        it { should_not end_with 3 }
+        it { should_not end_with 0, 1, 2, 3, 4, 5 }
+
+        # deliberate failures
+        it { should_not end_with 4 }
+        it { should end_with 3 }
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain all of these:
+      | 6 examples, 2 failures                     |
+      | expected [0, 1, 2, 3, 4] not to end with 4 |
+      | expected [0, 1, 2, 3, 4] to end with 3     |
diff --git a/rspec-expectations/features/built_in_matchers/equality.feature b/rspec-expectations/features/built_in_matchers/equality.feature
new file mode 100644
index 0000000..4133032
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/equality.feature
@@ -0,0 +1,139 @@
+Feature: equality matchers
+
+  Ruby exposes several different methods for handling equality:
+
+      a.equal?(b) # object identity - a and b refer to the same object
+      a.eql?(b)   # object equivalence - a and b have the same value
+      a == b      # object equivalence - a and b have the same value with type conversions
+
+  Note that these descriptions are guidelines but are not forced by the
+  language. Any object can implement any of these methods with its own
+  semantics.
+
+  rspec-expectations ships with matchers that align with each of these methods:
+
+    ```ruby
+    a.should equal(b) # passes if a.equal?(b)
+    a.should eql(b)   # passes if a.eql?(b)
+    a.should == b     # passes if a == b
+    ```
+
+  It also ships with two matchers that have more of a DSL feel to them:
+
+    ```ruby
+    a.should be(b) # passes if a.equal?(b)
+    a.should eq(b) # passes if a == b
+    ```
+
+  These are a useful pair if you wish to avoid the warning that Ruby emits on
+  `a.should == b`
+
+  Scenario: compare using eq (==)
+    Given a file named "compare_using_eq.rb" with:
+      """ruby
+      describe "a string" do
+        it "is equal to another string of the same value" do
+          "this string".should eq("this string")
+        end
+
+        it "is not equal to another string of a different value" do
+          "this string".should_not eq("a different string")
+        end
+      end
+
+      describe "an integer" do
+        it "is equal to a float of the same value" do
+          5.should eq(5.0)
+        end
+      end
+      """
+    When I run `rspec compare_using_eq.rb`
+    Then the output should contain "3 examples, 0 failures"
+
+  Scenario: compare using ==
+    Given a file named "compare_using_==.rb" with:
+      """ruby
+      describe "a string" do
+        it "is equal to another string of the same value" do
+          "this string".should == "this string"
+        end
+
+        it "is not equal to another string of a different value" do
+          "this string".should_not == "a different string"
+        end
+      end
+
+      describe "an integer" do
+        it "is equal to a float of the same value" do
+          5.should == 5.0
+        end
+      end
+      """
+    When I run `rspec compare_using_==.rb`
+    Then the output should contain "3 examples, 0 failures"
+
+  Scenario: compare using eql (eql?)
+    Given a file named "compare_using_eql.rb" with:
+      """ruby
+      describe "an integer" do
+        it "is equal to another integer of the same value" do
+          5.should eql(5)
+        end
+
+        it "is not equal to another integer of a different value" do
+          5.should_not eql(6)
+        end
+
+        it "is not equal to a float of the same value" do
+          5.should_not eql(5.0)
+        end
+
+      end
+      """
+    When I run `rspec compare_using_eql.rb`
+    Then the output should contain "3 examples, 0 failures"
+
+  Scenario: compare using equal (equal?)
+    Given a file named "compare_using_equal.rb" with:
+      """ruby
+      describe "a string" do
+        it "is equal to itself" do
+          string = "this string"
+          string.should equal(string)
+        end
+
+        it "is not equal to another string of the same value" do
+          "this string".should_not equal("this string")
+        end
+
+        it "is not equal to another string of a different value" do
+          "this string".should_not equal("a different string")
+        end
+
+      end
+      """
+    When I run `rspec compare_using_equal.rb`
+    Then the output should contain "3 examples, 0 failures"
+
+  Scenario: compare using be (equal?)
+    Given a file named "compare_using_be.rb" with:
+      """ruby
+      describe "a string" do
+        it "is equal to itself" do
+          string = "this string"
+          string.should be(string)
+        end
+
+        it "is not equal to another string of the same value" do
+          "this string".should_not be("this string")
+        end
+
+        it "is not equal to another string of a different value" do
+          "this string".should_not be("a different string")
+        end
+
+      end
+      """
+    When I run `rspec compare_using_be.rb`
+    Then the output should contain "3 examples, 0 failures"
+
diff --git a/rspec-expectations/features/built_in_matchers/exist.feature b/rspec-expectations/features/built_in_matchers/exist.feature
new file mode 100644
index 0000000..424958f
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/exist.feature
@@ -0,0 +1,45 @@
+Feature: exist matcher
+
+  The exist matcher is used to specify that something exists
+  (as indicated by #exist? or #exists?):
+
+    ```ruby
+    obj.should exist # passes if obj.exist? or obj.exists?
+    ```
+
+  Scenario: basic usage
+    Given a file named "exist_matcher_spec.rb" with:
+      """ruby
+      class Planet
+        attr_reader :name
+
+        def initialize(name)
+          @name = name
+        end
+
+        def inspect
+          "<Planet: #{name}>"
+        end
+
+        def exist? # also works with exists?
+          %w[Mercury Venus Earth Mars Jupiter Saturn Uranus Neptune].include?(name)
+        end
+      end
+
+      describe "Earth" do
+        let(:earth) { Planet.new("Earth") }
+        specify { earth.should exist }
+        specify { earth.should_not exist } # deliberate failure
+      end
+
+      describe "Tatooine" do
+        let(:tatooine) { Planet.new("Tatooine") }
+        it { tatooine.should exist } # deliberate failure
+        it { tatooine.should_not exist }
+      end
+      """
+    When I run `rspec exist_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures                |
+      | expected <Planet: Earth> not to exist |
+      | expected <Planet: Tatooine> to exist  |
diff --git a/rspec-expectations/features/built_in_matchers/expect_change.feature b/rspec-expectations/features/built_in_matchers/expect_change.feature
new file mode 100644
index 0000000..35cc396
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/expect_change.feature
@@ -0,0 +1,59 @@
+Feature: expect change
+
+  Expect the execution of a block of code to change the state of an object.
+
+  Background:
+    Given a file named "lib/counter.rb" with:
+      """ruby
+      class Counter
+        class << self
+          def increment
+            @count ||= 0
+            @count += 1
+          end
+
+          def count
+            @count ||= 0
+          end
+        end
+      end
+      """
+
+  Scenario: expect change
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "counter"
+
+      describe Counter, "#increment" do
+        it "should increment the count" do
+          expect { Counter.increment }.to change{Counter.count}.from(0).to(1)
+        end
+
+        # deliberate failure
+        it "should increment the count by 2" do
+          expect { Counter.increment }.to change{Counter.count}.by(2)
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should contain "1 failure"
+    Then the output should contain "should have been changed by 2, but was changed by 1"
+
+  Scenario: expect no change
+    Given a file named "spec/example_spec.rb" with:
+      """ruby
+      require "counter"
+
+      describe Counter, "#increment" do
+        it "should not increment the count by 1 (using not_to)" do
+          expect { Counter.increment }.not_to change{Counter.count}
+        end
+
+        it "should not increment the count by 1 (using to_not)" do
+          expect { Counter.increment }.to_not change{Counter.count}
+        end
+      end
+      """
+    When I run `rspec spec/example_spec.rb`
+    Then the output should contain "2 failures"
+    Then the output should contain "should not have changed, but did change from 1 to 2"
diff --git a/rspec-expectations/features/built_in_matchers/expect_error.feature b/rspec-expectations/features/built_in_matchers/expect_error.feature
new file mode 100644
index 0000000..2b1f550
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/expect_error.feature
@@ -0,0 +1,144 @@
+Feature: raise_error matcher
+
+  Use the `raise_error` matcher to specify that a block of code raises an
+  error. The most basic form passes if any error is thrown:
+
+    ```ruby
+    expect { raise StandardError }.to raise_error
+    ```
+
+  You can use `raise_exception` instead if you prefer that wording:
+
+    ```ruby
+    expect { 3 / 0 }.to raise_exception
+    ```
+
+  `raise_error` and `raise_exception` are functionally interchangeable, so use
+  the one that makes the most sense to you in any given context.
+
+  In addition to the basic form, above, there are a number of ways to specify
+  details of an error/exception:
+
+    ```ruby
+    expect { raise "oops" }.to raise_error
+    expect { raise "oops" }.to raise_error(RuntimeError)
+    expect { raise "oops" }.to raise_error("oops")
+    expect { raise "oops" }.to raise_error(/op/)
+    expect { raise "oops" }.to raise_error(RuntimeError, "oops")
+    expect { raise "oops" }.to raise_error(RuntimeError, /op/)
+    ```
+
+  Scenario: expect any error
+    Given a file named "example_spec" with:
+      """
+      describe "calling a missing method" do
+        it "raises" do
+          expect { Object.new.foo }.to raise_error
+        end
+      end
+      """
+    When I run `rspec example_spec`
+    Then the example should pass
+
+  Scenario: expect specific error
+    Given a file named "example_spec" with:
+      """
+      describe "calling a missing method" do
+        it "raises" do
+          expect { Object.new.foo }.to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec example_spec`
+    Then the example should pass
+
+  Scenario: match message with a string
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "matching error message with string" do
+        it "matches the error message" do
+          expect { raise StandardError, 'this message exactly'}.
+            to raise_error('this message exactly')
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the example should pass
+
+  Scenario: match message with a regexp
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "matching error message with regex" do
+        it "matches the error message" do
+          expect { raise StandardError, "my message" }.
+            to raise_error(/my mess/)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the example should pass
+
+  Scenario: match type + message with string
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "matching error message with string" do
+        it "matches the error message" do
+          expect { raise StandardError, 'this message exactly'}.
+            to raise_error(StandardError, 'this message exactly')
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the example should pass
+
+  Scenario: match type + message with regexp
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "matching error message with regex" do
+        it "matches the error message" do
+          expect { raise StandardError, "my message" }.
+            to raise_error(StandardError, /my mess/)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the example should pass
+
+  Scenario: set expectations on error object passed to block
+    Given a file named "example_spec" with:
+      """
+      describe "#foo" do
+        it "raises NameError" do
+          expect { Object.new.foo }.to raise_error { |error|
+            error.should be_a(NameError)
+          }
+        end
+      end
+      """
+      When I run `rspec example_spec`
+      Then the example should pass
+
+  Scenario: expect no occurence of a specific error
+    Given a file named "example_spec" with:
+      """
+      describe Object, "#public_instance_methods" do
+        it "does not raise" do
+          expect { Object.public_instance_methods }.
+            not_to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec example_spec`
+    Then the example should pass
+
+  Scenario: expect no error at all
+    Given a file named "example_spec" with:
+      """
+      describe "#to_s" do
+        it "does not raise" do
+          expect { Object.new.to_s }.not_to raise_error
+        end
+      end
+      """
+    When I run `rspec example_spec`
+    Then the example should pass
diff --git a/rspec-expectations/features/built_in_matchers/have.feature b/rspec-expectations/features/built_in_matchers/have.feature
new file mode 100644
index 0000000..c4fcab9
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/have.feature
@@ -0,0 +1,109 @@
+Feature: have(n).items matcher
+
+  RSpec provides several matchers that make it easy to set expectations about the
+  size of a collection.  There are three basic forms:
+
+    ```ruby
+    collection.should have(x).items
+    collection.should have_at_least(x).items
+    collection.should have_at_most(x).items
+    ```
+
+  In addition, #have_exactly is provided as an alias to #have.
+
+  These work on any collection-like object--the object just needs to respond to #size
+  or #length (or both).  When the matcher is called directly on a collection object,
+  the #items call is pure syntactic sugar.  You can use anything you want here.  These
+  are equivalent:
+
+    ```ruby
+    collection.should have(x).items
+    collection.should have(x).things
+    ```
+
+  You can also use this matcher on a non-collection object that returns a collection
+  from one of its methods.  For example, Dir#entries returns an array, so you could
+  set an expectation using the following:
+
+    ```ruby
+    Dir.new("my/directory").should have(7).entries
+    ```
+
+  Scenario: have(x).items on a collection
+    Given a file named "have_items_spec.rb" with:
+      """ruby
+      describe [1, 2, 3] do
+        it { should have(3).items }
+        it { should_not have(2).items }
+        it { should_not have(4).items }
+
+        it { should have_exactly(3).items }
+        it { should_not have_exactly(2).items }
+        it { should_not have_exactly(4).items }
+
+        it { should have_at_least(2).items }
+        it { should have_at_most(4).items }
+
+        # deliberate failures
+        it { should_not have(3).items }
+        it { should have(2).items }
+        it { should have(4).items }
+
+        it { should_not have_exactly(3).items }
+        it { should have_exactly(2).items }
+        it { should have_exactly(4).items }
+
+        it { should have_at_least(4).items }
+        it { should have_at_most(2).items }
+      end
+      """
+     When I run `rspec have_items_spec.rb`
+     Then the output should contain "16 examples, 8 failures"
+      And the output should contain "expected target not to have 3 items, got 3"
+      And the output should contain "expected 2 items, got 3"
+      And the output should contain "expected 4 items, got 3"
+      And the output should contain "expected at least 4 items, got 3"
+      And the output should contain "expected at most 2 items, got 3"
+
+  Scenario: have(x).words on a String when String#words is defined
+    Given a file named "have_words_spec.rb" with:
+      """ruby
+      class String
+        def words
+          split(' ')
+        end
+      end
+
+      describe "a sentence with some words" do
+        it { should have(5).words }
+        it { should_not have(4).words }
+        it { should_not have(6).words }
+
+        it { should have_exactly(5).words }
+        it { should_not have_exactly(4).words }
+        it { should_not have_exactly(6).words }
+
+        it { should have_at_least(4).words }
+        it { should have_at_most(6).words }
+
+        # deliberate failures
+        it { should_not have(5).words }
+        it { should have(4).words }
+        it { should have(6).words }
+
+        it { should_not have_exactly(5).words }
+        it { should have_exactly(4).words }
+        it { should have_exactly(6).words }
+
+        it { should have_at_least(6).words }
+        it { should have_at_most(4).words }
+      end
+      """
+     When I run `rspec have_words_spec.rb`
+     Then the output should contain "16 examples, 8 failures"
+      And the output should contain "expected target not to have 5 words, got 5"
+      And the output should contain "expected 4 words, got 5"
+      And the output should contain "expected 6 words, got 5"
+      And the output should contain "expected at least 6 words, got 5"
+      And the output should contain "expected at most 4 words, got 5"
+
diff --git a/rspec-expectations/features/built_in_matchers/include.feature b/rspec-expectations/features/built_in_matchers/include.feature
new file mode 100644
index 0000000..773d217
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/include.feature
@@ -0,0 +1,174 @@
+Feature: include matcher
+
+  Use the include matcher to specify that a collection includes one or more
+  expected objects.  This works on any object that responds to #include?  (such
+  as a string or array):
+
+    ```ruby
+    "a string".should include("a")
+    "a string".should include("str")
+    "a string".should include("str", "g")
+    "a string".should_not include("foo")
+
+    [1, 2].should include(1)
+    [1, 2].should include(1, 2)
+    [1, 2].should_not include(17)
+    ```
+
+  The matcher also provides flexible handling for hashes:
+
+    ```ruby
+    {:a => 1, :b => 2}.should include(:a)
+    {:a => 1, :b => 2}.should include(:a, :b)
+    {:a => 1, :b => 2}.should include(:a => 1)
+    {:a => 1, :b => 2}.should include(:b => 2, :a => 1)
+    {:a => 1, :b => 2}.should_not include(:c)
+    {:a => 1, :b => 2}.should_not include(:a => 2)
+    {:a => 1, :b => 2}.should_not include(:c => 3)
+    ```
+
+  Scenario: array usage
+    Given a file named "array_include_matcher_spec.rb" with:
+      """ruby
+      describe [1, 3, 7] do
+        it { should include(1) }
+        it { should include(3) }
+        it { should include(7) }
+        it { should include(1, 7) }
+        it { should include(1, 3, 7) }
+        it { should_not include(17) }
+        it { should_not include(43, 100) }
+
+        # deliberate failures
+        it { should include(4) }
+        it { should_not include(1) }
+        it { should_not include(3) }
+        it { should_not include(7) }
+        it { should_not include(1, 3, 7) }
+
+        # both of these should fail since it includes 1 but not 9
+        it { should include(1, 9) }
+        it { should_not include(1, 9) }
+      end
+      """
+    When I run `rspec array_include_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 14 examples, 7 failures                       |
+      | expected [1, 3, 7] to include 4               |
+      | expected [1, 3, 7] not to include 1           |
+      | expected [1, 3, 7] not to include 3           |
+      | expected [1, 3, 7] not to include 7           |
+      | expected [1, 3, 7] not to include 1, 3, and 7 |
+      | expected [1, 3, 7] to include 1 and 9         |
+      | expected [1, 3, 7] not to include 1 and 9     |
+
+  Scenario: string usage
+    Given a file named "string_include_matcher_spec.rb" with:
+      """ruby
+      describe "a string" do
+        it { should include("str") }
+        it { should include("a", "str", "ng") }
+        it { should_not include("foo") }
+        it { should_not include("foo", "bar") }
+
+        # deliberate failures
+        it { should include("foo") }
+        it { should_not include("str") }
+        it { should include("str", "foo") }
+        it { should_not include("str", "foo") }
+      end
+      """
+    When I run `rspec string_include_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures                             |
+      | expected "a string" to include "foo"               |
+      | expected "a string" not to include "str"           |
+      | expected "a string" to include "str" and "foo"     |
+      | expected "a string" not to include "str" and "foo" |
+
+  Scenario: hash usage
+    Given a file named "hash_include_matcher_spec.rb" with:
+      """ruby
+      describe Hash do
+        subject { { :a => 7, :b => 5 } }
+
+        it { should include(:a) }
+        it { should include(:b, :a) }
+        it { should include(:a => 7) }
+        it { should include(:b => 5, :a => 7) }
+        it { should_not include(:c) }
+        it { should_not include(:c, :d) }
+        it { should_not include(:d => 2) }
+        it { should_not include(:a => 5) }
+        it { should_not include(:b => 7, :a => 5) }
+
+        # deliberate failures
+        it { should_not include(:a) }
+        it { should_not include(:b, :a) }
+        it { should_not include(:a => 7) }
+        it { should_not include(:a => 7, :b => 5) }
+        it { should include(:c) }
+        it { should include(:c, :d) }
+        it { should include(:d => 2) }
+        it { should include(:a => 5) }
+        it { should include(:a => 5, :b => 7) }
+
+        # Mixed cases--the hash includes one but not the other.
+        # All 4 of these cases should fail.
+        it { should include(:a, :d) }
+        it { should_not include(:a, :d) }
+        it { should include(:a => 7, :d => 3) }
+        it { should_not include(:a => 7, :d => 3) }
+      end
+      """
+    When I run `rspec hash_include_matcher_spec.rb`
+    Then the output should contain "13 failure"
+
+  Scenario: fuzzy usage with matchers
+    Given a file named "fuzzy_include_matcher_spec.rb" with:
+      """
+      require 'ostruct'
+
+      class User < OpenStruct
+        def inspect
+          name
+        end
+      end
+
+      RSpec::Matchers.define :a_user_named do |expected|
+        match do |actual|
+          actual.is_a?(User) && (actual.name == expected)
+        end
+        description do
+          "a user named '#{expected}'"
+        end
+      end
+
+      describe "Collection of users" do
+        subject do
+          [User.new(:name => "Joe"),
+           User.new(:name => "Fred"),
+           User.new(:name => "John"),
+           User.new(:name => "Luke"),
+           User.new(:name => "David")]
+        end
+
+        it { should include( a_user_named "Joe" ) }
+        it { should include( a_user_named "Luke" ) }
+        it { should_not include( a_user_named "Richard" ) }
+        it { should_not include( a_user_named "Hayley" ) }
+
+        # deliberate failures
+        it { should include( a_user_named "Richard" ) }
+        it { should_not include( a_user_named "Fred" ) }
+        it { should include( a_user_named "Sarah" ) }
+        it { should_not include( a_user_named "Luke" ) }
+      end
+      """
+    When I run `rspec fuzzy_include_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures                                                     |
+      | expected [Joe, Fred, John, Luke, David] to include a user named 'Richard'  |
+      | expected [Joe, Fred, John, Luke, David] not to include a user named 'Fred' |
+      | expected [Joe, Fred, John, Luke, David] to include a user named 'Sarah'    |
+      | expected [Joe, Fred, John, Luke, David] not to include a user named 'Luke' |
diff --git a/rspec-expectations/features/built_in_matchers/match.feature b/rspec-expectations/features/built_in_matchers/match.feature
new file mode 100644
index 0000000..72a6158
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/match.feature
@@ -0,0 +1,52 @@
+Feature: match matcher
+
+  The match matcher calls #match on the object, passing if #match returns a
+  truthy (not false or nil) value.  Regexp and String both provide a #match
+  method.
+
+    ```ruby
+    "a string".should match(/str/) # passes
+    "a string".should match(/foo/) # fails
+    /foo/.should match("food")     # passes
+    /foo/.should match("drinks")   # fails
+    ```
+
+  This is equivalent to using the =~ matcher (see the operator matchers
+  feature for more details).
+
+  Scenario: string usage
+    Given a file named "string_match_spec.rb" with:
+      """ruby
+      describe "a string" do
+        it { should match(/str/) }
+        it { should_not match(/foo/) }
+
+        # deliberate failures
+        it { should_not match(/str/) }
+        it { should match(/foo/) }
+      end
+      """
+    When I run `rspec string_match_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures                 |
+      | expected "a string" not to match /str/ |
+      | expected "a string" to match /foo/     |
+
+  Scenario: regular expression usage
+    Given a file named "regexp_match_spec.rb" with:
+      """ruby
+      describe /foo/ do
+        it { should match("food") }
+        it { should_not match("drinks") }
+
+        # deliberate failures
+        it { should_not match("food") }
+        it { should match("drinks") }
+      end
+      """
+    When I run `rspec regexp_match_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures             |
+      | expected /foo/ not to match "food" |
+      | expected /foo/ to match "drinks"   |
+
diff --git a/rspec-expectations/features/built_in_matchers/operators.feature b/rspec-expectations/features/built_in_matchers/operators.feature
new file mode 100644
index 0000000..2a95ad2
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/operators.feature
@@ -0,0 +1,227 @@
+Feature: operator matchers
+
+  RSpec provides a number of matchers that are based on Ruby's built-in
+  operators. These pretty much work like you expect. For example, each of these
+  pass:
+
+    ```ruby
+    7.should == 7
+    [1, 2, 3].should == [1, 2, 3]
+    "this is a string".should =~ /^this/
+    "this is a string".should_not =~ /^that/
+    String.should === "this is a string"
+    ```
+
+  You can also use comparison operators combined with the "be" matcher like
+  this:
+
+    ```ruby
+    37.should be < 100
+    37.should be <= 38
+    37.should be >= 2
+    37.should be > 7
+    ```
+
+  RSpec also provides a `=~` matcher for arrays that disregards differences in
+  the ording between the actual and expected array.  For example:
+
+    ```ruby
+    [1, 2, 3].should =~ [2, 3, 1] # pass
+    [:a, :c, :b].should =~ [:a, :c] # fail
+    ```
+
+  Scenario: numeric operator matchers
+    Given a file named "numeric_operator_matchers_spec.rb" with:
+      """ruby
+      describe 18 do
+        it { should == 18 }
+        it { should be < 20 }
+        it { should be > 15 }
+        it { should be <= 19 }
+        it { should be >= 17 }
+
+        it { should_not == 28 }
+
+        # deliberate failures
+        it { should == 28 }
+        it { should be < 15 }
+        it { should be > 20 }
+        it { should be <= 17 }
+        it { should be >= 19 }
+
+        it { should_not == 18 }
+      end
+      """
+     When I run `rspec numeric_operator_matchers_spec.rb`
+     Then the output should contain "12 examples, 6 failures"
+      And the output should contain:
+      """
+           Failure/Error: it { should == 28 }
+             expected: 28
+                  got: 18 (using ==)
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be < 15 }
+             expected: < 15
+                  got:   18
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be > 20 }
+             expected: > 20
+                  got:   18
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be <= 17 }
+             expected: <= 17
+                  got:    18
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be >= 19 }
+             expected: >= 19
+                  got:    18
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should_not == 18 }
+             expected not: == 18
+                      got:    18
+      """
+
+  Scenario: string operator matchers
+    Given a file named "string_operator_matchers_spec.rb" with:
+      """ruby
+      describe "Strawberry" do
+        it { should == "Strawberry" }
+        it { should be < "Tomato" }
+        it { should be > "Apple" }
+        it { should be <= "Turnip" }
+        it { should be >= "Banana" }
+        it { should =~ /berry/ }
+
+        it { should_not == "Peach" }
+        it { should_not =~ /apple/ }
+
+        it "reports that it is a string using ===" do
+          String.should === subject
+        end
+
+        # deliberate failures
+        it { should == "Peach" }
+        it { should be < "Cranberry" }
+        it { should be > "Zuchini" }
+        it { should be <= "Potato" }
+        it { should be >= "Tomato" }
+        it { should =~ /apple/ }
+
+        it { should_not == "Strawberry" }
+        it { should_not =~ /berry/ }
+
+        it "fails a spec asserting that it is a symbol" do
+          Symbol.should === subject
+        end
+      end
+      """
+     When I run `rspec string_operator_matchers_spec.rb`
+     Then the output should contain "18 examples, 9 failures"
+      And the output should contain:
+      """
+           Failure/Error: it { should == "Peach" }
+             expected: "Peach"
+                  got: "Strawberry" (using ==)
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be < "Cranberry" }
+             expected: < "Cranberry"
+                  got:   "Strawberry"
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be > "Zuchini" }
+             expected: > "Zuchini"
+                  got:   "Strawberry"
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be <= "Potato" }
+             expected: <= "Potato"
+                  got:    "Strawberry"
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should be >= "Tomato" }
+             expected: >= "Tomato"
+                  got:    "Strawberry"
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should =~ /apple/ }
+             expected: /apple/
+                  got: "Strawberry" (using =~)
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should_not == "Strawberry" }
+             expected not: == "Strawberry"
+                      got:    "Strawberry"
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should_not =~ /berry/ }
+             expected not: =~ /berry/
+                      got:    "Strawberry"
+      """
+      And the output should contain:
+      """
+           Failure/Error: Symbol.should === subject
+             expected: "Strawberry"
+                  got: Symbol (using ===)
+      """
+
+  Scenario: array operator matchers
+    Given a file named "array_operator_matchers_spec.rb" with:
+      """ruby
+      describe [1, 2, 3] do
+        it { should == [1, 2, 3] }
+        it { should_not == [1, 3, 2] }
+
+        it { should =~ [1, 2, 3] }
+        it { should =~ [1, 3, 2] }
+        it { should =~ [2, 1, 3] }
+        it { should =~ [2, 3, 1] }
+        it { should =~ [3, 1, 2] }
+        it { should =~ [3, 2, 1] }
+
+        # deliberate failures
+        it { should_not == [1, 2, 3] }
+        it { should == [1, 3, 2] }
+        it { should =~ [1, 2, 1] }
+      end
+      """
+     When I run `rspec array_operator_matchers_spec.rb`
+     Then the output should contain "11 examples, 3 failures"
+      And the output should contain:
+      """
+           Failure/Error: it { should_not == [1, 2, 3] }
+             expected not: == [1, 2, 3]
+                      got:    [1, 2, 3]
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should == [1, 3, 2] }
+             expected: [1, 3, 2]
+                  got: [1, 2, 3] (using ==)
+      """
+      And the output should contain:
+      """
+           Failure/Error: it { should =~ [1, 2, 1] }
+             expected collection contained:  [1, 1, 2]
+             actual collection contained:    [1, 2, 3]
+             the missing elements were:      [1]
+             the extra elements were:        [3]
+      """
+
diff --git a/rspec-expectations/features/built_in_matchers/predicates.feature b/rspec-expectations/features/built_in_matchers/predicates.feature
new file mode 100644
index 0000000..8654133
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/predicates.feature
@@ -0,0 +1,137 @@
+Feature: predicate matchers
+
+  Ruby objects commonly provide predicate methods:
+
+    ```ruby
+    7.zero?                  # => false
+    0.zero?                  # => true
+    [1].empty?               # => false
+    [].empty?                # => true
+    { :a => 5 }.has_key?(:b) # => false
+    { :b => 5 }.has_key?(:b) # => true
+    ```
+
+  You could use a basic equality matcher to set expectations on these:
+
+    ```ruby
+    7.zero?.should == true # fails with "expected true, got false (using ==)"
+    ```
+
+  ...but RSpec provides dynamic predicate matchers that are more readable and
+  provide better failure output.
+
+  For any predicate method, RSpec gives you a corresponding matcher.  Simply
+  prefix the method with `be_` and remove the question mark.  Examples:
+
+    ```ruby
+    7.should_not be_zero       # calls 7.zero?
+    [].should be_empty         # calls [].empty?
+    x.should be_multiple_of(3) # calls x.multiple_of?(3)
+    ```
+
+  Alternately, for a predicate method that begins with `has_` like
+  `Hash#has_key?`, RSpec allows you to use an alternate form since `be_has_key`
+  makes no sense.
+
+    ```ruby
+    hash.should have_key(:foo)       # calls hash.has_key?(:foo)
+    array.should_not have_odd_values # calls array.has_odd_values?
+    ```
+
+  In either case, RSpec provides nice, clear error messages, such as:
+
+    `expected zero? to return true, got false`
+
+  Any arguments passed to the matcher will be passed on to the predicate method.
+
+  Scenario: should be_zero (based on Fixnum#zero?)
+    Given a file named "should_be_zero_spec.rb" with:
+      """ruby
+      describe 0 do
+        it { should be_zero }
+      end
+
+      describe 7 do
+        it { should be_zero } # deliberate failure
+      end
+      """
+    When I run `rspec should_be_zero_spec.rb`
+    Then the output should contain "2 examples, 1 failure"
+     And the output should contain "expected zero? to return true, got false"
+
+  Scenario: should_not be_empty (based on Array#empty?)
+    Given a file named "should_not_be_empty_spec.rb" with:
+      """ruby
+      describe [1, 2, 3] do
+        it { should_not be_empty }
+      end
+
+      describe [] do
+        it { should_not be_empty } # deliberate failure
+      end
+      """
+    When I run `rspec should_not_be_empty_spec.rb`
+    Then the output should contain "2 examples, 1 failure"
+     And the output should contain "expected empty? to return false, got true"
+
+   Scenario: should have_key (based on Hash#has_key?)
+    Given a file named "should_have_key_spec.rb" with:
+      """ruby
+      describe Hash do
+        subject { { :foo => 7 } }
+        it { should have_key(:foo) }
+        it { should have_key(:bar) } # deliberate failure
+      end
+      """
+    When I run `rspec should_have_key_spec.rb`
+    Then the output should contain "2 examples, 1 failure"
+     And the output should contain "expected #has_key?(:bar) to return true, got false"
+
+   Scenario: should_not have_all_string_keys (based on custom #has_all_string_keys? method)
+     Given a file named "should_not_have_all_string_keys_spec.rb" with:
+       """ruby
+       class Hash
+         def has_all_string_keys?
+           keys.all? { |k| String === k }
+         end
+       end
+
+       describe Hash do
+         context 'with symbol keys' do
+           subject { { :foo => 7, :bar => 5 } }
+           it { should_not have_all_string_keys }
+         end
+
+         context 'with string keys' do
+           subject { { 'foo' => 7, 'bar' => 5 } }
+           it { should_not have_all_string_keys } # deliberate failure
+         end
+       end
+       """
+     When I run `rspec should_not_have_all_string_keys_spec.rb`
+     Then the output should contain "2 examples, 1 failure"
+      And the output should contain "expected #has_all_string_keys? to return false, got true"
+
+   Scenario: matcher arguments are passed on to the predicate method
+     Given a file named "predicate_matcher_argument_spec.rb" with:
+       """ruby
+       class Fixnum
+         def multiple_of?(x)
+           (self % x).zero?
+         end
+       end
+
+       describe 12 do
+         it { should be_multiple_of(3) }
+         it { should_not be_multiple_of(7) }
+
+         # deliberate failures
+         it { should_not be_multiple_of(4) }
+         it { should be_multiple_of(5) }
+       end
+       """
+     When I run `rspec predicate_matcher_argument_spec.rb`
+     Then the output should contain "4 examples, 2 failures"
+      And the output should contain "expected multiple_of?(4) to return false, got true"
+      And the output should contain "expected multiple_of?(5) to return true, got false"
+
diff --git a/rspec-expectations/features/built_in_matchers/respond_to.feature b/rspec-expectations/features/built_in_matchers/respond_to.feature
new file mode 100644
index 0000000..b759845
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/respond_to.feature
@@ -0,0 +1,84 @@
+Feature: respond_to matcher
+
+  Use the respond_to matcher to specify details of an object's interface.  In
+  its most basic form:
+
+    ```ruby
+    obj.should respond_to(:foo) # pass if obj.respond_to?(:foo)
+    ```
+
+  You can specify that an object responds to multiple messages in a single
+  statement with multiple arguments passed to the matcher:
+
+    ```ruby
+    obj.should respond_to(:foo, :bar) # passes if obj.respond_to?(:foo) && obj.respond_to?(:bar)
+    ```
+
+  If the number of arguments accepted by the method is important to you,
+  you can specify that as well:
+
+    ```ruby
+    obj.should respond_to(:foo).with(1).argument
+    obj.should respond_to(:bar).with(2).arguments
+    ```
+
+  Note that this matcher relies entirely upon #respond_to?.  If an object
+  dynamically responds to a message via #method_missing, but does not indicate
+  this via #respond_to?, then this matcher will give you false results.
+
+  Scenario: basic usage
+    Given a file named "respond_to_matcher_spec.rb" with:
+      """ruby
+      describe "a string" do
+        it { should respond_to(:length) }
+        it { should respond_to(:hash, :class, :to_s) }
+        it { should_not respond_to(:to_model) }
+        it { should_not respond_to(:compact, :flatten) }
+
+        # deliberate failures
+        it { should respond_to(:to_model) }
+        it { should respond_to(:compact, :flatten) }
+        it { should_not respond_to(:length) }
+        it { should_not respond_to(:hash, :class, :to_s) }
+
+        # mixed examples--String responds to :length but not :flatten
+        # both specs should fail
+        it { should respond_to(:length, :flatten) }
+        it { should_not respond_to(:length, :flatten) }
+      end
+      """
+    When I run `rspec respond_to_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 10 examples, 6 failures                                    |
+      | expected "a string" to respond to :to_model                |
+      | expected "a string" to respond to :compact, :flatten       |
+      | expected "a string" not to respond to :length              |
+      | expected "a string" not to respond to :hash, :class, :to_s |
+      | expected "a string" to respond to :flatten                 |
+      | expected "a string" not to respond to :length              |
+
+  Scenario: specify arguments
+    Given a file named "respond_to_matcher_argument_checking_spec.rb" with:
+      """ruby
+      describe 7 do
+        it { should respond_to(:zero?).with(0).arguments }
+        it { should_not respond_to(:zero?).with(1).argument }
+
+        it { should respond_to(:between?).with(2).arguments }
+        it { should_not respond_to(:between?).with(7).arguments }
+
+        # deliberate failures
+        it { should respond_to(:zero?).with(1).argument }
+        it { should_not respond_to(:zero?).with(0).arguments }
+
+        it { should respond_to(:between?).with(7).arguments }
+        it { should_not respond_to(:between?).with(2).arguments }
+      end
+      """
+    When I run `rspec respond_to_matcher_argument_checking_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures                                  |
+      | expected 7 to respond to :zero? with 1 argument         |
+      | expected 7 not to respond to :zero? with 0 arguments    |
+      | expected 7 to respond to :between? with 7 arguments     |
+      | expected 7 not to respond to :between? with 2 arguments |
diff --git a/rspec-expectations/features/built_in_matchers/satisfy.feature b/rspec-expectations/features/built_in_matchers/satisfy.feature
new file mode 100644
index 0000000..538f026
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/satisfy.feature
@@ -0,0 +1,33 @@
+Feature: satisfy matcher
+
+  The satisfy matcher is extremely flexible and can handle almost anything
+  you want to specify.  It passes if the block you provide returns true:
+
+    ```ruby
+    10.should satisfy { |v| v % 5 == 0 }
+    7.should_not satisfy { |v| v % 5 == 0 }
+    ```
+
+  This flexibility comes at a cost, however: the failure message
+  ("expected [actual] to satisfy block") is not very descriptive
+  or helpful.  You will usually be better served by using one of
+  the other built-in matchers, or writing a custom matcher.
+
+  Scenario: basic usage
+    Given a file named "satisfy_matcher_spec.rb" with:
+      """ruby
+      describe 10 do
+        it { should satisfy { |v| v > 5 } }
+        it { should_not satisfy { |v| v > 15 } }
+
+        # deliberate failures
+        it { should_not satisfy { |v| v > 5 } }
+        it { should satisfy { |v| v > 15 } }
+      end
+      """
+    When I run `rspec satisfy_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures           |
+      | expected 10 not to satisfy block |
+      | expected 10 to satisfy block     |
+
diff --git a/rspec-expectations/features/built_in_matchers/start_with.feature b/rspec-expectations/features/built_in_matchers/start_with.feature
new file mode 100644
index 0000000..ca41685
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/start_with.feature
@@ -0,0 +1,48 @@
+Feature: start_with matcher
+
+  Use the `start_with` matcher to specify that a string or array starts with
+  the expected characters or elements.
+
+    ```ruby
+    "this string".should start_with("this")
+    "this string".should_not start_with("that")
+    [0,1,2].should start_with(0, 1)
+    ```
+
+  Scenario: with a string
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "this string" do
+        it { should start_with "this" }
+        it { should_not start_with "that" }
+
+        # deliberate failures
+        it { should_not start_with "this" }
+        it { should start_with "that" }
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures                          |
+      | expected "this string" not to start with "this" |
+      | expected "this string" to start with "that"     |
+
+  Scenario: with an array
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe [0, 1, 2, 3, 4] do
+        it { should start_with 0 }
+        it { should start_with(0, 1)}
+        it { should_not start_with(2) }
+        it { should_not start_with(0, 1, 2, 3, 4, 5) }
+
+        # deliberate failures
+        it { should_not start_with 0 }
+        it { should start_with 3 }
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain all of these:
+      | 6 examples, 2 failures                       |
+      | expected [0, 1, 2, 3, 4] not to start with 0 |
+      | expected [0, 1, 2, 3, 4] to start with 3     |
diff --git a/rspec-expectations/features/built_in_matchers/throw_symbol.feature b/rspec-expectations/features/built_in_matchers/throw_symbol.feature
new file mode 100644
index 0000000..281c09c
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/throw_symbol.feature
@@ -0,0 +1,91 @@
+Feature: throw_symbol matcher
+
+  The throw_symbol matcher is used to specify that a block of code
+  throws a symbol.  The most basic form passes if any symbol is thrown:
+
+    ```ruby
+    expect { throw :foo }.to throw_symbol
+    ```
+
+  You'll often want to specify that a particular symbol is thrown:
+
+    ```ruby
+    expect { throw :foo }.to throw_symbol(:foo)
+    ```
+
+  If you care about the additional argument given to throw, you can
+  specify that as well:
+
+    ```ruby
+    expect { throw :foo, 7 }.to throw_symbol(:foo, 7)
+    ```
+
+  Scenario: basic usage
+    Given a file named "throw_symbol_matcher_spec.rb" with:
+      """ruby
+      describe "throw" do
+        specify { expect { throw :foo    }.to     throw_symbol }
+        specify { expect { throw :bar, 7 }.to     throw_symbol }
+        specify { expect { 5 + 5         }.not_to throw_symbol }
+
+        # deliberate failures
+        specify { expect { throw :foo    }.not_to throw_symbol }
+        specify { expect { throw :bar, 7 }.not_to throw_symbol }
+        specify { expect { 5 + 5         }.to     throw_symbol }
+      end
+      """
+    When I run `rspec throw_symbol_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 6 examples, 3 failures                      |
+      | expected no Symbol to be thrown, got :foo   |
+      | expected no Symbol to be thrown, got :bar   |
+      | expected a Symbol to be thrown, got nothing |
+
+  Scenario: specify thrown symbol
+    Given a file named "throw_symbol_matcher_spec.rb" with:
+      """ruby
+      describe "throw symbol" do
+        specify { expect { throw :foo    }.to     throw_symbol(:foo) }
+        specify { expect { throw :foo, 7 }.to     throw_symbol(:foo) }
+        specify { expect { 5 + 5         }.not_to throw_symbol(:foo) }
+        specify { expect { throw :bar    }.not_to throw_symbol(:foo) }
+
+        # deliberate failures
+        specify { expect { throw :foo    }.not_to throw_symbol(:foo) }
+        specify { expect { throw :foo, 7 }.not_to throw_symbol(:foo) }
+        specify { expect { 5 + 5         }.to     throw_symbol(:foo) }
+        specify { expect { throw :bar    }.to     throw_symbol(:foo) }
+      end
+      """
+    When I run `rspec throw_symbol_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures                          |
+      | expected :foo not to be thrown, got :foo        |
+      | expected :foo not to be thrown, got :foo with 7 |
+      | expected :foo to be thrown, got nothing         |
+      | expected :foo to be thrown, got :bar            |
+
+  Scenario: specify thrown symbol and argument
+    Given a file named "throw_symbol_argument_matcher_spec.rb" with:
+      """ruby
+      describe "throw symbol with argument" do
+        specify { expect { throw :foo, 7 }.to     throw_symbol(:foo, 7) }
+        specify { expect { throw :foo, 8 }.not_to throw_symbol(:foo, 7) }
+        specify { expect { throw :bar, 7 }.not_to throw_symbol(:foo, 7) }
+        specify { expect { throw :foo    }.not_to throw_symbol(:foo, 7) }
+
+        # deliberate failures
+        specify { expect { throw :foo, 7 }.not_to throw_symbol(:foo, 7) }
+        specify { expect { throw :foo, 8 }.to     throw_symbol(:foo, 7) }
+        specify { expect { throw :bar, 7 }.to     throw_symbol(:foo, 7) }
+        specify { expect { throw :foo    }.to     throw_symbol(:foo, 7) }
+      end
+      """
+    When I run `rspec throw_symbol_argument_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures                                       |
+      | expected :foo with 7 not to be thrown, got :foo with 7       |
+      | expected :foo with 7 to be thrown, got :foo with 8           |
+      | expected :foo with 7 to be thrown, got :bar                  |
+      | expected :foo with 7 to be thrown, got :foo with no argument |
+
diff --git a/rspec-expectations/features/built_in_matchers/types.feature b/rspec-expectations/features/built_in_matchers/types.feature
new file mode 100644
index 0000000..a90e427
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/types.feature
@@ -0,0 +1,116 @@
+Feature: specify types of objects
+
+  rspec-expectations includes two matchers to specify types of objects:
+
+    * `obj.should be_kind_of(type)`: calls `obj.kind_of?(type)`, which returns
+      true if type is in obj's class hierarchy or is a module and is
+      included in a class in obj's class hierarchy.
+    * `obj.should be_instance_of(type)`: calls `obj.instance_of?(type)`, which
+      returns true if and only if type if obj's class.
+
+  Both of these matchers have aliases:
+
+    ```ruby
+    obj.should be_a_kind_of(type)      # same as obj.should be_kind_of(type)
+    obj.should be_a(type)              # same as obj.should be_kind_of(type)
+    obj.should be_an(type)             # same as obj.should be_kind_of(type)
+    obj.should be_an_instance_of(type) # same as obj.should be_instance_of(type)
+    ```
+
+  Scenario: be_(a_)kind_of matcher
+    Given a file named "be_kind_of_matcher_spec.rb" with:
+      """ruby
+      module MyModule; end
+
+      class Fixnum
+        include MyModule
+      end
+
+      describe 17 do
+        # the actual class
+        it { should be_kind_of(Fixnum) }
+        it { should be_a_kind_of(Fixnum) }
+        it { should be_a(Fixnum) }
+
+        # the superclass
+        it { should be_kind_of(Integer) }
+        it { should be_a_kind_of(Integer) }
+        it { should be_an(Integer) }
+
+        # an included module
+        it { should be_kind_of(MyModule) }
+        it { should be_a_kind_of(MyModule) }
+        it { should be_a(MyModule) }
+
+        # negative passing case
+        it { should_not be_kind_of(String) }
+        it { should_not be_a_kind_of(String) }
+        it { should_not be_a(String) }
+
+        # deliberate failures
+        it { should_not be_kind_of(Fixnum) }
+        it { should_not be_a_kind_of(Fixnum) }
+        it { should_not be_a(Fixnum) }
+        it { should_not be_kind_of(Integer) }
+        it { should_not be_a_kind_of(Integer) }
+        it { should_not be_an(Integer) }
+        it { should_not be_kind_of(MyModule) }
+        it { should_not be_a_kind_of(MyModule) }
+        it { should_not be_a(MyModule) }
+        it { should be_kind_of(String) }
+        it { should be_a_kind_of(String) }
+        it { should be_a(String) }
+      end
+      """
+    When I run `rspec be_kind_of_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 24 examples, 12 failures                 |
+      | expected 17 not to be a kind of Fixnum   |
+      | expected 17 not to be a kind of Integer  |
+      | expected 17 not to be a kind of MyModule |
+      | expected 17 to be a kind of String       |
+
+  Scenario: be_(an_)instance_of matcher
+    Given a file named "be_instance_of_matcher_spec.rb" with:
+      """ruby
+      module MyModule; end
+
+      class Fixnum
+        include MyModule
+      end
+
+      describe 17 do
+        # the actual class
+        it { should be_instance_of(Fixnum) }
+        it { should be_an_instance_of(Fixnum) }
+
+        # the superclass
+        it { should_not be_instance_of(Integer) }
+        it { should_not be_an_instance_of(Integer) }
+
+        # an included module
+        it { should_not be_instance_of(MyModule) }
+        it { should_not be_an_instance_of(MyModule) }
+
+        # another class with no relation to the subject's hierarchy
+        it { should_not be_instance_of(String) }
+        it { should_not be_an_instance_of(String) }
+
+        # deliberate failures
+        it { should_not be_instance_of(Fixnum) }
+        it { should_not be_an_instance_of(Fixnum) }
+        it { should be_instance_of(Integer) }
+        it { should be_an_instance_of(Integer) }
+        it { should be_instance_of(MyModule) }
+        it { should be_an_instance_of(MyModule) }
+        it { should be_instance_of(String) }
+        it { should be_an_instance_of(String) }
+      end
+      """
+    When I run `rspec be_instance_of_matcher_spec.rb`
+    Then the output should contain all of these:
+      | 16 examples, 8 failures                     |
+      | expected 17 not to be an instance of Fixnum |
+      | expected 17 to be an instance of Integer    |
+      | expected 17 to be an instance of MyModule   |
+      | expected 17 to be an instance of String     |
diff --git a/rspec-expectations/features/built_in_matchers/yield.feature b/rspec-expectations/features/built_in_matchers/yield.feature
new file mode 100644
index 0000000..4152c61
--- /dev/null
+++ b/rspec-expectations/features/built_in_matchers/yield.feature
@@ -0,0 +1,161 @@
+Feature: yield matchers
+
+  There are four related matchers that allow you to specify whether
+  or not a method yields, how many times it yields, whether or not
+  it yields with arguments, and what those arguments are.
+
+    * `yield_control` matches if the method-under-test yields, regardless
+      of whether or not arguments are yielded.
+    * `yield_with_args` matches if the method-under-test yields with
+      arguments. If arguments are provided to this matcher, it will
+      only pass if the actual yielded arguments match the expected ones
+      using `===` or `==`.
+    * `yield_with_no_args` matches if the method-under-test yields with
+      no arguments.
+    * `yield_successive_args` is designed for iterators, and will match
+      if the method-under-test yields the same number of times as arguments
+      passed to this matcher, and all actual yielded arguments match the
+      expected ones using `===` or `==`.
+
+  Note: your expect block _must_ accept an argument that is then passed on to
+  the method-under-test as a block. This acts as a "probe" that allows the matcher
+  to detect whether or not your method yields, and, if so, how many times and what
+  the yielded arguments are.
+
+  Background:
+    Given a file named "my_class.rb" with:
+      """ruby
+      class MyClass
+        def self.yield_once_with(*args)
+          yield *args
+        end
+
+        def self.yield_twice_with(*args)
+          2.times { yield *args }
+        end
+
+        def self.raw_yield
+          yield
+        end
+
+        def self.dont_yield
+        end
+      end
+      """
+
+  Scenario: yield_control matcher
+    Given a file named "yield_control_spec.rb" with:
+      """ruby
+      require './my_class'
+
+      describe "yield_control matcher" do
+        specify { expect { |b| MyClass.yield_once_with(1, &b) }.to yield_control }
+        specify { expect { |b| MyClass.dont_yield(&b) }.not_to yield_control }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.twice }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.exactly(2).times }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.at_least(1) }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.to yield_control.at_most(3).times }
+
+        # deliberate failures
+        specify { expect { |b| MyClass.yield_once_with(1, &b) }.not_to yield_control }
+        specify { expect { |b| MyClass.dont_yield(&b) }.to yield_control }
+        specify { expect { |b| MyClass.yield_once_with(1, &b) }.to yield_control.at_least(2).times }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.twice }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.at_least(2).times }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.at_least(1) }
+        specify { expect { |b| MyClass.yield_twice_with(1, &b) }.not_to yield_control.at_most(3).times }
+      end
+      """
+    When I run `rspec yield_control_spec.rb`
+    Then the output should contain all of these:
+      | 13 examples, 7 failures                                   |
+      | expected given block to yield control                     |
+      | expected given block not to yield control                 |
+      | expected given block not to yield control at least twice  |
+      | expected given block not to yield control at most 3 times |
+
+  Scenario: yield_with_args matcher
+    Given a file named "yield_with_args_spec.rb" with:
+      """ruby
+      require './my_class'
+
+      describe "yield_with_args matcher" do
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args }
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args("foo") }
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args(String) }
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.to yield_with_args(/oo/) }
+
+        specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args("foo", "bar") }
+        specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args(String, String) }
+        specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args(/fo/, /ar/) }
+
+        specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.not_to yield_with_args(17, "baz") }
+
+        # deliberate failures
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args }
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args("foo") }
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args(String) }
+        specify { expect { |b| MyClass.yield_once_with("foo", &b) }.not_to yield_with_args(/oo/) }
+        specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.not_to yield_with_args("foo", "bar") }
+        specify { expect { |b| MyClass.yield_once_with("foo", "bar", &b) }.to yield_with_args(17, "baz") }
+      end
+      """
+    When I run `rspec yield_with_args_spec.rb`
+    Then the output should contain all of these:
+      | 14 examples, 6 failures                                                               |
+      | expected given block not to yield with arguments, but did                             |
+      | expected given block not to yield with arguments, but yielded with expected arguments |
+      | expected given block to yield with arguments, but yielded with unexpected arguments   |
+
+  Scenario: yield_with_no_args matcher
+    Given a file named "yield_with_no_args_spec.rb" with:
+      """ruby
+      require './my_class'
+
+      describe "yield_with_no_args matcher" do
+        specify { expect { |b| MyClass.raw_yield(&b) }.to yield_with_no_args }
+        specify { expect { |b| MyClass.dont_yield(&b) }.not_to yield_with_no_args }
+        specify { expect { |b| MyClass.yield_once_with("a", &b) }.not_to yield_with_no_args }
+
+        # deliberate failures
+        specify { expect { |b| MyClass.raw_yield(&b) }.not_to yield_with_no_args }
+        specify { expect { |b| MyClass.dont_yield(&b) }.to yield_with_no_args }
+        specify { expect { |b| MyClass.yield_once_with("a", &b) }.to yield_with_no_args }
+      end
+      """
+    When I run `rspec yield_with_no_args_spec.rb`
+    Then the output should contain all of these:
+      | 6 examples, 3 failures                                                             |
+      | expected given block not to yield with no arguments, but did                       |
+      | expected given block to yield with no arguments, but did not yield                 |
+      | expected given block to yield with no arguments, but yielded with arguments: ["a"] |
+
+  Scenario: yield_successive_args matcher
+    Given a file named "yield_successive_args_spec.rb" with:
+      """ruby
+      def array
+        [1, 2, 3]
+      end
+
+      def array_of_tuples
+        [[:a, :b], [:c, :d]]
+      end
+
+      describe "yield_successive_args matcher" do
+        specify { expect { |b| array.each(&b) }.to yield_successive_args(1, 2, 3) }
+        specify { expect { |b| array_of_tuples.each(&b) }.to yield_successive_args([:a, :b], [:c, :d]) }
+        specify { expect { |b| array.each(&b) }.to yield_successive_args(Fixnum, Fixnum, Fixnum) }
+        specify { expect { |b| array.each(&b) }.not_to yield_successive_args(1, 2) }
+
+        # deliberate failures
+        specify { expect { |b| array.each(&b) }.not_to yield_successive_args(1, 2, 3) }
+        specify { expect { |b| array_of_tuples.each(&b) }.not_to yield_successive_args([:a, :b], [:c, :d]) }
+        specify { expect { |b| array.each(&b) }.not_to yield_successive_args(Fixnum, Fixnum, Fixnum) }
+        specify { expect { |b| array.each(&b) }.to yield_successive_args(1, 2) }
+      end
+      """
+    When I run `rspec yield_successive_args_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures                                                                             |
+      | expected given block not to yield successively with arguments, but yielded with expected arguments |
+      | expected given block to yield successively with arguments, but yielded with unexpected arguments   |
diff --git a/rspec-expectations/features/custom_matchers/access_running_example.feature b/rspec-expectations/features/custom_matchers/access_running_example.feature
new file mode 100644
index 0000000..af83118
--- /dev/null
+++ b/rspec-expectations/features/custom_matchers/access_running_example.feature
@@ -0,0 +1,53 @@
+Feature: access running example
+
+  In order to take advantage of services that are available
+    in my examples when I'm writing matchers
+  As a spec author
+  I want to call methods on the running example
+
+  If the method exists in the context of the example, it gets
+  called. If not, a NoMethodError is raised on the Matcher itself
+  (not the example).
+
+  Scenario: call method defined on example from matcher
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec::Matchers.define :bar do
+        match do |_|
+          foo == "foo"
+        end
+      end
+
+      describe "something" do
+        def foo
+          "foo"
+        end
+
+        it "does something" do
+          "foo".should bar
+        end
+      end
+      """
+    When I run `rspec ./example_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: call method _not_ defined on example from matcher
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec::Matchers.define :bar do
+        match do |_|
+          foo == "foo"
+        end
+      end
+
+      describe "something" do
+        it "does something" do
+          "foo".should bar
+        end
+      end
+      """
+    When I run `rspec ./example_spec.rb`
+    Then the output should contain "1 example, 1 failure"
+    And the output should match /undefined.*method/
+    And the output should contain "RSpec::Matchers::DSL::Matcher"
+    And the output should not contain "ExampleGroup"
diff --git a/rspec-expectations/features/custom_matchers/define_diffable_matcher.feature b/rspec-expectations/features/custom_matchers/define_diffable_matcher.feature
new file mode 100644
index 0000000..696fc4c
--- /dev/null
+++ b/rspec-expectations/features/custom_matchers/define_diffable_matcher.feature
@@ -0,0 +1,27 @@
+Feature: define diffable matcher
+
+  When a matcher is defined as diffable, and the --diff
+  flag is set, the output will include a diff of the submitted
+  objects.
+
+  @wip
+  Scenario: define a diffable matcher
+    Given a file named "diffable_matcher_spec.rb" with:
+      """ruby
+      RSpec::Matchers.define :be_just_like do |expected|
+        match do |actual|
+          actual == expected
+        end
+
+        diffable
+      end
+
+      describe "this" do
+        it {should be_just_like("that")}
+      end
+      """
+    When I run `rspec ./diffable_matcher_spec.rb --diff`
+    Then the exit status should not be 0
+
+    And the output should contain "should be just like that"
+    And the output should contain "Diff:\n@@ -1,2 +1,2 @@\n-that\n+this"
diff --git a/rspec-expectations/features/custom_matchers/define_matcher.feature b/rspec-expectations/features/custom_matchers/define_matcher.feature
new file mode 100644
index 0000000..fe4b516
--- /dev/null
+++ b/rspec-expectations/features/custom_matchers/define_matcher.feature
@@ -0,0 +1,368 @@
+Feature: define matcher
+
+  In order to express my domain clearly in my code examples
+  As an RSpec user
+  I want a shortcut to define custom matchers
+
+  Scenario: define a matcher with default messages
+    Given a file named "matcher_with_default_message_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      RSpec::Matchers.define :be_a_multiple_of do |expected|
+        match do |actual|
+          actual % expected == 0
+        end
+      end
+
+      describe 9 do
+        it {should be_a_multiple_of(3)}
+      end
+
+      describe 9 do
+        it {should_not be_a_multiple_of(4)}
+      end
+
+      # fail intentionally to generate expected output
+      describe 9 do
+        it {should be_a_multiple_of(4)}
+      end
+
+      # fail intentionally to generate expected output
+      describe 9 do
+        it {should_not be_a_multiple_of(3)}
+      end
+
+      """
+    When I run `rspec ./matcher_with_default_message_spec.rb --format documentation`
+    Then the exit status should not be 0
+
+    And the output should contain "should be a multiple of 3"
+    And the output should contain "should not be a multiple of 4"
+    And the output should contain "Failure/Error: it {should be_a_multiple_of(4)}"
+    And the output should contain "Failure/Error: it {should_not be_a_multiple_of(3)}"
+
+    And the output should contain "4 examples, 2 failures"
+    And the output should contain "expected 9 to be a multiple of 4"
+    And the output should contain "expected 9 not to be a multiple of 3"
+
+  Scenario: overriding the failure_message_for_should
+    Given a file named "matcher_with_failure_message_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      RSpec::Matchers.define :be_a_multiple_of do |expected|
+        match do |actual|
+          actual % expected == 0
+        end
+        failure_message_for_should do |actual|
+          "expected that #{actual} would be a multiple of #{expected}"
+        end
+      end
+
+      # fail intentionally to generate expected output
+      describe 9 do
+        it {should be_a_multiple_of(4)}
+      end
+      """
+    When I run `rspec ./matcher_with_failure_message_spec.rb`
+    Then the exit status should not be 0
+    And the stdout should contain "1 example, 1 failure"
+    And the stdout should contain "expected that 9 would be a multiple of 4"
+
+  Scenario: overriding the failure_message_for_should_not
+    Given a file named "matcher_with_failure_for_message_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      RSpec::Matchers.define :be_a_multiple_of do |expected|
+        match do |actual|
+          actual % expected == 0
+        end
+        failure_message_for_should_not do |actual|
+          "expected that #{actual} would not be a multiple of #{expected}"
+        end
+      end
+
+      # fail intentionally to generate expected output
+      describe 9 do
+        it {should_not be_a_multiple_of(3)}
+      end
+      """
+    When I run `rspec ./matcher_with_failure_for_message_spec.rb`
+    Then the exit status should not be 0
+    And the stdout should contain "1 example, 1 failure"
+    And the stdout should contain "expected that 9 would not be a multiple of 3"
+
+  Scenario: overriding the description
+    Given a file named "matcher_overriding_description_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      RSpec::Matchers.define :be_a_multiple_of do |expected|
+        match do |actual|
+          actual % expected == 0
+        end
+        description do
+          "be multiple of #{expected}"
+        end
+      end
+
+      describe 9 do
+        it {should be_a_multiple_of(3)}
+      end
+
+      describe 9 do
+        it {should_not be_a_multiple_of(4)}
+      end
+      """
+    When I run `rspec ./matcher_overriding_description_spec.rb --format documentation`
+    Then the exit status should be 0
+    And the stdout should contain "2 examples, 0 failures"
+    And the stdout should contain "should be multiple of 3"
+    And the stdout should contain "should not be multiple of 4"
+
+  Scenario: with no args
+    Given a file named "matcher_with_no_args_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      RSpec::Matchers.define :have_7_fingers do
+        match do |thing|
+          thing.fingers.length == 7
+        end
+      end
+
+      class Thing
+        def fingers; (1..7).collect {"finger"}; end
+      end
+
+      describe Thing do
+        it {should have_7_fingers}
+      end
+      """
+    When I run `rspec ./matcher_with_no_args_spec.rb --format documentation`
+    Then the exit status should be 0
+    And the stdout should contain "1 example, 0 failures"
+    And the stdout should contain "should have 7 fingers"
+
+  Scenario: with multiple args
+    Given a file named "matcher_with_multiple_args_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      RSpec::Matchers.define :be_the_sum_of do |a,b,c,d|
+        match do |sum|
+          a + b + c + d == sum
+        end
+      end
+
+      describe 10 do
+        it {should be_the_sum_of(1,2,3,4)}
+      end
+      """
+    When I run `rspec ./matcher_with_multiple_args_spec.rb --format documentation`
+    Then the exit status should be 0
+    And the stdout should contain "1 example, 0 failures"
+    And the stdout should contain "should be the sum of 1, 2, 3, and 4"
+
+  Scenario: with helper methods
+    Given a file named "matcher_with_internal_helper_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      RSpec::Matchers.define :have_same_elements_as do |sample|
+        match do |actual|
+          similar?(sample, actual)
+        end
+
+        def similar?(a, b)
+          a.sort == b.sort
+        end
+      end
+
+      describe "these two arrays" do
+        specify "should be similar" do
+          [1,2,3].should have_same_elements_as([2,3,1])
+        end
+      end
+      """
+    When I run `rspec ./matcher_with_internal_helper_spec.rb`
+    Then the exit status should be 0
+    And the stdout should contain "1 example, 0 failures"
+
+  Scenario: scoped in a module
+    Given a file named "scoped_matcher_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      module MyHelpers
+        extend RSpec::Matchers::DSL
+
+        matcher :be_just_like do |expected|
+          match {|actual| actual == expected}
+        end
+      end
+
+      describe "group with MyHelpers" do
+        include MyHelpers
+        it "has access to the defined matcher" do
+          5.should be_just_like(5)
+        end
+      end
+
+      describe "group without MyHelpers" do
+        it "does not have access to the defined matcher" do
+          expect do
+            5.should be_just_like(5)
+          end.to raise_exception
+        end
+      end
+      """
+
+    When I run `rspec ./scoped_matcher_spec.rb`
+    Then the stdout should contain "2 examples, 0 failures"
+
+  Scenario: scoped in an example group
+    Given a file named "scoped_matcher_spec.rb" with:
+      """ruby
+      require 'rspec/expectations'
+
+      describe "group with matcher" do
+        matcher :be_just_like do |expected|
+          match {|actual| actual == expected}
+        end
+
+        it "has access to the defined matcher" do
+          5.should be_just_like(5)
+        end
+
+        describe "nested group" do
+          it "has access to the defined matcher" do
+            5.should be_just_like(5)
+          end
+        end
+
+      end
+
+      describe "group without matcher" do
+        it "does not have access to the defined matcher" do
+          expect do
+            5.should be_just_like(5)
+          end.to raise_exception
+        end
+      end
+      """
+
+    When I run `rspec scoped_matcher_spec.rb`
+    Then the output should contain "3 examples, 0 failures"
+
+  Scenario: matcher with separate logic for should and should_not
+    Given a file named "matcher_with_separate_should_not_logic_spec.rb" with:
+      """ruby
+      RSpec::Matchers.define :contain do |*expected|
+        match_for_should do |actual|
+          expected.all? { |e| actual.include?(e) }
+        end
+
+        match_for_should_not do |actual|
+          expected.none? { |e| actual.include?(e) }
+        end
+      end
+
+      describe [1, 2, 3] do
+        it { should contain(1, 2) }
+        it { should_not contain(4, 5, 6) }
+
+        # deliberate failures
+        it { should contain(1, 4) }
+        it { should_not contain(1, 4) }
+      end
+      """
+    When I run `rspec matcher_with_separate_should_not_logic_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures                    |
+      | expected [1, 2, 3] to contain 1 and 4     |
+      | expected [1, 2, 3] not to contain 1 and 4 |
+
+  Scenario: use define_method to create a helper method with access to matcher params
+    Given a file named "define_method_spec.rb" with:
+      """ruby
+      RSpec::Matchers.define :be_a_multiple_of do |expected|
+        define_method :is_multiple? do |actual|
+          actual % expected == 0
+        end
+        match { |actual| is_multiple?(actual) }
+      end
+
+      describe 9 do
+        it { should be_a_multiple_of(3) }
+        it { should_not be_a_multiple_of(4) }
+
+        # deliberate failures
+        it { should be_a_multiple_of(2) }
+        it { should_not be_a_multiple_of(3) }
+      end
+      """
+    When I run `rspec define_method_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures               |
+      | expected 9 to be a multiple of 2     |
+      | expected 9 not to be a multiple of 3 |
+
+  Scenario: include a module with helper methods in the matcher
+    Given a file named "include_module_spec.rb" with:
+      """ruby
+      module MatcherHelpers
+        def is_multiple?(actual, expected)
+          actual % expected == 0
+        end
+      end
+
+      RSpec::Matchers.define :be_a_multiple_of do |expected|
+        include MatcherHelpers
+        match { |actual| is_multiple?(actual, expected) }
+      end
+
+      describe 9 do
+        it { should be_a_multiple_of(3) }
+        it { should_not be_a_multiple_of(4) }
+
+        # deliberate failures
+        it { should be_a_multiple_of(2) }
+        it { should_not be_a_multiple_of(3) }
+      end
+      """
+    When I run `rspec include_module_spec.rb`
+    Then the output should contain all of these:
+      | 4 examples, 2 failures               |
+      | expected 9 to be a multiple of 2     |
+      | expected 9 not to be a multiple of 3 |
+
+  Scenario: matching against a regular expression
+    Given a file named "regular_expression_matcher_spec.rb" with:
+      """ruby
+      # Due to Ruby's method dispatch mechanism, use the `#match_regex` alias
+      # rather than the `#match` matcher when defining custom matchers via the
+      # DSL.
+
+      RSpec::Matchers.define :be_valid_us_zipcode do
+        match do |actual|
+          expect(actual).to match_regex(/\A\d{5}(-\d{4})?\z/)
+        end
+      end
+
+      describe "30316" do
+        it { should be_valid_us_zipcode }
+      end
+
+      describe "30316-0001" do
+        it { should be_valid_us_zipcode }
+      end
+
+      describe "1000-61303" do
+        it { should_not be_valid_us_zipcode }
+      end
+      """
+    When I run `rspec regular_expression_matcher_spec.rb`
+    Then the stdout should contain "3 examples, 0 failures"
diff --git a/rspec-expectations/features/custom_matchers/define_matcher_outside_rspec.feature b/rspec-expectations/features/custom_matchers/define_matcher_outside_rspec.feature
new file mode 100644
index 0000000..a0abe78
--- /dev/null
+++ b/rspec-expectations/features/custom_matchers/define_matcher_outside_rspec.feature
@@ -0,0 +1,38 @@
+Feature: define matcher outside rspec
+
+  In order to express my domain clearly in my code examples
+  As a non-rspec user
+  I want a shortcut to define custom matchers
+
+  Scenario: define a matcher with default messages
+    Given a file named "test_multiples.rb" with:
+      """ruby
+      require "rspec/expectations"
+      require "test/unit"
+
+      RSpec::Matchers.define :be_a_multiple_of do |expected|
+        match do |actual|
+          actual % expected == 0
+        end
+      end
+
+      class Test::Unit::TestCase
+        include RSpec::Matchers
+      end
+
+      class TestMultiples < Test::Unit::TestCase
+
+        def test_9_should_be_a_multiple_of_3
+          9.should be_a_multiple_of(3)
+        end
+
+        def test_9_should_be_a_multiple_of_4
+          9.should be_a_multiple_of(4)
+        end
+
+      end
+      """
+    When I run `ruby test_multiples.rb`
+    Then the exit status should not be 0
+    And the output should contain "expected 9 to be a multiple of 4"
+    And the output should contain "2 tests, 0 assertions, 0 failures, 1 errors"
diff --git a/rspec-expectations/features/custom_matchers/define_matcher_with_fluent_interface.feature b/rspec-expectations/features/custom_matchers/define_matcher_with_fluent_interface.feature
new file mode 100644
index 0000000..eb2f49d
--- /dev/null
+++ b/rspec-expectations/features/custom_matchers/define_matcher_with_fluent_interface.feature
@@ -0,0 +1,24 @@
+Feature: define matcher with fluent interface
+
+  Use the chain() method to define matchers with a fluent interface.
+
+  Scenario: chained method with argumetn
+    Given a file named "between_spec.rb" with:
+      """ruby
+      RSpec::Matchers.define :be_bigger_than do |first|
+        match do |actual|
+          (actual > first) && (actual < @second)
+        end
+
+        chain :but_smaller_than do |second|
+          @second = second
+        end
+      end
+
+      describe 5 do
+        it { should be_bigger_than(4).but_smaller_than(6) }
+      end
+      """
+    When I run `rspec between_spec.rb --format documentation`
+    Then the output should contain "1 example, 0 failures"
+    And  the output should contain "should be bigger than 4"
diff --git a/rspec-expectations/features/customized_message.feature b/rspec-expectations/features/customized_message.feature
new file mode 100644
index 0000000..f2c11f7
--- /dev/null
+++ b/rspec-expectations/features/customized_message.feature
@@ -0,0 +1,22 @@
+Feature: customized message
+
+  RSpec tries to provide useful failure messages, but for cases in which you
+  want more specific information, you can define your own message right in the
+  example. This works for any matcher _other than the operator matchers_.
+
+  Scenario: customize failure message
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe Array do
+        context "when created with `new`" do
+          it "is empty" do
+            array = Array.new
+            array << 1 # trigger a failure to demonstrate the message
+            array.should be_empty, "expected empty array, got #{array.inspect}"
+          end
+        end
+      end
+
+      """
+    When I run `rspec example_spec.rb --format documentation`
+    Then the output should contain "expected empty array, got [1]"
diff --git a/rspec-expectations/features/diffing.feature b/rspec-expectations/features/diffing.feature
new file mode 100644
index 0000000..9b54741
--- /dev/null
+++ b/rspec-expectations/features/diffing.feature
@@ -0,0 +1,85 @@
+Feature: diffing
+
+  When appropriate, failure messages will automatically include a diff.
+
+  Scenario: diff for a multiline string
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a multiline string" do
+        it "is like another string" do
+          expected = <<-EXPECTED
+      this is the
+        expected
+          string
+      EXPECTED
+          actual = <<-ACTUAL
+      this is the
+        actual
+          string
+      ACTUAL
+          actual.should eq(expected)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain:
+      """
+             Diff:
+             @@ -1,4 +1,4 @@
+              this is the
+             -  expected
+             +  actual
+                  string
+      """
+
+  Scenario: diff for a multiline string and a regexp
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a multiline string" do
+        it "is like another string" do
+          expected = /expected/m
+          actual = <<-ACTUAL
+      this is the
+        actual
+          string
+      ACTUAL
+          actual.should =~ expected
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain:
+      """
+             Diff:
+             @@ -1,2 +1,4 @@
+             -/expected/m
+             +this is the
+             +  actual
+             +    string
+      """
+
+  Scenario: no diff for a single line strings
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a single line string" do
+        it "is like another string" do
+          expected = "this string"
+          actual   = "that string"
+          actual.should eq(expected)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should not contain "Diff:"
+
+  Scenario: no diff for numbers
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a number" do
+        it "is like another number" do
+          1.should eq(2)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should not contain "Diff:"
diff --git a/rspec-expectations/features/implicit_docstrings.feature b/rspec-expectations/features/implicit_docstrings.feature
new file mode 100644
index 0000000..67f1cce
--- /dev/null
+++ b/rspec-expectations/features/implicit_docstrings.feature
@@ -0,0 +1,52 @@
+Feature: implicit docstrings
+
+  As an RSpec user
+  I want examples to generate their own names
+  So that I can reduce duplication between example names and example code
+
+  Scenario: run passing examples
+    Given a file named "implicit_docstrings_spec.rb" with:
+    """ruby
+    describe "Examples with no docstrings generate their own:" do
+
+      specify { 3.should be < 5 }
+
+      specify { [1,2,3].should include(2) }
+
+      specify { [1,2,3].should respond_to(:size) }
+
+    end
+    """
+
+    When I run `rspec ./implicit_docstrings_spec.rb -fdoc`
+
+    Then the output should contain "should be < 5"
+    And the output should contain "should include 2"
+    And the output should contain "should respond to #size"
+
+  Scenario: run failing examples
+    Given a file named "failing_implicit_docstrings_spec.rb" with:
+    """ruby
+    describe "Failing examples with no descriptions" do
+
+      # description is auto-generated as "should equal(5)" based on the last #should
+      it do
+        3.should equal(2)
+        5.should equal(5)
+      end
+
+      it { 3.should be > 5 }
+
+      it { [1,2,3].should include(4) }
+
+      it { [1,2,3].should_not respond_to(:size) }
+
+    end
+    """
+
+    When I run `rspec ./failing_implicit_docstrings_spec.rb -fdoc`
+
+    Then the output should contain "should equal 2"
+    And the output should contain "should be > 5"
+    And the output should contain "should include 4"
+    And the output should contain "should not respond to #size"
diff --git a/rspec-expectations/features/step_definitions/additional_cli_steps.rb b/rspec-expectations/features/step_definitions/additional_cli_steps.rb
new file mode 100644
index 0000000..54927f4
--- /dev/null
+++ b/rspec-expectations/features/step_definitions/additional_cli_steps.rb
@@ -0,0 +1,22 @@
+# Useful for when the output is slightly different on different versions of ruby
+Then /^the output should contain "([^"]*)" or "([^"]*)"$/ do |string1, string2|
+  unless [string1, string2].any? { |s| all_output =~ regexp(s) }
+    fail %Q{Neither "#{string1}" or "#{string2}" were found in:\n#{all_output}}
+  end
+end
+
+Then /^the output should contain all of these:$/ do |table|
+  table.raw.flatten.each do |string|
+    assert_partial_output(string, all_output)
+  end
+end
+
+Then /^the example(?:s)? should(?: all)? pass$/ do
+  step %q{the output should contain "0 failures"}
+  step %q{the exit status should be 0}
+end
+
+Then /^the example should fail$/ do
+  step %q{the output should contain "1 failure"}
+  step %q{the exit status should not be 0}
+end
diff --git a/rspec-expectations/features/support/env.rb b/rspec-expectations/features/support/env.rb
new file mode 100644
index 0000000..c24c49d
--- /dev/null
+++ b/rspec-expectations/features/support/env.rb
@@ -0,0 +1,14 @@
+require 'aruba/cucumber'
+
+timeouts = { 'java' => 60 }
+
+Before do
+  @aruba_timeout_seconds = timeouts.fetch(RUBY_PLATFORM) { 15 }
+end
+
+Aruba.configure do |config|
+  config.before_cmd do |cmd|
+    set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived
+  end
+end if RUBY_PLATFORM == 'java'
+
diff --git a/rspec-expectations/features/support/rubinius.rb b/rspec-expectations/features/support/rubinius.rb
new file mode 100644
index 0000000..3907962
--- /dev/null
+++ b/rspec-expectations/features/support/rubinius.rb
@@ -0,0 +1,6 @@
+# Required until https://github.com/rubinius/rubinius/issues/2430 is resolved
+ENV['RBXOPT'] = "#{ENV["RBXOPT"]} -Xcompiler.no_rbc"
+
+Around "@unsupported-on-rbx" do |scenario, block|
+  block.call unless defined?(Rubinius)
+end
diff --git a/rspec-expectations/features/syntax_configuration.feature b/rspec-expectations/features/syntax_configuration.feature
new file mode 100644
index 0000000..ed5983e
--- /dev/null
+++ b/rspec-expectations/features/syntax_configuration.feature
@@ -0,0 +1,71 @@
+Feature: Syntax Configuration
+
+  In addition to the long-supported `should` syntax, rspec-expectations
+  supports an alternate `expect` syntax. If you want your project to
+  only use one syntax, you can configure the available syntaxes.
+
+  Background:
+    Given a file named "syntaxes_spec.rb" with:
+      """ruby
+      describe "using the should syntax" do
+        specify { 3.should eq(3) }
+        specify { 3.should_not eq(4) }
+        specify { lambda { raise "boom" }.should raise_error("boom") }
+        specify { lambda { }.should_not raise_error }
+      end
+
+      describe "using the expect syntax" do
+        specify { expect(3).to eq(3) }
+        specify { expect(3).not_to eq(4) }
+        specify { expect { raise "boom" }.to raise_error("boom") }
+        specify { expect { }.not_to raise_error }
+      end
+      """
+
+  Scenario: Both syntaxes are available by default
+    When I run `rspec syntaxes_spec.rb`
+    Then the examples should all pass
+
+  Scenario: Disable should syntax
+    Given a file named "disable_should_syntax.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.expect_with :rspec do |c|
+          c.syntax = :expect
+        end
+      end
+      """
+    When I run `rspec disable_should_syntax.rb syntaxes_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures    |
+      | undefined method `should' |
+
+  Scenario: Disable expect syntax
+    Given a file named "disable_expect_syntax.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.expect_with :rspec do |c|
+          c.syntax = :should
+        end
+        config.mock_with :rspec do |c|
+          c.syntax = :should
+        end
+      end
+      """
+    When I run `rspec disable_expect_syntax.rb syntaxes_spec.rb`
+    Then the output should contain all of these:
+      | 8 examples, 4 failures    |
+      | undefined method `expect' |
+
+  Scenario: Explicitly enable both syntaxes
+    Given a file named "enable_both_syntaxes.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.expect_with :rspec do |c|
+          c.syntax = [:should, :expect]
+        end
+      end
+      """
+    When I run `rspec enable_both_syntaxes.rb syntaxes_spec.rb`
+    Then the examples should all pass
+
diff --git a/rspec-expectations/features/test_frameworks/test_unit.feature b/rspec-expectations/features/test_frameworks/test_unit.feature
new file mode 100644
index 0000000..e09c1ba
--- /dev/null
+++ b/rspec-expectations/features/test_frameworks/test_unit.feature
@@ -0,0 +1,44 @@
+Feature: Test::Unit integration
+
+  RSpec-expectations is a stand-alone gem that can be used without the rest of
+  RSpec. If you like the way Test::Unit (or MiniTest) organizes tests, but
+  prefer RSpec's approach to expressing expectations, you can have both.
+
+  The one downside is that failures are reported as errors with MiniTest.
+
+  Scenario: use rspec/expectations with Test::Unit
+    Given a file named "rspec_expectations_test.rb" with:
+      """ruby
+      require 'test/unit'
+      require 'rspec/expectations'
+
+      class RSpecExpectationsTest < Test::Unit::TestCase
+        RSpec::Matchers.define :be_an_integer do
+          match { |actual| Integer === actual }
+        end
+
+        def be_an_int
+          # This is actually an internal rspec-expectations API, but is used
+          # here to demonstrate that deprecation warnings from within
+          # rspec-expectations work correcty without depending on rspec-core
+          RSpec.deprecate(:be_an_int, :replacement => :be_an_integer)
+          be_an_integer
+        end
+
+        def test_passing_expectation
+          expect(1 + 3).to eq 4
+        end
+
+        def test_failing_expectation
+          expect([1,2]).to be_empty
+        end
+
+        def test_custom_matcher_with_deprecation_warning
+          expect(1).to be_an_int
+        end
+      end
+      """
+     When I run `ruby rspec_expectations_test.rb`
+     Then the output should contain "3 tests, 0 assertions, 0 failures, 1 errors" or "3 tests, 0 assertions, 1 failures, 0 errors"
+      And the output should contain "expected empty? to return true, got false"
+      And the output should contain "be_an_int is deprecated"
diff --git a/rspec-expectations/lib/rspec-expectations.rb b/rspec-expectations/lib/rspec-expectations.rb
new file mode 100644
index 0000000..021c588
--- /dev/null
+++ b/rspec-expectations/lib/rspec-expectations.rb
@@ -0,0 +1 @@
+require "rspec/expectations"
diff --git a/rspec-expectations/lib/rspec/expectations.rb b/rspec-expectations/lib/rspec/expectations.rb
new file mode 100644
index 0000000..05e576d
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations.rb
@@ -0,0 +1,47 @@
+require 'rspec/expectations/extensions'
+require 'rspec/matchers'
+require 'rspec/expectations/expectation_target'
+require 'rspec/matchers/configuration'
+require 'rspec/expectations/fail_with'
+require 'rspec/expectations/errors'
+require 'rspec/expectations/deprecation'
+require 'rspec/expectations/handler'
+require 'rspec/expectations/version'
+require 'rspec/expectations/differ'
+
+module RSpec
+  # RSpec::Expectations adds two instance methods to every object:
+  #
+  #     should(matcher=nil)
+  #     should_not(matcher=nil)
+  #
+  # Both methods take an optional matcher object (See
+  # [RSpec::Matchers](../RSpec/Matchers)).  When `should` is invoked with a
+  # matcher, it turns around and calls `matcher.matches?(self)`.  For example,
+  # in the expression:
+  #
+  #     order.total.should eq(Money.new(5.55, :USD))
+  #
+  # the `should` method invokes the equivalent of `eq.matches?(order.total)`. If
+  # `matches?` returns true, the expectation is met and execution continues. If
+  # `false`, then the spec fails with the message returned by
+  # `eq.failure_message_for_should`.
+  #
+  # Given the expression:
+  #
+  #     order.entries.should_not include(entry)
+  #
+  # the `should_not` method invokes the equivalent of
+  # `include.matches?(order.entries)`, but it interprets `false` as success, and
+  # `true` as a failure, using the message generated by
+  # `eq.failure_message_for_should_not`.
+  #
+  # rspec-expectations ships with a standard set of useful matchers, and writing
+  # your own matchers is quite simple.
+  #
+  # See [RSpec::Matchers](../RSpec/Matchers) for more information about the
+  # built-in matchers that ship with rspec-expectations, and how to write your
+  # own custom matchers.
+  module Expectations
+  end
+end
diff --git a/rspec-expectations/lib/rspec/expectations/deprecation.rb b/rspec-expectations/lib/rspec/expectations/deprecation.rb
new file mode 100644
index 0000000..21cf61e
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/deprecation.rb
@@ -0,0 +1,17 @@
+module RSpec
+  module Expectations
+    module Deprecation
+      # @private
+      #
+      # Used internally to print deprecation warnings
+      def deprecate(deprecated, options={})
+        message = "DEPRECATION: #{deprecated} is deprecated."
+        message << " Use #{options[:replacement]} instead." if options[:replacement]
+        message << " Called from #{caller(0)[2]}."
+        warn message
+      end
+    end
+  end
+
+  extend(Expectations::Deprecation) unless respond_to?(:deprecate)
+end
diff --git a/rspec-expectations/lib/rspec/expectations/differ.rb b/rspec-expectations/lib/rspec/expectations/differ.rb
new file mode 100644
index 0000000..685770f
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/differ.rb
@@ -0,0 +1,140 @@
+require 'diff/lcs'
+require 'diff/lcs/hunk'
+require 'pp'
+
+module RSpec
+  module Expectations
+    class Differ
+      # This is snagged from diff/lcs/ldiff.rb (which is a commandline tool)
+      def diff_as_string(input_data_new, input_data_old)
+        output = matching_encoding("", input_data_old)
+        data_old = input_data_old.split(matching_encoding("\n", input_data_old)).map! { |e| e.chomp }
+        data_new = input_data_new.split(matching_encoding("\n", input_data_new)).map! { |e| e.chomp }
+        diffs = Diff::LCS.diff(data_old, data_new)
+        return output if diffs.empty?
+        oldhunk = hunk = nil
+        file_length_difference = 0
+        diffs.each do |piece|
+          begin
+            hunk = Diff::LCS::Hunk.new(
+              data_old, data_new, piece, context_lines, file_length_difference
+            )
+            file_length_difference = hunk.file_length_difference
+            next unless oldhunk
+            # Hunks may overlap, which is why we need to be careful when our
+            # diff includes lines of context. Otherwise, we might print
+            # redundant lines.
+            if (context_lines > 0) and hunk.overlaps?(oldhunk)
+              if hunk.respond_to?(:merge)
+                # diff-lcs 1.2.x
+                hunk.merge(oldhunk)
+              else
+                # diff-lcs 1.1.3
+                hunk.unshift(oldhunk)
+              end
+            else
+              output << matching_encoding(oldhunk.diff(format).to_s, output)
+            end
+          ensure
+            oldhunk = hunk
+            output << matching_encoding("\n", output)
+          end
+        end
+        #Handle the last remaining hunk
+        output << matching_encoding(oldhunk.diff(format).to_s,output)
+        output << matching_encoding("\n",output)
+        color_diff output
+      rescue Encoding::CompatibilityError
+        if input_data_new.encoding != input_data_old.encoding
+          "Could not produce a diff because the encoding of the actual string (#{input_data_old.encoding}) "+
+          "differs from the encoding of the expected string (#{input_data_new.encoding})"
+        else
+          "Could not produce a diff because of the encoding of the string (#{input_data_old.encoding})"
+        end
+      end
+
+      def diff_as_object(actual, expected)
+        actual_as_string = object_to_string(actual)
+        expected_as_string = object_to_string(expected)
+        if diff = diff_as_string(actual_as_string, expected_as_string)
+          color_diff diff
+        end
+      end
+
+    protected
+
+      def format
+        :unified
+      end
+
+      def context_lines
+        3
+      end
+
+      def color(text, color_code)
+        "\e[#{color_code}m#{text}\e[0m"
+      end
+
+      def red(text)
+        color(text, 31)
+      end
+
+      def green(text)
+        color(text, 32)
+      end
+
+      def blue(text)
+        color(text, 34)
+      end
+
+      def color_diff(diff)
+        return diff unless RSpec::Matchers.configuration.color?
+
+        diff.lines.map { |line|
+          case line[0].chr
+          when "+"
+            green line
+          when "-"
+            red line
+          when "@"
+            line[1].chr == "@" ? blue(line) : line
+          else
+            line
+          end
+        }.join
+      end
+
+      def object_to_string(object)
+        case object
+        when Hash
+          object.keys.sort_by { |k| k.to_s }.map do |key|
+            pp_key   = PP.singleline_pp(key, "")
+            pp_value = PP.singleline_pp(object[key], "")
+
+            # on 1.9.3 PP seems to minimise to US-ASCII, ensure we're matching source encoding
+            #
+            # note, PP is used to ensure the ordering of the internal values of key/value e.g.
+            # <# a: b: c:> not <# c: a: b:>
+            matching_encoding("#{pp_key} => #{pp_value}", key)
+          end.join(",\n")
+        when String
+          object =~ /\n/ ? object : object.inspect
+        else
+          PP.pp(object,"")
+        end
+      end
+
+      if String.method_defined?(:encoding)
+        def matching_encoding(string, source)
+          string.encode(source.encoding)
+        end
+      else
+        def matching_encoding(string, source)
+          string
+        end
+      end
+    end
+
+  end
+end
+
diff --git a/rspec-expectations/lib/rspec/expectations/errors.rb b/rspec-expectations/lib/rspec/expectations/errors.rb
new file mode 100644
index 0000000..43c8366
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/errors.rb
@@ -0,0 +1,9 @@
+module RSpec
+  module Expectations
+    if defined?(Test::Unit::AssertionFailedError)
+      class ExpectationNotMetError < Test::Unit::AssertionFailedError; end
+    else
+      class ExpectationNotMetError < ::StandardError; end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/expectations/expectation_target.rb b/rspec-expectations/lib/rspec/expectations/expectation_target.rb
new file mode 100644
index 0000000..68a8c60
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/expectation_target.rb
@@ -0,0 +1,87 @@
+module RSpec
+  module Expectations
+    # Wraps the target of an expectation.
+    # @example
+    #   expect(something) # => ExpectationTarget wrapping something
+    #
+    #   # used with `to`
+    #   expect(actual).to eq(3)
+    #
+    #   # with `not_to`
+    #   expect(actual).not_to eq(3)
+    class ExpectationTarget
+      class << self
+        attr_accessor :deprecated_should_enabled
+        alias deprecated_should_enabled? deprecated_should_enabled
+      end
+
+      # @api private
+      def initialize(target)
+        @target = target
+      end
+
+      # Runs the given expectation, passing if `matcher` returns true.
+      # @example
+      #   expect(value).to eq(5)
+      #   expect { perform }.to raise_error
+      # @param [Matcher]
+      #   matcher
+      # @param [String] message optional message to display when the expectation fails
+      # @return [Boolean] true if the expectation succeeds (else raises)
+      # @see RSpec::Matchers
+      def to(matcher=nil, message=nil, &block)
+        prevent_operator_matchers(:to, matcher)
+        RSpec::Expectations::PositiveExpectationHandler.handle_matcher(@target, matcher, message, &block)
+      end
+
+      # Runs the given expectation, passing if `matcher` returns false.
+      # @example
+      #   expect(value).not_to eq(5)
+      # @param [Matcher]
+      #   matcher
+      # @param [String] message optional message to display when the expectation fails
+      # @return [Boolean] false if the negative expectation succeeds (else raises)
+      # @see RSpec::Matchers
+      def not_to(matcher=nil, message=nil, &block)
+        prevent_operator_matchers(:not_to, matcher)
+        RSpec::Expectations::NegativeExpectationHandler.handle_matcher(@target, matcher, message, &block)
+      end
+      alias to_not not_to
+
+      def self.enable_deprecated_should
+        return if deprecated_should_enabled?
+
+        def should(*args)
+          RSpec.deprecate "`expect { }.should`", :replacement => "`expect { }.to`"
+          @target.should(*args)
+        end
+
+        def should_not(*args)
+          RSpec.deprecate "`expect { }.should_not`", :replacement => "`expect { }.not_to`"
+          @target.should_not(*args)
+        end
+
+        self.deprecated_should_enabled = true
+      end
+
+      def self.disable_deprecated_should
+        return unless deprecated_should_enabled?
+
+        remove_method :should
+        remove_method :should_not
+
+        self.deprecated_should_enabled = false
+      end
+
+    private
+
+      def prevent_operator_matchers(verb, matcher)
+        return if matcher
+
+        raise ArgumentError, "The expect syntax does not support operator matchers, " +
+                             "so you must pass a matcher to `##{verb}`."
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/lib/rspec/expectations/extensions.rb b/rspec-expectations/lib/rspec/expectations/extensions.rb
new file mode 100644
index 0000000..5465f6f
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/extensions.rb
@@ -0,0 +1,2 @@
+require 'rspec/expectations/extensions/array'
+require 'rspec/expectations/extensions/object'
diff --git a/rspec-expectations/lib/rspec/expectations/extensions/array.rb b/rspec-expectations/lib/rspec/expectations/extensions/array.rb
new file mode 100644
index 0000000..169914e
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/extensions/array.rb
@@ -0,0 +1,9 @@
+# @private
+class Array
+  unless public_instance_methods.map {|m| m.to_s}.include?('none?')
+    # Supports +none?+ on early patch levels of Ruby 1.8.6
+    def none?(&block)
+      !any?(&block)
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/expectations/extensions/object.rb b/rspec-expectations/lib/rspec/expectations/extensions/object.rb
new file mode 100644
index 0000000..a0cdf5b
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/extensions/object.rb
@@ -0,0 +1,29 @@
+module RSpec
+  module Expectations
+    module DeprecatedConstants
+      # Displays deprecation warning when it captures Rspec and Spec. Otherwise
+      # delegates to super.
+      def const_missing(name)
+        case name
+        when :Rspec, :Spec
+          RSpec.deprecate(name.to_s, :replacement => "RSpec")
+          RSpec
+        else
+          begin
+            super
+          rescue Exception => e
+            e.backtrace.reject! {|l| l =~ Regexp.compile(__FILE__) }
+            raise e
+          end
+        end
+      end
+    end
+
+    # @deprecated (no replacement)
+    def differ=(ignore)
+      RSpec.deprecate("RSpec::Expectations.differ=(differ)")
+    end
+  end
+end
+
+extend RSpec::Expectations::DeprecatedConstants
diff --git a/rspec-expectations/lib/rspec/expectations/fail_with.rb b/rspec-expectations/lib/rspec/expectations/fail_with.rb
new file mode 100644
index 0000000..b68eb19
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/fail_with.rb
@@ -0,0 +1,79 @@
+module RSpec
+  module Expectations
+    class << self
+      # @private
+      def differ
+        @differ ||= Differ.new
+      end
+
+      # Raises an RSpec::Expectations::ExpectationNotMetError with message.
+      # @param [String] message
+      # @param [Object] expected
+      # @param [Object] actual
+      #
+      # Adds a diff to the failure message when `expected` and `actual` are
+      # both present.
+      def fail_with(message, expected=nil, actual=nil)
+        if !message
+          raise ArgumentError, "Failure message is nil. Does your matcher define the " +
+                               "appropriate failure_message_for_* method to return a string?"
+        end
+
+        if actual && expected
+          if all_strings?(actual, expected)
+            if any_multiline_strings?(actual, expected)
+              message << "\nDiff:" << differ.diff_as_string(coerce_to_string(actual), coerce_to_string(expected))
+            end
+          elsif no_procs?(actual, expected) && no_numbers?(actual, expected)
+            message << "\nDiff:" << differ.diff_as_object(actual, expected)
+          end
+        end
+
+        raise(RSpec::Expectations::ExpectationNotMetError.new(message))
+      end
+
+    private
+
+      def no_procs?(*args)
+        args.flatten.none? {|a| Proc === a}
+      end
+
+      def all_strings?(*args)
+        args.flatten.all? {|a| String === a}
+      end
+
+      def any_multiline_strings?(*args)
+        all_strings?(*args) && args.flatten.any? { |a| multiline?(a) }
+      end
+
+      def no_numbers?(*args)
+        args.flatten.none? {|a| Numeric === a}
+      end
+
+      def coerce_to_string(string_or_array)
+        return string_or_array unless Array === string_or_array
+        diffably_stringify(string_or_array).join("\n")
+      end
+
+      def diffably_stringify(array)
+        array.map do |entry|
+          if Array === entry
+            entry.inspect
+          else
+            entry.to_s.gsub("\n", "\\n")
+          end
+        end
+      end
+
+      if String.method_defined?(:encoding)
+        def multiline?(string)
+          string.include?("\n".encode(string.encoding))
+        end
+      else
+        def multiline?(string)
+          string.include?("\n")
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/expectations/handler.rb b/rspec-expectations/lib/rspec/expectations/handler.rb
new file mode 100644
index 0000000..27dc88d
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/handler.rb
@@ -0,0 +1,68 @@
+module RSpec
+  module Expectations
+
+    class ExpectationHandler
+      def self.check_message(msg)
+        unless msg.nil? || msg.respond_to?(:to_str) || msg.respond_to?(:call)
+          ::Kernel.warn [
+            "WARNING: ignoring the provided expectation message argument (",
+            msg.inspect,
+            ") since it is not a string or a proc."
+          ].join
+        end
+      end
+    end
+
+    class PositiveExpectationHandler < ExpectationHandler
+
+      def self.handle_matcher(actual, matcher, message=nil, &block)
+        check_message(message)
+        ::RSpec::Matchers.last_should = :should
+        ::RSpec::Matchers.last_matcher = matcher
+        return ::RSpec::Matchers::BuiltIn::PositiveOperatorMatcher.new(actual) if matcher.nil?
+
+        match = matcher.matches?(actual, &block)
+        return match if match
+
+        message = message.call if message.respond_to?(:call)
+
+        message ||= matcher.respond_to?(:failure_message_for_should) ?
+                    matcher.failure_message_for_should :
+                    matcher.failure_message
+
+        if matcher.respond_to?(:diffable?) && matcher.diffable?
+          ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
+        else
+          ::RSpec::Expectations.fail_with message
+        end
+      end
+    end
+
+    class NegativeExpectationHandler < ExpectationHandler
+      def self.handle_matcher(actual, matcher, message=nil, &block)
+        check_message(message)
+        ::RSpec::Matchers.last_should = :should_not
+        ::RSpec::Matchers.last_matcher = matcher
+        return ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(actual) if matcher.nil?
+
+        match = matcher.respond_to?(:does_not_match?) ?
+                !matcher.does_not_match?(actual, &block) :
+                matcher.matches?(actual, &block)
+        return match unless match
+
+        message = message.call if message.respond_to?(:call)
+
+        message ||= matcher.respond_to?(:failure_message_for_should_not) ?
+                    matcher.failure_message_for_should_not :
+                    matcher.negative_failure_message
+
+        if matcher.respond_to?(:diffable?) && matcher.diffable?
+          ::RSpec::Expectations.fail_with message, matcher.expected, matcher.actual
+        else
+          ::RSpec::Expectations.fail_with message
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/lib/rspec/expectations/syntax.rb b/rspec-expectations/lib/rspec/expectations/syntax.rb
new file mode 100644
index 0000000..ec151c7
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/syntax.rb
@@ -0,0 +1,164 @@
+module RSpec
+  module Expectations
+    # @api private
+    # Provides methods for enabling and disabling the available
+    # syntaxes provided by rspec-expectations.
+    module Syntax
+      extend self
+
+      # @method should
+      # Passes if `matcher` returns true.  Available on every `Object`.
+      # @example
+      #   actual.should eq expected
+      #   actual.should match /expression/
+      # @param [Matcher]
+      #   matcher
+      # @param [String] message optional message to display when the expectation fails
+      # @return [Boolean] true if the expectation succeeds (else raises)
+      # @see RSpec::Matchers
+
+      # @method should_not
+      # Passes if `matcher` returns false.  Available on every `Object`.
+      # @example
+      #   actual.should_not eq expected
+      # @param [Matcher]
+      #   matcher
+      # @param [String] message optional message to display when the expectation fails
+      # @return [Boolean] false if the negative expectation succeeds (else raises)
+      # @see RSpec::Matchers
+
+      # @method expect
+      # Supports `expect(actual).to matcher` syntax by wrapping `actual` in an
+      # `ExpectationTarget`.
+      # @example
+      #   expect(actual).to eq(expected)
+      #   expect(actual).not_to eq(expected)
+      # @return [ExpectationTarget]
+      # @see ExpectationTarget#to
+      # @see ExpectationTarget#not_to
+
+      # @api private
+      # Determines where we add `should` and `should_not`.
+      def default_should_host
+        @default_should_host ||= ::Object.ancestors.last
+      end
+
+      # @api private
+      # Enables the `should` syntax.
+      def enable_should(syntax_host = default_should_host)
+        return if should_enabled?(syntax_host)
+
+        syntax_host.module_eval do
+          def should(matcher=nil, message=nil, &block)
+            ::RSpec::Expectations::PositiveExpectationHandler.handle_matcher(self, matcher, message, &block)
+          end
+
+          def should_not(matcher=nil, message=nil, &block)
+            ::RSpec::Expectations::NegativeExpectationHandler.handle_matcher(self, matcher, message, &block)
+          end
+        end
+
+        ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if expect_enabled?
+      end
+
+      # @api private
+      # Disables the `should` syntax.
+      def disable_should(syntax_host = default_should_host)
+        return unless should_enabled?(syntax_host)
+
+        syntax_host.module_eval do
+          undef should
+          undef should_not
+        end
+
+        ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should
+      end
+
+      # @api private
+      # Enables the `expect` syntax.
+      def enable_expect(syntax_host = ::RSpec::Matchers)
+        return if expect_enabled?(syntax_host)
+
+        syntax_host.module_eval do
+          def expect(*target, &target_block)
+            target << target_block if block_given?
+            raise ArgumentError.new("You must pass an argument or a block to #expect but not both.") unless target.size == 1
+            ::RSpec::Expectations::ExpectationTarget.new(target.first)
+          end
+        end
+
+        ::RSpec::Expectations::ExpectationTarget.enable_deprecated_should if should_enabled?
+      end
+
+      # @api private
+      # Disables the `expect` syntax.
+      def disable_expect(syntax_host = ::RSpec::Matchers)
+        return unless expect_enabled?(syntax_host)
+
+        syntax_host.module_eval do
+          undef expect
+        end
+
+        ::RSpec::Expectations::ExpectationTarget.disable_deprecated_should
+      end
+
+      # @api private
+      # Indicates whether or not the `should` syntax is enabled.
+      def should_enabled?(syntax_host = default_should_host)
+        syntax_host.method_defined?(:should)
+      end
+
+      # @api private
+      # Indicates whether or not the `expect` syntax is enabled.
+      def expect_enabled?(syntax_host = ::RSpec::Matchers)
+        syntax_host.method_defined?(:expect)
+      end
+
+      # @api private
+      # Generates a positive expectation expression.
+      def positive_expression(target_expression, matcher_expression)
+        expression_generator.positive_expression(target_expression, matcher_expression)
+      end
+
+      # @api private
+      # Generates a negative expectation expression.
+      def negative_expression(target_expression, matcher_expression)
+        expression_generator.negative_expression(target_expression, matcher_expression)
+      end
+
+      # @api private
+      # Selects which expression generator to use based on the configured syntax.
+      def expression_generator
+        if expect_enabled?
+          ExpectExpressionGenerator
+        else
+          ShouldExpressionGenerator
+        end
+      end
+
+      # @api private
+      # Generates expectation expressions for the `should` syntax.
+      module ShouldExpressionGenerator
+        def self.positive_expression(target_expression, matcher_expression)
+          "#{target_expression}.should #{matcher_expression}"
+        end
+
+        def self.negative_expression(target_expression, matcher_expression)
+          "#{target_expression}.should_not #{matcher_expression}"
+        end
+      end
+
+      # @api private
+      # Generates expectation expressions for the `expect` syntax.
+      module ExpectExpressionGenerator
+        def self.positive_expression(target_expression, matcher_expression)
+          "expect(#{target_expression}).to #{matcher_expression}"
+        end
+
+        def self.negative_expression(target_expression, matcher_expression)
+          "expect(#{target_expression}).not_to #{matcher_expression}"
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/expectations/version.rb b/rspec-expectations/lib/rspec/expectations/version.rb
new file mode 100644
index 0000000..f1e109c
--- /dev/null
+++ b/rspec-expectations/lib/rspec/expectations/version.rb
@@ -0,0 +1,9 @@
+module RSpec
+  module Expectations
+    # @private
+    module Version
+      STRING = '2.14.2'
+    end
+  end
+end
+
diff --git a/rspec-expectations/lib/rspec/matchers.rb b/rspec-expectations/lib/rspec/matchers.rb
new file mode 100644
index 0000000..27597c0
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers.rb
@@ -0,0 +1,697 @@
+require 'rspec/matchers/extensions/instance_eval_with_args'
+require 'rspec/matchers/pretty'
+
+require 'rspec/matchers/built_in'
+require 'rspec/matchers/matcher'
+require 'rspec/matchers/operator_matcher'
+require 'rspec/matchers/be_close'
+
+require 'rspec/matchers/generated_descriptions'
+require 'rspec/matchers/method_missing'
+require 'rspec/matchers/compatibility'
+require 'rspec/matchers/dsl'
+require 'rspec/matchers/test_unit_integration'
+
+module RSpec
+  # RSpec::Matchers provides a number of useful matchers we use to define
+  # expectations. A matcher is any object that responds to the following:
+  #
+  #     matches?(actual)
+  #     failure_message_for_should
+  #
+  # These methods are also part of the matcher protocol, but are optional:
+  #
+  #     does_not_match?(actual)
+  #     failure_message_for_should_not
+  #     description
+  #
+  # ## Predicates
+  #
+  # In addition to matchers that are defined explicitly, RSpec will create
+  # custom matchers on the fly for any arbitrary predicate, giving your specs a
+  # much more natural language feel.
+  #
+  # A Ruby predicate is a method that ends with a "?" and returns true or false.
+  # Common examples are `empty?`, `nil?`, and `instance_of?`.
+  #
+  # All you need to do is write `expect(..).to be_` followed by the predicate
+  # without the question mark, and RSpec will figure it out from there.
+  # For example:
+  #
+  #     expect([]).to be_empty     # => [].empty?() | passes
+  #     expect([]).not_to be_empty # => [].empty?() | fails
+  #
+  # In addtion to prefixing the predicate matchers with "be_", you can also use "be_a_"
+  # and "be_an_", making your specs read much more naturally:
+  #
+  #     expect("a string").to be_an_instance_of(String) # =>"a string".instance_of?(String) # passes
+  #
+  #     expect(3).to be_a_kind_of(Fixnum)        # => 3.kind_of?(Numeric)     | passes
+  #     expect(3).to be_a_kind_of(Numeric)       # => 3.kind_of?(Numeric)     | passes
+  #     expect(3).to be_an_instance_of(Fixnum)   # => 3.instance_of?(Fixnum)  | passes
+  #     expect(3).not_to be_an_instance_of(Numeric) # => 3.instance_of?(Numeric) | fails
+  #
+  # RSpec will also create custom matchers for predicates like `has_key?`. To
+  # use this feature, just state that the object should have_key(:key) and RSpec will
+  # call has_key?(:key) on the target. For example:
+  #
+  #     expect(:a => "A").to have_key(:a)
+  #     expect(:a => "A").to have_key(:b) # fails
+  #
+  # You can use this feature to invoke any predicate that begins with "has_", whether it is
+  # part of the Ruby libraries (like `Hash#has_key?`) or a method you wrote on your own class.
+  #
+  # ## Custom Matchers
+  #
+  # When you find that none of the stock matchers provide a natural feeling
+  # expectation, you can very easily write your own using RSpec's matcher DSL
+  # or writing one from scratch.
+  #
+  # ### Matcher DSL
+  #
+  # Imagine that you are writing a game in which players can be in various
+  # zones on a virtual board. To specify that bob should be in zone 4, you
+  # could say:
+  #
+  #     expect(bob.current_zone).to eql(Zone.new("4"))
+  #
+  # But you might find it more expressive to say:
+  #
+  #     expect(bob).to be_in_zone("4")
+  #
+  # and/or
+  #
+  #     expect(bob).not_to be_in_zone("3")
+  #
+  # You can create such a matcher like so:
+  #
+  #     RSpec::Matchers.define :be_in_zone do |zone|
+  #       match do |player|
+  #         player.in_zone?(zone)
+  #       end
+  #     end
+  #
+  # This will generate a <tt>be_in_zone</tt> method that returns a matcher
+  # with logical default messages for failures. You can override the failure
+  # messages and the generated description as follows:
+  #
+  #     RSpec::Matchers.define :be_in_zone do |zone|
+  #       match do |player|
+  #         player.in_zone?(zone)
+  #       end
+  #
+  #       failure_message_for_should do |player|
+  #         # generate and return the appropriate string.
+  #       end
+  #
+  #       failure_message_for_should_not do |player|
+  #         # generate and return the appropriate string.
+  #       end
+  #
+  #       description do
+  #         # generate and return the appropriate string.
+  #       end
+  #     end
+  #
+  # Each of the message-generation methods has access to the block arguments
+  # passed to the <tt>create</tt> method (in this case, <tt>zone</tt>). The
+  # failure message methods (<tt>failure_message_for_should</tt> and
+  # <tt>failure_message_for_should_not</tt>) are passed the actual value (the
+  # receiver of <tt>expect(..)</tt> or <tt>expect(..).not_to</tt>).
+  #
+  # ### Custom Matcher from scratch
+  #
+  # You could also write a custom matcher from scratch, as follows:
+  #
+  #     class BeInZone
+  #       def initialize(expected)
+  #         @expected = expected
+  #       end
+  #
+  #       def matches?(target)
+  #         @target = target
+  #         @target.current_zone.eql?(Zone.new(@expected))
+  #       end
+  #
+  #       def failure_message_for_should
+  #         "expected #{@target.inspect} to be in Zone #{@expected}"
+  #       end
+  #
+  #       def failure_message_for_should_not
+  #         "expected #{@target.inspect} not to be in Zone #{@expected}"
+  #       end
+  #     end
+  #
+  # ... and a method like this:
+  #
+  #     def be_in_zone(expected)
+  #       BeInZone.new(expected)
+  #     end
+  #
+  # And then expose the method to your specs. This is normally done
+  # by including the method and the class in a module, which is then
+  # included in your spec:
+  #
+  #     module CustomGameMatchers
+  #       class BeInZone
+  #         # ...
+  #       end
+  #
+  #       def be_in_zone(expected)
+  #         # ...
+  #       end
+  #     end
+  #
+  #     describe "Player behaviour" do
+  #       include CustomGameMatchers
+  #       # ...
+  #     end
+  #
+  # or you can include in globally in a spec_helper.rb file <tt>require</tt>d
+  # from your spec file(s):
+  #
+  #     RSpec::configure do |config|
+  #       config.include(CustomGameMatchers)
+  #     end
+  module Matchers
+    # @api private
+    def self.is_a_matcher?(obj)
+      return true  if ::RSpec::Matchers::BuiltIn::BaseMatcher === obj
+      return false if obj.respond_to?(:i_respond_to_everything_so_im_not_really_a_matcher)
+      return false unless obj.respond_to?(:matches?)
+
+      obj.respond_to?(:failure_message_for_should) || obj.respond_to?(:failure_message)
+    end
+
+    # Passes if actual is truthy (anything but false or nil)
+    def be_true
+      BuiltIn::BeTrue.new
+    end
+
+    # Passes if actual is falsy (false or nil)
+    def be_false
+      BuiltIn::BeFalse.new
+    end
+
+    # Passes if actual is nil
+    def be_nil
+      BuiltIn::BeNil.new
+    end
+
+    # @example
+    #   expect(actual).to     be_true
+    #   expect(actual).to     be_false
+    #   expect(actual).to     be_nil
+    #   expect(actual).to     be_[arbitrary_predicate](*args)
+    #   expect(actual).not_to be_nil
+    #   expect(actual).not_to be_[arbitrary_predicate](*args)
+    #
+    # Given true, false, or nil, will pass if actual value is true, false or
+    # nil (respectively). Given no args means the caller should satisfy an if
+    # condition (to be or not to be).
+    #
+    # Predicates are any Ruby method that ends in a "?" and returns true or
+    # false.  Given be_ followed by arbitrary_predicate (without the "?"),
+    # RSpec will match convert that into a query against the target object.
+    #
+    # The arbitrary_predicate feature will handle any predicate prefixed with
+    # "be_an_" (e.g. be_an_instance_of), "be_a_" (e.g. be_a_kind_of) or "be_"
+    # (e.g. be_empty), letting you choose the prefix that best suits the
+    # predicate.
+    def be(*args)
+      args.empty? ?
+        Matchers::BuiltIn::Be.new : equal(*args)
+    end
+
+    # passes if target.kind_of?(klass)
+    def be_a(klass)
+      be_a_kind_of(klass)
+    end
+
+    alias_method :be_an, :be_a
+
+    # Passes if actual.instance_of?(expected)
+    #
+    # @example
+    #
+    #   expect(5).to     be_an_instance_of(Fixnum)
+    #   expect(5).not_to be_an_instance_of(Numeric)
+    #   expect(5).not_to be_an_instance_of(Float)
+    def be_an_instance_of(expected)
+      BuiltIn::BeAnInstanceOf.new(expected)
+    end
+
+    alias_method :be_instance_of, :be_an_instance_of
+
+    # Passes if actual.kind_of?(expected)
+    #
+    # @example
+    #
+    #   expect(5).to     be_a_kind_of(Fixnum)
+    #   expect(5).to     be_a_kind_of(Numeric)
+    #   expect(5).not_to be_a_kind_of(Float)
+    def be_a_kind_of(expected)
+      BuiltIn::BeAKindOf.new(expected)
+    end
+
+    alias_method :be_kind_of, :be_a_kind_of
+
+    # Passes if actual == expected +/- delta
+    #
+    # @example
+    #
+    #   expect(result).to     be_within(0.5).of(3.0)
+    #   expect(result).not_to be_within(0.5).of(3.0)
+    def be_within(delta)
+      BuiltIn::BeWithin.new(delta)
+    end
+
+    # Applied to a proc, specifies that its execution will cause some value to
+    # change.
+    #
+    # @param [Object] receiver
+    # @param [Symbol] message the message to send the receiver
+    #
+    # You can either pass <tt>receiver</tt> and <tt>message</tt>, or a block,
+    # but not both.
+    #
+    # When passing a block, it must use the <tt>{ ... }</tt> format, not
+    # do/end, as <tt>{ ... }</tt> binds to the +change+ method, whereas do/end
+    # would errantly bind to the +expect(..)+ or +expect(..).not_to+ method.
+    #
+    # @example
+    #
+    #   expect {
+    #     team.add_player(player)
+    #   }.to change(roster, :count)
+    #
+    #   expect {
+    #     team.add_player(player)
+    #   }.to change(roster, :count).by(1)
+    #
+    #   expect {
+    #     team.add_player(player)
+    #   }.to change(roster, :count).by_at_least(1)
+    #
+    #   expect {
+    #     team.add_player(player)
+    #   }.to change(roster, :count).by_at_most(1)
+    #
+    #   string = "string"
+    #   expect {
+    #     string.reverse!
+    #   }.to change { string }.from("string").to("gnirts")
+    #
+    #   string = "string"
+    #   expect {
+    #     string
+    #   }.not_to change { string }
+    #
+    #   expect {
+    #     person.happy_birthday
+    #   }.to change(person, :birthday).from(32).to(33)
+    #
+    #   expect {
+    #     employee.develop_great_new_social_networking_app
+    #   }.to change(employee, :title).from("Mail Clerk").to("CEO")
+    #
+    #   expect {
+    #     doctor.leave_office
+    #   }.to change(doctor, :sign).from(/is in/).to(/is out/)
+    #
+    #   user = User.new(:type => "admin")
+    #   expect {
+    #     user.symbolize_type
+    #   }.to change(user, :type).from(String).to(Symbol)
+    #
+    # == Notes
+    #
+    # Evaluates <tt>receiver.message</tt> or <tt>block</tt> before and after it
+    # evaluates the block passed to <tt>expect</tt>.
+    #
+    # <tt>expect( ... ).not_to change</tt> only supports the form with no subsequent
+    # calls to <tt>by</tt>, <tt>by_at_least</tt>, <tt>by_at_most</tt>,
+    # <tt>to</tt> or <tt>from</tt>.
+    def change(receiver=nil, message=nil, &block)
+      BuiltIn::Change.new(receiver, message, &block)
+    end
+
+    # Passes if actual covers expected. This works for
+    # Ranges. You can also pass in multiple args
+    # and it will only pass if all args are found in Range.
+    #
+    # @example
+    #   expect(1..10).to     cover(5)
+    #   expect(1..10).to     cover(4, 6)
+    #   expect(1..10).to     cover(4, 6, 11) # fails
+    #   expect(1..10).not_to cover(11)
+    #   expect(1..10).not_to cover(5)        # fails
+    #
+    # ### Warning:: Ruby >= 1.9 only
+    def cover(*values)
+      BuiltIn::Cover.new(*values)
+    end if (1..2).respond_to?(:cover?)
+
+    # Matches if the actual value ends with the expected value(s). In the case
+    # of a string, matches against the last `expected.length` characters of the
+    # actual string. In the case of an array, matches against the last
+    # `expected.length` elements of the actual array.
+    #
+    # @example
+    #
+    #   expect("this string").to   end_with "string"
+    #   expect([0, 1, 2, 3, 4]).to end_with 4
+    #   expect([0, 2, 3, 4, 4]).to end_with 3, 4
+    def end_with(*expected)
+      BuiltIn::EndWith.new(*expected)
+    end
+
+    # Passes if <tt>actual == expected</tt>.
+    #
+    # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more
+    # information about equality in Ruby.
+    #
+    # @example
+    #
+    #   expect(5).to     eq(5)
+    #   expect(5).not_to eq(3)
+    def eq(expected)
+      BuiltIn::Eq.new(expected)
+    end
+
+    # Passes if +actual.eql?(expected)+
+    #
+    # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more
+    # information about equality in Ruby.
+    #
+    # @example
+    #
+    #   expect(5).to     eql(5)
+    #   expect(5).not_to eql(3)
+    def eql(expected)
+      BuiltIn::Eql.new(expected)
+    end
+
+    # Passes if <tt>actual.equal?(expected)</tt> (object identity).
+    #
+    # See http://www.ruby-doc.org/core/classes/Object.html#M001057 for more
+    # information about equality in Ruby.
+    #
+    # @example
+    #
+    #   expect(5).to       equal(5)   # Fixnums are equal
+    #   expect("5").not_to equal("5") # Strings that look the same are not the same object
+    def equal(expected)
+      BuiltIn::Equal.new(expected)
+    end
+
+    # Passes if `actual.exist?` or `actual.exists?`
+    #
+    # @example
+    #   expect(File).to exist("path/to/file")
+    def exist(*args)
+      BuiltIn::Exist.new(*args)
+    end
+
+    # Passes if receiver is a collection with the submitted number of items OR
+    # if the receiver OWNS a collection with the submitted number of items.
+    #
+    # If the receiver OWNS the collection, you must use the name of the
+    # collection. So if a `Team` instance has a collection named `#players`,
+    # you must use that name to set the expectation.
+    #
+    # If the receiver IS the collection, you can use any name you like for
+    # `named_collection`. We'd recommend using either "elements", "members", or
+    # "items" as these are all standard ways of describing the things IN a
+    # collection.
+    #
+    # This also works for Strings, letting you set expectations about their
+    # lengths.
+    #
+    # @example
+    #
+    #   # Passes if team.players.size == 11
+    #   expect(team).to have(11).players
+    #
+    #   # Passes if [1,2,3].length == 3
+    #   expect([1,2,3]).to have(3).items #"items" is pure sugar
+    #
+    #   # Passes if ['a', 'b', 'c'].count == 3
+    #   expect([1,2,3]).to have(3).items #"items" is pure sugar
+    #
+    #   # Passes if "this string".length == 11
+    #   expect("this string").to have(11).characters #"characters" is pure sugar
+    def have(n)
+      BuiltIn::Have.new(n)
+    end
+    alias :have_exactly :have
+
+    # Exactly like have() with >=.
+    #
+    # @example
+    #   expect("this").to have_at_least(3).letters
+    #
+    # ### Warning:
+    #
+    # `expect(..).not_to have_at_least` is not supported
+    def have_at_least(n)
+      BuiltIn::Have.new(n, :at_least)
+    end
+
+    # Exactly like have() with <=.
+    #
+    # @example
+    #   expect("this").to have_at_most(4).letters
+    #
+    # ### Warning:
+    #
+    # `expect(..).not_to have_at_most` is not supported
+    def have_at_most(n)
+      BuiltIn::Have.new(n, :at_most)
+    end
+
+    # Passes if actual includes expected. This works for
+    # collections and Strings. You can also pass in multiple args
+    # and it will only pass if all args are found in collection.
+    #
+    # @example
+    #
+    #   expect([1,2,3]).to      include(3)
+    #   expect([1,2,3]).to      include(2,3)
+    #   expect([1,2,3]).to      include(2,3,4) # fails
+    #   expect([1,2,3]).not_to  include(4)
+    #   expect("spread").to     include("read")
+    #   expect("spread").not_to include("red")
+    def include(*expected)
+      BuiltIn::Include.new(*expected)
+    end
+
+    # Given a Regexp or String, passes if actual.match(pattern)
+    #
+    # @example
+    #
+    #   expect(email).to   match(/^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
+    #   expect(email).to   match("@example.com")
+    #   expect(zipcode).to match_regex(/\A\d{5}(-\d{4})?\z/)
+    #   expect(zipcode).to match_regex("90210")
+    #
+    # @note Due to Ruby's method dispatch mechanism, using the `#match` matcher
+    # within a custom matcher defined via the matcher DSL
+    # (`RSpec::Matcher.define`) will result Ruby calling the wrong `#match`
+    # method and raising an `ArgumentError`. Instead, use the aliased
+    # `#match_regex` method.
+    def match(expected)
+      BuiltIn::Match.new(expected)
+    end
+
+    alias_method :match_regex, :match
+
+    # With no args, matches if any error is raised.
+    # With a named error, matches only if that specific error is raised.
+    # With a named error and messsage specified as a String, matches only if both match.
+    # With a named error and messsage specified as a Regexp, matches only if both match.
+    # Pass an optional block to perform extra verifications on the exception matched
+    #
+    # @example
+    #
+    #   expect { do_something_risky }.to raise_error
+    #   expect { do_something_risky }.to raise_error(PoorRiskDecisionError)
+    #   expect { do_something_risky }.to raise_error(PoorRiskDecisionError) { |error| expect(error.data).to eq 42 }
+    #   expect { do_something_risky }.to raise_error(PoorRiskDecisionError, "that was too risky")
+    #   expect { do_something_risky }.to raise_error(PoorRiskDecisionError, /oo ri/)
+    #
+    #   expect { do_something_risky }.not_to raise_error
+    #   expect { do_something_risky }.not_to raise_error(PoorRiskDecisionError)
+    #   expect { do_something_risky }.not_to raise_error(PoorRiskDecisionError, "that was too risky")
+    #   expect { do_something_risky }.not_to raise_error(PoorRiskDecisionError, /oo ri/)
+    def raise_error(error=Exception, message=nil, &block)
+      BuiltIn::RaiseError.new(error, message, &block)
+    end
+
+    alias_method :raise_exception, :raise_error
+
+    # Matches if the target object responds to all of the names
+    # provided. Names can be Strings or Symbols.
+    #
+    # @example
+    #
+    # expect("string").to respond_to(:length)
+    #
+    def respond_to(*names)
+      BuiltIn::RespondTo.new(*names)
+    end
+
+    # Passes if the submitted block returns true. Yields target to the
+    # block.
+    #
+    # Generally speaking, this should be thought of as a last resort when
+    # you can't find any other way to specify the behaviour you wish to
+    # specify.
+    #
+    # If you do find yourself in such a situation, you could always write
+    # a custom matcher, which would likely make your specs more expressive.
+    #
+    # @example
+    #
+    #   expect(5).to satisfy { |n| n > 3 }
+    def satisfy(&block)
+      BuiltIn::Satisfy.new(&block)
+    end
+
+    # Matches if the actual value starts with the expected value(s). In the
+    # case of a string, matches against the first `expected.length` characters
+    # of the actual string. In the case of an array, matches against the first
+    # `expected.length` elements of the actual array.
+    #
+    # @example
+    #
+    #   expect("this string").to   start_with "this s"
+    #   expect([0, 1, 2, 3, 4]).to start_with 0
+    #   expect([0, 2, 3, 4, 4]).to start_with 0, 1
+    def start_with(*expected)
+      BuiltIn::StartWith.new(*expected)
+    end
+
+    # Given no argument, matches if a proc throws any Symbol.
+    #
+    # Given a Symbol, matches if the given proc throws the specified Symbol.
+    #
+    # Given a Symbol and an arg, matches if the given proc throws the
+    # specified Symbol with the specified arg.
+    #
+    # @example
+    #
+    #   expect { do_something_risky }.to throw_symbol
+    #   expect { do_something_risky }.to throw_symbol(:that_was_risky)
+    #   expect { do_something_risky }.to throw_symbol(:that_was_risky, 'culprit')
+    #
+    #   expect { do_something_risky }.not_to throw_symbol
+    #   expect { do_something_risky }.not_to throw_symbol(:that_was_risky)
+    #   expect { do_something_risky }.not_to throw_symbol(:that_was_risky, 'culprit')
+    def throw_symbol(expected_symbol=nil, expected_arg=nil)
+      BuiltIn::ThrowSymbol.new(expected_symbol, expected_arg)
+    end
+
+    # Passes if the method called in the expect block yields, regardless
+    # of whether or not arguments are yielded.
+    #
+    # @example
+    #
+    #   expect { |b| 5.tap(&b) }.to yield_control
+    #   expect { |b| "a".to_sym(&b) }.not_to yield_control
+    #
+    # @note Your expect block must accept a parameter and pass it on to
+    #   the method-under-test as a block.
+    # @note This matcher is not designed for use with methods that yield
+    #   multiple times.
+    def yield_control
+      BuiltIn::YieldControl.new
+    end
+
+    # Passes if the method called in the expect block yields with
+    # no arguments. Fails if it does not yield, or yields with arguments.
+    #
+    # @example
+    #
+    #   expect { |b| User.transaction(&b) }.to yield_with_no_args
+    #   expect { |b| 5.tap(&b) }.not_to yield_with_no_args # because it yields with `5`
+    #   expect { |b| "a".to_sym(&b) }.not_to yield_with_no_args # because it does not yield
+    #
+    # @note Your expect block must accept a parameter and pass it on to
+    #   the method-under-test as a block.
+    # @note This matcher is not designed for use with methods that yield
+    #   multiple times.
+    def yield_with_no_args
+      BuiltIn::YieldWithNoArgs.new
+    end
+
+    # Given no arguments, matches if the method called in the expect
+    # block yields with arguments (regardless of what they are or how
+    # many there are).
+    #
+    # Given arguments, matches if the method called in the expect block
+    # yields with arguments that match the given arguments.
+    #
+    # Argument matching is done using `===` (the case match operator)
+    # and `==`. If the expected and actual arguments match with either
+    # operator, the matcher will pass.
+    #
+    # @example
+    #
+    #   expect { |b| 5.tap(&b) }.to yield_with_args # because #tap yields an arg
+    #   expect { |b| 5.tap(&b) }.to yield_with_args(5) # because 5 == 5
+    #   expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum) # because Fixnum === 5
+    #   expect { |b| File.open("f.txt", &b) }.to yield_with_args(/txt/) # because /txt/ === "f.txt"
+    #
+    #   expect { |b| User.transaction(&b) }.not_to yield_with_args # because it yields no args
+    #   expect { |b| 5.tap(&b) }.not_to yield_with_args(1, 2, 3)
+    #
+    # @note Your expect block must accept a parameter and pass it on to
+    #   the method-under-test as a block.
+    # @note This matcher is not designed for use with methods that yield
+    #   multiple times.
+    def yield_with_args(*args)
+      BuiltIn::YieldWithArgs.new(*args)
+    end
+
+    # Designed for use with methods that repeatedly yield (such as
+    # iterators). Passes if the method called in the expect block yields
+    # multiple times with arguments matching those given.
+    #
+    # Argument matching is done using `===` (the case match operator)
+    # and `==`. If the expected and actual arguments match with either
+    # operator, the matcher will pass.
+    #
+    # @example
+    #
+    #   expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
+    #   expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+    #   expect { |b| [1, 2, 3].each(&b) }.not_to yield_successive_args(1, 2)
+    #
+    # @note Your expect block must accept a parameter and pass it on to
+    #   the method-under-test as a block.
+    def yield_successive_args(*args)
+      BuiltIn::YieldSuccessiveArgs.new(*args)
+    end
+
+    # Passes if actual contains all of the expected regardless of order.
+    # This works for collections. Pass in multiple args and it will only
+    # pass if all args are found in collection.
+    #
+    # @note This is also available using the `=~` operator with `should`,
+    #       but `=~` is not supported with `expect`.
+    #
+    # @note This matcher only supports positive expectations.
+    #       expect(..).not_to match_array(other_array) is not supported.
+    #
+    # @example
+    #
+    #   expect([1,2,3]).to match_array([1,2,3])
+    #   expect([1,2,3]).to match_array([1,3,2])
+    def match_array(array)
+      BuiltIn::MatchArray.new(array)
+    end
+
+    OperatorMatcher.register(Enumerable, '=~', BuiltIn::MatchArray)
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/be_close.rb b/rspec-expectations/lib/rspec/matchers/be_close.rb
new file mode 100644
index 0000000..e00f89c
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/be_close.rb
@@ -0,0 +1,9 @@
+module RSpec
+  module Matchers
+    # @deprecated use +be_within+ instead.
+    def be_close(expected, delta)
+      RSpec.deprecate("be_close(#{expected}, #{delta})", :replacement => "be_within(#{delta}).of(#{expected})")
+      be_within(delta).of(expected)
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in.rb b/rspec-expectations/lib/rspec/matchers/built_in.rb
new file mode 100644
index 0000000..0d527ba
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in.rb
@@ -0,0 +1,39 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      require 'rspec/matchers/built_in/base_matcher'
+      autoload :BeAnInstanceOf, 'rspec/matchers/built_in/be_instance_of'
+      autoload :Be,             'rspec/matchers/built_in/be'
+      autoload :BeTrue,         'rspec/matchers/built_in/be'
+      autoload :BeFalse,        'rspec/matchers/built_in/be'
+      autoload :BeNil,          'rspec/matchers/built_in/be'
+      autoload :BeComparedTo,   'rspec/matchers/built_in/be'
+      autoload :BePredicate,    'rspec/matchers/built_in/be'
+      autoload :BeAKindOf,      'rspec/matchers/built_in/be_kind_of'
+      autoload :BeWithin,       'rspec/matchers/built_in/be_within'
+      autoload :Change,         'rspec/matchers/built_in/change'
+      autoload :Cover,          'rspec/matchers/built_in/cover' if (1..2).respond_to?(:cover?)
+      autoload :Eq,             'rspec/matchers/built_in/eq'
+      autoload :Eql,            'rspec/matchers/built_in/eql'
+      autoload :Equal,          'rspec/matchers/built_in/equal'
+      autoload :Exist,          'rspec/matchers/built_in/exist'
+      autoload :Has,            'rspec/matchers/built_in/has'
+      autoload :Have,           'rspec/matchers/built_in/have'
+      autoload :Include,        'rspec/matchers/built_in/include'
+      autoload :Match,          'rspec/matchers/built_in/match'
+      autoload :MatchArray,     'rspec/matchers/built_in/match_array'
+      autoload :RaiseError,     'rspec/matchers/built_in/raise_error'
+      autoload :RespondTo,      'rspec/matchers/built_in/respond_to'
+      autoload :StartWith,      'rspec/matchers/built_in/start_and_end_with'
+      autoload :EndWith,        'rspec/matchers/built_in/start_and_end_with'
+      autoload :Satisfy,        'rspec/matchers/built_in/satisfy'
+      autoload :ThrowSymbol,    'rspec/matchers/built_in/throw_symbol'
+      autoload :YieldControl,   'rspec/matchers/built_in/yield'
+      autoload :YieldWithArgs,  'rspec/matchers/built_in/yield'
+      autoload :YieldWithNoArgs, 'rspec/matchers/built_in/yield'
+      autoload :YieldSuccessiveArgs, 'rspec/matchers/built_in/yield'
+    end
+  end
+end
+
+
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb b/rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb
new file mode 100644
index 0000000..e4aefe3
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/base_matcher.rb
@@ -0,0 +1,68 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      # @api private
+      #
+      # Used _internally_ as a base class for matchers that ship with
+      # rspec-expectations.
+      #
+      # ### Warning:
+      #
+      # This class is for internal use, and subject to change without notice.  We
+      # strongly recommend that you do not base your custom matchers on this
+      # class. If/when this changes, we will announce it and remove this warning.
+      class BaseMatcher
+        include RSpec::Matchers::Pretty
+
+        attr_reader :actual, :expected, :rescued_exception
+
+        def initialize(expected = nil)
+          @expected = expected
+        end
+
+        def matches?(actual)
+          @actual = actual
+          match(expected, actual)
+        end
+
+        def match_unless_raises(*exceptions)
+          exceptions.unshift Exception if exceptions.empty?
+          begin
+            yield
+            true
+          rescue *exceptions => @rescued_exception
+            false
+          end
+        end
+
+        def failure_message_for_should
+          assert_ivars :@actual, :@expected
+          "expected #{@actual.inspect} to #{name_to_sentence}#{expected_to_sentence}"
+        end
+
+        def failure_message_for_should_not
+          assert_ivars :@actual, :@expected
+          "expected #{@actual.inspect} not to #{name_to_sentence}#{expected_to_sentence}"
+        end
+
+        def description
+          expected ? "#{name_to_sentence} #{@expected.inspect}" : name_to_sentence
+        end
+
+        def diffable?
+          false
+        end
+
+        def ==(other)
+          matches?(other)
+        end
+
+        private
+
+        def assert_ivars *ivars
+          raise "#{self.class.name} needs to supply #{to_sentence ivars}" unless ivars.all? { |v| instance_variables.map(&:intern).include? v }
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/be.rb b/rspec-expectations/lib/rspec/matchers/built_in/be.rb
new file mode 100644
index 0000000..9677541
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/be.rb
@@ -0,0 +1,197 @@
+require 'rspec/matchers/dsl'
+
+module RSpec
+  module Matchers
+    module BuiltIn
+      class BeTrue < BaseMatcher
+        def match(_, actual)
+          !!actual
+        end
+
+        def failure_message_for_should
+          "expected: true value\n     got: #{actual.inspect}"
+        end
+
+        def failure_message_for_should_not
+          "expected: non-true value\n     got: #{actual.inspect}"
+        end
+      end
+
+      class BeFalse < BaseMatcher
+        def match(_, actual)
+          !actual
+        end
+
+        def failure_message_for_should
+          "expected: false value\n     got: #{actual.inspect}"
+        end
+
+        def failure_message_for_should_not
+          "expected: non-false value\n     got: #{actual.inspect}"
+        end
+      end
+
+      class BeNil < BaseMatcher
+        def match(_, actual)
+          actual.nil?
+        end
+
+        def failure_message_for_should
+          "expected: nil\n     got: #{actual.inspect}"
+        end
+
+        def failure_message_for_should_not
+          "expected: not nil\n     got: nil"
+        end
+      end
+
+      module BeHelpers
+        private
+
+        def args_to_s
+          @args.empty? ? "" : parenthesize(inspected_args.join(', '))
+        end
+
+        def parenthesize(string)
+          "(#{string})"
+        end
+
+        def inspected_args
+          @args.collect{|a| a.inspect}
+        end
+
+        def expected_to_sentence
+          split_words(@expected)
+        end
+
+        def args_to_sentence
+          to_sentence(@args)
+        end
+      end
+
+      class Be < BaseMatcher
+        include BeHelpers
+
+        def initialize(*args, &block)
+          @args = args
+        end
+
+        def match(_, actual)
+          !!actual
+        end
+
+        def failure_message_for_should
+          "expected #{@actual.inspect} to evaluate to true"
+        end
+
+        def failure_message_for_should_not
+          "expected #{@actual.inspect} to evaluate to false"
+        end
+
+        [:==, :<, :<=, :>=, :>, :===, :=~].each do |operator|
+          define_method operator do |operand|
+            BeComparedTo.new(operand, operator)
+          end
+        end
+      end
+
+      class BeComparedTo < Be
+        def initialize(operand, operator)
+          @expected, @operator = operand, operator
+            @args = []
+        end
+
+        def matches?(actual)
+          @actual = actual
+          @actual.__send__ @operator, @expected
+        end
+
+        def failure_message_for_should
+          "expected: #{@operator} #{@expected.inspect}\n     got: #{@operator.to_s.gsub(/./, ' ')} #{@actual.inspect}"
+        end
+
+        def failure_message_for_should_not
+          message = <<-MESSAGE
+`#{negative_expectation_expression}` not only FAILED,
+it is a bit confusing.
+          MESSAGE
+
+          raise message << ([:===,:==].include?(@operator) ?
+                            "It might be more clearly expressed without the \"be\"?" :
+                            "It might be more clearly expressed in the positive?")
+        end
+
+        def description
+          "be #{@operator} #{expected_to_sentence}#{args_to_sentence}"
+        end
+
+        def negative_expectation_expression
+          Expectations::Syntax.negative_expression("actual", "be #{@operator} #{@expected}")
+        end
+      end
+
+      class BePredicate < BaseMatcher
+        include BeHelpers
+
+        def initialize(*args, &block)
+          @expected = parse_expected(args.shift)
+          @args = args
+          @block = block
+        end
+
+        def matches?(actual)
+          @actual = actual
+          begin
+            return @result = actual.__send__(predicate, *@args, &@block)
+          rescue NameError => predicate_missing_error
+            "this needs to be here or rcov will not count this branch even though it's executed in a code example"
+          end
+
+          begin
+            return @result = actual.__send__(present_tense_predicate, *@args, &@block)
+          rescue NameError
+            raise predicate_missing_error
+          end
+        end
+
+        alias === matches?
+
+        def failure_message_for_should
+          "expected #{predicate}#{args_to_s} to return true, got #{@result.inspect}"
+        end
+
+        def failure_message_for_should_not
+          "expected #{predicate}#{args_to_s} to return false, got #{@result.inspect}"
+        end
+
+        def description
+          "#{prefix_to_sentence}#{expected_to_sentence}#{args_to_sentence}"
+        end
+
+        private
+
+        def predicate
+          "#{@expected}?".to_sym
+        end
+
+        def present_tense_predicate
+          "#{@expected}s?".to_sym
+        end
+
+        def parse_expected(expected)
+          @prefix, expected = prefix_and_expected(expected)
+          expected
+        end
+
+        def prefix_and_expected(symbol)
+          symbol.to_s =~ /^(be_(an?_)?)(.*)/
+          return $1, $3
+        end
+
+        def prefix_to_sentence
+          split_words(@prefix)
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/be_instance_of.rb b/rspec-expectations/lib/rspec/matchers/built_in/be_instance_of.rb
new file mode 100644
index 0000000..1640edc
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/be_instance_of.rb
@@ -0,0 +1,15 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class BeAnInstanceOf < BaseMatcher
+        def match(expected, actual)
+          actual.instance_of? expected
+        end
+
+        def description
+          "be an instance of #{expected}"
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/be_kind_of.rb b/rspec-expectations/lib/rspec/matchers/built_in/be_kind_of.rb
new file mode 100644
index 0000000..658fea0
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/be_kind_of.rb
@@ -0,0 +1,11 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class BeAKindOf < BaseMatcher
+        def match(expected, actual)
+          actual.kind_of? expected
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/be_within.rb b/rspec-expectations/lib/rspec/matchers/built_in/be_within.rb
new file mode 100644
index 0000000..c46c54a
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/be_within.rb
@@ -0,0 +1,55 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class BeWithin
+        def initialize(delta)
+          @delta = delta
+        end
+
+        def matches?(actual)
+          @actual = actual
+          raise needs_expected     unless defined? @expected
+          raise needs_subtractable unless @actual.respond_to? :-
+          (@actual - @expected).abs <= @tolerance
+        end
+        alias == matches?
+
+        def of(expected)
+          @expected  = expected
+          @tolerance = @delta
+          @unit      = ''
+          self
+        end
+
+        def percent_of(expected)
+          @expected  = expected
+          @tolerance = @delta * @expected.abs / 100.0
+          @unit      = '%'
+          self
+        end
+
+        def failure_message_for_should
+          "expected #{@actual} to #{description}"
+        end
+
+        def failure_message_for_should_not
+          "expected #{@actual} not to #{description}"
+        end
+
+        def description
+          "be within #{@delta}#{@unit} of #{@expected}"
+        end
+
+        private
+
+        def needs_subtractable
+          ArgumentError.new "The actual value (#{@actual.inspect}) must respond to `-`"
+        end
+
+        def needs_expected
+          ArgumentError.new "You must set an expected value using #of: be_within(#{@delta}).of(expected_value)"
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/change.rb b/rspec-expectations/lib/rspec/matchers/built_in/change.rb
new file mode 100644
index 0000000..1acd86d
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/change.rb
@@ -0,0 +1,141 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Change
+        def initialize(receiver=nil, message=nil, &block)
+          @message = message
+          @value_proc = block || lambda {receiver.__send__(message)}
+          @expected_after = @expected_before = @minimum = @maximum = @expected_delta = nil
+          @eval_before = @eval_after = false
+        end
+
+        def matches?(event_proc)
+          raise_block_syntax_error if block_given?
+
+          @actual_before = evaluate_value_proc
+          event_proc.call
+          @actual_after = evaluate_value_proc
+
+          (!change_expected? || changed?) && matches_before? && matches_after? && matches_expected_delta? && matches_min? && matches_max?
+        end
+        alias == matches?
+
+        def raise_block_syntax_error
+          raise SyntaxError.new(<<-MESSAGE)
+block passed to should or should_not change must use {} instead of do/end
+MESSAGE
+        end
+
+        def evaluate_value_proc
+          case val = @value_proc.call
+          when Enumerable, String
+            val.dup
+          else
+            val
+          end
+        end
+
+        def failure_message_for_should
+          if @eval_before && !expected_matches_actual?(@expected_before, @actual_before)
+            "#{message} should have initially been #{@expected_before.inspect}, but was #{@actual_before.inspect}"
+          elsif @eval_after && !expected_matches_actual?(@expected_after, @actual_after)
+            "#{message} should have been changed to #{failure_message_for_expected_after}, but is now #{@actual_after.inspect}"
+          elsif @expected_delta
+            "#{message} should have been changed by #{@expected_delta.inspect}, but was changed by #{actual_delta.inspect}"
+          elsif @minimum
+            "#{message} should have been changed by at least #{@minimum.inspect}, but was changed by #{actual_delta.inspect}"
+          elsif @maximum
+            "#{message} should have been changed by at most #{@maximum.inspect}, but was changed by #{actual_delta.inspect}"
+          else
+            "#{message} should have changed, but is still #{@actual_before.inspect}"
+          end
+        end
+
+        def actual_delta
+          @actual_after - @actual_before
+        end
+
+        def failure_message_for_should_not
+          "#{message} should not have changed, but did change from #{@actual_before.inspect} to #{@actual_after.inspect}"
+        end
+
+        def by(expected_delta)
+          @expected_delta = expected_delta
+          self
+        end
+
+        def by_at_least(minimum)
+          @minimum = minimum
+          self
+        end
+
+        def by_at_most(maximum)
+          @maximum = maximum
+          self
+        end
+
+        def to(to)
+          @eval_after = true
+          @expected_after = to
+          self
+        end
+
+        def from (before)
+          @eval_before = true
+          @expected_before = before
+          self
+        end
+
+        def description
+          "change ##{message}"
+        end
+
+        private
+
+        def failure_message_for_expected_after
+          if RSpec::Matchers.is_a_matcher?(@expected_after)
+            @expected_after.description
+          else
+            @expected_after.inspect
+          end
+        end
+
+        def message
+          @message || "result"
+        end
+
+        def change_expected?
+          @expected_delta != 0
+        end
+
+        def changed?
+          @actual_before != @actual_after
+        end
+
+        def matches_before?
+          @eval_before ? expected_matches_actual?(@expected_before, @actual_before) : true
+        end
+
+        def matches_after?
+          @eval_after ? expected_matches_actual?(@expected_after, @actual_after) : true
+        end
+
+        def matches_expected_delta?
+          @expected_delta ? (@actual_before + @expected_delta == @actual_after) : true
+        end
+
+        def matches_min?
+          @minimum ? (@actual_after - @actual_before >= @minimum) : true
+        end
+
+        def matches_max?
+          @maximum ? (@actual_after - @actual_before <= @maximum) : true
+        end
+
+        def expected_matches_actual?(expected, actual)
+          expected === actual || actual == expected
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/cover.rb b/rspec-expectations/lib/rspec/matchers/built_in/cover.rb
new file mode 100644
index 0000000..1449585
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/cover.rb
@@ -0,0 +1,21 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Cover < BaseMatcher
+        def initialize(*expected)
+          @expected = expected
+        end
+
+        def matches?(range)
+          @actual = range
+          @expected.all? { |e| range.cover?(e) }
+        end
+
+        def does_not_match?(range)
+          @actual = range
+          expected.none? { |e| range.cover?(e) }
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/eq.rb b/rspec-expectations/lib/rspec/matchers/built_in/eq.rb
new file mode 100644
index 0000000..c6f6c3e
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/eq.rb
@@ -0,0 +1,22 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Eq < BaseMatcher
+        def match(expected, actual)
+          actual == expected
+        end
+
+        def failure_message_for_should
+          "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using ==)\n"
+        end
+
+        def failure_message_for_should_not
+          "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using ==)\n"
+        end
+
+        def diffable?; true; end
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/eql.rb b/rspec-expectations/lib/rspec/matchers/built_in/eql.rb
new file mode 100644
index 0000000..fb4424a
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/eql.rb
@@ -0,0 +1,23 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Eql < BaseMatcher
+        def match(expected, actual)
+          actual.eql? expected
+        end
+
+        def failure_message_for_should
+          "\nexpected: #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
+        end
+
+        def failure_message_for_should_not
+          "\nexpected: value != #{expected.inspect}\n     got: #{actual.inspect}\n\n(compared using eql?)\n"
+        end
+
+        def diffable?
+          true
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/equal.rb b/rspec-expectations/lib/rspec/matchers/built_in/equal.rb
new file mode 100644
index 0000000..f1dba96
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/equal.rb
@@ -0,0 +1,48 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Equal < BaseMatcher
+        def match(expected, actual)
+          actual.equal? expected
+        end
+
+        def failure_message_for_should
+          return <<-MESSAGE
+
+expected #{inspect_object(expected)}
+     got #{inspect_object(actual)}
+
+Compared using equal?, which compares object identity,
+but expected and actual are not the same object. Use
+`#{eq_expression}` if you don't care about
+object identity in this example.
+
+MESSAGE
+        end
+
+        def failure_message_for_should_not
+          return <<-MESSAGE
+
+expected not #{inspect_object(actual)}
+         got #{inspect_object(expected)}
+
+Compared using equal?, which compares object identity.
+
+MESSAGE
+        end
+
+        def diffable?; true; end
+
+        private
+
+        def inspect_object(o)
+          "#<#{o.class}:#{o.object_id}> => #{o.inspect}"
+        end
+
+        def eq_expression
+          Expectations::Syntax.positive_expression("actual", "eq(expected)")
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/exist.rb b/rspec-expectations/lib/rspec/matchers/built_in/exist.rb
new file mode 100644
index 0000000..45491b2
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/exist.rb
@@ -0,0 +1,26 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Exist < BaseMatcher
+        def initialize(*expected)
+          @expected = expected
+        end
+
+        def matches?(actual)
+          @actual = actual
+          predicates = [:exist?, :exists?].select { |p| @actual.respond_to?(p) }
+          existence_values = predicates.map { |p| @actual.__send__(p, *@expected) }
+          uniq_truthy_values = existence_values.map { |v| !!v }.uniq
+
+          case uniq_truthy_values.size
+          when 0; raise NoMethodError.new("#{@actual.inspect} does not respond to either #exist? or #exists?")
+          when 1; existence_values.first
+          else raise "#exist? and #exists? returned different values:\n\n" +
+            " exist?: #{existence_values.first}\n" +
+            "exists?: #{existence_values.last}"
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/has.rb b/rspec-expectations/lib/rspec/matchers/built_in/has.rb
new file mode 100644
index 0000000..befe097
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/has.rb
@@ -0,0 +1,48 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Has
+        def initialize(expected, *args)
+          @expected, @args = expected, args
+        end
+
+        def matches?(actual)
+          actual.__send__(predicate(@expected), *@args)
+        end
+        alias == matches?
+
+        def failure_message_for_should
+          "expected ##{predicate(@expected)}#{failure_message_args_description} to return true, got false"
+        end
+
+        def failure_message_for_should_not
+          "expected ##{predicate(@expected)}#{failure_message_args_description} to return false, got true"
+        end
+
+        def description
+          [method_description(@expected), args_description].compact.join(' ')
+        end
+
+        private
+
+        def predicate(sym)
+          "#{sym.to_s.sub("have_","has_")}?".to_sym
+        end
+
+        def method_description(method)
+          method.to_s.gsub('_', ' ')
+        end
+
+        def args_description
+          return nil if @args.empty?
+          @args.map { |arg| arg.inspect }.join(', ')
+        end
+
+        def failure_message_args_description
+          desc = args_description
+          "(#{desc})" if desc
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/have.rb b/rspec-expectations/lib/rspec/matchers/built_in/have.rb
new file mode 100644
index 0000000..1fe90a2
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/have.rb
@@ -0,0 +1,124 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Have
+        QUERY_METHODS = [:size, :length, :count].freeze
+
+        def initialize(expected, relativity=:exactly)
+          @expected = case expected
+                      when :no then 0
+                      when String then expected.to_i
+                      else expected
+                      end
+          @relativity = relativity
+          @actual = @collection_name = @plural_collection_name = nil
+        end
+
+        def relativities
+          @relativities ||= {
+            :exactly => "",
+            :at_least => "at least ",
+            :at_most => "at most "
+          }
+        end
+
+        def matches?(collection_or_owner)
+          collection = determine_collection(collection_or_owner)
+          case collection
+          when enumerator_class
+            for query_method in QUERY_METHODS
+              next unless collection.respond_to?(query_method)
+              @actual = collection.__send__(query_method)
+              break unless @actual.nil?
+            end
+            raise not_a_collection if @actual.nil?
+          else
+            query_method = determine_query_method(collection)
+            raise not_a_collection unless query_method
+            @actual = collection.__send__(query_method)
+          end
+          case @relativity
+          when :at_least then @actual >= @expected
+          when :at_most  then @actual <= @expected
+          else                @actual == @expected
+          end
+        end
+        alias == matches?
+
+        def determine_collection(collection_or_owner)
+          if collection_or_owner.respond_to?(@collection_name)
+            collection_or_owner.__send__(@collection_name, *@args, &@block)
+          elsif (@plural_collection_name && collection_or_owner.respond_to?(@plural_collection_name))
+            collection_or_owner.__send__(@plural_collection_name, *@args, &@block)
+          elsif determine_query_method(collection_or_owner)
+            collection_or_owner
+          else
+            collection_or_owner.__send__(@collection_name, *@args, &@block)
+          end
+        end
+
+        def determine_query_method(collection)
+          QUERY_METHODS.detect {|m| collection.respond_to?(m)}
+        end
+
+        def not_a_collection
+          "expected #{@collection_name} to be a collection but it does not respond to #length, #size or #count"
+        end
+
+        def failure_message_for_should
+          "expected #{relative_expectation} #{@collection_name}, got #{@actual}"
+        end
+
+        def failure_message_for_should_not
+          if @relativity == :exactly
+            return "expected target not to have #{@expected} #{@collection_name}, got #{@actual}"
+          elsif @relativity == :at_most
+            return <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  #{Expectations::Syntax.negative_expression("actual", "have_at_most(#{@expected}).#{@collection_name}")}
+We recommend that you use this instead:
+  #{Expectations::Syntax.positive_expression("actual", "have_at_least(#{@expected + 1}).#{@collection_name}")}
+EOF
+          elsif @relativity == :at_least
+            return <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  #{Expectations::Syntax.negative_expression("actual", "have_at_least(#{@expected}).#{@collection_name}")}
+We recommend that you use this instead:
+  #{Expectations::Syntax.positive_expression("actual", "have_at_most(#{@expected - 1}).#{@collection_name}")}
+EOF
+          end
+        end
+
+        def description
+          "have #{relative_expectation} #{@collection_name}"
+        end
+
+        def respond_to?(m)
+          @expected.respond_to?(m) || super
+        end
+
+        private
+
+        def method_missing(method, *args, &block)
+          @collection_name = method
+          if inflector = (defined?(ActiveSupport::Inflector) && ActiveSupport::Inflector.respond_to?(:pluralize) ? ActiveSupport::Inflector : (defined?(Inflector) ? Inflector : nil))
+            @plural_collection_name = inflector.pluralize(method.to_s)
+          end
+          @args = args
+          @block = block
+          self
+        end
+
+        def relative_expectation
+          "#{relativities[@relativity]}#{@expected}"
+        end
+
+        def enumerator_class
+          RUBY_VERSION < '1.9' ? Enumerable::Enumerator : Enumerator
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/include.rb b/rspec-expectations/lib/rspec/matchers/built_in/include.rb
new file mode 100644
index 0000000..6c51ceb
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/include.rb
@@ -0,0 +1,61 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Include < BaseMatcher
+        def initialize(*expected)
+          @expected = expected
+        end
+
+        def matches?(actual)
+          @actual = actual
+          perform_match(:all?, :all?, @actual, @expected)
+        end
+
+        def does_not_match?(actual)
+          @actual = actual
+          perform_match(:none?, :any?, @actual, @expected)
+        end
+
+        def description
+          "include#{expected_to_sentence}"
+        end
+
+        def diffable?
+          # Matchers do not diff well, since diff uses their inspect
+          # output, which includes their instance variables and such.
+          @expected.none? { |e| RSpec::Matchers.is_a_matcher?(e) }
+        end
+
+        private
+
+        def perform_match(predicate, hash_predicate, actuals, expecteds)
+          expecteds.__send__(predicate) do |expected|
+            if comparing_hash_values?(actuals, expected)
+              expected.__send__(hash_predicate) { |k,v|
+                actuals.has_key?(k) && actuals[k] == v
+              }
+            elsif comparing_hash_keys?(actuals, expected)
+              actuals.has_key?(expected)
+            elsif comparing_with_matcher?(actual, expected)
+              actual.any? { |value| expected.matches?(value) }
+            else
+              actuals.include?(expected)
+            end
+          end
+        end
+
+        def comparing_hash_keys?(actual, expected)
+          actual.is_a?(Hash) && !expected.is_a?(Hash)
+        end
+
+        def comparing_hash_values?(actual, expected)
+          actual.is_a?(Hash) && expected.is_a?(Hash)
+        end
+
+        def comparing_with_matcher?(actual, expected)
+          actual.is_a?(Array) && RSpec::Matchers.is_a_matcher?(expected)
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/match.rb b/rspec-expectations/lib/rspec/matchers/built_in/match.rb
new file mode 100644
index 0000000..699ab8c
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/match.rb
@@ -0,0 +1,12 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Match < BaseMatcher
+
+        def match(expected, actual)
+          actual.match expected
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/match_array.rb b/rspec-expectations/lib/rspec/matchers/built_in/match_array.rb
new file mode 100644
index 0000000..78b6b9d
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/match_array.rb
@@ -0,0 +1,51 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class MatchArray < BaseMatcher
+        def match(expected, actual)
+          return false unless actual.respond_to? :to_ary
+          @extra_items = difference_between_arrays(actual, expected)
+          @missing_items = difference_between_arrays(expected, actual)
+          @extra_items.empty? & @missing_items.empty?
+        end
+
+        def failure_message_for_should
+          if actual.respond_to? :to_ary
+            message =  "expected collection contained:  #{safe_sort(expected).inspect}\n"
+            message += "actual collection contained:    #{safe_sort(actual).inspect}\n"
+            message += "the missing elements were:      #{safe_sort(@missing_items).inspect}\n" unless @missing_items.empty?
+            message += "the extra elements were:        #{safe_sort(@extra_items).inspect}\n"   unless @extra_items.empty?
+          else
+            message = "expected an array, actual collection was #{actual.inspect}"
+          end
+
+          message
+        end
+
+        def failure_message_for_should_not
+          "Matcher does not support should_not"
+        end
+
+        def description
+          "contain exactly #{_pretty_print(expected)}"
+        end
+
+        private
+
+        def safe_sort(array)
+          array.sort rescue array
+        end
+
+        def difference_between_arrays(array_1, array_2)
+          difference = array_1.to_ary.dup
+          array_2.to_ary.each do |element|
+            if index = difference.index(element)
+              difference.delete_at(index)
+            end
+          end
+          difference
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/raise_error.rb b/rspec-expectations/lib/rspec/matchers/built_in/raise_error.rb
new file mode 100644
index 0000000..ebe080b
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/raise_error.rb
@@ -0,0 +1,123 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class RaiseError
+        def initialize(expected_error_or_message=Exception, expected_message=nil, &block)
+          @block = block
+          @actual_error = nil
+          case expected_error_or_message
+          when String, Regexp
+            @expected_error, @expected_message = Exception, expected_error_or_message
+          else
+            @expected_error, @expected_message = expected_error_or_message, expected_message
+          end
+        end
+
+        def matches?(given_proc, negative_expectation = false)
+          if negative_expectation && (expecting_specific_exception? || @expected_message)
+            what_to_deprecate = if expecting_specific_exception? && @expected_message
+                                  "`expect { }.not_to raise_error(SpecificErrorClass, message)`"
+                                elsif expecting_specific_exception?
+                                  "`expect { }.not_to raise_error(SpecificErrorClass)`"
+                                elsif @expected_message
+                                  "`expect { }.not_to raise_error(message)`"
+                                end
+            RSpec.deprecate(what_to_deprecate, :replacement => "`expect { }.not_to raise_error()`")
+          end
+          @raised_expected_error = false
+          @with_expected_message = false
+          @eval_block = false
+          @eval_block_passed = false
+          unless given_proc.respond_to?(:call)
+            ::Kernel.warn "`raise_error` was called with non-proc object #{given_proc.inspect}"
+            return false
+          end
+          begin
+            given_proc.call
+          rescue Exception => @actual_error
+            if @actual_error == @expected_error || @expected_error === @actual_error
+              @raised_expected_error = true
+              @with_expected_message = verify_message
+            end
+          end
+
+          unless negative_expectation
+            eval_block if @raised_expected_error && @with_expected_message && @block
+          end
+        ensure
+          return (@raised_expected_error & @with_expected_message) ? (@eval_block ? @eval_block_passed : true) : false
+        end
+        alias == matches?
+
+        def does_not_match?(given_proc)
+          !matches?(given_proc, :negative_expectation)
+        end
+
+        def eval_block
+          @eval_block = true
+          begin
+            @block[@actual_error]
+            @eval_block_passed = true
+          rescue Exception => err
+            @actual_error = err
+          end
+        end
+
+        def verify_message
+          case @expected_message
+          when nil
+            true
+          when Regexp
+            @expected_message =~ @actual_error.message
+          else
+            @expected_message == @actual_error.message
+          end
+        end
+
+        def failure_message_for_should
+          @eval_block ? @actual_error.message : "expected #{expected_error}#{given_error}"
+        end
+
+        def failure_message_for_should_not
+          "expected no #{expected_error}#{given_error}"
+        end
+
+        def description
+          "raise #{expected_error}"
+        end
+
+        private
+
+        def expected_error
+          case @expected_message
+          when nil
+            @expected_error.inspect
+          when Regexp
+            "#{@expected_error} with message matching #{@expected_message.inspect}"
+          else
+            "#{@expected_error} with #{@expected_message.inspect}"
+          end
+        end
+
+        def format_backtrace(backtrace)
+          formatter = Matchers.configuration.backtrace_formatter
+          formatter.format_backtrace(backtrace)
+        end
+
+        def given_error
+          return " but nothing was raised" unless @actual_error
+
+          backtrace = format_backtrace(@actual_error.backtrace)
+          [
+            ", got #{@actual_error.inspect} with backtrace:",
+            *backtrace
+          ].join("\n  # ")
+        end
+
+        def expecting_specific_exception?
+          @expected_error != Exception
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/respond_to.rb b/rspec-expectations/lib/rspec/matchers/built_in/respond_to.rb
new file mode 100644
index 0000000..53c5d2f
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/respond_to.rb
@@ -0,0 +1,74 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class RespondTo
+        def initialize(*names)
+          @names = names
+          @expected_arity = nil
+        end
+
+        def matches?(actual)
+          find_failing_method_names(actual, :reject).empty?
+        end
+        alias == matches?
+
+        def does_not_match?(actual)
+          find_failing_method_names(actual, :select).empty?
+        end
+
+        def failure_message_for_should
+          "expected #{@actual.inspect} to respond to #{@failing_method_names.collect {|name| name.inspect }.join(', ')}#{with_arity}"
+        end
+
+        def failure_message_for_should_not
+          failure_message_for_should.sub(/to respond to/, 'not to respond to')
+        end
+
+        def description
+          "respond to #{pp_names}#{with_arity}"
+        end
+
+        def with(n)
+          @expected_arity = n
+          self
+        end
+
+        def argument
+          self
+        end
+        alias :arguments :argument
+
+        private
+
+        def find_failing_method_names(actual, filter_method)
+          @actual = actual
+          @failing_method_names = @names.__send__(filter_method) do |name|
+            @actual.respond_to?(name) && matches_arity?(actual, name)
+          end
+        end
+
+        def matches_arity?(actual, name)
+          return true unless @expected_arity
+
+          actual_arity = actual.method(name).arity
+          if actual_arity < 0
+            # ~ inverts the one's complement and gives us the number of required args
+            ~actual_arity <= @expected_arity
+          else
+            actual_arity == @expected_arity
+          end
+        end
+
+        def with_arity
+          @expected_arity.nil?? "" :
+            " with #{@expected_arity} argument#{@expected_arity == 1 ? '' : 's'}"
+        end
+
+        def pp_names
+          # Ruby 1.9 returns the same thing for array.to_s as array.inspect, so just use array.inspect here
+          @names.length == 1 ? "##{@names.first}" : @names.inspect
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/satisfy.rb b/rspec-expectations/lib/rspec/matchers/built_in/satisfy.rb
new file mode 100644
index 0000000..9aa7388
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/satisfy.rb
@@ -0,0 +1,30 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class Satisfy
+        def initialize(&block)
+          @block = block
+        end
+
+        def matches?(actual, &block)
+          @block = block if block
+          @actual = actual
+          @block.call(actual)
+        end
+        alias == matches?
+
+        def failure_message_for_should
+          "expected #{@actual} to satisfy block"
+        end
+
+        def failure_message_for_should_not
+          "expected #{@actual} not to satisfy block"
+        end
+
+        def description
+          "satisfy block"
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/start_and_end_with.rb b/rspec-expectations/lib/rspec/matchers/built_in/start_and_end_with.rb
new file mode 100644
index 0000000..558404c
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/start_and_end_with.rb
@@ -0,0 +1,48 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class StartAndEndWith < BaseMatcher
+        def initialize(*expected)
+          @expected = expected.length == 1 ? expected.first : expected
+        end
+
+        def matches?(actual)
+          @actual = actual.respond_to?(:[]) ? actual : (raise ArgumentError.new("#{actual.inspect} does not respond to :[]"))
+          begin
+            @expected.respond_to?(:length) ? subset_matches?(@expected, @actual) : element_matches?(@expected, @actual)
+          rescue ArgumentError
+            raise ArgumentError.new("#{actual.inspect} does not have ordered elements")
+          end
+        end
+
+        def failure_message_for_should
+          "expected #{@actual.inspect} to #{self.class.name.split('::').last.sub(/With/,'').downcase} with #{@expected.inspect}"
+        end
+
+        def failure_message_for_should_not
+          "expected #{@actual.inspect} not to #{self.class.name.split('::').last.sub(/With/,'').downcase} with #{@expected.inspect}"
+        end
+      end
+
+      class StartWith < StartAndEndWith
+        def subset_matches?(expected, actual)
+          actual[0, expected.length] == expected
+        end
+
+        def element_matches?(expected, actual)
+          @actual[0] == @expected
+        end
+      end
+
+      class EndWith < StartAndEndWith
+        def subset_matches?(expected, actual)
+          actual[-expected.length, expected.length] == expected
+        end
+
+        def element_matches?(expected, actual)
+          actual[-1] == expected
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/throw_symbol.rb b/rspec-expectations/lib/rspec/matchers/built_in/throw_symbol.rb
new file mode 100644
index 0000000..6108c3e
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/throw_symbol.rb
@@ -0,0 +1,94 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class ThrowSymbol
+        def initialize(expected_symbol = nil, expected_arg=nil)
+          @expected_symbol = expected_symbol
+          @expected_arg = expected_arg
+          @caught_symbol = @caught_arg = nil
+        end
+
+        def matches?(given_proc)
+          begin
+            if @expected_symbol.nil?
+              given_proc.call
+            else
+              @caught_arg = catch :proc_did_not_throw_anything do
+                catch @expected_symbol do
+                  given_proc.call
+                  throw :proc_did_not_throw_anything, :nothing_thrown
+                end
+              end
+
+              if @caught_arg == :nothing_thrown
+                @caught_arg = nil
+              else
+                @caught_symbol = @expected_symbol
+              end
+            end
+
+            # Ruby 1.8 uses NameError with `symbol'
+            # Ruby 1.9 uses ArgumentError with :symbol
+          rescue NameError, ArgumentError => e
+            unless e.message =~ /uncaught throw (`|\:)([a-zA-Z0-9_]*)(')?/
+              other_exception = e
+              raise
+            end
+            @caught_symbol = $2.to_sym
+          rescue => other_exception
+            raise
+          ensure
+            unless other_exception
+              if @expected_symbol.nil?
+                return !@caught_symbol.nil?
+              else
+                if @expected_arg.nil?
+                  return @caught_symbol == @expected_symbol
+                else
+                  return (@caught_symbol == @expected_symbol) & (@caught_arg == @expected_arg)
+                end
+              end
+            end
+          end
+        end
+        alias == matches?
+
+        def failure_message_for_should
+          "expected #{expected} to be thrown, got #{caught}"
+        end
+
+        def failure_message_for_should_not
+          "expected #{expected('no Symbol')}#{' not' if @expected_symbol} to be thrown, got #{caught}"
+        end
+
+        def description
+          "throw #{expected}"
+        end
+
+        private
+
+        def expected(symbol_desc = 'a Symbol')
+          throw_description(@expected_symbol || symbol_desc, @expected_arg)
+        end
+
+        def caught
+          throw_description(@caught_symbol || 'nothing', @caught_arg)
+        end
+
+        def throw_description(symbol, arg)
+          symbol_description = symbol.is_a?(String) ? symbol : symbol.inspect
+
+          arg_description = if arg
+                              " with #{arg.inspect}"
+                            elsif @expected_arg && @caught_symbol == @expected_symbol
+                              " with no argument"
+                            else
+                              ""
+                            end
+
+          symbol_description + arg_description
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/built_in/yield.rb b/rspec-expectations/lib/rspec/matchers/built_in/yield.rb
new file mode 100644
index 0000000..75f886f
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/built_in/yield.rb
@@ -0,0 +1,296 @@
+module RSpec
+  module Matchers
+    module BuiltIn
+      class YieldProbe
+        def self.probe(block)
+          probe = new
+          assert_valid_expect_block!(block)
+          block.call(probe)
+          probe.assert_used!
+          probe
+        end
+
+        attr_accessor :num_yields, :yielded_args
+
+        def initialize
+          @used = false
+          self.num_yields, self.yielded_args = 0, []
+        end
+
+        def to_proc
+          @used = true
+
+          probe = self
+          Proc.new do |*args|
+            probe.num_yields += 1
+            probe.yielded_args << args
+          end
+        end
+
+        def single_yield_args
+          yielded_args.first
+        end
+
+        def yielded_once?(matcher_name)
+          case num_yields
+          when 1 then true
+          when 0 then false
+          else
+            raise "The #{matcher_name} matcher is not designed to be used with a " +
+                  "method that yields multiple times. Use the yield_successive_args " +
+                  "matcher for that case."
+          end
+        end
+
+        def successive_yield_args
+          yielded_args.map do |arg_array|
+            arg_array.size == 1 ? arg_array.first : arg_array
+          end
+        end
+
+        def assert_used!
+          return if @used
+          raise "You must pass the argument yielded to your expect block on " +
+                "to the method-under-test as a block. It acts as a probe that " +
+                "allows the matcher to detect whether or not the method-under-test " +
+                "yields, and, if so, how many times, and what the yielded arguments " +
+                "are."
+        end
+
+        def self.assert_valid_expect_block!(block)
+          return if block.arity == 1
+          raise "Your expect block must accept an argument to be used with this " +
+                "matcher. Pass the argument as a block on to the method you are testing."
+        end
+      end
+
+      class YieldControl < BaseMatcher
+        def initialize
+          @expectation_type = nil
+          @expected_yields_count = nil
+        end
+
+        def matches?(block)
+          probe = YieldProbe.probe(block)
+
+          if @expectation_type
+            probe.num_yields.send(@expectation_type, @expected_yields_count)
+          else
+            probe.yielded_once?(:yield_control)
+          end
+        end
+
+        def once
+          exactly(1)
+          self
+        end
+
+        def twice
+          exactly(2)
+          self
+        end
+
+        def exactly(number)
+          set_expected_yields_count(:==, number)
+          self
+        end
+
+        def at_most(number)
+          set_expected_yields_count(:<=, number)
+          self
+        end
+
+        def at_least(number)
+          set_expected_yields_count(:>=, number)
+          self
+        end
+
+        def times
+          self
+        end
+
+        def failure_message_for_should
+          'expected given block to yield control'.tap do |failure_message|
+            failure_message << relativity_failure_message
+          end
+        end
+
+        def failure_message_for_should_not
+          'expected given block not to yield control'.tap do |failure_message|
+            failure_message << relativity_failure_message
+          end
+        end
+
+        private
+
+        def set_expected_yields_count(relativity, n)
+          @expectation_type = relativity
+          @expected_yields_count = case n
+                                   when Numeric then n
+                                   when :once then 1
+                                   when :twice then 2
+                                   end
+        end
+
+        def relativity_failure_message
+          return '' unless @expected_yields_count
+          " #{human_readable_expecation_type}#{human_readable_count}"
+        end
+
+        def human_readable_expecation_type
+          case @expectation_type
+          when :<= then 'at most '
+          when :>= then 'at least '
+          else ''
+          end
+        end
+
+        def human_readable_count
+          case @expected_yields_count
+          when 1 then "once"
+          when 2 then "twice"
+          else "#{@expected_yields_count} times"
+          end
+        end
+      end
+
+      class YieldWithNoArgs < BaseMatcher
+
+        def matches?(block)
+          @probe = YieldProbe.probe(block)
+          @probe.yielded_once?(:yield_with_no_args) && @probe.single_yield_args.empty?
+        end
+
+        def failure_message_for_should
+          "expected given block to yield with no arguments, but #{failure_reason}"
+        end
+
+        def failure_message_for_should_not
+          "expected given block not to yield with no arguments, but did"
+        end
+
+      private
+
+        def failure_reason
+          if @probe.num_yields.zero?
+            "did not yield"
+          else
+            "yielded with arguments: #{@probe.single_yield_args.inspect}"
+          end
+        end
+      end
+
+      class YieldWithArgs
+        def initialize(*args)
+          @expected = args
+        end
+
+        def matches?(block)
+          @probe = YieldProbe.probe(block)
+          @actual = @probe.single_yield_args
+          @probe.yielded_once?(:yield_with_args) && args_match?
+        end
+        alias == matches?
+
+        def failure_message_for_should
+          "expected given block to yield with arguments, but #{positive_failure_reason}"
+        end
+
+        def failure_message_for_should_not
+          "expected given block not to yield with arguments, but #{negative_failure_reason}"
+        end
+
+        def description
+          desc = "yield with args"
+          desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")" unless @expected.empty?
+          desc
+        end
+
+      private
+
+        def positive_failure_reason
+          if @probe.num_yields.zero?
+            "did not yield"
+          else
+            @positive_args_failure
+          end
+        end
+
+        def negative_failure_reason
+          if all_args_match?
+            "yielded with expected arguments" +
+              "\nexpected not: #{@expected.inspect}" +
+              "\n         got: #{@actual.inspect} (compared using === and ==)"
+          else
+            "did"
+          end
+        end
+
+        def args_match?
+          if @expected.empty? # expect {...}.to yield_with_args
+            @positive_args_failure = "yielded with no arguments" if @actual.empty?
+            return !@actual.empty?
+          end
+
+          unless match = all_args_match?
+            @positive_args_failure = "yielded with unexpected arguments" +
+              "\nexpected: #{@expected.inspect}" +
+              "\n     got: #{@actual.inspect} (compared using === and ==)"
+          end
+
+          match
+        end
+
+        def all_args_match?
+          return false if @expected.size != @actual.size
+
+          @expected.zip(@actual).all? do |expected, actual|
+            expected === actual || actual == expected
+          end
+        end
+      end
+
+      class YieldSuccessiveArgs
+        def initialize(*args)
+          @expected = args
+        end
+
+        def matches?(block)
+          @probe = YieldProbe.probe(block)
+          @actual = @probe.successive_yield_args
+          args_match?
+        end
+        alias == matches?
+
+        def failure_message_for_should
+          "expected given block to yield successively with arguments, but yielded with unexpected arguments" +
+            "\nexpected: #{@expected.inspect}" +
+            "\n     got: #{@actual.inspect} (compared using === and ==)"
+        end
+
+        def failure_message_for_should_not
+          "expected given block not to yield successively with arguments, but yielded with expected arguments" +
+              "\nexpected not: #{@expected.inspect}" +
+              "\n         got: #{@actual.inspect} (compared using === and ==)"
+        end
+
+        def description
+          desc = "yield successive args"
+          desc << "(" + @expected.map { |e| e.inspect }.join(", ") + ")"
+          desc
+        end
+
+      private
+
+        def args_match?
+          return false if @expected.size != @actual.size
+
+          @expected.zip(@actual).all? do |expected, actual|
+            expected === actual || actual == expected
+          end
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/lib/rspec/matchers/compatibility.rb b/rspec-expectations/lib/rspec/matchers/compatibility.rb
new file mode 100644
index 0000000..63e2e08
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/compatibility.rb
@@ -0,0 +1,14 @@
+RSpec::Matchers.constants.each do |c|
+  if Class === (klass = RSpec::Matchers.const_get(c))
+    if klass.public_instance_methods.any? {|m| ['failure_message_for_should',:failure_message_for_should].include?(m)}
+      klass.class_eval do
+        alias_method :failure_message, :failure_message_for_should
+      end
+    end
+    if klass.public_instance_methods.any? {|m| ['failure_message_for_should_not',:failure_message_for_should_not].include?(m)}
+      klass.class_eval do
+        alias_method :negative_failure_message, :failure_message_for_should_not
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/configuration.rb b/rspec-expectations/lib/rspec/matchers/configuration.rb
new file mode 100644
index 0000000..650ed14
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/configuration.rb
@@ -0,0 +1,108 @@
+require 'rspec/expectations/syntax'
+
+module RSpec
+  module Matchers
+    # Provides configuration options for rspec-expectations.
+    class Configuration
+      # Configures the supported syntax.
+      # @param [Array<Symbol>, Symbol] values the syntaxes to enable
+      # @example
+      #   RSpec.configure do |rspec|
+      #     rspec.expect_with :rspec do |c|
+      #       c.syntax = :should
+      #       # or
+      #       c.syntax = :expect
+      #       # or
+      #       c.syntax = [:should, :expect]
+      #     end
+      #   end
+      def syntax=(values)
+        if Array(values).include?(:expect)
+          Expectations::Syntax.enable_expect
+        else
+          Expectations::Syntax.disable_expect
+        end
+
+        if Array(values).include?(:should)
+          Expectations::Syntax.enable_should
+        else
+          Expectations::Syntax.disable_should
+        end
+      end
+
+      # The list of configured syntaxes.
+      # @return [Array<Symbol>] the list of configured syntaxes.
+      def syntax
+        syntaxes = []
+        syntaxes << :should if Expectations::Syntax.should_enabled?
+        syntaxes << :expect if Expectations::Syntax.expect_enabled?
+        syntaxes
+      end
+
+      # color config for expectations
+      # fallback if rspec core not available
+      if ::RSpec.respond_to?(:configuration)
+        def color?
+          ::RSpec.configuration.color_enabled?
+        end
+      else
+        attr_writer :color
+        def color?
+          @color
+        end
+      end
+
+      # Adds `should` and `should_not` to the given classes
+      # or modules. This can be used to ensure `should` works
+      # properly on things like proxy objects (particular
+      # `Delegator`-subclassed objects on 1.8).
+      #
+      # @param [Array<Module>] modules the list of classes or modules
+      #   to add `should` and `should_not` to.
+      def add_should_and_should_not_to(*modules)
+        modules.each do |mod|
+          Expectations::Syntax.enable_should(mod)
+        end
+      end
+
+      # Sets or gets the backtrace formatter. The backtrace formatter should
+      # implement `#format_backtrace(Array<String>)`. This is used
+      # to format backtraces of errors handled by the `raise_error`
+      # matcher.
+      #
+      # If you are using rspec-core, rspec-core's backtrace formatting
+      # will be used (including respecting the presence or absence of
+      # the `--backtrace` option).
+      #
+      # @overload backtrace_formatter
+      #   @return [#format_backtrace] the backtrace formatter
+      # @overload backtrace_formatter=
+      #   @param value [#format_backtrace] sets the backtrace formatter
+      attr_writer :backtrace_formatter
+      def backtrace_formatter
+        @backtrace_formatter ||= if defined?(::RSpec::Core::BacktraceFormatter)
+          ::RSpec::Core::BacktraceFormatter
+        else
+          NullBacktraceFormatter
+        end
+      end
+
+      # @api private
+      NullBacktraceFormatter = Module.new do
+        def self.format_backtrace(backtrace)
+          backtrace
+        end
+      end
+    end
+
+    # The configuration object
+    # @return [RSpec::Matchers::Configuration] the configuration object
+    def self.configuration
+      @configuration ||= Configuration.new
+    end
+
+    # set default syntax
+    configuration.syntax = [:expect, :should]
+  end
+end
+
diff --git a/rspec-expectations/lib/rspec/matchers/dsl.rb b/rspec-expectations/lib/rspec/matchers/dsl.rb
new file mode 100644
index 0000000..6a714af
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/dsl.rb
@@ -0,0 +1,24 @@
+module RSpec
+  module Matchers
+    module DSL
+      # Defines a custom matcher.
+      # @see RSpec::Matchers
+      def define(name, &declarations)
+        matcher_template = RSpec::Matchers::DSL::Matcher.new(name, &declarations)
+        define_method name do |*expected|
+          matcher = matcher_template.for_expected(*expected)
+          matcher.matcher_execution_context = @matcher_execution_context ||= self
+          matcher
+        end
+      end
+
+      alias_method :matcher, :define
+
+      if RSpec.respond_to?(:configure)
+        RSpec.configure {|c| c.extend self}
+      end
+    end
+  end
+end
+
+RSpec::Matchers.extend RSpec::Matchers::DSL
diff --git a/rspec-expectations/lib/rspec/matchers/extensions/instance_eval_with_args.rb b/rspec-expectations/lib/rspec/matchers/extensions/instance_eval_with_args.rb
new file mode 100644
index 0000000..a10e463
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/extensions/instance_eval_with_args.rb
@@ -0,0 +1,39 @@
+module RSpec
+  module Matchers
+    module Extensions
+      module InstanceEvalWithArgs
+        # based on Bounded Spec InstanceExec (Mauricio Fernandez)
+        # http://eigenclass.org/hiki/bounded+space+instance_exec
+        # - uses singleton_class instead of global InstanceExecHelper module
+        # - this keeps it scoped to classes/modules that include this module
+        # - only necessary for ruby 1.8.6
+        def instance_eval_with_args(*args, &block)
+          return instance_exec(*args, &block) if respond_to?(:instance_exec)
+
+          # If there are no args and the block doesn't expect any, there's no
+          # need to fake instance_exec with our hack below.
+          # Notes:
+          #   * lambda { }.arity # => -1
+          #   * lambda { || }.arity # => 0
+          #   * lambda { |*a| }.arity # -1
+          return instance_eval(&block) if block.arity < 1 && args.empty?
+
+          singleton_class = (class << self; self; end)
+          begin
+            orig_critical, Thread.critical = Thread.critical, true
+            n = 0
+            n += 1 while respond_to?(method_name="__instance_exec#{n}")
+            singleton_class.module_eval{ define_method(method_name, &block) }
+          ensure
+            Thread.critical = orig_critical
+          end
+          begin
+            return __send__(method_name, *args)
+          ensure
+            singleton_class.module_eval{ remove_method(method_name) } rescue nil
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/generated_descriptions.rb b/rspec-expectations/lib/rspec/matchers/generated_descriptions.rb
new file mode 100644
index 0000000..be062c1
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/generated_descriptions.rb
@@ -0,0 +1,35 @@
+module RSpec
+  module Matchers
+    class << self
+      attr_accessor :last_matcher, :last_should
+    end
+
+    def self.clear_generated_description
+      self.last_matcher = nil
+      self.last_should = nil
+    end
+
+    def self.generated_description
+      return nil if last_should.nil?
+      "#{last_should.to_s.gsub('_',' ')} #{last_description}"
+    end
+
+  private
+
+    def self.last_description
+      last_matcher.respond_to?(:description) ? last_matcher.description : <<-MESSAGE
+When you call a matcher in an example without a String, like this:
+
+specify { object.should matcher }
+
+or this:
+
+it { should matcher }
+
+RSpec expects the matcher to have a #description method. You should either
+add a String to the example this matcher is being used in, or give it a
+description method. Then you won't have to suffer this lengthy warning again.
+MESSAGE
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/matcher.rb b/rspec-expectations/lib/rspec/matchers/matcher.rb
new file mode 100644
index 0000000..076bde7
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/matcher.rb
@@ -0,0 +1,300 @@
+require 'set'
+
+module RSpec
+  module Matchers
+    module DSL
+      # Provides the context in which the block passed to RSpec::Matchers.define
+      # will be evaluated.
+      class Matcher
+        include RSpec::Matchers::Extensions::InstanceEvalWithArgs
+        include RSpec::Matchers::Pretty
+        include RSpec::Matchers
+
+        attr_reader :expected, :actual, :rescued_exception
+        attr_accessor :matcher_execution_context
+
+        # @api private
+        def initialize(name, &declarations)
+          @name         = name
+          @declarations = declarations
+          @actual       = nil
+          @diffable     = false
+          @expected_exception, @rescued_exception = nil, nil
+          @match_for_should_not_block = nil
+          @messages = {}
+        end
+
+        PERSISTENT_INSTANCE_VARIABLES = [
+          :@name, :@declarations, :@diffable,
+          :@match_block, :@match_for_should_not_block,
+          :@expected_exception
+        ].to_set
+
+        # @api private
+        def for_expected(*expected)
+          @expected = expected
+          dup.instance_eval do
+            instance_variables.map {|ivar| ivar.intern}.each do |ivar|
+              instance_variable_set(ivar, nil) unless (PERSISTENT_INSTANCE_VARIABLES + [:@expected]).include?(ivar)
+            end
+            @messages = {}
+            making_declared_methods_public do
+              instance_eval_with_args(*@expected, &@declarations)
+            end
+            self
+          end
+        end
+
+        # @api private
+        # Used internally by +should+ and +should_not+.
+        def matches?(actual)
+          @actual = actual
+          if @expected_exception
+            begin
+              instance_eval_with_args(actual, &@match_block)
+              true
+            rescue @expected_exception => @rescued_exception
+              false
+            end
+          else
+            begin
+              instance_eval_with_args(actual, &@match_block)
+            rescue RSpec::Expectations::ExpectationNotMetError
+              false
+            end
+          end
+        end
+
+        # Stores the block that is used to determine whether this matcher passes
+        # or fails. The block should return a boolean value. When the matcher is
+        # passed to `should` and the block returns `true`, then the expectation
+        # passes. Similarly, when the matcher is passed to `should_not` and the
+        # block returns `false`, then the expectation passes.
+        #
+        # Use `match_for_should` when used in conjuntion with
+        # `match_for_should_not`.
+        #
+        # @example
+        #
+        #     RSpec::Matchers.define :be_even do
+        #       match do |actual|
+        #         actual.even?
+        #       end
+        #     end
+        #
+        #     4.should be_even     # passes
+        #     3.should_not be_even # passes
+        #     3.should be_even     # fails
+        #     4.should_not be_even # fails
+        #
+        # @yield [Object] actual the actual value (or receiver of should)
+        def match(&block)
+          @match_block = block
+        end
+
+        alias_method :match_for_should, :match
+
+        # Use this to define the block for a negative expectation (`should_not`)
+        # when the positive and negative forms require different handling. This
+        # is rarely necessary, but can be helpful, for example, when specifying
+        # asynchronous processes that require different timeouts.
+        #
+        # @yield [Object] actual the actual value (or receiver of should)
+        def match_for_should_not(&block)
+          @match_for_should_not_block = block
+        end
+
+        # Use this instead of `match` when the block will raise an exception
+        # rather than returning false to indicate a failure.
+        #
+        # @example
+        #
+        #     RSpec::Matchers.define :accept_as_valid do |candidate_address|
+        #       match_unless_raises ValidationException do |validator|
+        #         validator.validate(candidate_address)
+        #       end
+        #     end
+        #
+        #     email_validator.should accept_as_valid("person at company.com")
+        def match_unless_raises(exception=Exception, &block)
+          @expected_exception = exception
+          match(&block)
+        end
+
+        # Customize the failure messsage to use when this matcher is invoked with
+        # `should`. Only use this when the message generated by default doesn't
+        # suit your needs.
+        #
+        # @example
+        #
+        #     RSpec::Matchers.define :have_strength do |expected|
+        #       match { ... }
+        #
+        #       failure_message_for_should do |actual|
+        #         "Expected strength of #{expected}, but had #{actual.strength}"
+        #       end
+        #     end
+        #
+        # @yield [Object] actual the actual object
+        def failure_message_for_should(&block)
+          cache_or_call_cached(:failure_message_for_should, &block)
+        end
+
+        # Customize the failure messsage to use when this matcher is invoked with
+        # `should_not`. Only use this when the message generated by default
+        # doesn't suit your needs.
+        #
+        # @example
+        #
+        #     RSpec::Matchers.define :have_strength do |expected|
+        #       match { ... }
+        #
+        #       failure_message_for_should_not do |actual|
+        #         "Expected not to have strength of #{expected}, but did"
+        #       end
+        #     end
+        #
+        # @yield [Object] actual the actual object
+        # @yield [Object] actual the actual object
+        def failure_message_for_should_not(&block)
+          cache_or_call_cached(:failure_message_for_should_not, &block)
+        end
+
+
+        # Customize the description to use for one-liners.  Only use this when
+        # the description generated by default doesn't suit your needs.
+        #
+        # @example
+        #
+        #     RSpec::Matchers.define :qualify_for do |expected|
+        #       match { ... }
+        #
+        #       description do
+        #         "qualify for #{expected}"
+        #       end
+        #     end
+        def description(&block)
+          cache_or_call_cached(:description, &block)
+        end
+
+        # Tells the matcher to diff the actual and expected values in the failure
+        # message.
+        def diffable
+          @diffable = true
+        end
+
+        # Convenience for defining methods on this matcher to create a fluent
+        # interface. The trick about fluent interfaces is that each method must
+        # return self in order to chain methods together. `chain` handles that
+        # for you.
+        #
+        # @example
+        #
+        #     RSpec::Matchers.define :have_errors_on do |key|
+        #       chain :with do |message|
+        #         @message = message
+        #       end
+        #
+        #       match do |actual|
+        #         actual.errors[key] == @message
+        #       end
+        #     end
+        #
+        #     minor.should have_errors_on(:age).with("Not old enough to participate")
+        def chain(method, &block)
+          define_method method do |*args|
+            block.call(*args)
+            self
+          end
+        end
+
+        # @api private
+        # Used internally by objects returns by +should+ and +should_not+.
+        def diffable?
+          @diffable
+        end
+
+        # @api private
+        # Used internally by +should_not+
+        def does_not_match?(actual)
+          @actual = actual
+          @match_for_should_not_block ?
+            instance_eval_with_args(actual, &@match_for_should_not_block) :
+            !matches?(actual)
+        end
+
+        def respond_to?(method, include_private=false)
+          super || matcher_execution_context.respond_to?(method, include_private)
+        end
+
+        private
+
+        def method_missing(method, *args, &block)
+          if matcher_execution_context.respond_to?(method)
+            matcher_execution_context.__send__ method, *args, &block
+          else
+            super(method, *args, &block)
+          end
+        end
+
+        def include(*args)
+          singleton_class.__send__(:include, *args)
+        end
+
+        def define_method(name, &block)
+          singleton_class.__send__(:define_method, name, &block)
+        end
+
+        def making_declared_methods_public
+          # Our home-grown instance_exec in ruby 1.8.6 results in any methods
+          # declared in the block eval'd by instance_exec in the block to which we
+          # are yielding here are scoped private. This is NOT the case for Ruby
+          # 1.8.7 or 1.9.
+          #
+          # Also, due some crazy scoping that I don't understand, these methods
+          # are actually available in the specs (something about the matcher being
+          # defined in the scope of RSpec::Matchers or within an example), so not
+          # doing the following will not cause specs to fail, but they *will*
+          # cause features to fail and that will make users unhappy. So don't.
+          orig_private_methods = private_methods
+          yield
+          (private_methods - orig_private_methods).each {|m| singleton_class.__send__ :public, m}
+        end
+
+        def cache_or_call_cached(key, &block)
+          block ? cache(key, &block) : call_cached(key)
+        end
+
+        def cache(key, &block)
+          @messages[key] = block
+        end
+
+        def call_cached(key)
+          if @messages.has_key?(key)
+            @messages[key].arity == 1 ? @messages[key].call(@actual) : @messages[key].call
+          else
+            __send__("default_#{key}")
+          end
+        end
+
+        def default_description
+          "#{name_to_sentence}#{expected_to_sentence}"
+        end
+
+        def default_failure_message_for_should
+          "expected #{actual.inspect} to #{name_to_sentence}#{expected_to_sentence}"
+        end
+
+        def default_failure_message_for_should_not
+          "expected #{actual.inspect} not to #{name_to_sentence}#{expected_to_sentence}"
+        end
+
+        unless method_defined?(:singleton_class)
+          def singleton_class
+            class << self; self; end
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/method_missing.rb b/rspec-expectations/lib/rspec/matchers/method_missing.rb
new file mode 100644
index 0000000..7ac7101
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/method_missing.rb
@@ -0,0 +1,12 @@
+module RSpec
+  module Matchers
+
+    private
+
+    def method_missing(method, *args, &block)
+      return Matchers::BuiltIn::BePredicate.new(method, *args, &block) if method.to_s =~ /^be_/
+      return Matchers::BuiltIn::Has.new(method, *args, &block) if method.to_s =~ /^have_/
+      super
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/operator_matcher.rb b/rspec-expectations/lib/rspec/matchers/operator_matcher.rb
new file mode 100644
index 0000000..5f72a20
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/operator_matcher.rb
@@ -0,0 +1,109 @@
+module RSpec
+  module Matchers
+    class OperatorMatcher
+      class << self
+        def registry
+          @registry ||= {}
+        end
+
+        def register(klass, operator, matcher)
+          registry[klass] ||= {}
+          registry[klass][operator] = matcher
+        end
+
+        def unregister(klass, operator)
+          registry[klass] && registry[klass].delete(operator)
+        end
+
+        def get(klass, operator)
+          klass.ancestors.each { |ancestor|
+            matcher = registry[ancestor] && registry[ancestor][operator]
+            return matcher if matcher
+          }
+
+          nil
+        end
+      end
+
+      def initialize(actual)
+        @actual = actual
+      end
+
+      def self.use_custom_matcher_or_delegate(operator)
+        define_method(operator) do |expected|
+          if uses_generic_implementation_of?(operator) && matcher = OperatorMatcher.get(@actual.class, operator)
+            @actual.__send__(::RSpec::Matchers.last_should, matcher.new(expected))
+          else
+            eval_match(@actual, operator, expected)
+          end
+        end
+
+        negative_operator = operator.sub(/^=/, '!')
+        if negative_operator != operator && respond_to?(negative_operator)
+          define_method(negative_operator) do |expected|
+            opposite_should = ::RSpec::Matchers.last_should == :should ? :should_not : :should
+            raise "RSpec does not support `#{::RSpec::Matchers.last_should} #{negative_operator} expected`.  " +
+              "Use `#{opposite_should} #{operator} expected` instead."
+          end
+        end
+      end
+
+      ['==', '===', '=~', '>', '>=', '<', '<='].each do |operator|
+        use_custom_matcher_or_delegate operator
+      end
+
+      def fail_with_message(message)
+        RSpec::Expectations.fail_with(message, @expected, @actual)
+      end
+
+      def description
+        "#{@operator} #{@expected.inspect}"
+      end
+
+      private
+
+      if Method.method_defined?(:owner) # 1.8.6 lacks Method#owner :-(
+        def uses_generic_implementation_of?(op)
+          @actual.method(op).owner == ::Kernel
+        end
+      else
+        def uses_generic_implementation_of?(op)
+          # This is a bit of a hack, but:
+          #
+          # {}.method(:=~).to_s # => "#<Method: Hash(Kernel)#=~>"
+          #
+          # In the absence of Method#owner, this is the best we
+          # can do to see if the method comes from Kernel.
+          @actual.method(op).to_s.include?('(Kernel)')
+        end
+      end
+
+      def eval_match(actual, operator, expected)
+        ::RSpec::Matchers.last_matcher = self
+        @operator, @expected = operator, expected
+        __delegate_operator(actual, operator, expected)
+      end
+    end
+
+    module BuiltIn
+      class PositiveOperatorMatcher < OperatorMatcher
+        def __delegate_operator(actual, operator, expected)
+          if actual.__send__(operator, expected)
+            true
+          elsif ['==','===', '=~'].include?(operator)
+            fail_with_message("expected: #{expected.inspect}\n     got: #{actual.inspect} (using #{operator})")
+          else
+            fail_with_message("expected: #{operator} #{expected.inspect}\n     got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
+          end
+        end
+      end
+
+      class NegativeOperatorMatcher < OperatorMatcher
+        def __delegate_operator(actual, operator, expected)
+          return false unless actual.__send__(operator, expected)
+          return fail_with_message("expected not: #{operator} #{expected.inspect}\n         got: #{operator.gsub(/./, ' ')} #{actual.inspect}")
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/pretty.rb b/rspec-expectations/lib/rspec/matchers/pretty.rb
new file mode 100644
index 0000000..36927c6
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/pretty.rb
@@ -0,0 +1,70 @@
+module RSpec
+  module Matchers
+    module Pretty
+      def split_words(sym)
+        sym.to_s.gsub(/_/,' ')
+      end
+
+      def to_sentence(words)
+        return "" unless words
+        words = Array(words).map { |w| to_word(w) }
+        case words.length
+          when 0
+            ""
+          when 1
+            " #{words[0]}"
+          when 2
+            " #{words[0]} and #{words[1]}"
+          else
+            " #{words[0...-1].join(', ')}, and #{words[-1]}"
+        end
+      end
+
+      def _pretty_print(array)
+        result = ""
+        array.each_with_index do |item, index|
+          if index < (array.length - 2)
+            result << "#{item.inspect}, "
+          elsif index < (array.length - 1)
+            result << "#{item.inspect} and "
+          else
+            result << "#{item.inspect}"
+          end
+        end
+        result
+      end
+
+      def to_word(item)
+        is_matcher_with_description?(item) ? item.description : item.inspect
+      end
+
+      def name_to_sentence
+        split_words(name)
+      end
+
+      def expected_to_sentence
+        to_sentence(@expected) if defined?(@expected)
+      end
+
+      def name
+        defined?(@name) ? @name : underscore(self.class.name.split("::").last)
+      end
+
+      # Borrowed from ActiveSupport
+      def underscore(camel_cased_word)
+        word = camel_cased_word.to_s.dup
+        word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
+        word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
+        word.tr!("-", "_")
+        word.downcase!
+        word
+      end
+
+      private
+
+      def is_matcher_with_description?(object)
+        RSpec::Matchers.is_a_matcher?(object) && object.respond_to?(:description)
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/lib/rspec/matchers/test_unit_integration.rb b/rspec-expectations/lib/rspec/matchers/test_unit_integration.rb
new file mode 100644
index 0000000..2df760c
--- /dev/null
+++ b/rspec-expectations/lib/rspec/matchers/test_unit_integration.rb
@@ -0,0 +1,11 @@
+# Include Matchers for other test frameworks.  Note that MiniTest _must_
+# come before TU because on ruby 1.9, T::U::TC is a subclass of MT::U::TC
+# and a 1.9 bug can lead to infinite recursion from the `super` call in our
+# method_missing hook.  See this gist for more info:
+# https://gist.github.com/845896
+if defined?(MiniTest::Unit::TestCase)
+  MiniTest::Unit::TestCase.send(:include, RSpec::Matchers)
+end
+if defined?(Test::Unit::TestCase)
+  Test::Unit::TestCase.send(:include, RSpec::Matchers)
+end
diff --git a/rspec-expectations/metadata.yml b/rspec-expectations/metadata.yml
new file mode 100644
index 0000000..0c073ee
--- /dev/null
+++ b/rspec-expectations/metadata.yml
@@ -0,0 +1,333 @@
+--- !ruby/object:Gem::Specification
+name: rspec-expectations
+version: !ruby/object:Gem::Version
+  prerelease: 
+  version: 2.14.2
+platform: ruby
+authors:
+- Steven Baker
+- David Chelimsky
+autorequire: 
+bindir: bin
+cert_chain: []
+date: 2013-08-15 00:00:00.000000000 Z
+dependencies:
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ! '>='
+      - !ruby/object:Gem::Version
+        version: 1.1.3
+    - - <
+      - !ruby/object:Gem::Version
+        version: '2.0'
+    none: false
+  prerelease: false
+  name: diff-lcs
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ! '>='
+      - !ruby/object:Gem::Version
+        version: 1.1.3
+    - - <
+      - !ruby/object:Gem::Version
+        version: '2.0'
+    none: false
+  type: :runtime
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 10.0.0
+    none: false
+  prerelease: false
+  name: rake
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 10.0.0
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.1.9
+    none: false
+  prerelease: false
+  name: cucumber
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.1.9
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '0.5'
+    none: false
+  prerelease: false
+  name: aruba
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '0.5'
+    none: false
+  type: :development
+description: rspec expectations (should[_not] and matchers)
+email: rspec-users at rubyforge.org
+executables: []
+extensions: []
+extra_rdoc_files: []
+files:
+- lib/rspec-expectations.rb
+- lib/rspec/expectations.rb
+- lib/rspec/expectations/deprecation.rb
+- lib/rspec/expectations/differ.rb
+- lib/rspec/expectations/errors.rb
+- lib/rspec/expectations/expectation_target.rb
+- lib/rspec/expectations/extensions.rb
+- lib/rspec/expectations/extensions/array.rb
+- lib/rspec/expectations/extensions/object.rb
+- lib/rspec/expectations/fail_with.rb
+- lib/rspec/expectations/handler.rb
+- lib/rspec/expectations/syntax.rb
+- lib/rspec/expectations/version.rb
+- lib/rspec/matchers.rb
+- lib/rspec/matchers/be_close.rb
+- lib/rspec/matchers/built_in.rb
+- lib/rspec/matchers/built_in/base_matcher.rb
+- lib/rspec/matchers/built_in/be.rb
+- lib/rspec/matchers/built_in/be_instance_of.rb
+- lib/rspec/matchers/built_in/be_kind_of.rb
+- lib/rspec/matchers/built_in/be_within.rb
+- lib/rspec/matchers/built_in/change.rb
+- lib/rspec/matchers/built_in/cover.rb
+- lib/rspec/matchers/built_in/eq.rb
+- lib/rspec/matchers/built_in/eql.rb
+- lib/rspec/matchers/built_in/equal.rb
+- lib/rspec/matchers/built_in/exist.rb
+- lib/rspec/matchers/built_in/has.rb
+- lib/rspec/matchers/built_in/have.rb
+- lib/rspec/matchers/built_in/include.rb
+- lib/rspec/matchers/built_in/match.rb
+- lib/rspec/matchers/built_in/match_array.rb
+- lib/rspec/matchers/built_in/raise_error.rb
+- lib/rspec/matchers/built_in/respond_to.rb
+- lib/rspec/matchers/built_in/satisfy.rb
+- lib/rspec/matchers/built_in/start_and_end_with.rb
+- lib/rspec/matchers/built_in/throw_symbol.rb
+- lib/rspec/matchers/built_in/yield.rb
+- lib/rspec/matchers/compatibility.rb
+- lib/rspec/matchers/configuration.rb
+- lib/rspec/matchers/dsl.rb
+- lib/rspec/matchers/extensions/instance_eval_with_args.rb
+- lib/rspec/matchers/generated_descriptions.rb
+- lib/rspec/matchers/matcher.rb
+- lib/rspec/matchers/method_missing.rb
+- lib/rspec/matchers/operator_matcher.rb
+- lib/rspec/matchers/pretty.rb
+- lib/rspec/matchers/test_unit_integration.rb
+- README.md
+- License.txt
+- Changelog.md
+- .yardopts
+- .document
+- features/README.md
+- features/Upgrade.md
+- features/built_in_matchers/README.md
+- features/built_in_matchers/be.feature
+- features/built_in_matchers/be_within.feature
+- features/built_in_matchers/cover.feature
+- features/built_in_matchers/end_with.feature
+- features/built_in_matchers/equality.feature
+- features/built_in_matchers/exist.feature
+- features/built_in_matchers/expect_change.feature
+- features/built_in_matchers/expect_error.feature
+- features/built_in_matchers/have.feature
+- features/built_in_matchers/include.feature
+- features/built_in_matchers/match.feature
+- features/built_in_matchers/operators.feature
+- features/built_in_matchers/predicates.feature
+- features/built_in_matchers/respond_to.feature
+- features/built_in_matchers/satisfy.feature
+- features/built_in_matchers/start_with.feature
+- features/built_in_matchers/throw_symbol.feature
+- features/built_in_matchers/types.feature
+- features/built_in_matchers/yield.feature
+- features/custom_matchers/access_running_example.feature
+- features/custom_matchers/define_diffable_matcher.feature
+- features/custom_matchers/define_matcher.feature
+- features/custom_matchers/define_matcher_outside_rspec.feature
+- features/custom_matchers/define_matcher_with_fluent_interface.feature
+- features/customized_message.feature
+- features/diffing.feature
+- features/implicit_docstrings.feature
+- features/step_definitions/additional_cli_steps.rb
+- features/support/env.rb
+- features/support/rubinius.rb
+- features/syntax_configuration.feature
+- features/test_frameworks/test_unit.feature
+- spec/rspec/expectations/differ_spec.rb
+- spec/rspec/expectations/expectation_target_spec.rb
+- spec/rspec/expectations/extensions/kernel_spec.rb
+- spec/rspec/expectations/fail_with_spec.rb
+- spec/rspec/expectations/handler_spec.rb
+- spec/rspec/expectations/syntax_spec.rb
+- spec/rspec/matchers/base_matcher_spec.rb
+- spec/rspec/matchers/be_close_spec.rb
+- spec/rspec/matchers/be_instance_of_spec.rb
+- spec/rspec/matchers/be_kind_of_spec.rb
+- spec/rspec/matchers/be_spec.rb
+- spec/rspec/matchers/be_within_spec.rb
+- spec/rspec/matchers/change_spec.rb
+- spec/rspec/matchers/configuration_spec.rb
+- spec/rspec/matchers/cover_spec.rb
+- spec/rspec/matchers/description_generation_spec.rb
+- spec/rspec/matchers/dsl_spec.rb
+- spec/rspec/matchers/eq_spec.rb
+- spec/rspec/matchers/eql_spec.rb
+- spec/rspec/matchers/equal_spec.rb
+- spec/rspec/matchers/exist_spec.rb
+- spec/rspec/matchers/has_spec.rb
+- spec/rspec/matchers/have_spec.rb
+- spec/rspec/matchers/include_matcher_integration_spec.rb
+- spec/rspec/matchers/include_spec.rb
+- spec/rspec/matchers/match_array_spec.rb
+- spec/rspec/matchers/match_spec.rb
+- spec/rspec/matchers/matcher_spec.rb
+- spec/rspec/matchers/matchers_spec.rb
+- spec/rspec/matchers/method_missing_spec.rb
+- spec/rspec/matchers/operator_matcher_spec.rb
+- spec/rspec/matchers/raise_error_spec.rb
+- spec/rspec/matchers/respond_to_spec.rb
+- spec/rspec/matchers/satisfy_spec.rb
+- spec/rspec/matchers/start_with_end_with_spec.rb
+- spec/rspec/matchers/throw_symbol_spec.rb
+- spec/rspec/matchers/yield_spec.rb
+- spec/spec_helper.rb
+- spec/support/classes.rb
+- spec/support/in_sub_process.rb
+- spec/support/matchers.rb
+- spec/support/ruby_version.rb
+- spec/support/shared_examples.rb
+homepage: http://github.com/rspec/rspec-expectations
+licenses:
+- MIT
+post_install_message: 
+rdoc_options:
+- --charset=UTF-8
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+      segments:
+      - 0
+      hash: 2244321019137391681
+  none: false
+required_rubygems_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+      segments:
+      - 0
+      hash: 2244321019137391681
+  none: false
+requirements: []
+rubyforge_project: rspec
+rubygems_version: 1.8.24
+signing_key: 
+specification_version: 3
+summary: rspec-expectations-2.14.2
+test_files:
+- features/README.md
+- features/Upgrade.md
+- features/built_in_matchers/README.md
+- features/built_in_matchers/be.feature
+- features/built_in_matchers/be_within.feature
+- features/built_in_matchers/cover.feature
+- features/built_in_matchers/end_with.feature
+- features/built_in_matchers/equality.feature
+- features/built_in_matchers/exist.feature
+- features/built_in_matchers/expect_change.feature
+- features/built_in_matchers/expect_error.feature
+- features/built_in_matchers/have.feature
+- features/built_in_matchers/include.feature
+- features/built_in_matchers/match.feature
+- features/built_in_matchers/operators.feature
+- features/built_in_matchers/predicates.feature
+- features/built_in_matchers/respond_to.feature
+- features/built_in_matchers/satisfy.feature
+- features/built_in_matchers/start_with.feature
+- features/built_in_matchers/throw_symbol.feature
+- features/built_in_matchers/types.feature
+- features/built_in_matchers/yield.feature
+- features/custom_matchers/access_running_example.feature
+- features/custom_matchers/define_diffable_matcher.feature
+- features/custom_matchers/define_matcher.feature
+- features/custom_matchers/define_matcher_outside_rspec.feature
+- features/custom_matchers/define_matcher_with_fluent_interface.feature
+- features/customized_message.feature
+- features/diffing.feature
+- features/implicit_docstrings.feature
+- features/step_definitions/additional_cli_steps.rb
+- features/support/env.rb
+- features/support/rubinius.rb
+- features/syntax_configuration.feature
+- features/test_frameworks/test_unit.feature
+- spec/rspec/expectations/differ_spec.rb
+- spec/rspec/expectations/expectation_target_spec.rb
+- spec/rspec/expectations/extensions/kernel_spec.rb
+- spec/rspec/expectations/fail_with_spec.rb
+- spec/rspec/expectations/handler_spec.rb
+- spec/rspec/expectations/syntax_spec.rb
+- spec/rspec/matchers/base_matcher_spec.rb
+- spec/rspec/matchers/be_close_spec.rb
+- spec/rspec/matchers/be_instance_of_spec.rb
+- spec/rspec/matchers/be_kind_of_spec.rb
+- spec/rspec/matchers/be_spec.rb
+- spec/rspec/matchers/be_within_spec.rb
+- spec/rspec/matchers/change_spec.rb
+- spec/rspec/matchers/configuration_spec.rb
+- spec/rspec/matchers/cover_spec.rb
+- spec/rspec/matchers/description_generation_spec.rb
+- spec/rspec/matchers/dsl_spec.rb
+- spec/rspec/matchers/eq_spec.rb
+- spec/rspec/matchers/eql_spec.rb
+- spec/rspec/matchers/equal_spec.rb
+- spec/rspec/matchers/exist_spec.rb
+- spec/rspec/matchers/has_spec.rb
+- spec/rspec/matchers/have_spec.rb
+- spec/rspec/matchers/include_matcher_integration_spec.rb
+- spec/rspec/matchers/include_spec.rb
+- spec/rspec/matchers/match_array_spec.rb
+- spec/rspec/matchers/match_spec.rb
+- spec/rspec/matchers/matcher_spec.rb
+- spec/rspec/matchers/matchers_spec.rb
+- spec/rspec/matchers/method_missing_spec.rb
+- spec/rspec/matchers/operator_matcher_spec.rb
+- spec/rspec/matchers/raise_error_spec.rb
+- spec/rspec/matchers/respond_to_spec.rb
+- spec/rspec/matchers/satisfy_spec.rb
+- spec/rspec/matchers/start_with_end_with_spec.rb
+- spec/rspec/matchers/throw_symbol_spec.rb
+- spec/rspec/matchers/yield_spec.rb
+- spec/spec_helper.rb
+- spec/support/classes.rb
+- spec/support/in_sub_process.rb
+- spec/support/matchers.rb
+- spec/support/ruby_version.rb
+- spec/support/shared_examples.rb
+has_rdoc: 
diff --git a/rspec-expectations/spec/rspec/expectations/differ_spec.rb b/rspec-expectations/spec/rspec/expectations/differ_spec.rb
new file mode 100644
index 0000000..800eb28
--- /dev/null
+++ b/rspec-expectations/spec/rspec/expectations/differ_spec.rb
@@ -0,0 +1,203 @@
+# encoding: utf-8
+require 'spec_helper'
+require 'ostruct'
+
+module RSpec
+  module Expectations
+    describe Differ do
+      context "without --color" do
+
+      before { RSpec::Matchers.configuration.stub(:color? => false) }
+
+      let(:differ) { RSpec::Expectations::Differ.new }
+
+        # color disabled context
+
+      describe '#diff_as_string' do
+        subject { differ.diff_as_string(@expected, @actual) }
+        it "outputs unified diff of two strings" do
+          @expected="foo\nbar\nzap\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nline\n"
+          @actual="foo\nzap\nbar\nthis\nis\nsoo\nvery\nvery\nequal\ninsert\na\nanother\nline\n"
+          expect(subject).to eql(<<-'EOD')
+
+
+@@ -1,6 +1,6 @@
+ foo
+-zap
+ bar
++zap
+ this
+ is
+ soo
+@@ -9,6 +9,5 @@
+ equal
+ insert
+ a
+-another
+ line
+EOD
+
+        end
+        if RUBY_VERSION.to_f > 1.9
+          it 'copes with encoded strings', :pending => (Diff::LCS::VERSION < '1.2.2') do
+            @expected="Tu avec carté {count} itém has".encode('UTF-16LE')
+            @actual="Tu avec carte {count} item has".encode('UTF-16LE')
+            expect(subject).to eql(<<-EOD.encode('UTF-16LE'))
+
+@@ -1,2 +1,2 @@
+-Tu avec carte {count} item has
++Tu avec carté {count} itém has
+EOD
+          end
+          it 'copes with encoded strings', :pending => (Diff::LCS::VERSION >= '1.2.2') do
+            @expected="Tu avec carté {count} itém has".encode('UTF-16LE')
+            @actual="Tu avec carte {count} item has".encode('UTF-16LE')
+            expect(subject).to eql 'Could not produce a diff because of the encoding of the string (UTF-16LE)'
+          end
+          it 'ouputs a message when encountering differently encoded strings' do
+            @expected="Tu avec carté {count} itém has".encode('UTF-16LE')
+            @actual="Tu avec carte {count} item has"
+            expect(subject).to eql 'Could not produce a diff because the encoding of the actual string (UTF-8) differs from the encoding of the expected string (UTF-16LE)'
+          end
+        end
+      end
+
+      describe '#diff_as_object' do
+        it "outputs unified diff message of two objects" do
+          animal_class = Class.new do
+            def initialize(name, species)
+              @name, @species = name, species
+            end
+
+            def inspect
+              <<-EOA
+<Animal
+  name=#{@name},
+  species=#{@species}
+>
+              EOA
+            end
+          end
+
+          expected = animal_class.new "bob", "giraffe"
+          actual   = animal_class.new "bob", "tortoise"
+
+          expected_diff = <<'EOD'
+
+@@ -1,5 +1,5 @@
+ <Animal
+   name=bob,
+-  species=tortoise
++  species=giraffe
+ >
+EOD
+
+          diff = differ.diff_as_object(expected,actual)
+          expect(diff).to eq expected_diff
+        end
+
+        it "outputs unified diff message of two arrays" do
+          expected = [ :foo, 'bar', :baz, 'quux', :metasyntactic, 'variable', :delta, 'charlie', :width, 'quite wide' ]
+          actual   = [ :foo, 'bar', :baz, 'quux', :metasyntactic, 'variable', :delta, 'tango'  , :width, 'very wide'  ]
+
+          expected_diff = <<'EOD'
+
+
+@@ -5,7 +5,7 @@
+  :metasyntactic,
+  "variable",
+  :delta,
+- "tango",
++ "charlie",
+  :width,
+- "very wide"]
++ "quite wide"]
+EOD
+
+          diff = differ.diff_as_object(expected,actual)
+          expect(diff).to eq expected_diff
+        end
+
+        it "outputs unified diff message of two hashes" do
+          expected = { :foo => 'bar', :baz => 'quux', :metasyntactic => 'variable', :delta => 'charlie', :width =>'quite wide' }
+          actual   = { :foo => 'bar', :metasyntactic => 'variable', :delta => 'charlotte', :width =>'quite wide' }
+
+          expected_diff = <<'EOD'
+
+@@ -1,4 +1,5 @@
+-:delta => "charlotte",
++:baz => "quux",
++:delta => "charlie",
+ :foo => "bar",
+ :metasyntactic => "variable",
+ :width => "quite wide"
+EOD
+
+          diff = differ.diff_as_object(expected,actual)
+          expect(diff).to eq expected_diff
+        end
+
+        it 'outputs unified diff messaoge of two hashes with differing encoding' do
+          expected_diff = %Q{
+@@ -1,2 +1,2 @@
+-"a" => "a"
+#{ (RUBY_VERSION.to_f > 1.8) ?  %Q{+"ö" => "ö"} : '+"\303\266" => "\303\266"' }
+}
+
+          diff = differ.diff_as_object({'ö' => 'ö'}, {'a' => 'a'})
+          expect(diff).to eq expected_diff
+        end
+
+        it "outputs unified diff of single line strings" do
+          expected = "this is one string"
+          actual   = "this is another string"
+
+          expected_diff = <<'EOD'
+
+@@ -1,2 +1,2 @@
+-"this is another string"
++"this is one string"
+EOD
+
+          diff = differ.diff_as_object(expected,actual)
+          expect(diff).to eq expected_diff
+        end
+
+        it "outputs unified diff of multi line strings" do
+          expected = "this is:\n  one string"
+          actual   = "this is:\n  another string"
+
+          expected_diff = <<'EOD'
+
+@@ -1,3 +1,3 @@
+ this is:
+-  another string
++  one string
+EOD
+
+          diff = differ.diff_as_object(expected,actual)
+          expect(diff).to eq expected_diff
+        end
+      end
+    end
+
+    context "with --color" do
+      before { RSpec::Matchers.configuration.stub(:color? => true) }
+
+      let(:differ) { RSpec::Expectations::Differ.new }
+
+      it "outputs colored diffs" do
+        expected = "foo bar baz"
+        actual = "foo bang baz"
+        expected_diff = "\n\e[34m@@ -1,2 +1,2 @@\n\e[0m\e[31m-foo bang baz\n\e[0m\e[32m+foo bar baz\n\e[0m"
+
+
+        diff = differ.diff_as_string(expected,actual)
+        expect(diff).to eq expected_diff
+      end
+    end
+
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/expectations/expectation_target_spec.rb b/rspec-expectations/spec/rspec/expectations/expectation_target_spec.rb
new file mode 100644
index 0000000..1f390ed
--- /dev/null
+++ b/rspec-expectations/spec/rspec/expectations/expectation_target_spec.rb
@@ -0,0 +1,82 @@
+require 'spec_helper'
+
+module RSpec
+  module Expectations
+    # so our examples below can set expectations about the target
+    ExpectationTarget.send(:attr_reader, :target)
+
+    describe ExpectationTarget do
+      context 'when constructed via #expect' do
+        it 'constructs a new instance targetting the given argument' do
+          expect(expect(7).target).to eq(7)
+        end
+
+        it 'constructs a new instance targetting the given block' do
+          block = lambda {}
+          expect(expect(&block).target).to be(block)
+        end
+
+        it 'raises an ArgumentError when given an argument and a block' do
+          expect {
+            expect(7) { }
+          }.to raise_error(ArgumentError)
+        end
+
+        it 'raises an ArgumentError when given neither an argument nor a block' do
+          expect {
+            expect
+          }.to raise_error(ArgumentError)
+        end
+
+        it 'can be passed nil' do
+          expect(expect(nil).target).to be_nil
+        end
+
+        it 'passes a valid positive expectation' do
+          expect(5).to eq(5)
+        end
+
+        it 'passes a valid negative expectation' do
+          expect(5).not_to eq(4)
+        end
+
+        it 'passes a valid negative expectation with a split infinitive' do
+          expect(5).to_not eq(4)
+        end
+
+        it 'fails an invalid positive expectation' do
+          expect {
+            expect(5).to eq(4)
+          }.to fail_with(/expected: 4.*got: 5/m)
+        end
+
+        it 'fails an invalid negative expectation' do
+          message = /expected 5 not to be a kind of Fixnum/
+          expect {
+            expect(5).not_to be_a(Fixnum)
+          }.to fail_with(message)
+        end
+
+        it 'fails an invalid negative expectation with a split infinitive' do
+          message = /expected 5 not to be a kind of Fixnum/
+          expect {
+            expect(5).to_not be_a(Fixnum)
+          }.to fail_with(message)
+        end
+
+        it 'does not support operator matchers from #to' do
+          expect {
+            expect(3).to == 3
+          }.to raise_error(ArgumentError)
+        end
+
+        it 'does not support operator matchers from #not_to' do
+          expect {
+            expect(3).not_to == 4
+          }.to raise_error(ArgumentError)
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/expectations/extensions/kernel_spec.rb b/rspec-expectations/spec/rspec/expectations/extensions/kernel_spec.rb
new file mode 100644
index 0000000..8359538
--- /dev/null
+++ b/rspec-expectations/spec/rspec/expectations/extensions/kernel_spec.rb
@@ -0,0 +1,67 @@
+require 'spec_helper'
+
+describe Object, "#should" do
+  before(:each) do
+    @target = "target"
+    @matcher = double("matcher")
+    @matcher.stub(:matches?).and_return(true)
+    @matcher.stub(:failure_message_for_should)
+  end
+
+  it "accepts and interacts with a matcher" do
+    @matcher.should_receive(:matches?).with(@target).and_return(true)
+    expect(@target).to @matcher
+  end
+
+  it "asks for a failure_message_for_should when matches? returns false" do
+    @matcher.should_receive(:matches?).with(@target).and_return(false)
+    @matcher.should_receive(:failure_message_for_should).and_return("the failure message")
+    expect {
+      expect(@target).to @matcher
+    }.to fail_with("the failure message")
+  end
+
+  context "on interpretters that have BasicObject", :if => defined?(BasicObject) do
+    let(:proxy_class) do
+      Class.new(BasicObject) do
+        def initialize(target)
+          @target = target
+        end
+
+        def proxied?
+          true
+        end
+
+        def method_missing(name, *args)
+          @target.send(name, *args)
+        end
+      end
+    end
+
+    it 'works properly on BasicObject-subclassed proxy objects' do
+      expect(proxy_class.new(Object.new)).to be_proxied
+    end
+  end
+end
+
+describe Object, "#should_not" do
+  before(:each) do
+    @target = "target"
+    @matcher = double("matcher")
+  end
+
+  it "accepts and interacts with a matcher" do
+    @matcher.should_receive(:matches?).with(@target).and_return(false)
+    @matcher.stub(:failure_message_for_should_not)
+
+    expect(@target).not_to @matcher
+  end
+
+  it "asks for a failure_message_for_should_not when matches? returns true" do
+    @matcher.should_receive(:matches?).with(@target).and_return(true)
+    @matcher.should_receive(:failure_message_for_should_not).and_return("the failure message for should not")
+    expect {
+      expect(@target).not_to @matcher
+    }.to fail_with("the failure message for should not")
+  end
+end
diff --git a/rspec-expectations/spec/rspec/expectations/fail_with_spec.rb b/rspec-expectations/spec/rspec/expectations/fail_with_spec.rb
new file mode 100644
index 0000000..82981b7
--- /dev/null
+++ b/rspec-expectations/spec/rspec/expectations/fail_with_spec.rb
@@ -0,0 +1,114 @@
+# encoding: utf-8
+require 'spec_helper'
+
+
+describe RSpec::Expectations, "#fail_with with diff of arrays" do
+  before { RSpec::Matchers.configuration.stub(:color? => false) }
+
+  it "splits items with newlines" do
+    expected_diff = "\nDiff:\n@@ -1 +1,3 @@\n+a\\nb\n+c\\nd\n"
+    expect {
+      RSpec::Expectations.fail_with("", [], ["a\nb", "c\nd"])
+    }.to fail_with(expected_diff)
+  end
+
+  it "shows inner arrays on a single line" do
+    expected_diff = "\nDiff:\n@@ -1 +1,3 @@\n+a\\nb\n+[\"c\\nd\"]\n"
+    expect {
+      RSpec::Expectations.fail_with("", [], ["a\nb", ["c\nd"]])
+    }.to fail_with(expected_diff)
+  end
+end
+
+describe RSpec::Expectations, "#fail_with with diff" do
+  let(:differ) { double("differ") }
+
+  before(:each) do
+    RSpec::Expectations.stub(:differ) { differ }
+  end
+
+  it "calls differ if expected/actual are not strings (or numbers or procs)" do
+    differ.should_receive(:diff_as_object).and_return("diff")
+    expect {
+      RSpec::Expectations.fail_with "the message", Object.new, Object.new
+    }.to fail_with("the message\nDiff:diff")
+  end
+
+  context "with two strings" do
+    context "and actual is multiline" do
+      it "calls differ" do
+        differ.should_receive(:diff_as_string).and_return("diff")
+        expect {
+          RSpec::Expectations.fail_with "the message", "expected\nthis", "actual"
+        }.to fail_with("the message\nDiff:diff")
+      end
+    end
+
+    context "and expected is multiline" do
+      it "calls differ" do
+        differ.should_receive(:diff_as_string).and_return("diff")
+        expect {
+          RSpec::Expectations.fail_with "the message", "expected", "actual\nthat"
+        }.to fail_with("the message\nDiff:diff")
+      end
+    end
+
+    context "and both are single line strings" do
+      it "does not call differ" do
+        differ.should_not_receive(:diff_as_string)
+        expect {
+          RSpec::Expectations.fail_with("the message", "expected", "actual")
+        }.to fail_with("the message")
+      end
+    end
+
+    context "and they are UTF-16LE encoded", :if => String.method_defined?(:encode) do
+      it 'does not diff when they are not multiline' do
+        differ.should_not_receive(:diff_as_string)
+
+        str_1 = "This is a pile of poo: 💩".encode("UTF-16LE")
+        str_2 = "This is a pile of poo: 💩".encode("UTF-16LE")
+
+        expect {
+          RSpec::Expectations.fail_with("the message", str_1, str_2)
+        }.to fail_with("the message")
+      end
+
+      it 'diffs when they are multiline' do
+        differ.should_receive(:diff_as_string).and_return("diff")
+
+        str_1 = "This is a pile of poo:\n💩".encode("UTF-16LE")
+        str_2 = "This is a pile of poo:\n💩".encode("UTF-16LE")
+
+        expect {
+          RSpec::Expectations.fail_with("the message", str_1, str_2)
+        }.to fail_with("the message\nDiff:diff")
+      end
+    end
+  end
+
+  it "does not call differ if no expected/actual" do
+    expect {
+      RSpec::Expectations.fail_with "the message"
+    }.to fail_with("the message")
+  end
+
+  it "does not call differ expected is Numeric" do
+    expect {
+      RSpec::Expectations.fail_with "the message", 1, "1"
+    }.to fail_with("the message")
+  end
+
+  it "does not call differ when actual is Numeric" do
+    expect {
+      RSpec::Expectations.fail_with "the message", "1", 1
+    }.to fail_with("the message")
+  end
+
+  it "does not call differ if expected or actual are procs" do
+    expect {
+      RSpec::Expectations.fail_with "the message", lambda {}, lambda {}
+    }.to fail_with("the message")
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/expectations/handler_spec.rb b/rspec-expectations/spec/rspec/expectations/handler_spec.rb
new file mode 100644
index 0000000..c230cd8
--- /dev/null
+++ b/rspec-expectations/spec/rspec/expectations/handler_spec.rb
@@ -0,0 +1,227 @@
+require 'spec_helper'
+
+module ExampleExpectations
+
+  class ArbitraryMatcher
+    def initialize(*args, &block)
+      if args.last.is_a? Hash
+        @expected = args.last[:expected]
+      end
+      @expected = block.call if block
+      @block = block
+    end
+
+    def matches?(target)
+      @target = target
+      return @expected == target
+    end
+
+    def with(new_value)
+      @expected = new_value
+      self
+    end
+
+    def failure_message
+      "expected #{@expected}, got #{@target}"
+    end
+
+    def negative_failure_message
+      "expected not #{@expected}, got #{@target}"
+    end
+  end
+
+  class PositiveOnlyMatcher < ArbitraryMatcher
+    undef negative_failure_message rescue nil
+  end
+
+  def arbitrary_matcher(*args, &block)
+    ArbitraryMatcher.new(*args, &block)
+  end
+
+  def positive_only_matcher(*args, &block)
+    PositiveOnlyMatcher.new(*args, &block)
+  end
+
+end
+
+module RSpec
+  module Expectations
+    describe PositiveExpectationHandler do
+      describe "#handle_matcher" do
+        it "asks the matcher if it matches" do
+          matcher = double("matcher")
+          actual = Object.new
+          matcher.should_receive(:matches?).with(actual).and_return(true)
+          RSpec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher)
+        end
+
+        it "returns the match value" do
+          matcher = double("matcher")
+          actual = Object.new
+          matcher.should_receive(:matches?).with(actual).and_return(:this_value)
+          expect(RSpec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher)).to eq :this_value
+        end
+
+        it "calls failure_message_for_should if the matcher implements it" do
+          matcher = double("matcher", :failure_message_for_should => "message", :matches? => false)
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("message")
+
+          RSpec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher)
+        end
+
+        it "calls fail if matcher.diffable?" do
+          matcher = double("matcher",
+            :diffable? => true,
+            :failure_message_for_should => "message",
+            :matches? => false,
+            :expected => 1,
+            :actual   => 2
+          )
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("message", 1, 2)
+
+          RSpec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher)
+        end
+
+        it "calls failure_message if the matcher does not implement failure_message_for_should" do
+          matcher = double("matcher", :failure_message => "message", :matches? => false)
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("message")
+
+          RSpec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher)
+
+        end
+
+        it "uses the custom failure message when one is provided" do
+          matcher = double("matcher", :failure_message_for_should => "message", :matches? => false)
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("custom")
+
+          RSpec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher, "custom")
+        end
+
+        it "uses the custom failure message when one is provided as a callable object" do
+          matcher = double("matcher", :failure_message_for_should => "message", :matches? => false)
+          actual = Object.new
+
+          failure_message = double("failure message", :call => "custom")
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("custom")
+
+          RSpec::Expectations::PositiveExpectationHandler.handle_matcher(actual, matcher, failure_message)
+        end
+      end
+    end
+
+    describe NegativeExpectationHandler do
+      describe "#handle_matcher" do
+        it "asks the matcher if it doesn't match when the matcher responds to #does_not_match?" do
+          matcher = double("matcher", :does_not_match? => true, :negative_failure_message => nil)
+          actual = Object.new
+          matcher.should_receive(:does_not_match?).with(actual).and_return(true)
+          RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher)
+        end
+
+        it "asks the matcher if it matches when the matcher doesn't respond to #does_not_match?" do
+          matcher = double("matcher")
+          actual = Object.new
+          matcher.stub(:negative_failure_message)
+          matcher.should_receive(:matches?).with(actual).and_return(false)
+          RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher)
+        end
+
+        it "returns the match value" do
+          matcher = double("matcher")
+          actual = Object.new
+          matcher.should_receive(:matches?).with(actual).and_return(false)
+          matcher.stub(:negative_failure_message).and_return("ignore")
+          expect(RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher)).to be_false
+        end
+
+
+        it "calls failure_message_for_should_not if the matcher implements it" do
+          matcher = double("matcher", :failure_message_for_should_not => "message", :matches? => true)
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("message")
+
+          RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher)
+
+        end
+
+        it "calls negative_failure_message if the matcher does not implement failure_message_for_should_not" do
+          matcher = double("matcher", :negative_failure_message => "message", :matches? => true)
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("message")
+
+          RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher)
+
+        end
+
+
+        it "calls fail if matcher.diffable?" do
+          matcher = double("matcher",
+            :diffable? => true,
+            :failure_message_for_should_not => "message",
+            :matches? => true,
+            :expected => 1,
+            :actual   => 2
+          )
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("message", 1, 2)
+
+          RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher)
+        end
+
+        it "uses the custom failure message when one is provided" do
+          matcher = double("matcher", :failure_message_for_should_not => "message", :matches? => true)
+          actual = Object.new
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("custom")
+
+          RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher, "custom")
+        end
+
+        it "uses the custom failure message when one is provided as a callable object" do
+          matcher = double("matcher", :failure_message_for_should_not => "message", :matches? => true)
+          actual = Object.new
+
+          failure_message = double("failure message", :call => "custom")
+
+          ::RSpec::Expectations.should_receive(:fail_with).with("custom")
+
+          RSpec::Expectations::NegativeExpectationHandler.handle_matcher(actual, matcher, failure_message)
+        end
+      end
+    end
+
+    describe PositiveExpectationHandler do
+      include ExampleExpectations
+
+      it "handles submitted args" do
+        expect(5).to arbitrary_matcher(:expected => 5)
+        expect(5).to arbitrary_matcher(:expected => "wrong").with(5)
+        expect { expect(5).to arbitrary_matcher(:expected => 4) }.to fail_with("expected 4, got 5")
+        expect { expect(5).to arbitrary_matcher(:expected => 5).with(4) }.to fail_with("expected 4, got 5")
+        expect(5).not_to arbitrary_matcher(:expected => 4)
+        expect(5).not_to arbitrary_matcher(:expected => 5).with(4)
+        expect { expect(5).not_to arbitrary_matcher(:expected => 5) }.to fail_with("expected not 5, got 5")
+        expect { expect(5).not_to arbitrary_matcher(:expected => 4).with(5) }.to fail_with("expected not 5, got 5")
+      end
+
+      it "handles the submitted block" do
+        expect(5).to arbitrary_matcher { 5 }
+        expect(5).to arbitrary_matcher(:expected => 4) { 5 }
+        expect(5).to arbitrary_matcher(:expected => 4).with(5) { 3 }
+      end
+
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/expectations/syntax_spec.rb b/rspec-expectations/spec/rspec/expectations/syntax_spec.rb
new file mode 100644
index 0000000..2d4e997
--- /dev/null
+++ b/rspec-expectations/spec/rspec/expectations/syntax_spec.rb
@@ -0,0 +1,139 @@
+require 'spec_helper'
+
+module RSpec
+  module Expectations
+    describe Syntax do
+      context "when passing a message to an expectation" do
+        let(:warner) { ::Kernel }
+
+        let(:string_like_object) do
+          Struct.new(:to_str, :to_s).new(*(["Ceci n'est pas une Chaine."]*2))
+        end
+
+        let(:insufficiently_string_like_object) do
+          Struct.new(:to_s).new("Ceci n'est pas une Chaine.")
+        end
+
+        let(:callable_object) do
+          Struct.new(:call).new("Ceci n'est pas une Chaine.")
+        end
+
+        describe "expect(...).to" do
+          it "prints a warning when the message object isn't a String" do
+            warner.should_receive(:warn).with(/ignoring.*message/)
+            expect(3).to eq(3), :not_a_string
+          end
+
+          it "doesn't print a warning when message is a String" do
+            warner.should_not_receive(:warn)
+            expect(3).to eq(3), "a string"
+          end
+
+          it "doesn't print a warning when message responds to to_str" do
+            warner.should_not_receive(:warn)
+            expect(3).to eq(3), string_like_object
+          end
+
+          it "prints a warning when the message object handles to_s but not to_str" do
+            warner.should_receive(:warn).with(/ignoring.*message/)
+            expect(3).to eq(3), insufficiently_string_like_object
+          end
+
+          it "doesn't print a warning when message responds to call" do
+            warner.should_not_receive(:warn)
+            expect(3).to eq(3), callable_object
+          end
+        end
+
+        describe "expect(...).not_to" do
+          it "prints a warning when the message object isn't a String" do
+            warner.should_receive(:warn).with(/ignoring.*message/)
+            expect(3).not_to eq(4), :not_a_string
+          end
+
+          it "doesn't print a warning when message is a String" do
+            warner.should_not_receive(:warn)
+            expect(3).not_to eq(4), "a string"
+          end
+
+          it "doesn't print a warning when message responds to to_str" do
+            warner.should_not_receive(:warn)
+            expect(3).not_to eq(4), string_like_object
+          end
+
+          it "prints a warning when the message object handles to_s but not to_str" do
+            warner.should_receive(:warn).with(/ignoring.*message/)
+            expect(3).not_to eq(4), insufficiently_string_like_object
+          end
+
+          it "doesn't print a warning when message responds to call" do
+            warner.should_not_receive(:warn)
+            expect(3).not_to eq(4), callable_object
+          end
+        end
+      end
+
+      describe "expression generation" do
+        let(:target) { "foo" }
+        let(:expectation) { "eq('bar')" }
+        let(:positive_expect_example) { "expect(foo).to eq('bar')" }
+        let(:positive_should_example) { "foo.should eq('bar')" }
+        let(:negative_expect_example) { "expect(foo).not_to eq('bar')" }
+        let(:negative_should_example) { "foo.should_not eq('bar')" }
+
+        def positive_expression
+          Syntax.positive_expression(target, expectation)
+        end
+
+        def negative_expression
+          Syntax.negative_expression(target, expectation)
+        end
+
+        context "when only :expect is enabled" do
+          before do
+            expect(Syntax.should_enabled?).to be_false
+            expect(Syntax.expect_enabled?).to be_true
+          end
+
+          it 'generates a positive expression using the expect syntax' do
+            expect(positive_expression).to eq(positive_expect_example)
+          end
+
+          it 'generates a negative expression using the expect syntax' do
+            expect(negative_expression).to eq(negative_expect_example)
+          end
+        end
+
+        context "when both :should and :expect are enabled", :uses_should do
+          before do
+            expect(Syntax.should_enabled?).to be_true
+            expect(Syntax.expect_enabled?).to be_true
+          end
+
+          it 'generates a positive expression using the expect syntax' do
+            expect(positive_expression).to eq(positive_expect_example)
+          end
+
+          it 'generates a negative expression using the expect syntax' do
+            expect(negative_expression).to eq(negative_expect_example)
+          end
+        end
+
+        context "when only :should is enabled", :uses_only_should do
+          before do
+            Syntax.should_enabled?.should be_true
+            Syntax.expect_enabled?.should be_false
+          end
+
+          it 'generates a positive expression using the expect syntax' do
+            positive_expression.should eq(positive_should_example)
+          end
+
+          it 'generates a negative expression using the expect syntax' do
+            negative_expression.should eq(negative_should_example)
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/base_matcher_spec.rb b/rspec-expectations/spec/rspec/matchers/base_matcher_spec.rb
new file mode 100644
index 0000000..b080c65
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/base_matcher_spec.rb
@@ -0,0 +1,62 @@
+require 'spec_helper'
+
+module RSpec::Matchers::BuiltIn
+  describe BaseMatcher do
+    describe "#match_unless_raises" do
+      let(:matcher) do
+        Class.new(BaseMatcher).new
+      end
+
+      it "returns true if there are no errors" do
+        expect(matcher.match_unless_raises {}).to be_true
+      end
+
+      it "returns false if there is an error" do
+        expect(matcher.match_unless_raises { raise }).to be_false
+      end
+
+      it "returns false if the only submitted error is raised" do
+        expect(matcher.match_unless_raises(RuntimeError){ raise "foo" }).to be_false
+      end
+
+      it "returns false if any of several errors submitted is raised" do
+        expect(matcher.match_unless_raises(RuntimeError, ArgumentError, NameError) { raise "foo" }).to be_false
+        expect(matcher.match_unless_raises(RuntimeError, ArgumentError, NameError) { raise ArgumentError.new('') }).to be_false
+        expect(matcher.match_unless_raises(RuntimeError, ArgumentError, NameError) { raise NameError.new('') }).to be_false
+      end
+
+      it "re-raises any error other than one of those specified" do
+        expect do
+          matcher.match_unless_raises(ArgumentError){ raise "foo" }
+        end.to raise_error
+      end
+
+      it "stores the rescued exception for use in messages" do
+        matcher.match_unless_raises(RuntimeError){ raise "foo" }
+        expect(matcher.rescued_exception).to be_a(RuntimeError)
+        expect(matcher.rescued_exception.message).to eq("foo")
+      end
+
+    end
+
+    describe "#==" do
+      it "responds the same way as matches?" do
+        matcher = Class.new(BaseMatcher) do
+          def initialize(expected)
+            @expected = expected
+          end
+
+          def matches?(actual)
+            (@actual = actual) == @expected
+          end
+        end
+
+        expect(matcher.new(3).matches?(3)).to be_true
+        expect(matcher.new(3)).to eq(3)
+
+        expect(matcher.new(3).matches?(4)).to be_false
+        expect(matcher.new(3)).not_to eq(4)
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/be_close_spec.rb b/rspec-expectations/spec/rspec/matchers/be_close_spec.rb
new file mode 100644
index 0000000..84b6aa5
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/be_close_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+module RSpec
+  module Matchers
+    describe "expect(actual).to be_close(expected, delta)" do
+      before(:each) do
+        allow(RSpec).to receive(:deprecate)
+      end
+
+      it "is deprecated" do
+        expect(RSpec).to receive(:deprecate).with(/be_close.*/, :replacement => "be_within(0.5).of(3.0)")
+        be_close(3.0, 0.5)
+      end
+
+      it "delegates to be_within(delta).of(expected)" do
+        should_receive(:be_within).with(0.5).and_return( be_within_matcher = double )
+        be_within_matcher.should_receive(:of).with(3.0)
+        be_close(3.0, 0.5)
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/be_instance_of_spec.rb b/rspec-expectations/spec/rspec/matchers/be_instance_of_spec.rb
new file mode 100644
index 0000000..a8a1705
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/be_instance_of_spec.rb
@@ -0,0 +1,63 @@
+require 'spec_helper'
+
+module RSpec
+  module Matchers
+    [:be_an_instance_of, :be_instance_of].each do |method|
+      describe "expect(actual).to #{method}(expected)" do
+        it_behaves_like "an RSpec matcher", :valid_value => 5, :invalid_value => "a" do
+          let(:matcher) { send(method, Fixnum) }
+        end
+
+        it "passes if actual is instance of expected class" do
+          expect(5).to send(method, Fixnum)
+        end
+
+        it "fails if actual is instance of subclass of expected class" do
+          expect {
+            expect(5).to send(method, Numeric)
+          }.to fail_with(%Q{expected 5 to be an instance of Numeric})
+        end
+
+        it "fails with failure message for should unless actual is instance of expected class" do
+          expect {
+            expect("foo").to send(method, Array)
+          }.to fail_with(%Q{expected "foo" to be an instance of Array})
+        end
+
+        it "provides a description" do
+          matcher = be_an_instance_of(Fixnum)
+          matcher.matches?(Numeric)
+          expect(matcher.description).to eq "be an instance of Fixnum"
+        end
+
+        context "when expected provides an expanded inspect, e.g. AR::Base" do
+          let(:user_klass) do
+            Class.new do
+              def self.inspect
+                "User(id: integer, name: string)"
+              end
+            end
+          end
+
+          before { stub_const("User", user_klass) }
+
+          it "provides a description including only the class name" do
+            matcher = be_an_instance_of(User)
+            expect(matcher.description).to eq "be an instance of User"
+          end
+        end
+      end
+
+      describe "expect(actual).not_to #{method}(expected)" do
+
+        it "fails with failure message for should_not if actual is instance of expected class" do
+          expect {
+            expect("foo").not_to send(method, String)
+          }.to fail_with(%Q{expected "foo" not to be an instance of String})
+        end
+
+      end
+
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/be_kind_of_spec.rb b/rspec-expectations/spec/rspec/matchers/be_kind_of_spec.rb
new file mode 100644
index 0000000..2019c18
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/be_kind_of_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+module RSpec
+  module Matchers
+    [:be_a_kind_of, :be_kind_of].each do |method|
+      describe "expect(actual).to #{method}(expected)" do
+        it_behaves_like "an RSpec matcher", :valid_value => 5, :invalid_value => "a" do
+          let(:matcher) { send(method, Fixnum) }
+        end
+
+        it "passes if actual is instance of expected class" do
+          expect(5).to send(method, Fixnum)
+        end
+
+        it "passes if actual is instance of subclass of expected class" do
+          expect(5).to send(method, Numeric)
+        end
+
+        it "fails with failure message for should unless actual is kind of expected class" do
+          expect {
+            expect("foo").to send(method, Array)
+          }.to fail_with(%Q{expected "foo" to be a kind of Array})
+        end
+
+        it "provides a description" do
+          matcher = be_a_kind_of(String)
+          matcher.matches?("this")
+          expect(matcher.description).to eq "be a kind of String"
+        end
+      end
+
+      describe "expect(actual).not_to #{method}(expected)" do
+        it "fails with failure message for should_not if actual is kind of expected class" do
+          expect {
+            expect("foo").not_to send(method, String)
+          }.to fail_with(%Q{expected "foo" not to be a kind of String})
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/be_spec.rb b/rspec-expectations/spec/rspec/matchers/be_spec.rb
new file mode 100644
index 0000000..c6f451f
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/be_spec.rb
@@ -0,0 +1,522 @@
+require 'spec_helper'
+
+describe "expect(...).to be_predicate" do
+  it "passes when actual returns true for :predicate?" do
+    actual = double("actual", :happy? => true)
+    expect(actual).to be_happy
+  end
+
+  it "passes when actual returns true for :predicates? (present tense)" do
+    actual = double("actual", :exists? => true, :exist? => true)
+    expect(actual).to be_exist
+  end
+
+  it "fails when actual returns false for :predicate?" do
+    actual = double("actual", :happy? => false)
+    expect {
+      expect(actual).to be_happy
+    }.to fail_with("expected happy? to return true, got false")
+  end
+
+  it "fails when actual returns false for :predicate?" do
+    actual = double("actual", :happy? => nil)
+    expect {
+      expect(actual).to be_happy
+    }.to fail_with("expected happy? to return true, got nil")
+  end
+
+  it "fails when actual does not respond to :predicate?" do
+    expect {
+      expect(Object.new).to be_happy
+    }.to raise_error(NameError, /happy\?/)
+  end
+
+  it "fails on error other than NameError" do
+    actual = double("actual")
+    actual.should_receive(:foo?).and_raise("aaaah")
+    expect {
+      expect(actual).to be_foo
+    }.to raise_error(/aaaah/)
+  end
+
+  it "fails on error other than NameError (with the present tense predicate)" do
+    actual = Object.new
+    actual.should_receive(:foos?).and_raise("aaaah")
+    expect {
+      expect(actual).to be_foo
+    }.to raise_error(/aaaah/)
+  end
+
+  it "does not support operator chaining like a basic `be` matcher does" do
+    matcher = be_happy
+    value = double(:happy? => false)
+    expect(be_happy == value).to be false
+  end
+end
+
+describe "expect(...).not_to be_predicate" do
+  it "passes when actual returns false for :sym?" do
+    actual = double("actual", :happy? => false)
+    expect(actual).not_to be_happy
+  end
+
+  it "passes when actual returns nil for :sym?" do
+    actual = double("actual", :happy? => nil)
+    expect(actual).not_to be_happy
+  end
+
+  it "fails when actual returns true for :sym?" do
+    actual = double("actual", :happy? => true)
+    expect {
+      expect(actual).not_to be_happy
+    }.to fail_with("expected happy? to return false, got true")
+  end
+
+  it "fails when actual does not respond to :sym?" do
+    expect {
+      expect(Object.new).not_to be_happy
+    }.to raise_error(NameError)
+  end
+end
+
+describe "expect(...).to be_predicate(*args)" do
+  it "passes when actual returns true for :predicate?(*args)" do
+    actual = double("actual")
+    actual.should_receive(:older_than?).with(3).and_return(true)
+    expect(actual).to be_older_than(3)
+  end
+
+  it "fails when actual returns false for :predicate?(*args)" do
+    actual = double("actual")
+    actual.should_receive(:older_than?).with(3).and_return(false)
+    expect {
+      expect(actual).to be_older_than(3)
+    }.to fail_with("expected older_than?(3) to return true, got false")
+  end
+
+  it "fails when actual does not respond to :predicate?" do
+    expect {
+      expect(Object.new).to be_older_than(3)
+    }.to raise_error(NameError)
+  end
+end
+
+describe "expect(...).not_to be_predicate(*args)" do
+  it "passes when actual returns false for :predicate?(*args)" do
+    actual = double("actual")
+    actual.should_receive(:older_than?).with(3).and_return(false)
+    expect(actual).not_to be_older_than(3)
+  end
+
+  it "fails when actual returns true for :predicate?(*args)" do
+    actual = double("actual")
+    actual.should_receive(:older_than?).with(3).and_return(true)
+    expect {
+      expect(actual).not_to be_older_than(3)
+    }.to fail_with("expected older_than?(3) to return false, got true")
+  end
+
+  it "fails when actual does not respond to :predicate?" do
+    expect {
+      expect(Object.new).not_to be_older_than(3)
+    }.to raise_error(NameError)
+  end
+end
+
+describe "expect(...).to be_predicate(&block)" do
+  it "passes when actual returns true for :predicate?(&block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:happy?).and_yield
+    delegate.should_receive(:check_happy).and_return(true)
+    expect(actual).to be_happy { delegate.check_happy }
+  end
+
+  it "fails when actual returns false for :predicate?(&block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:happy?).and_yield
+    delegate.should_receive(:check_happy).and_return(false)
+    expect {
+      expect(actual).to be_happy { delegate.check_happy }
+    }.to fail_with("expected happy? to return true, got false")
+  end
+
+  it "fails when actual does not respond to :predicate?" do
+    delegate = double("delegate", :check_happy => true)
+    expect {
+      expect(Object.new).to be_happy { delegate.check_happy }
+    }.to raise_error(NameError)
+  end
+end
+
+describe "expect(...).not_to be_predicate(&block)" do
+  it "passes when actual returns false for :predicate?(&block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:happy?).and_yield
+    delegate.should_receive(:check_happy).and_return(false)
+    expect(actual).not_to be_happy { delegate.check_happy }
+  end
+
+  it "fails when actual returns true for :predicate?(&block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:happy?).and_yield
+    delegate.should_receive(:check_happy).and_return(true)
+    expect {
+      expect(actual).not_to be_happy { delegate.check_happy }
+    }.to fail_with("expected happy? to return false, got true")
+  end
+
+  it "fails when actual does not respond to :predicate?" do
+    delegate = double("delegate", :check_happy => true)
+    expect {
+      expect(Object.new).not_to be_happy { delegate.check_happy }
+    }.to raise_error(NameError)
+  end
+end
+
+describe "expect(...).to be_predicate(*args, &block)" do
+  it "passes when actual returns true for :predicate?(*args, &block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:older_than?).with(3).and_yield(3)
+    delegate.should_receive(:check_older_than).with(3).and_return(true)
+    expect(actual).to be_older_than(3) { |age| delegate.check_older_than(age) }
+  end
+
+  it "fails when actual returns false for :predicate?(*args, &block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:older_than?).with(3).and_yield(3)
+    delegate.should_receive(:check_older_than).with(3).and_return(false)
+    expect {
+      expect(actual).to be_older_than(3) { |age| delegate.check_older_than(age) }
+    }.to fail_with("expected older_than?(3) to return true, got false")
+  end
+
+  it "fails when actual does not respond to :predicate?" do
+    delegate = double("delegate", :check_older_than => true)
+    expect {
+      expect(Object.new).to be_older_than(3) { |age| delegate.check_older_than(age) }
+    }.to raise_error(NameError)
+  end
+end
+
+describe "expect(...).not_to be_predicate(*args, &block)" do
+  it "passes when actual returns false for :predicate?(*args, &block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:older_than?).with(3).and_yield(3)
+    delegate.should_receive(:check_older_than).with(3).and_return(false)
+    expect(actual).not_to be_older_than(3) { |age| delegate.check_older_than(age) }
+  end
+
+  it "fails when actual returns true for :predicate?(*args, &block)" do
+    actual = double("actual")
+    delegate = double("delegate")
+    actual.should_receive(:older_than?).with(3).and_yield(3)
+    delegate.should_receive(:check_older_than).with(3).and_return(true)
+    expect {
+      expect(actual).not_to be_older_than(3) { |age| delegate.check_older_than(age) }
+    }.to fail_with("expected older_than?(3) to return false, got true")
+  end
+
+  it "fails when actual does not respond to :predicate?" do
+    delegate = double("delegate", :check_older_than => true)
+    expect {
+      expect(Object.new).not_to be_older_than(3) { |age| delegate.check_older_than(age) }
+    }.to raise_error(NameError)
+  end
+end
+
+describe "expect(...).to be_true" do
+  it "passes when actual equal?(true)" do
+    expect(true).to be_true
+  end
+
+  it "passes when actual is 1" do
+    expect(1).to be_true
+  end
+
+  it "fails when actual equal?(false)" do
+    expect {
+      expect(false).to be_true
+    }.to fail_with("expected: true value\n     got: false")
+  end
+end
+
+describe "expect(...).to be_false" do
+  it "passes when actual equal?(false)" do
+    expect(false).to be_false
+  end
+
+  it "passes when actual equal?(nil)" do
+    expect(nil).to be_false
+  end
+
+  it "fails when actual equal?(true)" do
+    expect {
+      expect(true).to be_false
+    }.to fail_with("expected: false value\n     got: true")
+  end
+end
+
+describe "expect(...).to be_nil" do
+  it "passes when actual is nil" do
+    expect(nil).to be_nil
+  end
+
+  it "fails when actual is not nil" do
+    expect {
+      expect(:not_nil).to be_nil
+    }.to fail_with(/^expected: nil/)
+  end
+end
+
+describe "expect(...).not_to be_nil" do
+  it "passes when actual is not nil" do
+    expect(:not_nil).not_to be_nil
+  end
+
+  it "fails when actual is nil" do
+    expect {
+      expect(nil).not_to be_nil
+    }.to fail_with(/^expected: not nil/)
+  end
+end
+
+describe "expect(...).to be <" do
+  it "passes when < operator returns true" do
+    expect(3).to be < 4
+  end
+
+  it "fails when < operator returns false" do
+    expect {
+      expect(3).to be < 3
+    }.to fail_with("expected: < 3\n     got:   3")
+  end
+
+  it "describes itself" do
+    expect(be.<(4).description).to eq "be < 4"
+  end
+end
+
+describe "expect(...).to be <=" do
+  it "passes when <= operator returns true" do
+    expect(3).to be <= 4
+    expect(4).to be <= 4
+  end
+
+  it "fails when <= operator returns false" do
+    expect {
+      expect(3).to be <= 2
+    }.to fail_with("expected: <= 2\n     got:    3")
+  end
+end
+
+describe "expect(...).to be >=" do
+  it "passes when >= operator returns true" do
+    expect(4).to be >= 4
+    expect(5).to be >= 4
+  end
+
+  it "fails when >= operator returns false" do
+    expect {
+      expect(3).to be >= 4
+    }.to fail_with("expected: >= 4\n     got:    3")
+  end
+end
+
+describe "expect(...).to be >" do
+  it "passes when > operator returns true" do
+    expect(5).to be > 4
+  end
+
+  it "fails when > operator returns false" do
+    expect {
+      expect(3).to be > 4
+    }.to fail_with("expected: > 4\n     got:   3")
+  end
+end
+
+describe "expect(...).to be ==" do
+  it "passes when == operator returns true" do
+    expect(5).to be == 5
+  end
+
+  it "fails when == operator returns false" do
+    expect {
+      expect(3).to be == 4
+    }.to fail_with("expected: == 4\n     got:    3")
+  end
+
+  it 'works when the target overrides `#send`' do
+    klass = Struct.new(:message) do
+      def send
+        :message_sent
+      end
+    end
+
+    msg_1 = klass.new("hello")
+    msg_2 = klass.new("hello")
+    expect(msg_1).to be == msg_2
+  end
+end
+
+describe "expect(...).to be =~" do
+  it "passes when =~ operator returns true" do
+    expect("a string").to be =~ /str/
+  end
+
+  it "fails when =~ operator returns false" do
+    expect {
+      expect("a string").to be =~ /blah/
+    }.to fail_with(%Q|expected: =~ /blah/\n     got:    "a string"|)
+  end
+end
+
+describe "should be =~", :uses_should do
+  it "passes when =~ operator returns true" do
+    "a string".should be =~ /str/
+  end
+
+  it "fails when =~ operator returns false" do
+    expect {
+      "a string".should be =~ /blah/
+    }.to fail_with(%Q|expected: =~ /blah/\n     got:    "a string"|)
+  end
+end
+
+describe "expect(...).to be ===" do
+  it "passes when === operator returns true" do
+    expect(Hash).to be === Hash.new
+  end
+
+  it "fails when === operator returns false" do
+    expect {
+      expect(Hash).to be === "not a hash"
+    }.to fail_with(%[expected: === "not a hash"\n     got:     Hash])
+  end
+end
+
+describe "expect(...).not_to with operators" do
+  it "coaches user to stop using operators with expect().not_to" do
+    expect {
+      expect(5).not_to be < 6
+    }.to raise_error(/`expect\(actual\).not_to be < 6` not only FAILED,\nit is a bit confusing./m)
+  end
+end
+
+describe "should_not with operators", :uses_only_should do
+  it "coaches user to stop using operators with should_not" do
+    lambda {
+      5.should_not be < 6
+    }.should raise_error(/`actual.should_not be < 6` not only FAILED,\nit is a bit confusing./m)
+  end
+end
+
+describe "expect(...).to be" do
+  it "passes if actual is truthy" do
+    expect(true).to be
+    expect(1).to be
+  end
+
+  it "fails if actual is false" do
+    expect {
+      expect(false).to be
+    }.to fail_with("expected false to evaluate to true")
+  end
+
+  it "fails if actual is nil" do
+    expect {
+      expect(nil).to be
+    }.to fail_with("expected nil to evaluate to true")
+  end
+
+  it "describes itself" do
+    expect(be.description).to eq "be"
+  end
+end
+
+describe "expect(...).not_to be" do
+  it "passes if actual is falsy" do
+    expect(false).not_to be
+    expect(nil).not_to be
+  end
+
+  it "fails on true" do
+    expect {
+      expect(true).not_to be
+    }.to fail_with("expected true to evaluate to false")
+  end
+end
+
+describe "expect(...).to be(value)" do
+  it "delegates to equal" do
+    matcher = equal(5)
+    self.should_receive(:equal).with(5).and_return(matcher)
+    expect(5).to be(5)
+  end
+end
+
+describe "expect(...).not_to be(value)" do
+  it "delegates to equal" do
+    matcher = equal(4)
+    self.should_receive(:equal).with(4).and_return(matcher)
+    expect(5).not_to be(4)
+  end
+end
+
+describe "'expect(...).to be' with operator" do
+  it "includes 'be' in the description" do
+    expect((be > 6).description).to match(/be > 6/)
+    expect((be >= 6).description).to match(/be >= 6/)
+    expect((be <= 6).description).to match(/be <= 6/)
+    expect((be < 6).description).to match(/be < 6/)
+  end
+end
+
+
+describe "arbitrary predicate with DelegateClass" do
+  it "accesses methods defined in the delegating class (LH[#48])" do
+    require 'delegate'
+    class ArrayDelegate < DelegateClass(Array)
+      def initialize(array)
+        @internal_array = array
+        super(@internal_array)
+      end
+
+      def large?
+        @internal_array.size >= 5
+      end
+    end
+
+    delegate = ArrayDelegate.new([1,2,3,4,5,6])
+    expect(delegate).to be_large
+  end
+end
+
+describe "be_a, be_an" do
+  it "passes when class matches" do
+    expect("foobar").to be_a(String)
+    expect([1,2,3]).to be_an(Array)
+  end
+
+  it "fails when class does not match" do
+    expect("foobar").not_to be_a(Hash)
+    expect([1,2,3]).not_to be_an(Integer)
+  end
+end
+
+describe "be_an_instance_of" do
+  it "passes when direct class matches" do
+    expect(5).to be_an_instance_of(Fixnum)
+  end
+
+  it "fails when class is higher up hierarchy" do
+    expect(5).not_to be_an_instance_of(Numeric)
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/be_within_spec.rb b/rspec-expectations/spec/rspec/matchers/be_within_spec.rb
new file mode 100644
index 0000000..c57127b
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/be_within_spec.rb
@@ -0,0 +1,137 @@
+require 'spec_helper'
+
+module RSpec
+  module Matchers
+    describe "expect(actual).to be_within(delta).of(expected)" do
+      it_behaves_like "an RSpec matcher", :valid_value => 5, :invalid_value => -5 do
+        let(:matcher) { be_within(2).of(4.0) }
+      end
+
+      it "passes when actual == expected" do
+        expect(5.0).to be_within(0.5).of(5.0)
+      end
+
+      it "passes when actual < (expected + delta)" do
+        expect(5.49).to be_within(0.5).of(5.0)
+      end
+
+      it "passes when actual > (expected - delta)" do
+        expect(4.51).to be_within(0.5).of(5.0)
+      end
+
+      it "passes when actual == (expected - delta)" do
+        expect(4.5).to be_within(0.5).of(5.0)
+      end
+
+      it "passes when actual == (expected + delta)" do
+        expect(5.5).to be_within(0.5).of(5.0)
+      end
+
+      it "passes with integer arguments that are near each other" do
+        expect(1.0001).to be_within(5).percent_of(1)
+      end
+
+      it "passes with negative arguments" do
+        expect(-1.0001).to be_within(5).percent_of(-1)
+      end
+
+      it "fails when actual < (expected - delta)" do
+        expect {
+          expect(4.49).to be_within(0.5).of(5.0)
+        }.to fail_with("expected 4.49 to be within 0.5 of 5.0")
+      end
+
+      it "fails when actual > (expected + delta)" do
+        expect {
+          expect(5.51).to be_within(0.5).of(5.0)
+        }.to fail_with("expected 5.51 to be within 0.5 of 5.0")
+      end
+
+      it "works with Time" do
+        expect(Time.now).to be_within(0.1).of(Time.now)
+      end
+
+      it "provides a description" do
+        matcher = be_within(0.5).of(5.0)
+        matcher.matches?(5.1)
+        expect(matcher.description).to eq "be within 0.5 of 5.0"
+      end
+
+      it "raises an error if no expected value is given" do
+        expect {
+          expect(5.1).to be_within(0.5)
+        }.to raise_error(ArgumentError, /must set an expected value using #of/)
+      end
+
+      it "raises an error if the actual does not respond to :-" do
+        expect {
+          expect(nil).to be_within(0.1).of(0)
+        }.to raise_error(ArgumentError, /The actual value \(nil\) must respond to `-`/)
+      end
+    end
+
+    describe "expect(actual).to be_within(delta).percent_of(expected)" do
+      it "passes when actual is within the given percent variance" do
+        expect(9.0).to be_within(10).percent_of(10.0)
+        expect(10.0).to be_within(10).percent_of(10.0)
+        expect(11.0).to be_within(10).percent_of(10.0)
+      end
+
+      it "fails when actual is outside the given percent variance" do
+        expect {
+          expect(8.9).to be_within(10).percent_of(10.0)
+        }.to fail_with("expected 8.9 to be within 10% of 10.0")
+
+        expect {
+          expect(11.1).to be_within(10).percent_of(10.0)
+        }.to fail_with("expected 11.1 to be within 10% of 10.0")
+      end
+
+      it "provides a description" do
+        matcher = be_within(0.5).percent_of(5.0)
+        matcher.matches?(5.1)
+        expect(matcher.description).to eq "be within 0.5% of 5.0"
+      end
+    end
+
+    describe "expect(actual).not_to be_within(delta).of(expected)" do
+      it "passes when actual < (expected - delta)" do
+        expect(4.49).not_to be_within(0.5).of(5.0)
+      end
+
+      it "passes when actual > (expected + delta)" do
+        expect(5.51).not_to be_within(0.5).of(5.0)
+      end
+
+      it "fails when actual == expected" do
+        expect {
+          expect(5.0).not_to be_within(0.5).of(5.0)
+        }.to fail_with("expected 5.0 not to be within 0.5 of 5.0")
+      end
+
+      it "fails when actual < (expected + delta)" do
+        expect {
+          expect(5.49).not_to be_within(0.5).of(5.0)
+        }.to fail_with("expected 5.49 not to be within 0.5 of 5.0")
+      end
+
+      it "fails when actual > (expected - delta)" do
+        expect {
+          expect(4.51).not_to be_within(0.5).of(5.0)
+        }.to fail_with("expected 4.51 not to be within 0.5 of 5.0")
+      end
+
+      it "fails when actual == (expected - delta)" do
+        expect {
+          expect(4.5).not_to be_within(0.5).of(5.0)
+        }.to fail_with("expected 4.5 not to be within 0.5 of 5.0")
+      end
+
+      it "fails when actual == (expected + delta)" do
+        expect {
+          expect(5.5).not_to be_within(0.5).of(5.0)
+        }.to fail_with("expected 5.5 not to be within 0.5 of 5.0")
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/change_spec.rb b/rspec-expectations/spec/rspec/matchers/change_spec.rb
new file mode 100644
index 0000000..d787558
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/change_spec.rb
@@ -0,0 +1,567 @@
+#Based on patch from Wilson Bilkovich
+
+require 'spec_helper'
+
+class SomethingExpected
+  attr_accessor :some_value
+end
+
+describe "expect { ... }.to change(actual, message)" do
+  context "with a numeric value" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = 5
+    end
+
+    it "passes when actual is modified by the block" do
+      expect {@instance.some_value = 6.0}.to change(@instance, :some_value)
+    end
+
+    it "fails when actual is not modified by the block" do
+      expect do
+        expect {}.to change(@instance, :some_value)
+      end.to fail_with("some_value should have changed, but is still 5")
+    end
+
+    it "provides a #description" do
+      expect(change(@instance, :some_value).description).to eq "change #some_value"
+    end
+  end
+
+  it "can specify the change of a variable's class" do
+    val = nil
+
+    expect {
+      val = 42
+    }.to change { val.class }.from(NilClass).to(Fixnum)
+
+    expect {
+      expect {
+        val = "string"
+      }.to change { val.class }.from(Fixnum).to(NilClass)
+    }.to fail_with(/but is now String/)
+  end
+
+  context "with boolean values" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = true
+    end
+
+    it "passes when actual is modified by the block" do
+      expect {@instance.some_value = false}.to change(@instance, :some_value)
+    end
+
+    it "fails when actual is not modified by the block" do
+      expect do
+        expect {}.to change(@instance, :some_value)
+      end.to fail_with("some_value should have changed, but is still true")
+    end
+  end
+
+  context "with nil value" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = nil
+    end
+
+    it "passes when actual is modified by the block" do
+      expect {@instance.some_value = false}.to change(@instance, :some_value)
+    end
+
+    it "fails when actual is not modified by the block" do
+      expect do
+        expect {}.to change(@instance, :some_value)
+      end.to fail_with("some_value should have changed, but is still nil")
+    end
+  end
+
+  context "with an array" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = []
+    end
+
+    it "passes when actual is modified by the block" do
+      expect {@instance.some_value << 1}.to change(@instance, :some_value)
+    end
+
+    it "fails when a predicate on the actual fails" do
+      expect do
+        expect {@instance.some_value << 1}.to change { @instance.some_value }.to be_empty
+      end.to fail_with(/result should have been changed to/)
+    end
+
+    it "passes when a predicate on the actual passes" do
+      @instance.some_value = [1]
+      expect {@instance.some_value.pop}.to change { @instance.some_value }.to be_empty
+    end
+
+    it "fails when actual is not modified by the block" do
+      expect do
+        expect {}.to change(@instance, :some_value)
+      end.to fail_with("some_value should have changed, but is still []")
+    end
+  end
+
+  context "with a hash" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = {:a => 'a'}
+    end
+
+    it "passes when actual is modified by the block" do
+      expect {@instance.some_value[:a] = 'A'}.to change(@instance, :some_value)
+    end
+
+    it "fails when actual is not modified by the block" do
+      expect do
+        expect {}.to change(@instance, :some_value)
+      end.to fail
+    end
+  end
+
+  context "with a string" do
+    it "passes when actual is modified by the block" do
+      string = "ab"
+      expect { string << "c" }.to change { string }
+    end
+
+    it 'fails when actual is not modified by the block' do
+      string = "ab"
+      expect {
+        expect { }.to change { string }
+      }.to fail_with(/should have changed/)
+    end
+  end
+
+  context "with an arbitrary enumerable" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = Class.new do
+        include Enumerable
+
+        attr_reader :elements
+
+        def initialize(*elements)
+          @elements = elements.dup
+        end
+
+        def <<(element)
+          elements << element
+        end
+
+        def dup
+          self.class.new(*elements)
+        end
+
+        def ==(other)
+          elements == other.elements
+        end
+      end.new
+    end
+
+    it "passes when actual is modified by the block" do
+      expect {@instance.some_value << 1}.to change(@instance, :some_value)
+    end
+
+    it "fails when actual is not modified by the block" do
+      expect do
+        expect {}.to change(@instance, :some_value)
+      end.to fail_with(/^some_value should have changed, but is still/)
+    end
+
+  end
+end
+
+describe "expect { ... }.not_to change(actual, message)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when actual is not modified by the block" do
+    expect { }.not_to change(@instance, :some_value)
+  end
+
+  it "fails when actual is not modified by the block" do
+    expect do
+      expect {@instance.some_value = 6}.not_to change(@instance, :some_value)
+    end.to fail_with("some_value should not have changed, but did change from 5 to 6")
+  end
+end
+
+describe "expect { ... }.to change { block }" do
+  o = SomethingExpected.new
+  it_behaves_like "an RSpec matcher", :valid_value => lambda { o.some_value = 5 },
+                                      :invalid_value => lambda { } do
+    let(:matcher) { change { o.some_value } }
+  end
+
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when actual is modified by the block" do
+    expect {@instance.some_value = 6}.to change { @instance.some_value }
+  end
+
+  it "fails when actual is not modified by the block" do
+    expect do
+      expect {}.to change{ @instance.some_value }
+    end.to fail_with("result should have changed, but is still 5")
+  end
+
+  it "warns if passed a block using do/end instead of {}" do
+    expect do
+      expect {}.to change do; end
+    end.to raise_error(SyntaxError, /block passed to should or should_not/)
+  end
+
+  it "provides a #description" do
+    expect(change { @instance.some_value }.description).to eq "change #result"
+  end
+end
+
+describe "expect { ... }.not_to change { block }" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when actual is modified by the block" do
+    expect {}.not_to change{ @instance.some_value }
+  end
+
+  it "fails when actual is not modified by the block" do
+    expect do
+      expect {@instance.some_value = 6}.not_to change { @instance.some_value }
+    end.to fail_with("result should not have changed, but did change from 5 to 6")
+  end
+
+  it "warns if passed a block using do/end instead of {}" do
+    expect do
+      expect {}.not_to change do; end
+    end.to raise_error(SyntaxError, /block passed to should or should_not/)
+  end
+end
+
+describe "expect { ... }.to change(actual, message).by(expected)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when attribute is changed by expected amount" do
+    expect { @instance.some_value += 1 }.to change(@instance, :some_value).by(1)
+  end
+
+  it "passes when attribute is not changed and expected amount is 0" do
+    expect { @instance.some_value += 0 }.to change(@instance, :some_value).by(0)
+  end
+
+  it "fails when the attribute is changed by unexpected amount" do
+    expect do
+      expect { @instance.some_value += 2 }.to change(@instance, :some_value).by(1)
+    end.to fail_with("some_value should have been changed by 1, but was changed by 2")
+  end
+
+  it "fails when the attribute is changed by unexpected amount in the opposite direction" do
+    expect do
+      expect { @instance.some_value -= 1 }.to change(@instance, :some_value).by(1)
+    end.to fail_with("some_value should have been changed by 1, but was changed by -1")
+  end
+end
+
+describe "expect { ... }.to change { block }.by(expected)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when attribute is changed by expected amount" do
+    expect { @instance.some_value += 1 }.to change{@instance.some_value}.by(1)
+  end
+
+  it "fails when the attribute is changed by unexpected amount" do
+    expect do
+      expect { @instance.some_value += 2 }.to change{@instance.some_value}.by(1)
+    end.to fail_with("result should have been changed by 1, but was changed by 2")
+  end
+
+  it "fails when the attribute is changed by unexpected amount in the opposite direction" do
+    expect do
+      expect { @instance.some_value -= 1 }.to change{@instance.some_value}.by(1)
+    end.to fail_with("result should have been changed by 1, but was changed by -1")
+  end
+end
+
+describe "expect { ... }.to change(actual, message).by_at_least(expected)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when attribute is changed by greater than the expected amount" do
+    expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_least(1)
+  end
+
+  it "passes when attribute is changed by the expected amount" do
+    expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_least(2)
+  end
+
+  it "fails when the attribute is changed by less than the expected amount" do
+    expect do
+      expect { @instance.some_value += 1 }.to change(@instance, :some_value).by_at_least(2)
+    end.to fail_with("some_value should have been changed by at least 2, but was changed by 1")
+  end
+
+end
+
+describe "expect { ... }.to change { block }.by_at_least(expected)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when attribute is changed by greater than expected amount" do
+    expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_least(1)
+  end
+
+  it "passes when attribute is changed by the expected amount" do
+    expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_least(2)
+  end
+
+  it "fails when the attribute is changed by less than the unexpected amount" do
+    expect do
+      expect { @instance.some_value += 1 }.to change{@instance.some_value}.by_at_least(2)
+    end.to fail_with("result should have been changed by at least 2, but was changed by 1")
+  end
+end
+
+
+describe "expect { ... }.to change(actual, message).by_at_most(expected)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when attribute is changed by less than the expected amount" do
+    expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(3)
+  end
+
+  it "passes when attribute is changed by the expected amount" do
+    expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(2)
+  end
+
+  it "fails when the attribute is changed by greater than the expected amount" do
+    expect do
+      expect { @instance.some_value += 2 }.to change(@instance, :some_value).by_at_most(1)
+    end.to fail_with("some_value should have been changed by at most 1, but was changed by 2")
+  end
+
+end
+
+describe "expect { ... }.to change { block }.by_at_most(expected)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 5
+  end
+
+  it "passes when attribute is changed by less than expected amount" do
+    expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(3)
+  end
+
+  it "passes when attribute is changed by the expected amount" do
+    expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(2)
+  end
+
+  it "fails when the attribute is changed by greater than the unexpected amount" do
+    expect do
+      expect { @instance.some_value += 2 }.to change{@instance.some_value}.by_at_most(1)
+    end.to fail_with("result should have been changed by at most 1, but was changed by 2")
+  end
+end
+
+describe "expect { ... }.to change(actual, message).from(old)" do
+  context "with boolean values" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = true
+    end
+
+    it "passes when attribute is == to expected value before executing block" do
+      expect { @instance.some_value = false }.to change(@instance, :some_value).from(true)
+    end
+
+    it "fails when attribute is not == to expected value before executing block" do
+      expect do
+        expect { @instance.some_value = 'foo' }.to change(@instance, :some_value).from(false)
+      end.to fail_with("some_value should have initially been false, but was true")
+    end
+  end
+  context "with non-boolean values" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = 'string'
+    end
+
+    it "passes when attribute is === to expected value before executing block" do
+      expect { @instance.some_value = "astring" }.to change(@instance, :some_value).from("string")
+    end
+
+    it "compares the expected and actual values with ===" do
+      expected = "string"
+      expected.should_receive(:===).and_return true
+      expect { @instance.some_value = "astring" }.to change(@instance, :some_value).from(expected)
+    end
+
+    it "fails when attribute is not === to expected value before executing block" do
+      expect do
+        expect { @instance.some_value = "knot" }.to change(@instance, :some_value).from("cat")
+      end.to fail_with("some_value should have initially been \"cat\", but was \"string\"")
+    end
+  end
+end
+
+describe "expect { ... }.to change { block }.from(old)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 'string'
+  end
+
+  it "passes when attribute is === to expected value before executing block" do
+    expect { @instance.some_value = "astring" }.to change{@instance.some_value}.from("string")
+  end
+
+  it "compares the expected and actual values with ===" do
+    expected = "string"
+    expected.should_receive(:===).and_return true
+    expect { @instance.some_value = "astring" }.to change{@instance.some_value}.from(expected)
+  end
+
+  it "fails when attribute is not === to expected value before executing block" do
+    expect do
+      expect { @instance.some_value = "knot" }.to change{@instance.some_value}.from("cat")
+    end.to fail_with("result should have initially been \"cat\", but was \"string\"")
+  end
+end
+
+describe "expect { ... }.to change(actual, message).to(new)" do
+  context "with boolean values" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = true
+    end
+
+    it "passes when attribute is == to expected value after executing block" do
+      expect { @instance.some_value = false }.to change(@instance, :some_value).to(false)
+    end
+
+    it "fails when attribute is not == to expected value after executing block" do
+      expect do
+        expect { @instance.some_value = 1 }.to change(@instance, :some_value).from(true).to(false)
+      end.to fail_with("some_value should have been changed to false, but is now 1")
+    end
+  end
+  context "with non-boolean values" do
+    before(:each) do
+      @instance = SomethingExpected.new
+      @instance.some_value = 'string'
+    end
+
+    it "passes when attribute is === to expected value after executing block" do
+      expect { @instance.some_value = "cat" }.to change(@instance, :some_value).to("cat")
+    end
+
+    it "compares the expected and actual values with ===" do
+      expected = "cat"
+      expected.should_receive(:===).and_return true
+      expect { @instance.some_value = "cat" }.to change(@instance, :some_value).to(expected)
+    end
+
+    it "fails when attribute is not === to expected value after executing block" do
+      expect do
+        expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("dog")
+      end.to fail_with("some_value should have been changed to \"dog\", but is now \"cat\"")
+    end
+  end
+end
+
+describe "expect { ... }.to change { block }.to(new)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 'string'
+  end
+
+  it "passes when attribute is === to expected value after executing block" do
+    expect { @instance.some_value = "cat" }.to change{@instance.some_value}.to("cat")
+  end
+
+  it "compares the expected and actual values with ===" do
+    expected = "cat"
+    expected.should_receive(:===).and_return true
+    expect { @instance.some_value = "cat" }.to change{@instance.some_value}.to(expected)
+  end
+
+  it "fails when attribute is not === to expected value after executing block" do
+    expect do
+      expect { @instance.some_value = "cat" }.to change{@instance.some_value}.from("string").to("dog")
+    end.to fail_with("result should have been changed to \"dog\", but is now \"cat\"")
+  end
+end
+
+describe "expect { ... }.to change(actual, message).from(old).to(new)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 'string'
+  end
+
+  it "passes when #to comes before #from" do
+    expect { @instance.some_value = "cat" }.to change(@instance, :some_value).to("cat").from("string")
+  end
+
+  it "passes when #from comes before #to" do
+    expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("cat")
+  end
+
+  it "shows the correct messaging when #after and #to are different" do
+    expect do
+      expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("string").to("dog")
+    end.to fail_with("some_value should have been changed to \"dog\", but is now \"cat\"")
+  end
+
+  it "shows the correct messaging when #before and #from are different" do
+    expect do
+      expect { @instance.some_value = "cat" }.to change(@instance, :some_value).from("not_string").to("cat")
+    end.to fail_with("some_value should have initially been \"not_string\", but was \"string\"")
+  end
+end
+
+describe "expect { ... }.to change { block }.from(old).to(new)" do
+  before(:each) do
+    @instance = SomethingExpected.new
+    @instance.some_value = 'string'
+  end
+
+  it "passes when #to comes before #from" do
+    expect { @instance.some_value = "cat" }.to change{@instance.some_value}.to("cat").from("string")
+  end
+
+  it "passes when #from comes before #to" do
+    expect { @instance.some_value = "cat" }.to change{@instance.some_value}.from("string").to("cat")
+  end
+end
+
+describe RSpec::Matchers::BuiltIn::Change do
+  it "works when the receiver has implemented #send" do
+    @instance = SomethingExpected.new
+    @instance.some_value = "string"
+    def @instance.send(*args); raise "DOH! Library developers shouldn't use #send!" end
+
+    expect {
+      expect { @instance.some_value = "cat" }.to change(@instance, :some_value)
+    }.not_to raise_error
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/configuration_spec.rb b/rspec-expectations/spec/rspec/matchers/configuration_spec.rb
new file mode 100644
index 0000000..175965e
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/configuration_spec.rb
@@ -0,0 +1,206 @@
+require 'spec_helper'
+require 'delegate'
+
+module RSpec
+  module Matchers
+    describe "RSpec::Matchers.configuration" do
+      it 'returns a memoized configuration instance' do
+        expect(RSpec::Matchers.configuration).to be_a(RSpec::Matchers::Configuration)
+        expect(RSpec::Matchers.configuration).to be(RSpec::Matchers.configuration)
+      end
+    end
+
+    describe Configuration do
+      let(:config) { Configuration.new }
+
+      describe "#backtrace_formatter" do
+        let(:original_backtrace) { %w[ clean-me/a.rb other/file.rb clean-me/b.rb ] }
+        let(:cleaned_backtrace)  { %w[ other/file.rb ] }
+
+        let(:formatted_backtrace) do
+          config.backtrace_formatter.format_backtrace(original_backtrace)
+        end
+
+        before do
+          @old_patterns = RSpec.configuration.backtrace_exclusion_patterns
+          RSpec.configuration.backtrace_exclusion_patterns = [/clean-me/]
+        end
+
+        after do
+          RSpec.configuration.backtrace_exclusion_patterns = @old_patterns
+        end
+
+        it "defaults to rspec-core's backtrace formatter when rspec-core is loaded" do
+          expect(config.backtrace_formatter).to be(RSpec::Core::BacktraceFormatter)
+          expect(formatted_backtrace).to eq(cleaned_backtrace)
+        end
+
+        it "defaults to a null formatter when rspec-core is not loaded" do
+          hide_const("RSpec::Core::BacktraceFormatter")
+          expect(formatted_backtrace).to eq(original_backtrace)
+        end
+
+        it "can be set to another backtrace formatter" do
+          config.backtrace_formatter = double(:format_backtrace => ['a'])
+          expect(formatted_backtrace).to eq(['a'])
+        end
+      end
+
+      context 'on an interpreter that does not provide BasicObject', :uses_should, :unless => defined?(::BasicObject) do
+        before { RSpec::Expectations::Syntax.disable_should(Delegator) }
+
+        let(:klass) do
+          Class.new(SimpleDelegator) do
+            def delegated?; true; end
+          end
+        end
+
+        let(:instance) { klass.new(Object.new) }
+
+        it 'provides a means to manually add it Delegator' do
+          instance.should_not respond_to(:delegated?) # because #should is being delegated...
+          config.add_should_and_should_not_to Delegator
+          instance.should respond_to(:delegated?) # now it should work!
+        end
+      end
+
+      shared_examples_for "configuring the expectation syntax" do
+        before do
+          @orig_syntax = RSpec::Matchers.configuration.syntax
+        end
+
+        after do
+          configure_syntax(@orig_syntax)
+        end
+
+        it 'can limit the syntax to :should' do
+          configure_syntax :should
+          configured_syntax.should eq([:should])
+
+          3.should eq(3)
+          3.should_not eq(4)
+          lambda { expect(6).to eq(6) }.should raise_error(NameError)
+        end
+
+        it 'is a no-op when configured to :should twice' do
+          configure_syntax :should
+          Expectations::Syntax.default_should_host.should_not_receive(:method_added)
+          configure_syntax :should
+          RSpec::Mocks.verify # because configure_syntax is called again in an after hook
+        end
+
+        it 'can limit the syntax to :expect' do
+          configure_syntax :expect
+          expect(configured_syntax).to eq([:expect])
+
+          expect(3).to eq(3)
+          expect { 3.should eq(3) }.to raise_error(NameError)
+          expect { 3.should_not eq(3) }.to raise_error(NameError)
+        end
+
+        it 'is a no-op when configured to :expect twice' do
+          RSpec::Matchers.stub(:method_added).and_raise("no methods should be added here")
+
+          configure_syntax :expect
+          configure_syntax :expect
+        end
+
+        it 'can re-enable the :should syntax' do
+          configure_syntax :expect
+          configure_syntax [:should, :expect]
+          configured_syntax.should eq([:should, :expect])
+
+          3.should eq(3)
+          3.should_not eq(4)
+          expect(3).to eq(3)
+        end
+
+        it 'can re-enable the :expect syntax' do
+          configure_syntax :should
+          configure_syntax [:should, :expect]
+          configured_syntax.should eq([:should, :expect])
+
+          3.should eq(3)
+          3.should_not eq(4)
+          expect(3).to eq(3)
+        end
+
+        it 'does not add the deprecated #should to ExpectationTarget when only :should is enabled' do
+          et = Expectations::ExpectationTarget
+
+          configure_syntax :should
+          et.new(Proc.new {}).should be_an(et)
+          et.new(Proc.new {}).should_not be_a(Proc)
+        end
+
+        it 'does not add the deprecated #should to ExpectationTarget when only :expect is enabled' do
+          configure_syntax :expect
+          expect(expect(3)).not_to respond_to(:should)
+          expect(expect(3)).not_to respond_to(:should_not)
+        end
+
+        context 'when both :expect and :should are enabled' do
+          before { allow(RSpec).to receive(:deprecate) }
+
+          it 'allows `expect {}.should` to be used' do
+            configure_syntax [:should, :expect]
+            expect { raise "boom" }.should raise_error("boom")
+            expect { }.should_not raise_error
+          end
+
+          it 'prints a deprecation notice when `expect {}.should` is used' do
+            configure_syntax [:should, :expect]
+
+            expect(RSpec).to receive(:deprecate)
+            expect { raise "boom" }.should raise_error("boom")
+
+            expect(RSpec).to receive(:deprecate)
+            expect { }.should_not raise_error
+          end
+        end
+      end
+
+      describe "configuring rspec-expectations directly" do
+        it_behaves_like "configuring the expectation syntax" do
+          def configure_syntax(syntax)
+            RSpec::Matchers.configuration.syntax = syntax
+          end
+
+          def configured_syntax
+            RSpec::Matchers.configuration.syntax
+          end
+        end
+      end
+
+      describe "configuring using the rspec-core config API" do
+        it_behaves_like "configuring the expectation syntax" do
+          def configure_syntax(syntax)
+            RSpec.configure do |rspec|
+              rspec.expect_with :rspec do |c|
+                c.syntax = syntax
+              end
+            end
+          end
+
+          def configured_syntax
+            RSpec.configure do |rspec|
+              rspec.expect_with :rspec do |c|
+                return c.syntax
+              end
+            end
+          end
+        end
+      end
+
+      it 'enables both syntaxes by default' do
+        # This is kinda a hack, but since we want to enforce use of
+        # the expect syntax within our specs here, we have modified the
+        # config setting, which makes it hard to get at the original
+        # default value. in spec_helper.rb we store the default value
+        # in $default_expectation_syntax so we can use it here.
+        expect($default_expectation_syntax).to match_array([:expect, :should])
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/cover_spec.rb b/rspec-expectations/spec/rspec/matchers/cover_spec.rb
new file mode 100644
index 0000000..fd05a3b
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/cover_spec.rb
@@ -0,0 +1,69 @@
+require 'spec_helper'
+
+if (1..2).respond_to?(:cover?)
+  describe "expect(...).to cover(expected)" do
+    it_behaves_like "an RSpec matcher", :valid_value => (1..10), :invalid_value => (20..30) do
+      let(:matcher) { cover(5) }
+    end
+
+    context "for a range target" do
+      it "passes if target covers expected" do
+        expect((1..10)).to cover(5)
+      end
+
+      it "fails if target does not cover expected" do
+        expect {
+          expect((1..10)).to cover(11)
+        }.to fail_with("expected 1..10 to cover 11")
+      end
+    end
+  end
+
+  describe "expect(...).to cover(with, multiple, args)" do
+    context "for a range target" do
+      it "passes if target covers all items" do
+        expect((1..10)).to cover(4, 6)
+      end
+
+      it "fails if target does not cover any one of the items" do
+        expect {
+          expect((1..10)).to cover(4, 6, 11)
+        }.to fail_with("expected 1..10 to cover 4, 6, and 11")
+      end
+    end
+  end
+
+  describe "expect(...).not_to cover(expected)" do
+    context "for a range target" do
+      it "passes if target does not cover expected" do
+        expect((1..10)).not_to cover(11)
+      end
+
+      it "fails if target covers expected" do
+        expect {
+          expect((1..10)).not_to cover(5)
+        }.to fail_with("expected 1..10 not to cover 5")
+      end
+    end
+  end
+
+  describe "expect(...).not_to cover(with, multiple, args)" do
+    context "for a range target" do
+      it "passes if the target does not cover any of the expected" do
+        expect((1..10)).not_to cover(11, 12, 13)
+      end
+
+      it "fails if the target covers all of the expected" do
+        expect {
+          expect((1..10)).not_to cover(4, 6)
+        }.to fail_with("expected 1..10 not to cover 4 and 6")
+      end
+
+      it "fails if the target covers some (but not all) of the expected" do
+        expect {
+          expect((1..10)).not_to cover(5, 11)
+        }.to fail_with("expected 1..10 not to cover 5 and 11")
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/description_generation_spec.rb b/rspec-expectations/spec/rspec/matchers/description_generation_spec.rb
new file mode 100644
index 0000000..ff20a91
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/description_generation_spec.rb
@@ -0,0 +1,190 @@
+require 'spec_helper'
+
+describe "Matchers should be able to generate their own descriptions" do
+  after(:each) do
+    RSpec::Matchers.clear_generated_description
+  end
+
+  it "expect(...).to eq expected" do
+    expect("this").to eq "this"
+    expect(RSpec::Matchers.generated_description).to eq "should eq \"this\""
+  end
+
+  it "expect(...).to not eq expected" do
+    expect("this").not_to eq "that"
+    expect(RSpec::Matchers.generated_description).to eq "should not eq \"that\""
+  end
+
+  it "expect(...).to be empty (arbitrary predicate)" do
+    expect([]).to be_empty
+    expect(RSpec::Matchers.generated_description).to eq "should be empty"
+  end
+
+  it "expect(...).to not be empty (arbitrary predicate)" do
+    expect([1]).not_to be_empty
+    expect(RSpec::Matchers.generated_description).to eq "should not be empty"
+  end
+
+  it "expect(...).to be true" do
+    expect(true).to be_true
+    expect(RSpec::Matchers.generated_description).to eq "should be true"
+  end
+
+  it "expect(...).to be false" do
+    expect(false).to be_false
+    expect(RSpec::Matchers.generated_description).to eq "should be false"
+  end
+
+  it "expect(...).to be nil" do
+    expect(nil).to be_nil
+    expect(RSpec::Matchers.generated_description).to eq "should be nil"
+  end
+
+  it "expect(...).to be > n" do
+    expect(5).to be > 3
+    expect(RSpec::Matchers.generated_description).to eq "should be > 3"
+  end
+
+  it "expect(...).to be predicate arg1, arg2 and arg3" do
+    expect(5.0).to be_between(0,10)
+    expect(RSpec::Matchers.generated_description).to eq "should be between 0 and 10"
+  end
+
+  it "expect(...).to equal" do
+    expected = "expected"
+    expect(expected).to equal(expected)
+    expect(RSpec::Matchers.generated_description).to eq "should equal \"expected\""
+  end
+
+  it "expect(...).not_to equal" do
+    expect(5).not_to equal(37)
+    expect(RSpec::Matchers.generated_description).to eq "should not equal 37"
+  end
+
+  it "expect(...).to eql" do
+    expect("string").to eql("string")
+    expect(RSpec::Matchers.generated_description).to eq "should eql \"string\""
+  end
+
+  it "expect(...).not_to eql" do
+    expect("a").not_to eql(:a)
+    expect(RSpec::Matchers.generated_description).to eq "should not eql :a"
+  end
+
+  it "expect(...).to have_key" do
+    expect({:a => "a"}).to have_key(:a)
+    expect(RSpec::Matchers.generated_description).to eq "should have key :a"
+  end
+
+  it "expect(...).to have_some_method" do
+    object = Object.new
+    def object.has_eyes_closed?; true; end
+
+    expect(object).to have_eyes_closed
+    expect(RSpec::Matchers.generated_description).to eq 'should have eyes closed'
+  end
+
+  it "expect(...).to have_some_method(args*)" do
+    object = Object.new
+    def object.has_taste_for?(*args); true; end
+
+    expect(object).to have_taste_for("wine", "cheese")
+    expect(RSpec::Matchers.generated_description).to eq 'should have taste for "wine", "cheese"'
+  end
+
+  it "expect(...).to have n items" do
+    expect(team).to have(3).players
+    expect(RSpec::Matchers.generated_description).to eq "should have 3 players"
+  end
+
+  it "expect(...).to have at least n items" do
+    expect(team).to have_at_least(2).players
+    expect(RSpec::Matchers.generated_description).to eq "should have at least 2 players"
+  end
+
+  it "expect(...).to have at most n items" do
+    expect(team).to have_at_most(4).players
+    expect(RSpec::Matchers.generated_description).to eq "should have at most 4 players"
+  end
+
+  it "expect(...).to include(x)" do
+    expect([1,2,3]).to include(3)
+    expect(RSpec::Matchers.generated_description).to eq "should include 3"
+  end
+
+  it "expect(...).to include(x) when x responds to description but is not a matcher" do
+    obj = double(:description => "description", :inspect => "inspect")
+    expect([obj]).to include(obj)
+    expect(RSpec::Matchers.generated_description).to eq "should include inspect"
+  end
+
+  it "expect(...).to include(x) when x responds to description and is a matcher" do
+    matcher = double(:description                => "description",
+                     :matches?                   => true,
+                     :failure_message_for_should => "")
+    expect([matcher]).to include(matcher)
+    expect(RSpec::Matchers.generated_description).to eq "should include description"
+  end
+
+  it "expect(array).not_to match_array [1,2,3]" do
+    expect([1,2,3]).to match_array [1,2,3]
+    expect(RSpec::Matchers.generated_description).to eq "should contain exactly 1, 2 and 3"
+  end
+
+  it "expect(...).to match" do
+    expect("this string").to match(/this string/)
+    expect(RSpec::Matchers.generated_description).to eq "should match /this string/"
+  end
+
+  it "expect(...).to raise_error" do
+    expect { raise }.to raise_error
+    expect(RSpec::Matchers.generated_description).to eq "should raise Exception"
+  end
+
+  it "expect(...).to raise_error with type" do
+    expect { raise }.to raise_error(RuntimeError)
+    expect(RSpec::Matchers.generated_description).to eq "should raise RuntimeError"
+  end
+
+  it "expect(...).to raise_error with type and message" do
+    expect { raise "there was an error" }.to raise_error(RuntimeError, "there was an error")
+    expect(RSpec::Matchers.generated_description).to eq "should raise RuntimeError with \"there was an error\""
+  end
+
+  it "expect(...).to respond_to" do
+    expect([]).to respond_to(:insert)
+    expect(RSpec::Matchers.generated_description).to eq "should respond to #insert"
+  end
+
+  it "expect(...).to throw symbol" do
+    expect { throw :what_a_mess }.to throw_symbol
+    expect(RSpec::Matchers.generated_description).to eq "should throw a Symbol"
+  end
+
+  it "expect(...).to throw symbol (with named symbol)" do
+    expect { throw :what_a_mess }.to throw_symbol(:what_a_mess)
+    expect(RSpec::Matchers.generated_description).to eq "should throw :what_a_mess"
+  end
+
+  def team
+    Class.new do
+      def players
+        [1,2,3]
+      end
+    end.new
+  end
+end
+
+describe "a Matcher with no description" do
+  def matcher
+     Class.new do
+       def matches?(ignore); true; end
+       def failure_message; ""; end
+     end.new
+  end
+
+  it "provides a helpful message when used in a string-less example block" do
+    expect(5).to matcher
+    expect(RSpec::Matchers.generated_description).to match(/When you call.*description method/m)
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/dsl_spec.rb b/rspec-expectations/spec/rspec/matchers/dsl_spec.rb
new file mode 100644
index 0000000..02482ff
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/dsl_spec.rb
@@ -0,0 +1,57 @@
+require 'spec_helper'
+
+describe "a matcher defined using the matcher DSL" do
+  def question?
+    :answer
+  end
+
+  def ok
+    "ok"
+  end
+
+  it "supports calling custom matchers from within other custom matchers" do
+    RSpec::Matchers.define :be_ok do
+      match { |actual| actual == ok }
+    end
+
+    RSpec::Matchers.define :be_well do
+      match { |actual| expect(actual).to be_ok }
+    end
+
+    expect(ok).to be_well
+  end
+
+  it "has access to methods available in the scope of the example" do
+    RSpec::Matchers::define(:matcher_a) {}
+    expect(matcher_a.question?).to eq(:answer)
+  end
+
+  it "raises when method is missing from local scope as well as matcher" do
+    RSpec::Matchers::define(:matcher_b) {}
+    expect { matcher_b.i_dont_exist }.to raise_error(NameError)
+  end
+
+  it "clears user instance variables between invocations" do
+    RSpec::Matchers::define(:be_just_like) do |expected|
+      match do |actual|
+        @foo ||= expected
+        @foo == actual
+      end
+    end
+
+    expect(3).to be_just_like(3)
+    expect(4).to be_just_like(4)
+  end
+
+  describe "#respond_to?" do
+    it "returns true for methods in example scope" do
+      RSpec::Matchers::define(:matcher_c) {}
+      expect(matcher_c).to respond_to(:question?)
+    end
+
+    it "returns false for methods not defined in matcher or example scope" do
+      RSpec::Matchers::define(:matcher_d) {}
+      expect(matcher_d).not_to respond_to(:i_dont_exist)
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/eq_spec.rb b/rspec-expectations/spec/rspec/matchers/eq_spec.rb
new file mode 100644
index 0000000..445519f
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/eq_spec.rb
@@ -0,0 +1,60 @@
+require 'spec_helper'
+
+module RSpec
+  module Matchers
+    describe "eq" do
+      it_behaves_like "an RSpec matcher", :valid_value => 1, :invalid_value => 2 do
+        let(:matcher) { eq(1) }
+      end
+
+      it "is diffable" do
+        expect(eq(1)).to be_diffable
+      end
+
+      it "matches when actual == expected" do
+        expect(1).to eq(1)
+      end
+
+      it "does not match when actual != expected" do
+        expect(1).not_to eq(2)
+      end
+
+      it "compares by sending == to actual (not expected)" do
+        called = false
+        actual = Class.new do
+          define_method :== do |other|
+            called = true
+          end
+        end.new
+
+        expect(actual).to eq :anything # to trigger the matches? method
+        expect(called).to be_true
+      end
+
+      it "describes itself" do
+        matcher = eq(1)
+        matcher.matches?(1)
+        expect(matcher.description).to eq "eq 1"
+      end
+
+      it "provides message, expected and actual on #failure_message" do
+        matcher = eq("1")
+        matcher.matches?(1)
+        expect(matcher.failure_message_for_should).to eq "\nexpected: \"1\"\n     got: 1\n\n(compared using ==)\n"
+      end
+
+      it "provides message, expected and actual on #negative_failure_message" do
+        matcher = eq(1)
+        matcher.matches?(1)
+        expect(matcher.failure_message_for_should_not).to eq "\nexpected: value != 1\n     got: 1\n\n(compared using ==)\n"
+      end
+
+      it 'fails properly when the actual is an array of multiline strings' do
+        expect {
+          expect(["a\nb", "c\nd"]).to eq([])
+        }.to fail_matching("expected: []")
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/eql_spec.rb b/rspec-expectations/spec/rspec/matchers/eql_spec.rb
new file mode 100644
index 0000000..156effe
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/eql_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+module RSpec
+  module Matchers
+    describe "eql" do
+      it_behaves_like "an RSpec matcher", :valid_value => 1, :invalid_value => 2 do
+        let(:matcher) { eql(1) }
+      end
+
+      it "is diffable" do
+        expect(eql(1)).to be_diffable
+      end
+
+      it "matches when actual.eql?(expected)" do
+        expect(1).to eql(1)
+      end
+
+      it "does not match when !actual.eql?(expected)" do
+        expect(1).not_to eql(2)
+      end
+
+      it "describes itself" do
+        matcher = eql(1)
+        matcher.matches?(1)
+        expect(matcher.description).to eq "eql 1"
+      end
+
+      it "provides message, expected and actual on #failure_message" do
+        matcher = eql("1")
+        matcher.matches?(1)
+        expect(matcher.failure_message_for_should).to eq "\nexpected: \"1\"\n     got: 1\n\n(compared using eql?)\n"
+      end
+
+      it "provides message, expected and actual on #negative_failure_message" do
+        matcher = eql(1)
+        matcher.matches?(1)
+        expect(matcher.failure_message_for_should_not).to eq "\nexpected: value != 1\n     got: 1\n\n(compared using eql?)\n"
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/equal_spec.rb b/rspec-expectations/spec/rspec/matchers/equal_spec.rb
new file mode 100644
index 0000000..514df66
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/equal_spec.rb
@@ -0,0 +1,78 @@
+require 'spec_helper'
+module RSpec
+  module Matchers
+    describe "equal" do
+      it_behaves_like "an RSpec matcher", :valid_value => :a, :invalid_value => :b do
+        let(:matcher) { equal(:a) }
+      end
+
+      def inspect_object(o)
+        "#<#{o.class}:#{o.object_id}> => #{o.inspect}"
+      end
+
+      it "matches when actual.equal?(expected)" do
+        expect(1).to equal(1)
+      end
+
+      it "does not match when !actual.equal?(expected)" do
+        expect("1").not_to equal("1")
+      end
+
+      it "describes itself" do
+        matcher = equal(1)
+        matcher.matches?(1)
+        expect(matcher.description).to eq "equal 1"
+      end
+
+      it "suggests the `eq` matcher on failure" do
+        expected, actual = "1", "1"
+        expect {
+          expect(actual).to equal(expected)
+        }.to fail_with <<-MESSAGE
+
+expected #{inspect_object(expected)}
+     got #{inspect_object(actual)}
+
+Compared using equal?, which compares object identity,
+but expected and actual are not the same object. Use
+`expect(actual).to eq(expected)` if you don't care about
+object identity in this example.
+
+MESSAGE
+      end
+
+      context "when using only `should`", :uses_only_should do
+        it "suggests the `eq` matcher on failure" do
+          expected, actual = "1", "1"
+          lambda {
+            actual.should equal(expected)
+          }.should fail_with <<-MESSAGE
+
+expected #{inspect_object(expected)}
+     got #{inspect_object(actual)}
+
+Compared using equal?, which compares object identity,
+but expected and actual are not the same object. Use
+`actual.should eq(expected)` if you don't care about
+object identity in this example.
+
+MESSAGE
+        end
+      end
+
+      it "provides message on #negative_failure_message" do
+        expected = actual = "1"
+        matcher = equal(expected)
+        matcher.matches?(actual)
+        expect(matcher.failure_message_for_should_not).to eq <<-MESSAGE
+
+expected not #{inspect_object(expected)}
+         got #{inspect_object(actual)}
+
+Compared using equal?, which compares object identity.
+
+MESSAGE
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/exist_spec.rb b/rspec-expectations/spec/rspec/matchers/exist_spec.rb
new file mode 100644
index 0000000..28d76c3
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/exist_spec.rb
@@ -0,0 +1,124 @@
+require 'spec_helper'
+require 'ostruct'
+
+describe "exist matcher" do
+  it_behaves_like "an RSpec matcher", :valid_value => OpenStruct.new(:exist? => true),
+                                      :invalid_value => OpenStruct.new(:exist? => false) do
+    let(:matcher) { exist }
+  end
+
+  context "when the object does not respond to #exist? or #exists?" do
+    subject { double }
+
+    [:to, :not_to].each do |expect_method|
+      describe "expect(...).#{expect_method} exist" do
+        it "raises an error" do
+          expect {
+            expect(subject).send(expect_method, exist)
+          }.to raise_error(NoMethodError)
+        end
+      end
+    end
+  end
+
+  [:exist?, :exists?].each do |predicate|
+    context "when the object responds to ##{predicate}" do
+      describe "expect(...).to exist" do
+        it "passes if #{predicate}" do
+          expect(double(predicate => true)).to exist
+        end
+
+        it "fails if not #{predicate}" do
+          expect {
+            expect(double(predicate => false)).to exist
+          }.to fail_with(/expected .* to exist/)
+        end
+
+        it 'works when the object overrides `send`' do
+          klass = Struct.new(:message) do
+            def send
+              :message_sent
+            end
+
+            define_method predicate do
+              true
+            end
+          end
+
+          expect(klass.new("msg")).to exist
+        end
+      end
+
+      describe "expect(...).not_to exist" do
+        it "passes if not #{predicate}" do
+          expect(double(predicate => false)).not_to exist
+        end
+
+        it "fails if #{predicate}" do
+          expect {
+            expect(double(predicate => true)).not_to exist
+          }.to fail_with(/expected .* not to exist/)
+        end
+      end
+    end
+  end
+
+  context "when the object responds to #exist? and #exists?" do
+    context "when they both return falsey values" do
+      subject { double(:exist? => false, :exists? => nil) }
+
+      describe "expect(...).not_to exist" do
+        it "passes" do
+          expect(subject).not_to exist
+        end
+      end
+
+      describe "expect(...).to exist" do
+        it "fails" do
+          expect {
+            expect(subject).to exist
+          }.to fail_with(/expected .* to exist/)
+        end
+      end
+    end
+
+    context "when they both return truthy values" do
+      subject { double(:exist? => true, :exists? => "something true") }
+
+      describe "expect(...).not_to exist" do
+        it "fails" do
+          expect {
+            expect(subject).not_to exist
+          }.to fail_with(/expected .* not to exist/)
+        end
+      end
+
+      describe "expect(...).to exist" do
+        it "passes" do
+          expect(subject).to exist
+        end
+      end
+    end
+
+    context "when they return values with different truthiness" do
+      subject { double(:exist? => true, :exists? => false) }
+
+      [:to, :not_to].each do |expect_method|
+        describe "expect(...).#{expect_method} exist" do
+          it "raises an error" do
+            expect {
+              expect(subject).send(expect_method, exist)
+            }.to raise_error(/#exist\? and #exists\? returned different values/)
+          end
+        end
+      end
+    end
+  end
+
+  it 'passes any provided arguments to the call to #exist?' do
+    object = double
+    object.should_receive(:exist?).with(:foo, :bar) { true }
+
+    expect(object).to exist(:foo, :bar)
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/has_spec.rb b/rspec-expectations/spec/rspec/matchers/has_spec.rb
new file mode 100644
index 0000000..15fc91d
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/has_spec.rb
@@ -0,0 +1,122 @@
+require 'spec_helper'
+
+describe "expect(...).to have_sym(*args)" do
+  it_behaves_like "an RSpec matcher", :valid_value => { :a => 1 },
+                                      :invalid_value => {} do
+    let(:matcher) { have_key(:a) }
+  end
+
+  it "passes if #has_sym?(*args) returns true" do
+    expect({:a => "A"}).to have_key(:a)
+  end
+
+  it "fails if #has_sym?(*args) returns false" do
+    expect {
+      expect({:b => "B"}).to have_key(:a)
+    }.to fail_with("expected #has_key?(:a) to return true, got false")
+  end
+
+  it 'does not include any args in the failure message if no args were given to the matcher' do
+    o = Object.new
+    def o.has_some_stuff?; false; end
+    expect {
+      expect(o).to have_some_stuff
+    }.to fail_with("expected #has_some_stuff? to return true, got false")
+  end
+
+  it 'includes multiple args in the failure message if multiple args were given to the matcher' do
+    o = Object.new
+    def o.has_some_stuff?(*_); false; end
+    expect {
+      expect(o).to have_some_stuff(:a, 7, "foo")
+    }.to fail_with('expected #has_some_stuff?(:a, 7, "foo") to return true, got false')
+  end
+
+  it "fails if #has_sym?(*args) returns nil" do
+    klass = Class.new do
+      def has_foo?
+      end
+    end
+    expect {
+      expect(klass.new).to have_foo
+    }.to fail_with(/expected #has_foo.* to return true, got false/)
+  end
+
+  it "fails if target does not respond to #has_sym?" do
+    expect {
+      expect(Object.new).to have_key(:a)
+    }.to raise_error(NoMethodError)
+  end
+
+  it "reraises an exception thrown in #has_sym?(*args)" do
+    o = Object.new
+    def o.has_sym?(*args)
+      raise "Funky exception"
+    end
+    expect {
+      expect(o).to have_sym(:foo)
+    }.to raise_error("Funky exception")
+  end
+end
+
+describe "expect(...).not_to have_sym(*args)" do
+  it "passes if #has_sym?(*args) returns false" do
+    expect({:a => "A"}).not_to have_key(:b)
+  end
+
+  it "passes if #has_sym?(*args) returns nil" do
+    klass = Class.new do
+      def has_foo?
+      end
+    end
+    expect(klass.new).not_to have_foo
+  end
+
+  it "fails if #has_sym?(*args) returns true" do
+    expect {
+      expect({:a => "A"}).not_to have_key(:a)
+    }.to fail_with("expected #has_key?(:a) to return false, got true")
+  end
+
+  it "fails if target does not respond to #has_sym?" do
+    expect {
+      expect(Object.new).to have_key(:a)
+    }.to raise_error(NoMethodError)
+  end
+
+  it "reraises an exception thrown in #has_sym?(*args)" do
+    o = Object.new
+    def o.has_sym?(*args)
+      raise "Funky exception"
+    end
+    expect {
+      expect(o).not_to have_sym(:foo)
+    }.to raise_error("Funky exception")
+  end
+
+  it 'does not include any args in the failure message if no args were given to the matcher' do
+    o = Object.new
+    def o.has_some_stuff?; true; end
+    expect {
+      expect(o).not_to have_some_stuff
+    }.to fail_with("expected #has_some_stuff? to return false, got true")
+  end
+
+  it 'includes multiple args in the failure message if multiple args were given to the matcher' do
+    o = Object.new
+    def o.has_some_stuff?(*_); true; end
+    expect {
+      expect(o).not_to have_some_stuff(:a, 7, "foo")
+    }.to fail_with('expected #has_some_stuff?(:a, 7, "foo") to return false, got true')
+  end
+end
+
+describe "has" do
+  it "works when the target implements #send" do
+    o = {:a => "A"}
+    def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
+    expect {
+      expect(o).to have_key(:a)
+    }.not_to raise_error
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/have_spec.rb b/rspec-expectations/spec/rspec/matchers/have_spec.rb
new file mode 100644
index 0000000..98945f8
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/have_spec.rb
@@ -0,0 +1,455 @@
+require 'spec_helper'
+require 'stringio'
+
+describe "have matcher" do
+  let(:inflector) do
+    Class.new do
+      def self.pluralize(string)
+        string.to_s + 's'
+      end
+    end
+  end
+
+  before(:each) { stub_const("ActiveSupport::Inflector", inflector) }
+
+  def create_collection_owner_with(n)
+    owner = RSpec::Expectations::Helper::CollectionOwner.new
+    (1..n).each do |number|
+      owner.add_to_collection_with_length_method(number)
+      owner.add_to_collection_with_size_method(number)
+      owner.add_to_collection_with_count_method(number)
+    end
+    owner
+  end
+
+  describe "expect(...).to have(n).items" do
+    it_behaves_like "an RSpec matcher", :valid_value => [1, 2], :invalid_value => [1] do
+      let(:matcher) { have(2).items }
+    end
+
+    it "passes if target has a collection of items with n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).to have(3).items_in_collection_with_length_method
+      expect(owner).to have(3).items_in_collection_with_size_method
+      expect(owner).to have(3).items_in_collection_with_count_method
+    end
+
+    it "converts :no to 0" do
+      owner = create_collection_owner_with(0)
+      expect(owner).to have(:no).items_in_collection_with_length_method
+      expect(owner).to have(:no).items_in_collection_with_size_method
+      expect(owner).to have(:no).items_in_collection_with_count_method
+    end
+
+    it "converts a String argument to Integer" do
+      owner = create_collection_owner_with(3)
+      expect(owner).to have('3').items_in_collection_with_length_method
+      expect(owner).to have('3').items_in_collection_with_size_method
+      expect(owner).to have('3').items_in_collection_with_count_method
+    end
+
+    it "fails if target has a collection of items with < n members" do
+      owner = create_collection_owner_with(3)
+      expect {
+        expect(owner).to have(4).items_in_collection_with_length_method
+      }.to fail_with("expected 4 items_in_collection_with_length_method, got 3")
+      expect {
+        expect(owner).to have(4).items_in_collection_with_size_method
+      }.to fail_with("expected 4 items_in_collection_with_size_method, got 3")
+      expect {
+        expect(owner).to have(4).items_in_collection_with_count_method
+      }.to fail_with("expected 4 items_in_collection_with_count_method, got 3")
+    end
+
+    it "fails if target has a collection of items with > n members" do
+      owner = create_collection_owner_with(3)
+      expect {
+        expect(owner).to have(2).items_in_collection_with_length_method
+      }.to fail_with("expected 2 items_in_collection_with_length_method, got 3")
+      expect {
+        expect(owner).to have(2).items_in_collection_with_size_method
+      }.to fail_with("expected 2 items_in_collection_with_size_method, got 3")
+      expect {
+        expect(owner).to have(2).items_in_collection_with_count_method
+      }.to fail_with("expected 2 items_in_collection_with_count_method, got 3")
+    end
+  end
+
+  describe 'expect(...).to have(1).item when ActiveSupport::Inflector is defined' do
+
+    it 'pluralizes the collection name' do
+      owner = create_collection_owner_with(1)
+      expect(owner).to have(1).item
+    end
+
+    context "when ActiveSupport::Inflector is partially loaded without its inflectors" do
+
+      it "does not pluralize the collection name" do
+        stub_const("ActiveSupport::Inflector", Module.new)
+        owner = create_collection_owner_with(1)
+        expect {
+          expect(owner).to have(1).item
+        }.to raise_error(NoMethodError)
+      end
+
+    end
+  end
+
+  describe 'expect(...).to have(1).item when Inflector is defined' do
+    before { stub_const("Inflector", inflector) }
+
+    it 'pluralizes the collection name' do
+      owner = create_collection_owner_with(1)
+      expect(owner).to have(1).item
+    end
+  end
+
+  describe "expect(...).to have(n).items where result responds to items but returns something other than a collection" do
+    it "provides a meaningful error" do
+      owner = Class.new do
+        def items
+          Object.new
+        end
+      end.new
+      expect do
+        expect(owner).to have(3).items
+      end.to raise_error("expected items to be a collection but it does not respond to #length, #size or #count")
+    end
+  end
+
+  describe "expect(...).not_to have(n).items" do
+
+    it "passes if target has a collection of items with < n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).not_to have(4).items_in_collection_with_length_method
+      expect(owner).not_to have(4).items_in_collection_with_size_method
+      expect(owner).not_to have(4).items_in_collection_with_count_method
+    end
+
+    it "passes if target has a collection of items with > n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).not_to have(2).items_in_collection_with_length_method
+      expect(owner).not_to have(2).items_in_collection_with_size_method
+      expect(owner).not_to have(2).items_in_collection_with_count_method
+    end
+
+    it "fails if target has a collection of items with n members" do
+      owner = create_collection_owner_with(3)
+      expect {
+        expect(owner).not_to have(3).items_in_collection_with_length_method
+      }.to fail_with("expected target not to have 3 items_in_collection_with_length_method, got 3")
+      expect {
+        expect(owner).not_to have(3).items_in_collection_with_size_method
+      }.to fail_with("expected target not to have 3 items_in_collection_with_size_method, got 3")
+      expect {
+        expect(owner).not_to have(3).items_in_collection_with_count_method
+      }.to fail_with("expected target not to have 3 items_in_collection_with_count_method, got 3")
+    end
+  end
+
+  describe "expect(...).to have_exactly(n).items" do
+
+    it "passes if target has a collection of items with n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).to have_exactly(3).items_in_collection_with_length_method
+      expect(owner).to have_exactly(3).items_in_collection_with_size_method
+      expect(owner).to have_exactly(3).items_in_collection_with_count_method
+    end
+
+    it "converts :no to 0" do
+      owner = create_collection_owner_with(0)
+      expect(owner).to have_exactly(:no).items_in_collection_with_length_method
+      expect(owner).to have_exactly(:no).items_in_collection_with_size_method
+      expect(owner).to have_exactly(:no).items_in_collection_with_count_method
+    end
+
+    it "fails if target has a collection of items with < n members" do
+      owner = create_collection_owner_with(3)
+      expect {
+        expect(owner).to have_exactly(4).items_in_collection_with_length_method
+      }.to fail_with("expected 4 items_in_collection_with_length_method, got 3")
+      expect {
+        expect(owner).to have_exactly(4).items_in_collection_with_size_method
+      }.to fail_with("expected 4 items_in_collection_with_size_method, got 3")
+      expect {
+        expect(owner).to have_exactly(4).items_in_collection_with_count_method
+      }.to fail_with("expected 4 items_in_collection_with_count_method, got 3")
+    end
+
+    it "fails if target has a collection of items with > n members" do
+      owner = create_collection_owner_with(3)
+      expect {
+        expect(owner).to have_exactly(2).items_in_collection_with_length_method
+      }.to fail_with("expected 2 items_in_collection_with_length_method, got 3")
+      expect {
+        expect(owner).to have_exactly(2).items_in_collection_with_size_method
+      }.to fail_with("expected 2 items_in_collection_with_size_method, got 3")
+      expect {
+        expect(owner).to have_exactly(2).items_in_collection_with_count_method
+      }.to fail_with("expected 2 items_in_collection_with_count_method, got 3")
+    end
+  end
+
+  describe "expect(...).to have_at_least(n).items" do
+
+    it "passes if target has a collection of items with n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).to have_at_least(3).items_in_collection_with_length_method
+      expect(owner).to have_at_least(3).items_in_collection_with_size_method
+      expect(owner).to have_at_least(3).items_in_collection_with_count_method
+    end
+
+    it "passes if target has a collection of items with > n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).to have_at_least(2).items_in_collection_with_length_method
+      expect(owner).to have_at_least(2).items_in_collection_with_size_method
+      expect(owner).to have_at_least(2).items_in_collection_with_count_method
+    end
+
+    it "fails if target has a collection of items with < n members" do
+      owner = create_collection_owner_with(3)
+      expect {
+        expect(owner).to have_at_least(4).items_in_collection_with_length_method
+      }.to fail_with("expected at least 4 items_in_collection_with_length_method, got 3")
+      expect {
+        expect(owner).to have_at_least(4).items_in_collection_with_size_method
+      }.to fail_with("expected at least 4 items_in_collection_with_size_method, got 3")
+      expect {
+        expect(owner).to have_at_least(4).items_in_collection_with_count_method
+      }.to fail_with("expected at least 4 items_in_collection_with_count_method, got 3")
+    end
+
+    it "provides educational negative failure messages" do
+      #given
+      owner = create_collection_owner_with(3)
+      length_matcher = have_at_least(3).items_in_collection_with_length_method
+      size_matcher = have_at_least(3).items_in_collection_with_size_method
+      count_matcher = have_at_least(3).items_in_collection_with_count_method
+
+      #when
+      length_matcher.matches?(owner)
+      size_matcher.matches?(owner)
+      count_matcher.matches?(owner)
+
+      #then
+      expect(length_matcher.failure_message_for_should_not).to eq <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  expect(actual).not_to have_at_least(3).items_in_collection_with_length_method
+We recommend that you use this instead:
+  expect(actual).to have_at_most(2).items_in_collection_with_length_method
+EOF
+
+      expect(size_matcher.failure_message_for_should_not).to eq <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  expect(actual).not_to have_at_least(3).items_in_collection_with_size_method
+We recommend that you use this instead:
+  expect(actual).to have_at_most(2).items_in_collection_with_size_method
+EOF
+      expect(count_matcher.failure_message_for_should_not).to eq <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  expect(actual).not_to have_at_least(3).items_in_collection_with_count_method
+We recommend that you use this instead:
+  expect(actual).to have_at_most(2).items_in_collection_with_count_method
+EOF
+    end
+  end
+
+  describe "expect(...).to have_at_most(n).items" do
+    it "passes if target has a collection of items with n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).to have_at_most(3).items_in_collection_with_length_method
+      expect(owner).to have_at_most(3).items_in_collection_with_size_method
+      expect(owner).to have_at_most(3).items_in_collection_with_count_method
+    end
+
+    it "fails if target has a collection of items with > n members" do
+      owner = create_collection_owner_with(3)
+      expect {
+        expect(owner).to have_at_most(2).items_in_collection_with_length_method
+      }.to fail_with("expected at most 2 items_in_collection_with_length_method, got 3")
+      expect {
+        expect(owner).to have_at_most(2).items_in_collection_with_size_method
+      }.to fail_with("expected at most 2 items_in_collection_with_size_method, got 3")
+      expect {
+        expect(owner).to have_at_most(2).items_in_collection_with_count_method
+      }.to fail_with("expected at most 2 items_in_collection_with_count_method, got 3")
+    end
+
+    it "passes if target has a collection of items with < n members" do
+      owner = create_collection_owner_with(3)
+      expect(owner).to have_at_most(4).items_in_collection_with_length_method
+      expect(owner).to have_at_most(4).items_in_collection_with_size_method
+      expect(owner).to have_at_most(4).items_in_collection_with_count_method
+    end
+
+    it "provides educational negative failure messages" do
+      #given
+      owner = create_collection_owner_with(3)
+      length_matcher = have_at_most(3).items_in_collection_with_length_method
+      size_matcher = have_at_most(3).items_in_collection_with_size_method
+      count_matcher = have_at_most(3).items_in_collection_with_count_method
+
+      #when
+      length_matcher.matches?(owner)
+      size_matcher.matches?(owner)
+      count_matcher.matches?(owner)
+
+      #then
+      expect(length_matcher.failure_message_for_should_not).to eq <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  expect(actual).not_to have_at_most(3).items_in_collection_with_length_method
+We recommend that you use this instead:
+  expect(actual).to have_at_least(4).items_in_collection_with_length_method
+EOF
+
+      expect(size_matcher.failure_message_for_should_not).to eq <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  expect(actual).not_to have_at_most(3).items_in_collection_with_size_method
+We recommend that you use this instead:
+  expect(actual).to have_at_least(4).items_in_collection_with_size_method
+EOF
+
+      expect(count_matcher.failure_message_for_should_not).to eq <<-EOF
+Isn't life confusing enough?
+Instead of having to figure out the meaning of this:
+  expect(actual).not_to have_at_most(3).items_in_collection_with_count_method
+We recommend that you use this instead:
+  expect(actual).to have_at_least(4).items_in_collection_with_count_method
+EOF
+    end
+  end
+
+  describe "have(n).items(args, block)" do
+    it "passes args to target" do
+      target = double("target")
+      target.should_receive(:items).with("arg1","arg2").and_return([1,2,3])
+      expect(target).to have(3).items("arg1","arg2")
+    end
+
+    it "passes block to target" do
+      target = double("target")
+      block = lambda { 5 }
+      target.should_receive(:items).with("arg1","arg2", block).and_return([1,2,3])
+      expect(target).to have(3).items("arg1","arg2", block)
+    end
+  end
+
+  describe "have(n).items where target IS a collection" do
+    it "references the number of items IN the collection" do
+      expect([1,2,3]).to have(3).items
+    end
+
+    it "fails when the number of items IN the collection is not as expected" do
+      expect {
+        expect([1,2,3]).to have(7).items
+      }.to fail_with("expected 7 items, got 3")
+    end
+  end
+
+  describe "have(n).characters where target IS a String" do
+    it "passes if the length is correct" do
+      expect("this string").to have(11).characters
+    end
+
+    it "fails if the length is incorrect" do
+      expect {
+        expect("this string").to have(12).characters
+      }.to fail_with("expected 12 characters, got 11")
+    end
+  end
+
+  describe "have(n).things on an object which is not a collection nor contains one" do
+    it "fails" do
+      expect {
+        expect(Object.new).to have(2).things
+      }.to raise_error(NoMethodError) { |e|
+        expect(e.name).to eq :things
+      }
+    end
+  end
+
+  describe RSpec::Matchers::BuiltIn::Have, "for a collection owner that implements #send" do
+    before(:each) do
+      @collection = Object.new
+      def @collection.floozles; [1,2] end
+      def @collection.send; :sent; end
+    end
+
+    it "works in the straightforward case" do
+      expect(@collection).to have(2).floozles
+    end
+
+    it "works when doing automatic pluralization" do
+      expect(@collection).to have_at_least(1).floozle
+    end
+
+    it "blows up when the owner doesn't respond to that method" do
+      expect {
+        expect(@collection).to have(99).problems
+      }.to raise_error(NoMethodError, /problems/)
+    end
+
+    it 'works when #send is defined directly on an array' do
+      array = [1, 2]
+      def array.send; :sent; end
+
+      expect(array).to have(2).items
+    end
+  end
+
+  if RUBY_VERSION >= '2.0'
+    describe RSpec::Matchers::BuiltIn::Have, "for an Enumerator whose size is nil but count is supplied" do
+      let(:enumerator) { %w[a b c d].to_enum(:each) }
+
+      it 'works fine' do
+        expect(enumerator).to have(4).items
+      end
+    end
+  end
+
+  describe RSpec::Matchers::BuiltIn::Have do
+    it "has method_missing as private" do
+      expect(described_class.private_instance_methods).to include_method(:method_missing)
+    end
+
+    it "does not respond_to? method_missing (because it's private)" do
+      formatter = described_class.new(0, StringIO.new)
+      expect(formatter).not_to respond_to(:method_missing)
+    end
+
+    describe "respond_to?" do
+      before :each do
+        @have = described_class.new(:foo)
+        @a_method_which_have_defines = described_class.instance_methods.first
+        @a_method_which_object_defines = Object.instance_methods.first
+      end
+
+      it "is true for a method which Have defines" do
+        expect(@have).to respond_to(@a_method_which_have_defines)
+      end
+
+      it "is true for a method that it's superclass (Object) defines" do
+        expect(@have).to respond_to(@a_method_which_object_defines)
+      end
+
+      it "is false for a method which neither Object nor nor Have defines" do
+        expect(@have).not_to respond_to(:foo_bar_baz)
+      end
+
+      it "is false if the owner doesn't respond to the method" do
+        have = described_class.new(99)
+        expect(have).not_to respond_to(:problems)
+      end
+
+      it "is true if the owner responds to the method" do
+        have = described_class.new(:a_symbol)
+        expect(have).to respond_to(:to_sym)
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/include_matcher_integration_spec.rb b/rspec-expectations/spec/rspec/matchers/include_matcher_integration_spec.rb
new file mode 100644
index 0000000..955f36e
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/include_matcher_integration_spec.rb
@@ -0,0 +1,30 @@
+require 'spec_helper'
+
+module RSpec
+  module Matchers
+    describe "include() interaction with built-in matchers" do
+      it "works with be_within(delta).of(expected)" do
+        expect([10, 20, 30]).to include( be_within(5).of(24) )
+        expect([10, 20, 30]).not_to include( be_within(3).of(24) )
+      end
+
+      it "works with be_instance_of(klass)" do
+        expect(["foo", 123, {:foo => "bar"}]).to include( be_instance_of(Hash) )
+        expect(["foo", 123, {:foo => "bar"}]).not_to include( be_instance_of(Range) )
+      end
+
+      it "works with be_kind_of(klass)" do
+        class StringSubclass < String; end
+        class NotHashSubclass; end
+
+        expect([StringSubclass.new("baz")]).to include( be_kind_of(String) )
+        expect([NotHashSubclass.new]).not_to include( be_kind_of(Hash) )
+      end
+
+      it "works with be_[some predicate]" do
+        expect([double("actual", :happy? => true)]).to include( be_happy )
+        expect([double("actual", :happy? => false)]).not_to include( be_happy )
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/include_spec.rb b/rspec-expectations/spec/rspec/matchers/include_spec.rb
new file mode 100644
index 0000000..a3c9ab4
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/include_spec.rb
@@ -0,0 +1,531 @@
+require 'spec_helper'
+require 'uri'
+
+describe "#include matcher" do
+  it "is diffable" do
+    expect(include("a")).to be_diffable
+  end
+
+  describe "expect(...).to include(with_one_arg)" do
+    it_behaves_like "an RSpec matcher", :valid_value => [1, 2], :invalid_value => [1] do
+      let(:matcher) { include(2) }
+    end
+
+    context "for a string target" do
+      it "passes if target includes expected" do
+        expect("abc").to include("a")
+      end
+
+      it "fails if target does not include expected" do
+        expect {
+          expect("abc").to include("d")
+        }.to fail_matching("expected \"abc\" to include \"d\"")
+      end
+
+      it "includes a diff when actual is multiline" do
+        expect {
+          expect("abc\ndef").to include("g")
+        }.to fail_matching("expected \"abc\\ndef\" to include \"g\"\nDiff")
+      end
+
+      it "includes a diff when actual is multiline and there are multiple expecteds" do
+        expect {
+          expect("abc\ndef").to include("g", "h")
+        }.to fail_matching("expected \"abc\\ndef\" to include \"g\" and \"h\"\nDiff")
+      end
+    end
+
+    context "for an array target" do
+      it "passes if target includes expected" do
+        expect([1,2,3]).to include(3)
+      end
+
+      it "fails if target does not include expected" do
+        expect {
+          expect([1,2,3]).to include(4)
+        }.to fail_matching("expected [1, 2, 3] to include 4")
+      end
+
+      it 'fails when given differing null doubles' do
+        dbl_1 = double.as_null_object
+        dbl_2 = double.as_null_object
+
+        expect {
+          expect([dbl_1]).to include(dbl_2)
+        }.to fail_matching("expected [#{dbl_1.inspect}] to include")
+      end
+
+      it 'passes when given the same null double' do
+        dbl = double.as_null_object
+        expect([dbl]).to include(dbl)
+      end
+    end
+
+    context "for a hash target" do
+      it 'passes if target has the expected as a key' do
+        expect({:key => 'value'}).to include(:key)
+      end
+
+      it "fails if target does not include expected" do
+        expect {
+          expect({:key => 'value'}).to include(:other)
+        }.to fail_matching(%Q|expected {:key=>"value"} to include :other|)
+      end
+
+      it "fails if target doesn't have a key and we expect nil" do
+        expect {
+          expect({}).to include(:something => nil)
+        }.to fail_matching(%Q|expected {} to include {:something=>nil}|)
+      end
+
+      it 'works even when an entry in the hash overrides #send' do
+        hash = { :key => 'value' }
+        def hash.send; :sent; end
+        expect(hash).to include(hash)
+      end
+
+      context 'that overrides #send' do
+        it 'still works' do
+          array = [1, 2]
+          def array.send; :sent; end
+
+          expect(array).to include(*array)
+        end
+      end
+    end
+  end
+
+  describe "expect(...).to include(with, multiple, args)" do
+    it "has a description" do
+      matcher = include("a")
+      expect(matcher.description).to eq("include \"a\"")
+    end
+    context "for a string target" do
+      it "passes if target includes all items" do
+        expect("a string").to include("str", "a")
+      end
+
+      it "fails if target does not include any one of the items" do
+        expect {
+          expect("a string").to include("str", "a", "foo")
+        }.to fail_matching(%Q{expected "a string" to include "str", "a", and "foo"})
+      end
+    end
+
+    context "for an array target" do
+      it "passes if target includes all items" do
+        expect([1,2,3]).to include(1,2,3)
+      end
+
+      it "fails if target does not include any one of the items" do
+        expect {
+          expect([1,2,3]).to include(1,2,4)
+        }.to fail_matching("expected [1, 2, 3] to include 1, 2, and 4")
+      end
+    end
+
+    context "for a hash target" do
+      it 'passes if target includes all items as keys' do
+        expect({:key => 'value', :other => 'value'}).to include(:key, :other)
+      end
+
+      it 'fails if target is missing any item as a key' do
+        expect {
+          expect({:key => 'value'}).to include(:key, :other)
+        }.to fail_matching(%Q|expected {:key=>"value"} to include :key and :other|)
+      end
+    end
+  end
+
+  describe "expect(...).not_to include(expected)" do
+    context "for a string target" do
+      it "passes if target does not include expected" do
+        expect("abc").not_to include("d")
+      end
+
+      it "fails if target includes expected" do
+        expect {
+          expect("abc").not_to include("c")
+        }.to fail_with("expected \"abc\" not to include \"c\"")
+      end
+    end
+
+    context "for an array target" do
+      it "passes if target does not include expected" do
+        expect([1,2,3]).not_to include(4)
+      end
+
+      it "fails if target includes expected" do
+        expect {
+          expect([1,2,3]).not_to include(3)
+        }.to fail_with("expected [1, 2, 3] not to include 3")
+      end
+
+      it 'passes when given differing null doubles' do
+        expect([double.as_null_object]).not_to include(double.as_null_object)
+      end
+
+      it 'fails when given the same null double' do
+        dbl = double.as_null_object
+
+        expect {
+          expect([dbl]).not_to include(dbl)
+        }.to fail_matching("expected [#{dbl.inspect}] not to include")
+      end
+    end
+
+    context "for a hash target" do
+      it 'passes if target does not have the expected as a key' do
+        expect({:other => 'value'}).not_to include(:key)
+      end
+
+      it "fails if target includes expected key" do
+        expect {
+          expect({:key => 'value'}).not_to include(:key)
+        }.to fail_matching(%Q|expected {:key=>"value"} not to include :key|)
+      end
+    end
+
+  end
+
+  describe "expect(...).not_to include(with, multiple, args)" do
+    context "for a string target" do
+      it "passes if the target does not include any of the expected" do
+        expect("abc").not_to include("d", "e", "f")
+      end
+
+      it "fails if the target includes all of the expected" do
+        expect {
+          expect("abc").not_to include("c", "a")
+        }.to fail_with('expected "abc" not to include "c" and "a"')
+      end
+
+      it "fails if the target includes some (but not all) of the expected" do
+        expect {
+          expect("abc").not_to include("d", "a")
+        }.to fail_with(%q{expected "abc" not to include "d" and "a"})
+      end
+    end
+
+    context "for a hash target" do
+      it "passes if it does not include any of the expected keys" do
+        expect({ :a => 1, :b => 2 }).not_to include(:c, :d)
+      end
+
+      it "fails if the target includes all of the expected keys" do
+        expect {
+          expect({ :a => 1, :b => 2 }).not_to include(:a, :b)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>2}.inspect} not to include :a and :b|)
+      end
+
+      it "fails if the target includes some (but not all) of the expected keys" do
+        expect {
+          expect({ :a => 1, :b => 2 }).not_to include(:d, :b)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>2}.inspect} not to include :d and :b|)
+      end
+    end
+
+    context "for an array target" do
+      it "passes if the target does not include any of the expected" do
+        expect([1, 2, 3]).not_to include(4, 5, 6)
+      end
+
+      it "fails if the target includes all of the expected" do
+        expect {
+          expect([1, 2, 3]).not_to include(3, 1)
+        }.to fail_with(%q{expected [1, 2, 3] not to include 3 and 1})
+      end
+
+      it "fails if the target includes some (but not all) of the expected" do
+        expect {
+          expect([1, 2, 3]).not_to include(4, 1)
+        }.to fail_with(%q{expected [1, 2, 3] not to include 4 and 1})
+      end
+    end
+  end
+
+  describe "expect(...).to include(:key => value)" do
+    context 'for a hash target' do
+      it "passes if target includes the key/value pair" do
+        expect({:key => 'value'}).to include(:key => 'value')
+      end
+
+      it "passes if target includes the key/value pair among others" do
+        expect({:key => 'value', :other => 'different'}).to include(:key => 'value')
+      end
+
+      it "fails if target has a different value for key" do
+        expect {
+          expect({:key => 'different'}).to include(:key => 'value')
+        }.to fail_matching(%Q|expected {:key=>"different"} to include {:key=>"value"}|)
+      end
+
+      it "fails if target has a different key" do
+        expect {
+          expect({:other => 'value'}).to include(:key => 'value')
+        }.to fail_matching(%Q|expected {:other=>"value"} to include {:key=>"value"}|)
+      end
+    end
+
+    context 'for a non-hash target' do
+      it "fails if the target does not contain the given hash" do
+        expect {
+          expect(['a', 'b']).to include(:key => 'value')
+        }.to fail_matching(%q|expected ["a", "b"] to include {:key=>"value"}|)
+      end
+
+      it "passes if the target contains the given hash" do
+        expect(['a', { :key => 'value' } ]).to include(:key => 'value')
+      end
+    end
+  end
+
+  describe "expect(...).not_to include(:key => value)" do
+    context 'for a hash target' do
+      it "fails if target includes the key/value pair" do
+        expect {
+          expect({:key => 'value'}).not_to include(:key => 'value')
+        }.to fail_matching(%Q|expected {:key=>"value"} not to include {:key=>"value"}|)
+      end
+
+      it "fails if target includes the key/value pair among others" do
+        expect {
+          expect({:key => 'value', :other => 'different'}).not_to include(:key => 'value')
+        }.to fail_matching(%Q|expected #{{:key=>"value", :other=>"different"}.inspect} not to include {:key=>"value"}|)
+      end
+
+      it "passes if target has a different value for key" do
+        expect({:key => 'different'}).not_to include(:key => 'value')
+      end
+
+      it "passes if target has a different key" do
+        expect({:other => 'value'}).not_to include(:key => 'value')
+      end
+    end
+
+    context "for a non-hash target" do
+      it "passes if the target does not contain the given hash" do
+        expect(['a', 'b']).not_to include(:key => 'value')
+      end
+
+      it "fails if the target contains the given hash" do
+        expect {
+          expect(['a', { :key => 'value' } ]).not_to include(:key => 'value')
+        }.to fail_matching(%Q|expected ["a", {:key=>"value"}] not to include {:key=>"value"}|)
+      end
+    end
+  end
+
+  describe "expect(...).to include(:key1 => value1, :key2 => value2)" do
+    context 'for a hash target' do
+      it "passes if target includes the key/value pairs" do
+        expect({:a => 1, :b => 2}).to include(:b => 2, :a => 1)
+      end
+
+      it "passes if target includes the key/value pairs among others" do
+        expect({:a => 1, :c => 3, :b => 2}).to include(:b => 2, :a => 1)
+      end
+
+      it "fails if target has a different value for one of the keys" do
+        expect {
+          expect({:a => 1, :b => 2}).to include(:a => 2, :b => 2)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>2}.inspect} to include #{{:a=>2, :b=>2}.inspect}|)
+      end
+
+      it "fails if target has a different value for both of the keys" do
+        expect {
+          expect({:a => 1, :b => 1}).to include(:a => 2, :b => 2)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>1}.inspect} to include #{{:a=>2, :b=>2}.inspect}|)
+      end
+
+      it "fails if target lacks one of the keys" do
+        expect {
+          expect({:a => 1, :b => 1}).to include(:a => 1, :c => 1)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>1}.inspect} to include #{{:a=>1, :c=>1}.inspect}|)
+      end
+
+      it "fails if target lacks both of the keys" do
+        expect {
+          expect({:a => 1, :b => 1}).to include(:c => 1, :d => 1)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>1}.inspect} to include #{{:c=>1, :d=>1}.inspect}|)
+      end
+    end
+
+    context 'for a non-hash target' do
+      it "fails if the target does not contain the given hash" do
+        expect {
+          expect(['a', 'b']).to include(:a => 1, :b => 1)
+        }.to fail_matching(%Q|expected ["a", "b"] to include #{{:a=>1, :b=>1}.inspect}|)
+      end
+
+      it "passes if the target contains the given hash" do
+        expect(['a', { :a => 1, :b => 2 } ]).to include(:a => 1, :b => 2)
+      end
+    end
+  end
+
+  describe "expect(...).not_to include(:key1 => value1, :key2 => value2)" do
+    context 'for a hash target' do
+      it "fails if target includes the key/value pairs" do
+        expect {
+          expect({:a => 1, :b => 2}).not_to include(:a => 1, :b => 2)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>2}.inspect} not to include #{{:a=>1, :b=>2}.inspect}|)
+      end
+
+      it "fails if target includes the key/value pairs among others" do
+        hash = {:a => 1, :b => 2, :c => 3}
+        expect {
+          expect(hash).not_to include(:a => 1, :b => 2)
+        }.to fail_matching(%Q|expected #{hash.inspect} not to include #{{:a=>1, :b=>2}.inspect}|)
+      end
+
+      it "fails if target has a different value for one of the keys" do
+        expect {
+          expect({:a => 1, :b => 2}).not_to include(:a => 2, :b => 2)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>2}.inspect} not to include #{{:a=>2, :b=>2}.inspect}|)
+      end
+
+      it "passes if target has a different value for both of the keys" do
+        expect({:a => 1, :b => 1}).not_to include(:a => 2, :b => 2)
+      end
+
+      it "fails if target lacks one of the keys" do
+        expect {
+          expect({:a => 1, :b => 1}).not_to include(:a => 1, :c => 1)
+        }.to fail_matching(%Q|expected #{{:a=>1, :b=>1}.inspect} not to include #{{:a=>1, :c=>1}.inspect}|)
+      end
+
+      it "passes if target lacks both of the keys" do
+        expect({:a => 1, :b => 1}).not_to include(:c => 1, :d => 1)
+      end
+    end
+
+    context 'for a non-hash target' do
+      it "passes if the target does not contain the given hash" do
+        expect(['a', 'b']).not_to include(:a => 1, :b => 1)
+      end
+
+      it "fails if the target contains the given hash" do
+        expect {
+          expect(['a', { :a => 1, :b => 2 } ]).not_to include(:a => 1, :b => 2)
+        }.to fail_matching(%Q|expected #{["a", {:a=>1, :b=>2}].inspect} not to include #{{:a=>1, :b=>2}.inspect}|)
+      end
+    end
+  end
+end
+
+RSpec::Matchers.define :a_string_containing do |expected|
+  match do |actual|
+    actual.include?(expected)
+  end
+
+  description do
+    "a string containing '#{expected}'"
+  end
+end
+
+describe "expect(...).to include(matcher)" do
+  context 'for an array target' do
+    it "passes if target includes an object that satisfies the matcher" do
+      expect(['foo', 'bar', 'baz']).to include(a_string_containing("ar"))
+    end
+
+    it "fails if target doesn't include object that satisfies the matcher" do
+      expect {
+        expect(['foo', 'bar', 'baz']).to include(a_string_containing("abc"))
+      }.to fail_matching(%Q|expected #{['foo', 'bar', 'baz'].inspect} to include a string containing 'abc'|)
+    end
+
+    it 'does not include a diff when the match fails' do
+      expect {
+        expect(['foo', 'bar', 'baz']).to include(a_string_containing("abc"))
+      }.to raise_error { |e|
+        expect(e.message).not_to match(/diff/i)
+      }
+    end
+
+    it 'does not treat an object that only implements #matches? as a matcher' do
+      domain = Struct.new(:domain) do
+        def matches?(url)
+          URI(url).host == self.domain
+        end
+      end
+
+      expect([domain.new("rspec.info")]).to include(domain.new("rspec.info"))
+
+      expect {
+        expect([domain.new("rspec.info")]).to include(domain.new("foo.com"))
+      }.to fail_matching("expected [#{domain.new("rspec.info").inspect}] to include")
+    end
+
+    it 'works with an old-style matcher that implements failure_message rather than failure_message_for_should' do
+      a_multiple_of = Class.new do
+        def initialize(expected)
+          @expected = expected
+        end
+
+        def matches?(actual)
+          (actual % @expected).zero?
+        end
+
+        def failure_message
+          "expected a multiple of #{@expected}"
+        end
+      end
+
+      # Verify the matcher works normally
+      expect(10).to a_multiple_of.new(5)
+
+      expect {
+        expect(10).to a_multiple_of.new(7)
+      }.to fail_with("expected a multiple of 7")
+
+      expect([12, 13, 14]).to include(a_multiple_of.new(6))
+
+      expect {
+        expect([12, 13, 14]).to include(a_multiple_of.new(10))
+      }.to fail_matching("expected [12, 13, 14] to include")
+    end
+  end
+end
+
+describe "expect(...).to include(multiple, matcher, arguments)" do
+  context 'for an array target' do
+    it "passes if target includes items satisfying all matchers" do
+      expect(['foo', 'bar', 'baz']).to include(a_string_containing("ar"), a_string_containing('oo'))
+    end
+
+    it "fails if target does not include an item satisfying any one of the items" do
+      expect {
+        expect(['foo', 'bar', 'baz']).to include(a_string_containing("ar"), a_string_containing("abc"))
+      }.to fail_matching(%Q|expected #{['foo', 'bar', 'baz'].inspect} to include a string containing 'ar' and a string containing 'abc'|)
+    end
+
+    it 'does not include a diff when the match fails' do
+      expect {
+        expect(['foo', 'bar', 'baz']).to include(a_string_containing("ar"), a_string_containing("abc"))
+      }.to raise_error { |e|
+        expect(e.message).not_to match(/diff/i)
+      }
+    end
+  end
+end
+
+describe "expect(...).not_to include(multiple, matcher, arguments)" do
+  it "passes if none of the target values satisfies any of the matchers" do
+    expect(['foo', 'bar', 'baz']).not_to include(a_string_containing("gh"), a_string_containing('de'))
+  end
+
+  it 'fails if all of the matchers are satisfied by one of the target values' do
+    expect {
+      expect(['foo', 'bar', 'baz']).not_to include(a_string_containing("ar"), a_string_containing('az'))
+    }.to fail_matching(%Q|expected #{['foo', 'bar', 'baz'].inspect} not to include a string containing 'ar' and a string containing 'az'|)
+  end
+
+  it 'fails if the some (but not all) of the matchers are satisifed' do
+    expect {
+      expect(['foo', 'bar', 'baz']).not_to include(a_string_containing("ar"), a_string_containing('bz'))
+    }.to fail_matching(%Q|expected #{['foo', 'bar', 'baz'].inspect} not to include a string containing 'ar' and a string containing 'bz'|)
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/match_array_spec.rb b/rspec-expectations/spec/rspec/matchers/match_array_spec.rb
new file mode 100644
index 0000000..e7eaa46
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/match_array_spec.rb
@@ -0,0 +1,194 @@
+require 'spec_helper'
+
+class UnsortableObject
+  def initialize(id)
+    @id = id
+  end
+
+  def inspect
+    @id.to_s
+  end
+
+  def ==(other)
+    false
+  end
+end
+
+describe "should =~ array", :uses_should do
+  it "passes a valid positive expectation" do
+    [1, 2].should =~ [2, 1]
+  end
+
+  it "fails an invalid positive expectation" do
+    expect {
+      [1, 2, 3].should =~ [2, 1]
+    }.to fail_with(/expected collection contained/)
+  end
+
+  context "when the array defines a `=~` method" do
+    it 'delegates to that method rather than using the match_array matcher' do
+      array = []
+      def array.=~(other)
+        other == :foo
+      end
+
+      array.should =~ :foo
+      expect {
+        array.should =~ :bar
+      }.to fail_with(/expected: :bar/)
+    end
+  end
+
+  context 'when the array defines a `send` method' do
+    it 'still works' do
+      array = [1, 2]
+      def array.send; :sent; end
+
+      array.should =~ array
+    end
+  end
+end
+
+describe "should_not =~ [:with, :multiple, :args]", :uses_should do
+  it "is not supported" do
+    expect {
+      [1,2,3].should_not =~ [1,2,3]
+    }.to fail_with(/Matcher does not support should_not/)
+  end
+end
+
+describe "using match_array with expect" do
+  it "passes a valid positive expectation" do
+    expect([1, 2]).to match_array [2, 1]
+  end
+
+  it "fails an invalid positive expectation" do
+    expect {
+      expect([1, 2, 3]).to match_array [2, 1]
+    }.to fail_with(/expected collection contained/)
+  end
+end
+
+describe "expect(array).to match_array other_array" do
+  it_behaves_like "an RSpec matcher", :valid_value => [1, 2], :invalid_value => [1] do
+    let(:matcher) { match_array([2, 1]) }
+  end
+
+  it "passes if target contains all items" do
+    expect([1,2,3]).to match_array [1,2,3]
+  end
+
+  it "passes if target contains all items out of order" do
+    expect([1,3,2]).to match_array [1,2,3]
+  end
+
+  it "fails if target includes extra items" do
+    expect {
+      expect([1,2,3,4]).to match_array [1,2,3]
+    }.to fail_with(<<-MESSAGE)
+expected collection contained:  [1, 2, 3]
+actual collection contained:    [1, 2, 3, 4]
+the extra elements were:        [4]
+MESSAGE
+  end
+
+  it "fails if target is missing items" do
+    expect {
+      expect([1,2]).to match_array [1,2,3]
+    }.to fail_with(<<-MESSAGE)
+expected collection contained:  [1, 2, 3]
+actual collection contained:    [1, 2]
+the missing elements were:      [3]
+MESSAGE
+  end
+
+  it "fails if target is missing items and has extra items" do
+    expect {
+      expect([1,2,4]).to match_array [1,2,3]
+    }.to fail_with(<<-MESSAGE)
+expected collection contained:  [1, 2, 3]
+actual collection contained:    [1, 2, 4]
+the missing elements were:      [3]
+the extra elements were:        [4]
+MESSAGE
+  end
+
+  it "sorts items in the error message if they all respond to <=>" do
+    expect {
+      expect([6,2,1,5]).to match_array [4,1,2,3]
+    }.to fail_with(<<-MESSAGE)
+expected collection contained:  [1, 2, 3, 4]
+actual collection contained:    [1, 2, 5, 6]
+the missing elements were:      [3, 4]
+the extra elements were:        [5, 6]
+MESSAGE
+  end
+
+    it "does not sort items in the error message if they don't all respond to <=>" do
+      expect {
+        expect([UnsortableObject.new(2), UnsortableObject.new(1)]).to match_array [UnsortableObject.new(4), UnsortableObject.new(3)]
+      }.to fail_with(<<-MESSAGE)
+expected collection contained:  [4, 3]
+actual collection contained:    [2, 1]
+the missing elements were:      [4, 3]
+the extra elements were:        [2, 1]
+MESSAGE
+    end
+
+  it "accurately reports extra elements when there are duplicates" do
+    expect {
+      expect([1,1,1,5]).to match_array [1,5]
+    }.to fail_with(<<-MESSAGE)
+expected collection contained:  [1, 5]
+actual collection contained:    [1, 1, 1, 5]
+the extra elements were:        [1, 1]
+MESSAGE
+  end
+
+  it "accurately reports missing elements when there are duplicates" do
+    expect {
+      expect([1,5]).to match_array [1,1,5]
+    }.to fail_with(<<-MESSAGE)
+expected collection contained:  [1, 1, 5]
+actual collection contained:    [1, 5]
+the missing elements were:      [1]
+MESSAGE
+  end
+end
+
+describe "expect(...).not_to match_array [:with, :multiple, :args]" do
+  it "is not supported" do
+    expect {
+      expect([1,2,3]).not_to match_array [1,2,3]
+    }.to fail_with(/Matcher does not support should_not/)
+  end
+end
+
+describe "matching against things that aren't arrays" do
+  it "fails with nil and the expected error message is given" do
+    expect {
+      expect(nil).to match_array([1,2,3])
+    }.to fail_with(/expected an array/)
+  end
+
+  it "fails with a float and the expected error message is given" do
+    expect {
+      expect((3.7)).to match_array([1,2,3])
+    }.to fail_with(/expected an array/)
+  end
+
+  it "fails with a string and the expected error message is given" do
+    expect {
+      expect("I like turtles").to match_array([1,2,3])
+    }.to fail_with(/expected an array/)
+  end
+
+  context "when using the `should =~` syntax", :uses_should do
+    it 'fails with a clear message when given a hash' do
+      expect {
+        {}.should =~ {}
+      }.to fail_with(/expected an array/)
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/match_spec.rb b/rspec-expectations/spec/rspec/matchers/match_spec.rb
new file mode 100644
index 0000000..3268686
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/match_spec.rb
@@ -0,0 +1,61 @@
+require 'spec_helper'
+
+describe "expect(...).to match(expected)" do
+  it_behaves_like "an RSpec matcher", :valid_value => 'ab', :invalid_value => 'bc' do
+    let(:matcher) { match(/a/) }
+  end
+
+  it "passes when target (String) matches expected (Regexp)" do
+    expect("string").to match(/tri/)
+  end
+
+  it "passes when target (String) matches expected (String)" do
+    expect("string").to match("tri")
+  end
+
+  it "fails when target (String) does not match expected (Regexp)" do
+    expect {
+      expect("string").to match(/rings/)
+    }.to fail
+  end
+
+  it "fails when target (String) does not match expected (String)" do
+    expect {
+      expect("string").to match("rings")
+    }.to fail
+  end
+
+  it "provides message, expected and actual on failure" do
+    matcher = match(/rings/)
+    matcher.matches?("string")
+    expect(matcher.failure_message_for_should).to eq "expected \"string\" to match /rings/"
+  end
+end
+
+describe "expect(...).not_to match(expected)" do
+  it "passes when target (String) matches does not match (Regexp)" do
+    expect("string").not_to match(/rings/)
+  end
+
+  it "passes when target (String) matches does not match (String)" do
+    expect("string").not_to match("rings")
+  end
+
+  it "fails when target (String) matches expected (Regexp)" do
+    expect {
+      expect("string").not_to match(/tri/)
+    }.to fail
+  end
+
+  it "fails when target (String) matches expected (String)" do
+    expect {
+      expect("string").not_to match("tri")
+    }.to fail
+  end
+
+  it "provides message, expected and actual on failure" do
+    matcher = match(/tri/)
+    matcher.matches?("string")
+    expect(matcher.failure_message_for_should_not).to eq "expected \"string\" not to match /tri/"
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/matcher_spec.rb b/rspec-expectations/spec/rspec/matchers/matcher_spec.rb
new file mode 100644
index 0000000..985ec86
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/matcher_spec.rb
@@ -0,0 +1,471 @@
+require 'spec_helper'
+
+class UnexpectedError < StandardError; end
+module MatcherHelperModule
+  def self.included(base)
+    base.module_eval do
+      def included_method; end
+    end
+  end
+
+  def self.extended(base)
+    base.instance_eval do
+      def extended_method; end
+    end
+  end
+
+  def greeting
+    "Hello, World"
+  end
+end
+
+module RSpec::Matchers::DSL
+  describe Matcher do
+    it "can be stored aside and used later" do
+      # Supports using rspec-expectation matchers as argument matchers in
+      # rspec-mocks.
+      RSpec::Matchers.define :example_matcher do |expected|
+        match do |actual|
+          actual == expected
+        end
+      end
+
+      m1 = example_matcher(1)
+      m2 = example_matcher(2)
+
+      expect(m1.matches?(1)).to be_true
+      expect(m2.matches?(2)).to be_true
+    end
+
+    context "with an included module" do
+      let(:matcher) do
+        RSpec::Matchers::DSL::Matcher.new(:be_a_greeting) do
+          include MatcherHelperModule
+          match { |actual| actual == greeting }
+        end.for_expected
+      end
+
+      it "has access to the module's methods" do
+        matcher.matches?("Hello, World")
+      end
+
+      it "runs the module's included hook" do
+        expect(matcher).to respond_to(:included_method)
+      end
+
+      it "does not run the module's extended hook" do
+        expect(matcher).not_to respond_to(:extended_method)
+      end
+
+      it 'allows multiple modules to be included at once' do
+        m = RSpec::Matchers::DSL::Matcher.new(:multiple_modules) do
+          include Enumerable, Comparable
+        end.for_expected
+        expect(m).to be_a(Enumerable)
+        expect(m).to be_a(Comparable)
+      end
+    end
+
+    context "without overrides" do
+      before(:each) do
+        @matcher = RSpec::Matchers::DSL::Matcher.new(:be_a_multiple_of) do |multiple|
+          match do |actual|
+            actual % multiple == 0
+          end
+        end.for_expected(3)
+      end
+
+      it "provides a default description" do
+        expect(@matcher.description).to eq "be a multiple of 3"
+      end
+
+      it "provides a default failure message for #should" do
+        @matcher.matches?(8)
+        expect(@matcher.failure_message_for_should).to eq "expected 8 to be a multiple of 3"
+      end
+
+      it "provides a default failure message for #should_not" do
+        @matcher.matches?(9)
+        expect(@matcher.failure_message_for_should_not).to eq "expected 9 not to be a multiple of 3"
+      end
+    end
+
+    context "with separate match logic for should and should not" do
+      let(:matcher) do
+        RSpec::Matchers::DSL::Matcher.new(:to_be_composed_of) do |a, b|
+          match_for_should do |actual|
+            actual == a * b
+          end
+
+          match_for_should_not do |actual|
+            actual == a + b
+          end
+        end.for_expected(7, 11)
+      end
+
+      it "invokes the match_for_should block for #matches?" do
+        expect(matcher.matches?(77)).to be_true
+        expect(matcher.matches?(18)).to be_false
+      end
+
+      it "invokes the match_for_should_not block for #does_not_match?" do
+        expect(matcher.does_not_match?(77)).to be_false
+        expect(matcher.does_not_match?(18)).to be_true
+      end
+
+      it "provides a default failure message for #should_not" do
+        matcher.does_not_match?(77)
+        expect(matcher.failure_message_for_should_not).to eq "expected 77 not to to be composed of 7 and 11"
+      end
+    end
+
+    it "allows helper methods to be defined with #define_method to have access to matcher parameters" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:name) do |a, b|
+        define_method(:sum) { a + b }
+      end.for_expected(3,4)
+
+      expect(matcher.sum).to eq 7
+    end
+
+    it "is not diffable by default" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:name) {}
+      expect(matcher).not_to be_diffable
+    end
+
+    it "is diffable when told to be" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:name) { diffable }.for_expected
+      expect(matcher).to be_diffable
+    end
+
+    it "provides expected" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:name) {}.for_expected('expected string')
+      expect(matcher.expected).to eq ['expected string']
+    end
+
+    it "provides actual" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:name) do
+        match {|actual|}
+      end.for_expected('expected string')
+
+      matcher.matches?('actual string')
+
+      expect(matcher.actual).to eq 'actual string'
+    end
+
+    context "wrapping another expectation (should == ...)" do
+      it "returns true if the wrapped expectation passes" do
+        matcher = RSpec::Matchers::DSL::Matcher.new(:name) do |expected|
+          match do |actual|
+            expect(actual).to eq expected
+          end
+        end.for_expected('value')
+        expect(matcher.matches?('value')).to be_true
+      end
+
+      it "returns false if the wrapped expectation fails" do
+        matcher = RSpec::Matchers::DSL::Matcher.new(:name) do |expected|
+          match do |actual|
+            expect(actual).to eq expected
+          end
+        end.for_expected('value')
+        expect(matcher.matches?('other value')).to be_false
+      end
+    end
+
+    context "with overrides" do
+      before(:each) do
+        @matcher = RSpec::Matchers::DSL::Matcher.new(:be_boolean) do |boolean|
+          match do |actual|
+            actual
+          end
+          description do
+            "be the boolean #{boolean}"
+          end
+          failure_message_for_should do |actual|
+            "expected #{actual} to be the boolean #{boolean}"
+          end
+          failure_message_for_should_not do |actual|
+            "expected #{actual} not to be the boolean #{boolean}"
+          end
+        end.for_expected(true)
+      end
+
+      it "does not hide result of match block when true" do
+        expect(@matcher.matches?(true)).to be_true
+      end
+
+      it "does not hide result of match block when false" do
+        expect(@matcher.matches?(false)).to be_false
+      end
+
+      it "overrides the description" do
+        expect(@matcher.description).to eq "be the boolean true"
+      end
+
+      it "overrides the failure message for #should" do
+        @matcher.matches?(false)
+        expect(@matcher.failure_message_for_should).to eq "expected false to be the boolean true"
+      end
+
+      it "overrides the failure message for #should_not" do
+        @matcher.matches?(true)
+        expect(@matcher.failure_message_for_should_not).to eq "expected true not to be the boolean true"
+      end
+    end
+
+    context "#new" do
+      it "passes matches? arg to match block" do
+        matcher = RSpec::Matchers::DSL::Matcher.new(:ignore) do
+          match do |actual|
+            actual == 5
+          end
+        end.for_expected
+        expect(matcher.matches?(5)).to be_true
+      end
+
+      it "exposes arg submitted through #new to matcher block" do
+        matcher = RSpec::Matchers::DSL::Matcher.new(:ignore) do |expected|
+          match do |actual|
+            actual > expected
+          end
+        end.for_expected(4)
+        expect(matcher.matches?(5)).to be_true
+      end
+    end
+
+    context "with no args" do
+      before(:each) do
+        @matcher = RSpec::Matchers::DSL::Matcher.new(:matcher_name) do
+          match do |actual|
+            actual == 5
+          end
+        end.for_expected
+      end
+
+      it "matches" do
+        expect(@matcher.matches?(5)).to be_true
+      end
+
+      it "describes" do
+        expect(@matcher.description).to eq "matcher name"
+      end
+    end
+
+    context "with 1 arg" do
+      before(:each) do
+        @matcher = RSpec::Matchers::DSL::Matcher.new(:matcher_name) do |expected|
+          match do |actual|
+            actual == 5 && expected == 1
+          end
+        end.for_expected(1)
+      end
+
+      it "matches" do
+        expect(@matcher.matches?(5)).to be_true
+      end
+
+      it "describes" do
+        expect(@matcher.description).to eq "matcher name 1"
+      end
+    end
+
+    context "with multiple args" do
+      before(:each) do
+        @matcher = RSpec::Matchers::DSL::Matcher.new(:matcher_name) do |a,b,c,d|
+          match do |sum|
+            a + b + c + d == sum
+          end
+        end.for_expected(1,2,3,4)
+      end
+
+      it "matches" do
+        expect(@matcher.matches?(10)).to be_true
+      end
+
+      it "describes" do
+        expect(@matcher.description).to eq "matcher name 1, 2, 3, and 4"
+      end
+    end
+
+    it "supports helper methods" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:be_similar_to) do |sample|
+        match do |actual|
+          similar?(sample, actual)
+        end
+
+        def similar?(a, b)
+          a.sort == b.sort
+        end
+      end.for_expected([1,2,3])
+
+      expect(matcher.matches?([2,3,1])).to be_true
+    end
+
+    it "supports fluent interface" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:first_word) do
+        def second_word
+          self
+        end
+      end.for_expected
+
+      expect(matcher.second_word).to eq matcher
+    end
+
+    it "treats method missing normally for undeclared methods" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:ignore) { }.for_expected
+      expect { matcher.non_existent_method }.to raise_error(NoMethodError)
+    end
+
+    it "has access to other matchers" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:ignore) do |expected|
+        match do |actual|
+          extend RSpec::Matchers
+          expect(actual).to eql(5 + expected)
+        end
+      end.for_expected(3)
+
+      expect(matcher.matches?(8)).to be_true
+    end
+
+    context 'when multiple instances of the same matcher are used in the same example' do
+      RSpec::Matchers.define(:be_like_a) do |expected|
+        match { |actual| actual == expected }
+        description { "be like a #{expected}" }
+        failure_message_for_should { "expected to be like a #{expected}" }
+        failure_message_for_should_not { "expected not to be like a #{expected}" }
+      end
+
+      # Note: these bugs were only exposed when creating both instances
+      # first, then checking their descriptions/failure messages.
+      #
+      # That's why we eager-instantiate them here.
+      let!(:moose) { be_like_a("moose") }
+      let!(:horse) { be_like_a("horse") }
+
+      it 'allows them to use the expected value in the description' do
+        expect(horse.description).to eq("be like a horse")
+        expect(moose.description).to eq("be like a moose")
+      end
+
+      it 'allows them to use the expected value in the positive failure message' do
+        expect(moose.failure_message_for_should).to eq("expected to be like a moose")
+        expect(horse.failure_message_for_should).to eq("expected to be like a horse")
+      end
+
+      it 'allows them to use the expected value in the negative failure message' do
+        expect(moose.failure_message_for_should_not).to eq("expected not to be like a moose")
+        expect(horse.failure_message_for_should_not).to eq("expected not to be like a horse")
+      end
+
+      it 'allows them to match separately' do
+        expect("moose").to moose
+        expect("horse").to horse
+        expect("horse").not_to moose
+        expect("moose").not_to horse
+      end
+    end
+
+    describe "#match_unless_raises" do
+      context "with an assertion" do
+        let(:mod) do
+          Module.new do
+            def assert_equal(a,b)
+              a == b ? nil : (raise UnexpectedError.new("#{b} does not equal #{a}"))
+            end
+          end
+        end
+        let(:matcher) do
+          m = mod
+          RSpec::Matchers::DSL::Matcher.new :equal do |expected|
+            extend m
+            match_unless_raises UnexpectedError do
+              assert_equal expected, actual
+            end
+          end.for_expected(4)
+        end
+
+        context "with passing assertion" do
+          it "passes" do
+            expect(matcher.matches?(4)).to be_true
+          end
+        end
+
+        context "with failing assertion" do
+          it "fails" do
+            expect(matcher.matches?(5)).to be_false
+          end
+
+          it "provides the raised exception" do
+            matcher.matches?(5)
+            expect(matcher.rescued_exception.message).to eq("5 does not equal 4")
+          end
+        end
+      end
+
+      context "with an unexpected error" do
+        let(:matcher) do
+          RSpec::Matchers::DSL::Matcher.new :foo do |expected|
+            match_unless_raises SyntaxError do |actual|
+              raise "unexpected exception"
+            end
+          end.for_expected(:bar)
+        end
+
+        it "raises the error" do
+          expect do
+            matcher.matches?(:bar)
+          end.to raise_error("unexpected exception")
+        end
+      end
+
+    end
+
+    it "can define chainable methods" do
+      matcher = RSpec::Matchers::DSL::Matcher.new(:name) do
+        chain(:expecting) do |expected_value|
+          @expected_value = expected_value
+        end
+        match { |actual| actual == @expected_value }
+      end.for_expected
+
+      expect(matcher.expecting('value').matches?('value')).to be_true
+      expect(matcher.expecting('value').matches?('other value')).to be_false
+    end
+
+    it "prevents name collisions on chainable methods from different matchers" do
+      m1 = RSpec::Matchers::DSL::Matcher.new(:m1) { chain(:foo) { raise "foo in m1" } }.for_expected
+      m2 = RSpec::Matchers::DSL::Matcher.new(:m2) { chain(:foo) { raise "foo in m2" } }.for_expected
+
+      expect { m1.foo }.to raise_error("foo in m1")
+      expect { m2.foo }.to raise_error("foo in m2")
+    end
+
+    context "defined using the dsl" do
+      def a_method_in_the_example
+        "method defined in the example"
+      end
+
+      it "can access methods in the running example" do
+        RSpec::Matchers.define(:__access_running_example) do
+          match do |actual|
+            a_method_in_the_example == "method defined in the example"
+          end
+        end
+        expect(example).to __access_running_example
+      end
+
+      it "raises NoMethodError for methods not in the running_example" do
+        RSpec::Matchers.define(:__raise_no_method_error) do
+          match do |actual|
+            a_method_not_in_the_example == "method defined in the example"
+          end
+        end
+
+        expect do
+          expect(example).to __raise_no_method_error
+        end.to raise_error(/RSpec::Matchers::DSL::Matcher/)
+      end
+    end
+
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/matchers_spec.rb b/rspec-expectations/spec/rspec/matchers/matchers_spec.rb
new file mode 100644
index 0000000..c7c4f3c
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/matchers_spec.rb
@@ -0,0 +1,37 @@
+require 'spec_helper'
+
+module RSpec
+  describe Matchers do
+
+    let(:sample_matchers) do
+      [:be,
+       :be_close,
+       :be_instance_of,
+       :be_kind_of]
+    end
+
+    context "once required" do
+      include TestUnitIntegrationSupport
+
+      it "includes itself in Test::Unit::TestCase" do
+        with_test_unit_loaded do
+          test_unit_case = Test::Unit::TestCase.allocate
+          sample_matchers.each do |sample_matcher|
+              expect(test_unit_case).to respond_to(sample_matcher)
+          end
+        end
+      end
+
+      it "includes itself in MiniTest::Unit::TestCase", :if => defined?(MiniTest) do
+        with_test_unit_loaded do
+          minitest_case = MiniTest::Unit::TestCase.allocate
+          sample_matchers.each do |sample_matcher|
+              expect(minitest_case).to respond_to(sample_matcher)
+          end
+        end
+      end
+
+    end
+
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/method_missing_spec.rb b/rspec-expectations/spec/rspec/matchers/method_missing_spec.rb
new file mode 100644
index 0000000..8516f85
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/method_missing_spec.rb
@@ -0,0 +1,28 @@
+require 'spec_helper'
+
+shared_examples_for "a well-behaved method_missing hook" do
+  include TestUnitIntegrationSupport
+
+  it "raises a NoMethodError (and not SystemStackError) for an undefined method" do
+    with_test_unit_loaded do
+      expect { subject.some_undefined_method }.to raise_error(NoMethodError)
+    end
+  end
+end
+
+describe "RSpec::Matchers method_missing hook" do
+  subject { self }
+
+  it_behaves_like "a well-behaved method_missing hook"
+
+  context 'when invoked in a Test::Unit::TestCase' do
+    subject { Test::Unit::TestCase.allocate }
+    it_behaves_like "a well-behaved method_missing hook"
+  end
+
+  context 'when invoked in a MiniTest::Unit::TestCase', :if => defined?(MiniTest) do
+    subject { MiniTest::Unit::TestCase.allocate }
+    it_behaves_like "a well-behaved method_missing hook"
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/operator_matcher_spec.rb b/rspec-expectations/spec/rspec/matchers/operator_matcher_spec.rb
new file mode 100644
index 0000000..173f45d
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/operator_matcher_spec.rb
@@ -0,0 +1,223 @@
+require 'spec_helper'
+
+describe "operator matchers", :uses_should do
+  describe "should ==" do
+    it "delegates message to target" do
+      subject = "apple"
+      subject.should_receive(:==).with("apple").and_return(true)
+      subject.should == "apple"
+    end
+
+    it "returns true on success" do
+      subject = "apple"
+      (subject.should == "apple").should be_true
+    end
+
+    it "fails when target.==(actual) returns false" do
+      subject = "apple"
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected: "orange"\n     got: "apple" (using ==)], "orange", "apple")
+      subject.should == "orange"
+    end
+  end
+
+  describe "unsupported operators", :if => RUBY_VERSION.to_f == 1.9 do
+    it "raises an appropriate error for should != expected" do
+      expect {
+        "apple".should != "pear"
+      }.to raise_error(/does not support `should != expected`.  Use `should_not == expected`/)
+    end
+
+    it "raises an appropriate error for should_not != expected" do
+      expect {
+        "apple".should_not != "pear"
+      }.to raise_error(/does not support `should_not != expected`.  Use `should == expected`/)
+    end
+
+    it "raises an appropriate error for should !~ expected" do
+      expect {
+        "apple".should !~ /regex/
+      }.to raise_error(/does not support `should !~ expected`.  Use `should_not =~ expected`/)
+    end
+
+    it "raises an appropriate error for should_not !~ expected" do
+      expect {
+        "apple".should_not !~ /regex/
+      }.to raise_error(/does not support `should_not !~ expected`.  Use `should =~ expected`/)
+    end
+  end
+
+  describe "should_not ==" do
+    it "delegates message to target" do
+      subject = "orange"
+      subject.should_receive(:==).with("apple").and_return(false)
+      subject.should_not == "apple"
+    end
+
+    it "returns true on success" do
+      subject = "apple"
+      (subject.should_not == "orange").should be_false
+    end
+
+    it "fails when target.==(actual) returns false" do
+      subject = "apple"
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected not: == "apple"\n         got:    "apple"], "apple", "apple")
+      subject.should_not == "apple"
+    end
+  end
+
+  describe "should ===" do
+    it "delegates message to target" do
+      subject = "apple"
+      subject.should_receive(:===).with("apple").and_return(true)
+      subject.should === "apple"
+    end
+
+    it "fails when target.===(actual) returns false" do
+      subject = "apple"
+      subject.should_receive(:===).with("orange").and_return(false)
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected: "orange"\n     got: "apple" (using ===)], "orange", "apple")
+      subject.should === "orange"
+    end
+  end
+
+  describe "should_not ===" do
+    it "delegates message to target" do
+      subject = "orange"
+      subject.should_receive(:===).with("apple").and_return(false)
+      subject.should_not === "apple"
+    end
+
+    it "fails when target.===(actual) returns false" do
+      subject = "apple"
+      subject.should_receive(:===).with("apple").and_return(true)
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected not: === "apple"\n         got:     "apple"], "apple", "apple")
+      subject.should_not === "apple"
+    end
+  end
+
+  describe "should =~" do
+    it "delegates message to target" do
+      subject = "foo"
+      subject.should_receive(:=~).with(/oo/).and_return(true)
+      subject.should =~ /oo/
+    end
+
+    it "fails when target.=~(actual) returns false" do
+      subject = "fu"
+      subject.should_receive(:=~).with(/oo/).and_return(false)
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected: /oo/\n     got: "fu" (using =~)], /oo/, "fu")
+      subject.should =~ /oo/
+    end
+  end
+
+  describe "should_not =~" do
+    it "delegates message to target" do
+      subject = "fu"
+      subject.should_receive(:=~).with(/oo/).and_return(false)
+      subject.should_not =~ /oo/
+    end
+
+    it "fails when target.=~(actual) returns false" do
+      subject = "foo"
+      subject.should_receive(:=~).with(/oo/).and_return(true)
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected not: =~ /oo/\n         got:    "foo"], /oo/, "foo")
+      subject.should_not =~ /oo/
+    end
+  end
+
+  describe "should >" do
+    it "passes if > passes" do
+      4.should > 3
+    end
+
+    it "fails if > fails" do
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected: > 5\n     got:   4], 5, 4)
+      4.should > 5
+    end
+  end
+
+  describe "should >=" do
+    it "passes if actual == expected" do
+      4.should >= 4
+    end
+
+    it "passes if actual > expected" do
+      4.should >= 3
+    end
+
+    it "fails if > fails" do
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected: >= 5\n     got:    4], 5, 4)
+      4.should >= 5
+    end
+  end
+
+  describe "should <" do
+    it "passes if < passes" do
+      4.should < 5
+    end
+
+    it "fails if > fails" do
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected: < 3\n     got:   4], 3, 4)
+      4.should < 3
+    end
+  end
+
+  describe "should <=" do
+    it "passes if actual == expected" do
+      4.should <= 4
+    end
+
+    it "passes if actual < expected" do
+      4.should <= 5
+    end
+
+    it "fails if > fails" do
+      RSpec::Expectations.should_receive(:fail_with).with(%[expected: <= 3\n     got:    4], 3, 4)
+      4.should <= 3
+    end
+  end
+
+  describe "OperatorMatcher registry" do
+    let(:custom_klass) { Class.new }
+    let(:custom_subklass) { Class.new(custom_klass) }
+
+    after {
+      RSpec::Matchers::OperatorMatcher.unregister(custom_klass, "=~")
+    }
+
+    it "allows operator matchers to be registered for types" do
+      RSpec::Matchers::OperatorMatcher.register(custom_klass, "=~", RSpec::Matchers::BuiltIn::Match)
+      expect(RSpec::Matchers::OperatorMatcher.get(custom_klass, "=~")).to eq(RSpec::Matchers::BuiltIn::Match)
+    end
+
+    it "considers ancestors when finding an operator matcher" do
+      RSpec::Matchers::OperatorMatcher.register(custom_klass, "=~", RSpec::Matchers::BuiltIn::Match)
+      expect(RSpec::Matchers::OperatorMatcher.get(custom_subklass, "=~")).to eq(RSpec::Matchers::BuiltIn::Match)
+    end
+
+    it "returns nil if there is no matcher registered for a type" do
+      expect(RSpec::Matchers::OperatorMatcher.get(custom_klass, "=~")).to be_nil
+    end
+  end
+
+  describe RSpec::Matchers::BuiltIn::PositiveOperatorMatcher do
+    it "works when the target has implemented #send" do
+      o = Object.new
+      def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
+      expect {
+        o.should == o
+      }.not_to raise_error
+    end
+  end
+
+  describe RSpec::Matchers::BuiltIn::NegativeOperatorMatcher do
+    it "works when the target has implemented #send" do
+      o = Object.new
+      def o.send(*args); raise "DOH! Library developers shouldn't use #send!" end
+      expect {
+        o.should_not == :foo
+      }.not_to raise_error
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/raise_error_spec.rb b/rspec-expectations/spec/rspec/matchers/raise_error_spec.rb
new file mode 100644
index 0000000..6e4c6c9
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/raise_error_spec.rb
@@ -0,0 +1,485 @@
+require 'spec_helper'
+
+describe "expect { ... }.to raise_error" do
+  it_behaves_like("an RSpec matcher", :valid_value => lambda { raise "boom" },
+                                      :invalid_value => lambda { }) do
+    let(:matcher) { raise_error(/boom/) }
+  end
+
+  it "passes if anything is raised" do
+    expect {raise}.to raise_error
+  end
+
+  it "passes if an error instance is expected" do
+    s = StandardError.new
+    expect {raise s}.to raise_error(s)
+  end
+
+  it "fails if a different error instance is thrown from the one that is expected" do
+    s = StandardError.new("Error 1")
+    to_raise = StandardError.new("Error 2")
+    expect do
+      expect {raise to_raise}.to raise_error(s)
+    end.to fail_with(Regexp.new("expected #{s.inspect}, got #{to_raise.inspect} with backtrace"))
+  end
+
+  it "passes if an error class is expected and an instance of that class is thrown" do
+    s = StandardError.new :bees
+
+    expect { raise s }.to raise_error(StandardError)
+  end
+
+  it "fails if nothing is raised" do
+    expect {
+      expect {}.to raise_error
+    }.to fail_with("expected Exception but nothing was raised")
+  end
+end
+
+describe "raise_exception aliased to raise_error" do
+  it "passes if anything is raised" do
+    expect {raise}.to raise_exception
+  end
+end
+
+describe "expect { ... }.to raise_error {|err| ... }" do
+  it "passes if there is an error" do
+    ran = false
+    expect { non_existent_method }.to raise_error {|e|
+      ran = true
+    }
+    expect(ran).to be_true
+  end
+
+  it "passes the error to the block" do
+    error = nil
+    expect { non_existent_method }.to raise_error {|e|
+      error = e
+    }
+    expect(error).to be_kind_of(NameError)
+  end
+end
+
+describe "expect { ... }.not_to raise_error" do
+
+  context "with a specific error class" do
+    it "is deprecated" do
+      RSpec.should_receive :deprecate
+      expect {"bees"}.not_to raise_error(RuntimeError)
+    end
+  end
+
+  context "with no specific error class" do
+    it "is not deprecated" do
+      run = nil
+      allow(RSpec).to receive(:deprecate) { run = true }
+      expect {"bees"}.not_to raise_error
+      expect(run).to be_nil
+    end
+
+    it "passes if nothing is raised" do
+      expect {}.not_to raise_error
+    end
+
+    it "fails if anything is raised" do
+      expect {
+        expect { raise RuntimeError, "example message" }.not_to raise_error
+      }.to fail_with(/expected no Exception, got #<RuntimeError: example message>/)
+    end
+
+    it 'includes the backtrace of the error that was raised in the error message' do
+      expect {
+        expect { raise "boom" }.not_to raise_error
+      }.to raise_error { |e|
+        backtrace_line = "#{File.basename(__FILE__)}:#{__LINE__ - 2}"
+        expect(e.message).to include("with backtrace", backtrace_line)
+      }
+    end
+
+    it 'formats the backtrace using the configured backtrace formatter' do
+      RSpec::Matchers.configuration.backtrace_formatter.
+        stub(:format_backtrace).
+        and_return("formatted-backtrace")
+
+      expect {
+        expect { raise "boom" }.not_to raise_error
+      }.to raise_error { |e|
+        expect(e.message).to include("with backtrace", "formatted-backtrace")
+      }
+    end
+  end
+end
+
+describe "expect { ... }.to raise_error(message)" do
+  it "passes if RuntimeError is raised with the right message" do
+    expect {raise 'blah'}.to raise_error('blah')
+  end
+
+  it "passes if RuntimeError is raised with a matching message" do
+    expect {raise 'blah'}.to raise_error(/blah/)
+  end
+
+  it "passes if any other error is raised with the right message" do
+    expect {raise NameError.new('blah')}.to raise_error('blah')
+  end
+
+  it "fails if RuntimeError error is raised with the wrong message" do
+    expect do
+      expect {raise 'blarg'}.to raise_error('blah')
+    end.to fail_with(/expected Exception with \"blah\", got #<RuntimeError: blarg>/)
+  end
+
+  it "fails if any other error is raised with the wrong message" do
+    expect do
+      expect {raise NameError.new('blarg')}.to raise_error('blah')
+    end.to fail_with(/expected Exception with \"blah\", got #<NameError: blarg>/)
+  end
+
+  it 'includes the backtrace of any other error in the failure message' do
+    expect {
+      expect { raise "boom" }.to raise_error(ArgumentError)
+    }.to raise_error { |e|
+      backtrace_line = "#{File.basename(__FILE__)}:#{__LINE__ - 2}"
+      expect(e.message).to include("with backtrace", backtrace_line)
+    }
+  end
+end
+
+describe "expect { ... }.not_to raise_error(message)" do
+  before do
+    allow(RSpec).to receive(:deprecate)
+  end
+
+  it "is deprecated" do
+    expect(RSpec).to receive(:deprecate).with(/not_to raise_error\(message\)/, :replacement =>"`expect { }.not_to raise_error()`")
+    expect {raise 'blarg'}.not_to raise_error('blah')
+  end
+
+  it "passes if RuntimeError error is raised with the different message" do
+    expect {raise 'blarg'}.not_to raise_error('blah')
+  end
+
+  it "passes if any other error is raised with the wrong message" do
+    expect {raise NameError.new('blarg')}.not_to raise_error('blah')
+  end
+
+  it "fails if RuntimeError is raised with message" do
+    expect do
+      expect {raise 'blah'}.not_to raise_error('blah')
+    end.to fail_with(/expected no Exception with "blah", got #<RuntimeError: blah>/)
+  end
+
+  it "fails if any other error is raised with message" do
+    expect do
+      expect {raise NameError.new('blah')}.not_to raise_error('blah')
+    end.to fail_with(/expected no Exception with "blah", got #<NameError: blah>/)
+  end
+end
+
+describe "expect { ... }.to raise_error(NamedError)" do
+  it "passes if named error is raised" do
+    expect { non_existent_method }.to raise_error(NameError)
+  end
+
+  it "fails if nothing is raised" do
+    expect {
+      expect { }.to raise_error(NameError)
+    }.to fail_with(/expected NameError but nothing was raised/)
+  end
+
+  it "fails if another error is raised (NameError)" do
+    expect {
+      expect { raise RuntimeError, "example message" }.to raise_error(NameError)
+    }.to fail_with(/expected NameError, got #<RuntimeError: example message>/)
+  end
+
+  it "fails if another error is raised (NameError)" do
+    expect {
+      expect { load "non/existent/file" }.to raise_error(NameError)
+    }.to fail_with(/expected NameError, got #<LoadError/)
+  end
+end
+
+describe "expect { ... }.not_to raise_error(NamedError)" do
+  before do
+    allow(RSpec).to receive(:deprecate)
+  end
+
+  it "is deprecated" do
+    expect(RSpec).to receive(:deprecate).with(/not_to raise_error\(SpecificErrorClass\)/, :replacement => "`expect { }.not_to raise_error()`")
+    expect { }.not_to raise_error(NameError)
+  end
+
+  it "passes if nothing is raised" do
+    expect { }.not_to raise_error(NameError)
+  end
+
+  it "passes if another error is raised" do
+    expect { raise }.not_to raise_error(NameError)
+  end
+
+  it "fails if named error is raised" do
+    expect {
+      expect { 1 + 'b' }.not_to raise_error(TypeError)
+    }.to fail_with(/expected no TypeError, got #<TypeError: String can't be/)
+  end
+end
+
+describe "expect { ... }.to raise_error(NamedError, error_message) with String" do
+  it "passes if named error is raised with same message" do
+    expect { raise "example message" }.to raise_error(RuntimeError, "example message")
+  end
+
+  it "fails if nothing is raised" do
+    expect {
+      expect {}.to raise_error(RuntimeError, "example message")
+    }.to fail_with(/expected RuntimeError with \"example message\" but nothing was raised/)
+  end
+
+  it "fails if incorrect error is raised" do
+    expect {
+      expect { raise RuntimeError, "example message" }.to raise_error(NameError, "example message")
+    }.to fail_with(/expected NameError with \"example message\", got #<RuntimeError: example message>/)
+  end
+
+  it "fails if correct error is raised with incorrect message" do
+    expect {
+      expect { raise RuntimeError.new("not the example message") }.to raise_error(RuntimeError, "example message")
+    }.to fail_with(/expected RuntimeError with \"example message\", got #<RuntimeError: not the example message/)
+  end
+end
+
+describe "expect { ... }.not_to raise_error(NamedError, error_message) with String" do
+  before do
+    allow(RSpec).to receive(:deprecate)
+  end
+
+  it "is deprecated" do
+    expect(RSpec).to receive(:deprecate).with(/not_to raise_error\(SpecificErrorClass, message\)/, :replacement =>"`expect { }.not_to raise_error()`")
+    expect {}.not_to raise_error(RuntimeError, "example message")
+  end
+
+  it "passes if nothing is raised" do
+    expect {}.not_to raise_error(RuntimeError, "example message")
+  end
+
+  it "passes if a different error is raised" do
+    expect { raise }.not_to raise_error(NameError, "example message")
+  end
+
+  it "passes if same error is raised with different message" do
+    expect { raise RuntimeError.new("not the example message") }.not_to raise_error(RuntimeError, "example message")
+  end
+
+  it "fails if named error is raised with same message" do
+    expect {
+      expect { raise "example message" }.not_to raise_error(RuntimeError, "example message")
+    }.to fail_with(/expected no RuntimeError with \"example message\", got #<RuntimeError: example message>/)
+  end
+end
+
+describe "expect { ... }.to raise_error(NamedError, error_message) with Regexp" do
+  it "passes if named error is raised with matching message" do
+    expect { raise "example message" }.to raise_error(RuntimeError, /ample mess/)
+  end
+
+  it "fails if nothing is raised" do
+    expect {
+      expect {}.to raise_error(RuntimeError, /ample mess/)
+    }.to fail_with(/expected RuntimeError with message matching \/ample mess\/ but nothing was raised/)
+  end
+
+  it "fails if incorrect error is raised" do
+    expect {
+      expect { raise RuntimeError, "example message" }.to raise_error(NameError, /ample mess/)
+    }.to fail_with(/expected NameError with message matching \/ample mess\/, got #<RuntimeError: example message>/)
+  end
+
+  it "fails if correct error is raised with incorrect message" do
+    expect {
+      expect { raise RuntimeError.new("not the example message") }.to raise_error(RuntimeError, /less than ample mess/)
+    }.to fail_with(/expected RuntimeError with message matching \/less than ample mess\/, got #<RuntimeError: not the example message>/)
+  end
+end
+
+describe "expect { ... }.not_to raise_error(NamedError, error_message) with Regexp" do
+  before do
+    allow(RSpec).to receive(:deprecate)
+  end
+
+  it "is deprecated" do
+    expect(RSpec).to receive(:deprecate)
+    expect {}.not_to raise_error(RuntimeError, /ample mess/)
+  end
+
+  it "passes if nothing is raised" do
+    expect {}.not_to raise_error(RuntimeError, /ample mess/)
+  end
+
+  it "passes if a different error is raised" do
+    expect { raise }.not_to raise_error(NameError, /ample mess/)
+  end
+
+  it "passes if same error is raised with non-matching message" do
+    expect { raise RuntimeError.new("non matching message") }.not_to raise_error(RuntimeError, /ample mess/)
+  end
+
+  it "fails if named error is raised with matching message" do
+    expect {
+      expect { raise "example message" }.not_to raise_error(RuntimeError, /ample mess/)
+    }.to fail_with(/expected no RuntimeError with message matching \/ample mess\/, got #<RuntimeError: example message>/)
+  end
+end
+
+describe "expect { ... }.to raise_error(NamedError, error_message) { |err| ... }" do
+  it "yields exception if named error is raised with same message" do
+    ran = false
+
+    expect {
+      raise "example message"
+    }.to raise_error(RuntimeError, "example message") { |err|
+      ran = true
+      expect(err.class).to eq RuntimeError
+      expect(err.message).to eq "example message"
+    }
+
+    expect(ran).to be(true)
+  end
+
+  it "yielded block fails on it's own right" do
+    ran, passed = false, false
+
+    expect {
+      expect {
+        raise "example message"
+      }.to raise_error(RuntimeError, "example message") { |err|
+        ran = true
+        expect(5).to eq 4
+        passed = true
+      }
+    }.to fail_with(/expected: 4/m)
+
+    expect(ran).to    be_true
+    expect(passed).to be_false
+  end
+
+  it "does NOT yield exception if no error was thrown" do
+    ran = false
+
+    expect {
+      expect {}.to raise_error(RuntimeError, "example message") { |err|
+        ran = true
+      }
+    }.to fail_with(/expected RuntimeError with \"example message\" but nothing was raised/)
+
+    expect(ran).to eq false
+  end
+
+  it "does not yield exception if error class is not matched" do
+    ran = false
+
+    expect {
+      expect {
+        raise "example message"
+      }.to raise_error(SyntaxError, "example message") { |err|
+        ran = true
+      }
+    }.to fail_with(/expected SyntaxError with \"example message\", got #<RuntimeError: example message>/)
+
+    expect(ran).to eq false
+  end
+
+  it "does NOT yield exception if error message is not matched" do
+    ran = false
+
+    expect {
+      expect {
+        raise "example message"
+      }.to raise_error(RuntimeError, "different message") { |err|
+        ran = true
+      }
+    }.to fail_with(/expected RuntimeError with \"different message\", got #<RuntimeError: example message>/)
+
+    expect(ran).to eq false
+  end
+end
+
+describe "expect { ... }.not_to raise_error(NamedError, error_message) { |err| ... }" do
+  before do
+    allow(RSpec).to receive(:deprecate)
+  end
+
+  it "is deprecated" do
+    expect(RSpec).to receive(:deprecate)
+    expect {}.not_to raise_error(RuntimeError, "example message") { |err| }
+  end
+
+  it "passes if nothing is raised" do
+    ran = false
+
+    expect {}.not_to raise_error(RuntimeError, "example message") { |err|
+      ran = true
+    }
+
+    expect(ran).to eq false
+  end
+
+  it "passes if a different error is raised" do
+    ran = false
+
+    expect { raise }.not_to raise_error(NameError, "example message") { |err|
+      ran = true
+    }
+
+    expect(ran).to eq false
+  end
+
+  it "passes if same error is raised with different message" do
+    ran = false
+
+    expect {
+      raise RuntimeError.new("not the example message")
+    }.not_to raise_error(RuntimeError, "example message") { |err|
+      ran = true
+    }
+
+    expect(ran).to eq false
+  end
+
+  it "fails if named error is raised with same message" do
+    ran = false
+
+    expect {
+      expect {
+        raise "example message"
+      }.not_to raise_error(RuntimeError, "example message") { |err|
+        ran = true
+      }
+    }.to fail_with(/expected no RuntimeError with \"example message\", got #<RuntimeError: example message>/)
+
+    expect(ran).to eq false
+  end
+
+  it 'skips the error verification block when using the expect {...}.to syntax' do
+    ran = false
+
+    expect {
+      expect {
+        raise "example message"
+      }.not_to raise_error(RuntimeError, "example message") { |err|
+        ran = true
+      }
+    }.to fail_with(/expected no RuntimeError with \"example message\", got #<RuntimeError: example message>/)
+
+    expect(ran).to eq false
+  end
+end
+
+describe "misuse of raise_error, with (), not {}" do
+  it "fails with warning" do
+    ::Kernel.should_receive(:warn).with(/`raise_error` was called with non-proc object 1\.7/)
+    expect {
+      expect(Math.sqrt(3)).to raise_error
+    }.to fail_with(/nothing was raised/)
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/respond_to_spec.rb b/rspec-expectations/spec/rspec/matchers/respond_to_spec.rb
new file mode 100644
index 0000000..e8c83b3
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/respond_to_spec.rb
@@ -0,0 +1,292 @@
+require 'spec_helper'
+
+describe "expect(...).to respond_to(:sym)" do
+  it_behaves_like "an RSpec matcher", :valid_value => "s", :invalid_value => 5 do
+    let(:matcher) { respond_to(:upcase) }
+  end
+
+  it "passes if target responds to :sym" do
+    expect(Object.new).to respond_to(:methods)
+  end
+
+  it "fails if target does not respond to :sym" do
+    expect {
+      expect("this string").to respond_to(:some_method)
+    }.to fail_with(%q|expected "this string" to respond to :some_method|)
+  end
+end
+
+describe "expect(...).to respond_to(:sym).with(1).argument" do
+  it "passes if target responds to :sym with 1 arg" do
+    obj = Object.new
+    def obj.foo(arg); end
+    expect(obj).to respond_to(:foo).with(1).argument
+  end
+
+  it "passes if target responds to any number of arguments" do
+    obj = Object.new
+    def obj.foo(*args); end
+    expect(obj).to respond_to(:foo).with(1).argument
+  end
+
+  it "passes if target responds to one or more arguments" do
+    obj = Object.new
+    def obj.foo(a, *args); end
+    expect(obj).to respond_to(:foo).with(1).argument
+  end
+
+  it "fails if target does not respond to :sym" do
+    obj = Object.new
+    expect {
+      expect(obj).to respond_to(:some_method).with(1).argument
+    }.to fail_with(/expected .* to respond to :some_method/)
+  end
+
+  it "fails if :sym expects 0 args" do
+    obj = Object.new
+    def obj.foo; end
+    expect {
+      expect(obj).to respond_to(:foo).with(1).argument
+    }.to fail_with(/expected #<Object.*> to respond to :foo with 1 argument/)
+  end
+
+  it "fails if :sym expects 2 args" do
+    obj = Object.new
+    def obj.foo(arg, arg2); end
+    expect {
+      expect(obj).to respond_to(:foo).with(1).argument
+    }.to fail_with(/expected #<Object.*> to respond to :foo with 1 argument/)
+  end
+
+  it "fails if :sym expects 2 or more args" do
+    obj = Object.new
+    def obj.foo(arg, arg2, *args); end
+    expect {
+      expect(obj).to respond_to(:foo).with(1).argument
+    }.to fail_with(/expected #<Object.*> to respond to :foo with 1 argument/)
+  end
+end
+
+describe "expect(...).to respond_to(message1, message2)" do
+  it "passes if target responds to both messages" do
+    expect(Object.new).to respond_to('methods', 'inspect')
+  end
+
+  it "fails if target does not respond to first message" do
+    expect {
+      expect(Object.new).to respond_to('method_one', 'inspect')
+    }.to fail_with(/expected #<Object:.*> to respond to "method_one"/)
+  end
+
+  it "fails if target does not respond to second message" do
+    expect {
+      expect(Object.new).to respond_to('inspect', 'method_one')
+    }.to fail_with(/expected #<Object:.*> to respond to "method_one"/)
+  end
+
+  it "fails if target does not respond to either message" do
+    expect {
+      expect(Object.new).to respond_to('method_one', 'method_two')
+    }.to fail_with(/expected #<Object:.*> to respond to "method_one", "method_two"/)
+  end
+end
+
+describe "expect(...).to respond_to(:sym).with(2).arguments" do
+  it "passes if target responds to :sym with 2 args" do
+    obj = Object.new
+    def obj.foo(a1, a2); end
+    expect(obj).to respond_to(:foo).with(2).arguments
+  end
+
+  it "passes if target responds to any number of arguments" do
+    obj = Object.new
+    def obj.foo(*args); end
+    expect(obj).to respond_to(:foo).with(2).arguments
+  end
+
+  it "passes if target responds to one or more arguments" do
+    obj = Object.new
+    def obj.foo(a, *args); end
+    expect(obj).to respond_to(:foo).with(2).arguments
+  end
+
+  it "passes if target responds to two or more arguments" do
+    obj = Object.new
+    def obj.foo(a, b, *args); end
+    expect(obj).to respond_to(:foo).with(2).arguments
+  end
+
+  it "fails if target does not respond to :sym" do
+    obj = Object.new
+    expect {
+      expect(obj).to respond_to(:some_method).with(2).arguments
+    }.to fail_with(/expected .* to respond to :some_method/)
+  end
+
+  it "fails if :sym expects 0 args" do
+    obj = Object.new
+    def obj.foo; end
+    expect {
+      expect(obj).to respond_to(:foo).with(2).arguments
+    }.to fail_with(/expected #<Object.*> to respond to :foo with 2 arguments/)
+  end
+
+  it "fails if :sym expects 1 args" do
+    obj = Object.new
+    def obj.foo(arg); end
+    expect {
+      expect(obj).to respond_to(:foo).with(2).arguments
+    }.to fail_with(/expected #<Object.*> to respond to :foo with 2 arguments/)
+  end
+
+  it "fails if :sym expects 3 or more args" do
+    obj = Object.new
+    def obj.foo(arg, arg2, arg3, *args); end
+    expect {
+      expect(obj).to respond_to(:foo).with(2).arguments
+    }.to fail_with(/expected #<Object.*> to respond to :foo with 2 arguments/)
+  end
+end
+
+describe "expect(...).not_to respond_to(:sym)" do
+  it "passes if target does not respond to :sym" do
+    expect(Object.new).not_to respond_to(:some_method)
+  end
+
+  it "fails if target responds to :sym" do
+    expect {
+      expect(Object.new).not_to respond_to(:methods)
+    }.to fail_with(/expected #<Object:.*> not to respond to :methods/)
+  end
+end
+
+describe "expect(...).not_to respond_to(:sym).with(1).argument" do
+  it "fails if target responds to :sym with 1 arg" do
+    obj = Object.new
+    def obj.foo(arg); end
+    expect {
+      expect(obj).not_to respond_to(:foo).with(1).argument
+    }.to fail_with(/expected #<Object:.*> not to respond to :foo with 1 argument/)
+  end
+
+  it "fails if target responds to :sym with any number of args" do
+    obj = Object.new
+    def obj.foo(*args); end
+    expect {
+      expect(obj).not_to respond_to(:foo).with(1).argument
+    }.to fail_with(/expected #<Object:.*> not to respond to :foo with 1 argument/)
+  end
+
+  it "fails if target responds to :sym with one or more args" do
+    obj = Object.new
+    def obj.foo(a, *args); end
+    expect {
+      expect(obj).not_to respond_to(:foo).with(1).argument
+    }.to fail_with(/expected #<Object:.*> not to respond to :foo with 1 argument/)
+  end
+
+  it "passes if target does not respond to :sym" do
+    obj = Object.new
+    expect(obj).not_to respond_to(:some_method).with(1).argument
+  end
+
+  it "passes if :sym expects 0 args" do
+    obj = Object.new
+    def obj.foo; end
+    expect(obj).not_to respond_to(:foo).with(1).argument
+  end
+
+  it "passes if :sym expects 2 args" do
+    obj = Object.new
+    def obj.foo(arg, arg2); end
+    expect(obj).not_to respond_to(:foo).with(1).argument
+  end
+
+  it "passes if :sym expects 2 or more args" do
+    obj = Object.new
+    def obj.foo(arg, arg2, *args); end
+    expect(obj).not_to respond_to(:foo).with(1).argument
+  end
+end
+
+describe "expect(...).not_to respond_to(message1, message2)" do
+  it "passes if target does not respond to either message1 or message2" do
+    expect(Object.new).not_to respond_to(:some_method, :some_other_method)
+  end
+
+  it "fails if target responds to message1 but not message2" do
+    expect {
+      expect(Object.new).not_to respond_to(:object_id, :some_method)
+    }.to fail_with(/expected #<Object:.*> not to respond to :object_id/)
+  end
+
+  it "fails if target responds to message2 but not message1" do
+    expect {
+      expect(Object.new).not_to respond_to(:some_method, :object_id)
+    }.to fail_with(/expected #<Object:.*> not to respond to :object_id/)
+  end
+
+  it "fails if target responds to both message1 and message2" do
+    expect {
+      expect(Object.new).not_to respond_to(:class, :object_id)
+    }.to fail_with(/expected #<Object:.*> not to respond to :class, :object_id/)
+  end
+end
+
+describe "expect(...).not_to respond_to(:sym).with(2).arguments" do
+  it "fails if target responds to :sym with 2 args" do
+    obj = Object.new
+    def obj.foo(a1, a2); end
+    expect {
+      expect(obj).not_to respond_to(:foo).with(2).arguments
+    }.to fail_with(/expected .* not to respond to :foo with 2 arguments/)
+  end
+
+  it "fails if target responds to :sym with any number args" do
+    obj = Object.new
+    def obj.foo(*args); end
+    expect {
+      expect(obj).not_to respond_to(:foo).with(2).arguments
+    }.to fail_with(/expected .* not to respond to :foo with 2 arguments/)
+  end
+
+  it "fails if target responds to :sym with one or more args" do
+    obj = Object.new
+    def obj.foo(a, *args); end
+    expect {
+      expect(obj).not_to respond_to(:foo).with(2).arguments
+    }.to fail_with(/expected .* not to respond to :foo with 2 arguments/)
+  end
+
+  it "fails if target responds to :sym with two or more args" do
+    obj = Object.new
+    def obj.foo(a, b, *args); end
+    expect {
+      expect(obj).not_to respond_to(:foo).with(2).arguments
+    }.to fail_with(/expected .* not to respond to :foo with 2 arguments/)
+  end
+
+  it "passes if target does not respond to :sym" do
+    obj = Object.new
+    expect(obj).not_to respond_to(:some_method).with(2).arguments
+  end
+
+  it "passes if :sym expects 0 args" do
+    obj = Object.new
+    def obj.foo; end
+    expect(obj).not_to respond_to(:foo).with(2).arguments
+  end
+
+  it "passes if :sym expects 2 args" do
+    obj = Object.new
+    def obj.foo(arg); end
+    expect(obj).not_to respond_to(:foo).with(2).arguments
+  end
+
+  it "passes if :sym expects 3 or more args" do
+    obj = Object.new
+    def obj.foo(a, b, c, *arg); end
+    expect(obj).not_to respond_to(:foo).with(2).arguments
+  end
+end
+
diff --git a/rspec-expectations/spec/rspec/matchers/satisfy_spec.rb b/rspec-expectations/spec/rspec/matchers/satisfy_spec.rb
new file mode 100644
index 0000000..d525852
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/satisfy_spec.rb
@@ -0,0 +1,44 @@
+require 'spec_helper'
+
+describe "expect(...).to satisfy { block }" do
+  it_behaves_like "an RSpec matcher", :valid_value => true, :invalid_value => false do
+    let(:matcher) { satisfy { |v| v } }
+  end
+
+  it "describes itself" do
+    expect(satisfy.description).to eq("satisfy block")
+  end
+
+  it "passes if block returns true" do
+    expect(true).to satisfy { |val| val }
+    expect(true).to satisfy do |val|
+      val
+    end
+  end
+
+  it "fails if block returns false" do
+    expect {
+      expect(false).to satisfy { |val| val }
+    }.to fail_with("expected false to satisfy block")
+    expect do
+      expect(false).to satisfy do |val|
+        val
+      end
+    end.to fail_with("expected false to satisfy block")
+  end
+end
+
+describe "expect(...).not_to satisfy { block }" do
+  it "passes if block returns false" do
+    expect(false).not_to satisfy { |val| val }
+    expect(false).not_to satisfy do |val|
+      val
+    end
+  end
+
+  it "fails if block returns true" do
+    expect {
+      expect(true).not_to satisfy { |val| val }
+    }.to fail_with("expected true not to satisfy block")
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/start_with_end_with_spec.rb b/rspec-expectations/spec/rspec/matchers/start_with_end_with_spec.rb
new file mode 100644
index 0000000..c589cc6
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/start_with_end_with_spec.rb
@@ -0,0 +1,186 @@
+require "spec_helper"
+
+describe "expect(...).to start_with" do
+  it_behaves_like "an RSpec matcher", :valid_value => "ab", :invalid_value => "bc" do
+    let(:matcher) { start_with("a") }
+  end
+
+  context "with a string" do
+    it "passes if it matches the start of the actual string" do
+      expect("this string").to start_with "this str"
+    end
+
+    it "fails if it does not match the start of the actual string" do
+      expect {
+        expect("this string").to start_with "that str"
+      }.to fail_with("expected \"this string\" to start with \"that str\"")
+    end
+  end
+
+  context "with an array" do
+    it "passes if it is the first element of the array" do
+      expect([0, 1, 2]).to start_with 0
+    end
+
+    it "passes if the first elements of the array match" do
+      expect([0, 1, 2]).to start_with 0, 1
+    end
+
+    it "fails if it does not match the first element of the array" do
+      expect {
+        expect([0, 1, 2]).to start_with 2
+      }.to fail_with("expected [0, 1, 2] to start with 2")
+    end
+
+    it "fails if it the first elements of the array do not match" do
+      expect {
+        expect([0, 1, 2]).to start_with 1, 2
+      }.to fail_with("expected [0, 1, 2] to start with [1, 2]")
+    end
+  end
+
+  context "with an object that does not respond to :[]" do
+    it "raises an ArgumentError" do
+      expect {
+        expect(Object.new).to start_with 0
+      }.to raise_error(ArgumentError, /does not respond to :\[\]/)
+    end
+  end
+
+  context "with a hash" do
+    it "raises an ArgumentError if trying to match more than one element" do
+      expect{
+        expect({:a => 'b', :b => 'b', :c => 'c'}).to start_with({:a => 'b', :b => 'b'})
+      }.to raise_error(ArgumentError, /does not have ordered elements/)
+    end
+  end
+end
+
+describe "expect(...).not_to start_with" do
+  context "with a string" do
+    it "passes if it does not match the start of the actual string" do
+      expect("this string").not_to start_with "that str"
+    end
+
+    it "fails if it does match the start of the actual string" do
+      expect {
+        expect("this string").not_to start_with "this str"
+      }.to fail_with("expected \"this string\" not to start with \"this str\"")
+    end
+  end
+
+  context "with an array" do
+    it "passes if it is not the first element of the array" do
+      expect([0, 1, 2]).not_to start_with 2
+    end
+
+    it "passes if the first elements of the array do not match" do
+      expect([0, 1, 2]).not_to start_with 1, 2
+    end
+
+    it "fails if it matches the first element of the array" do
+      expect {
+        expect([0, 1, 2]).not_to start_with 0
+      }.to fail_with("expected [0, 1, 2] not to start with 0")
+    end
+
+    it "fails if it the first elements of the array match" do
+      expect {
+        expect([0, 1, 2]).not_to start_with 0, 1
+      }.to fail_with("expected [0, 1, 2] not to start with [0, 1]")
+    end
+  end
+end
+
+describe "expect(...).to end_with" do
+  it_behaves_like "an RSpec matcher", :valid_value => "ab", :invalid_value => "bc" do
+    let(:matcher) { end_with("b") }
+  end
+
+  context "with a string" do
+    it "passes if it matches the end of the actual string" do
+      expect("this string").to end_with "is string"
+    end
+
+    it "fails if it does not match the end of the actual string" do
+      expect {
+        expect("this string").to end_with "is stringy"
+      }.to fail_with("expected \"this string\" to end with \"is stringy\"")
+    end
+  end
+
+  context "with an array" do
+    it "passes if it is the last element of the array" do
+      expect([0, 1, 2]).to end_with 2
+    end
+
+    it "passes if the last elements of the array match" do
+      expect([0, 1, 2]).to end_with [1, 2]
+    end
+
+    it "fails if it does not match the last element of the array" do
+      expect {
+        expect([0, 1, 2]).to end_with 1
+      }.to fail_with("expected [0, 1, 2] to end with 1")
+    end
+
+    it "fails if it the last elements of the array do not match" do
+      expect {
+        expect([0, 1, 2]).to end_with [0, 1]
+      }.to fail_with("expected [0, 1, 2] to end with [0, 1]")
+    end
+  end
+
+  context "with an object that does not respond to :[]" do
+    it "raises an error if expected value can't be indexed'" do
+      expect {
+        expect(Object.new).to end_with 0
+      }.to raise_error(ArgumentError, /does not respond to :\[\]/)
+    end
+  end
+
+  context "with a hash" do
+    it "raises an ArgumentError if trying to match more than one element" do
+      expect{
+        expect({:a => 'b', :b => 'b', :c => 'c'}).to end_with({:a => 'b', :b =>'b'})
+      }.to raise_error(ArgumentError, /does not have ordered elements/)
+    end
+  end
+
+end
+
+describe "expect(...).not_to end_with" do
+  context "with a sting" do
+    it "passes if it does not match the end of the actual string" do
+      expect("this string").not_to end_with "stringy"
+    end
+
+    it "fails if it matches the end of the actual string" do
+      expect {
+        expect("this string").not_to end_with "string"
+      }.to fail_with("expected \"this string\" not to end with \"string\"")
+    end
+  end
+
+  context "an array" do
+    it "passes if it is not the last element of the array" do
+      expect([0, 1, 2]).not_to end_with 1
+    end
+
+    it "passes if the last elements of the array do not match" do
+      expect([0, 1, 2]).not_to end_with [0, 1]
+    end
+
+    it "fails if it matches the last element of the array" do
+      expect {
+        expect([0, 1, 2]).not_to end_with 2
+      }.to fail_with("expected [0, 1, 2] not to end with 2")
+    end
+
+    it "fails if it the last elements of the array match" do
+      expect {
+        expect([0, 1, 2]).not_to end_with [1, 2]
+      }.to fail_with("expected [0, 1, 2] not to end with [1, 2]")
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/throw_symbol_spec.rb b/rspec-expectations/spec/rspec/matchers/throw_symbol_spec.rb
new file mode 100644
index 0000000..9241f43
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/throw_symbol_spec.rb
@@ -0,0 +1,116 @@
+require 'spec_helper'
+
+module RSpec::Matchers::BuiltIn
+  describe ThrowSymbol do
+    it_behaves_like("an RSpec matcher", :valid_value => lambda { throw :foo },
+                                        :invalid_value => lambda { }) do
+      let(:matcher) { throw_symbol(:foo) }
+    end
+
+    describe "with no args" do
+      before(:each) { @matcher = throw_symbol }
+
+      it "matches if any Symbol is thrown" do
+        expect(@matcher.matches?(lambda{ throw :sym })).to be_true
+      end
+      it "matches if any Symbol is thrown with an arg" do
+        expect(@matcher.matches?(lambda{ throw :sym, "argument" })).to be_true
+      end
+      it "does not match if no Symbol is thrown" do
+        expect(@matcher.matches?(lambda{ })).to be_false
+      end
+      it "provides a failure message" do
+        @matcher.matches?(lambda{})
+        expect(@matcher.failure_message_for_should).to eq "expected a Symbol to be thrown, got nothing"
+      end
+      it "provides a negative failure message" do
+        @matcher.matches?(lambda{ throw :sym})
+        expect(@matcher.failure_message_for_should_not).to eq "expected no Symbol to be thrown, got :sym"
+      end
+    end
+
+    describe "with a symbol" do
+      before(:each) { @matcher = throw_symbol(:sym) }
+
+      it "matches if correct Symbol is thrown" do
+        expect(@matcher.matches?(lambda{ throw :sym })).to be_true
+      end
+      it "matches if correct Symbol is thrown with an arg" do
+        expect(@matcher.matches?(lambda{ throw :sym, "argument" })).to be_true
+      end
+      it "does not match if no Symbol is thrown" do
+        expect(@matcher.matches?(lambda{ })).to be_false
+      end
+      it "does not match if correct Symbol is thrown" do
+        expect(@matcher.matches?(lambda{ throw :other_sym })).to be_false
+      end
+      it "provides a failure message when no Symbol is thrown" do
+        @matcher.matches?(lambda{})
+        expect(@matcher.failure_message_for_should).to eq "expected :sym to be thrown, got nothing"
+      end
+      it "provides a failure message when wrong Symbol is thrown" do
+        @matcher.matches?(lambda{ throw :other_sym })
+        expect(@matcher.failure_message_for_should).to eq "expected :sym to be thrown, got :other_sym"
+      end
+      it "provides a negative failure message" do
+        @matcher.matches?(lambda{ throw :sym })
+        expect(@matcher.failure_message_for_should_not).to eq "expected :sym not to be thrown, got :sym"
+      end
+      it "only matches NameErrors raised by uncaught throws" do
+        expect {
+          expect(@matcher.matches?(lambda{ sym })).to be_false
+        }.to raise_error(NameError)
+      end
+    end
+
+    describe "with a symbol and an arg" do
+      before(:each) { @matcher = throw_symbol(:sym, "a") }
+
+      it "matches if correct Symbol and args are thrown" do
+        expect(@matcher.matches?(lambda{ throw :sym, "a" })).to be_true
+      end
+      it "does not match if nothing is thrown" do
+        expect(@matcher.matches?(lambda{ })).to be_false
+      end
+      it "does not match if other Symbol is thrown" do
+        expect(@matcher.matches?(lambda{ throw :other_sym, "a" })).to be_false
+      end
+      it "does not match if no arg is thrown" do
+        expect(@matcher.matches?(lambda{ throw :sym })).to be_false
+      end
+      it "does not match if wrong arg is thrown" do
+        expect(@matcher.matches?(lambda{ throw :sym, "b" })).to be_false
+      end
+      it "provides a failure message when no Symbol is thrown" do
+        @matcher.matches?(lambda{})
+        expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got nothing]
+      end
+      it "provides a failure message when wrong Symbol is thrown" do
+        @matcher.matches?(lambda{ throw :other_sym })
+        expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got :other_sym]
+      end
+      it "provides a failure message when wrong arg is thrown" do
+        @matcher.matches?(lambda{ throw :sym, "b" })
+        expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got :sym with "b"]
+      end
+      it "provides a failure message when no arg is thrown" do
+        @matcher.matches?(lambda{ throw :sym })
+        expect(@matcher.failure_message_for_should).to eq %q[expected :sym with "a" to be thrown, got :sym with no argument]
+      end
+      it "provides a negative failure message" do
+        @matcher.matches?(lambda{ throw :sym })
+        expect(@matcher.failure_message_for_should_not).to eq %q[expected :sym with "a" not to be thrown, got :sym with no argument]
+      end
+      it "only matches NameErrors raised by uncaught throws" do
+        expect {
+          expect(@matcher.matches?(lambda{ sym })).to be_false
+        }.to raise_error(NameError)
+      end
+      it "raises other errors" do
+        expect {
+          @matcher.matches?(lambda { raise "Boom" })
+        }.to raise_error(/Boom/)
+      end
+    end
+  end
+end
diff --git a/rspec-expectations/spec/rspec/matchers/yield_spec.rb b/rspec-expectations/spec/rspec/matchers/yield_spec.rb
new file mode 100644
index 0000000..6236587
--- /dev/null
+++ b/rspec-expectations/spec/rspec/matchers/yield_spec.rb
@@ -0,0 +1,514 @@
+require 'spec_helper'
+
+module YieldHelpers
+  # these helpers are prefixed with an underscore to prevent
+  # collisions with the matchers (some of which have the same names)
+  def _dont_yield
+  end
+
+  def _yield_with_no_args
+    yield
+  end
+
+  def _yield_with_args(*args)
+    yield(*args)
+  end
+end
+
+class InstanceEvaler
+  include RSpec::Matchers::Extensions::InstanceEvalWithArgs
+
+  def yield_with_no_args(&block)
+    instance_eval_with_args(&block)
+  end
+
+  def yield_with_args(*args, &block)
+    instance_eval_with_args(*args, &block)
+  end
+
+  def each_arg(*args, &block)
+    args.each do |arg|
+      instance_eval_with_args(arg, &block)
+    end
+  end
+end
+
+describe "yield_control matcher" do
+  include YieldHelpers
+  extend  YieldHelpers
+
+  it_behaves_like "an RSpec matcher",
+      :valid_value => lambda { |b| _yield_with_no_args(&b) },
+      :invalid_value => lambda { |b| _dont_yield(&b) } do
+    let(:matcher) { yield_control }
+  end
+
+  it 'has a description' do
+    expect(yield_control.description).to eq("yield control")
+  end
+
+  describe "expect {...}.to yield_control" do
+    it 'passes if the block yields, regardless of the number of yielded arguments' do
+      expect { |b| _yield_with_no_args(&b) }.to yield_control
+      expect { |b| _yield_with_args(1, 2, &b) }.to yield_control
+    end
+
+    it 'passes if the block yields using instance_eval' do
+      expect { |b| InstanceEvaler.new.yield_with_no_args(&b) }.to yield_control
+    end
+
+    it 'fails if the block does not yield' do
+      expect {
+        expect { |b| _dont_yield(&b) }.to yield_control
+      }.to fail_with(/expected given block to yield control/)
+    end
+
+    context "with exact count" do
+      it 'fails if the block yields wrong number of times' do
+        expect {
+          expect { |b| [1, 2, 3].each(&b) }.to yield_control.twice
+        }.to fail_with(/expected given block to yield control twice/)
+
+        expect {
+          expect { |b| [1, 2].each(&b) }.to yield_control.exactly(3).times
+        }.to fail_with(/expected given block to yield control 3 times/)
+      end
+
+      it 'passes if the block yields the specified number of times' do
+        expect { |b| [1].each(&b) }.to yield_control.once
+        expect { |b| [1, 2].each(&b) }.to yield_control.twice
+        expect { |b| [1, 2, 3].each(&b) }.to yield_control.exactly(3).times
+      end
+    end
+
+    context "with at_least count" do
+      it 'passes if the block yields the given number of times' do
+        expect { |b| [1, 2].each(&b) }.to yield_control.at_least(2).times
+        expect { |b| [1, 2, 3].each(&b) }.to yield_control.at_least(3).times
+      end
+
+      it 'passes if the block yields more times' do
+        expect { |b| [1, 2, 3].each(&b) }.to yield_control.at_least(2).times
+        expect { |b| [1, 2, 3, 4].each(&b) }.to yield_control.at_least(3).times
+      end
+
+      it 'allows :once and :twice to be passed as counts' do
+        expect { |b| [1].each(&b) }.to yield_control.at_least(:once)
+        expect { |b| [1, 2].each(&b) }.to yield_control.at_least(:once)
+
+        expect {
+          expect { |b| [].each(&b) }.to yield_control.at_least(:once)
+        }.to fail_with(/at least once/)
+
+        expect { |b| [1, 2].each(&b) }.to yield_control.at_least(:twice)
+        expect { |b| [1, 2, 3].each(&b) }.to yield_control.at_least(:twice)
+
+        expect {
+          expect { |b| [1].each(&b) }.to yield_control.at_least(:twice)
+        }.to fail_with(/at least twice/)
+      end
+
+      it 'fails if the block yields too few times' do
+        expect {
+          expect { |b| _yield_with_no_args(&b) }.to yield_control.at_least(2).times
+        }.to fail_with(/expected given block to yield control at least twice/)
+      end
+    end
+
+    context "with at_most count" do
+      it 'passes if the block yields the given number of times' do
+        expect { |b| [1, 2].each(&b) }.to yield_control.at_most(2).times
+        expect { |b| [1, 2, 3].each(&b) }.to yield_control.at_most(3).times
+      end
+
+      it 'passes if the block yields fewer times' do
+        expect { |b| [1, 2].each(&b) }.to yield_control.at_most(3).times
+      end
+
+      it 'allows :once and :twice to be passed as counts' do
+        expect { |b| [1].each(&b) }.to yield_control.at_most(:once)
+
+        expect {
+          expect { |b| [1, 2].each(&b) }.to yield_control.at_most(:once)
+        }.to fail_with(/expected given block to yield control at most once/)
+
+        expect { |b| [1, 2].each(&b) }.to yield_control.at_most(:twice)
+
+        expect {
+          expect { |b| [1, 2, 3].each(&b) }.to yield_control.at_most(:twice)
+        }.to fail_with(/expected given block to yield control at most twice/)
+      end
+
+      it 'fails if the block yields too many times' do
+        expect {
+          expect { |b| [1, 2, 3].each(&b) }.to yield_control.at_most(2).times
+        }.to fail_with(/expected given block to yield control at most twice/)
+      end
+    end
+  end
+
+  describe "expect {...}.not_to yield_control" do
+    it 'passes if the block does not yield' do
+      expect { |b| _dont_yield(&b) }.not_to yield_control
+    end
+
+    it 'fails if the block does yield' do
+      expect {
+        expect { |b| _yield_with_no_args(&b) }.not_to yield_control
+      }.to fail_with(/expected given block not to yield control/)
+    end
+
+    it 'fails if the expect block does not accept an argument' do
+      expect {
+        expect { }.not_to yield_control
+      }.to raise_error(/expect block must accept an argument/)
+    end
+
+    it 'raises an error if the expect block arg is not passed to a method as a block' do
+      expect {
+        expect { |b| }.not_to yield_control
+      }.to raise_error(/must pass the argument.*as a block/)
+    end
+  end
+end
+
+describe "yield_with_no_args matcher" do
+  include YieldHelpers
+  extend  YieldHelpers
+
+  it_behaves_like "an RSpec matcher",
+      :valid_value => lambda { |b| _yield_with_no_args(&b) },
+      :invalid_value => lambda { |b| _dont_yield(&b) } do
+    let(:matcher) { yield_with_no_args }
+  end
+
+  it 'has a description' do
+    expect(yield_with_no_args.description).to eq("yield with no args")
+  end
+
+  describe "expect {...}.to yield_with_no_args" do
+    it 'passes if the block yields with no args' do
+      expect { |b| _yield_with_no_args(&b) }.to yield_with_no_args
+    end
+
+    it 'passes if the block yields with no args using instance_eval' do
+      expect { |b| InstanceEvaler.new.yield_with_no_args(&b) }.to yield_with_no_args
+    end
+
+    it 'fails if the block does not yield' do
+      expect {
+        expect { |b| _dont_yield(&b) }.to yield_with_no_args
+      }.to fail_with(/expected given block to yield with no arguments, but did not yield/)
+    end
+
+    it 'fails if the block yields with args' do
+      expect {
+        expect { |b| _yield_with_args(1, &b) }.to yield_with_no_args
+      }.to fail_with(/expected given block to yield with no arguments, but yielded with arguments/)
+    end
+
+    it 'fails if the block yields with arg false' do
+      expect {
+        expect { |b| _yield_with_args(false, &b) }.to yield_with_no_args
+      }.to fail_with(/expected given block to yield with no arguments, but yielded with arguments/)
+    end
+
+    it 'raises an error if it yields multiple times' do
+      expect {
+        expect { |b| [1, 2].each(&b) }.to yield_with_no_args
+      }.to raise_error(/not designed.*yields multiple times/)
+    end
+  end
+
+  describe "expect {...}.not_to yield_with_no_args" do
+    it "passes if the block does not yield" do
+      expect { |b| _dont_yield(&b) }.not_to yield_with_no_args
+    end
+
+    it "passes if the block yields with args" do
+      expect { |b| _yield_with_args(1, &b) }.not_to yield_with_no_args
+    end
+
+    it "fails if the block yields with no args" do
+      expect {
+        expect { |b| _yield_with_no_args(&b) }.not_to yield_with_no_args
+      }.to fail_with(/expected given block not to yield with no arguments, but did/)
+    end
+
+    it 'fails if the expect block does not accept an argument' do
+      expect {
+        expect { }.not_to yield_with_no_args
+      }.to raise_error(/expect block must accept an argument/)
+    end
+
+    it 'raises an error if the expect block arg is not passed to a method as a block' do
+      expect {
+        expect { |b| }.not_to yield_with_no_args
+      }.to raise_error(/must pass the argument.*as a block/)
+    end
+  end
+end
+
+describe "yield_with_args matcher" do
+  include YieldHelpers
+  extend  YieldHelpers
+
+  it_behaves_like "an RSpec matcher",
+      :valid_value => lambda { |b| _yield_with_args(1, &b) },
+      :invalid_value => lambda { |b| _dont_yield(&b) } do
+    let(:matcher) { yield_with_args }
+  end
+
+  it 'has a description' do
+    expect(yield_with_args.description).to eq("yield with args")
+    expect(yield_with_args(1, 3).description).to eq("yield with args(1, 3)")
+    expect(yield_with_args(false).description).to eq("yield with args(false)")
+  end
+
+  describe "expect {...}.to yield_with_args" do
+    it 'passes if the block yields with arguments' do
+      expect { |b| _yield_with_args(1, &b) }.to yield_with_args
+    end
+
+    it 'fails if the block does not yield' do
+      expect {
+        expect { |b| _dont_yield(&b) }.to yield_with_args
+      }.to fail_with(/expected given block to yield with arguments, but did not yield/)
+    end
+
+    it 'fails if the block yields with no arguments' do
+      expect {
+        expect { |b| _yield_with_no_args(&b) }.to yield_with_args
+      }.to fail_with(/expected given block to yield with arguments, but yielded with no arguments/)
+    end
+
+    it 'raises an error if it yields multiple times' do
+      expect {
+        expect { |b| [1, 2].each(&b) }.to yield_with_args
+      }.to raise_error(/not designed.*yields multiple times/)
+    end
+  end
+
+  describe "expect {...}.not_to yield_with_args" do
+    it 'fails if the block yields with arguments' do
+      expect {
+        expect { |b| _yield_with_args(1, &b) }.not_to yield_with_args
+      }.to fail_with(/expected given block not to yield with arguments, but did/)
+    end
+
+    it 'passes if the block does not yield' do
+      expect { |b| _dont_yield(&b) }.not_to yield_with_args
+    end
+
+    it 'passes if the block yields with no arguments' do
+      expect { |b| _yield_with_no_args(&b) }.not_to yield_with_args
+    end
+
+    it 'fails if the expect block does not accept an argument' do
+      expect {
+        expect { }.not_to yield_with_args
+      }.to raise_error(/expect block must accept an argument/)
+    end
+
+    it 'raises an error if the expect block arg is not passed to a method as a block' do
+      expect {
+        expect { |b| }.not_to yield_with_args
+      }.to raise_error(/must pass the argument.*as a block/)
+    end
+  end
+
+  describe "expect {...}.to yield_with_args(3, 17)" do
+    it 'passes if the block yields with the given arguments' do
+      expect { |b| _yield_with_args(3, 17, &b) }.to yield_with_args(3, 17)
+    end
+
+    it 'passes if the block yields with the given arguments using instance_eval' do
+      expect { |b| InstanceEvaler.new.yield_with_args(3, 17, &b) }.to yield_with_args(3, 17)
+    end
+
+    it 'fails if the block does not yield' do
+      expect {
+        expect { |b| _dont_yield(&b) }.to yield_with_args(3, 17)
+      }.to fail_with(/expected given block to yield with arguments, but did not yield/)
+    end
+
+    it 'fails if the block yields with no arguments' do
+      expect {
+        expect { |b| _yield_with_no_args(&b) }.to yield_with_args(3, 17)
+      }.to fail_with(/expected given block to yield with arguments, but yielded with unexpected arguments/)
+    end
+
+    it 'fails if the block yields with different arguments' do
+      expect {
+        expect { |b| _yield_with_args("a", "b", &b) }.to yield_with_args("a", "c")
+      }.to fail_with(/expected given block to yield with arguments, but yielded with unexpected arguments/)
+    end
+  end
+
+  describe "expect {...}.not_to yield_with_args(3, 17)" do
+    it 'passes if the block yields with different arguments' do
+      expect { |b| _yield_with_args("a", "b", &b) }.not_to yield_with_args("a", "c")
+    end
+
+    it 'fails if the block yields with the given arguments' do
+      expect {
+        expect { |b| _yield_with_args("a", "b", &b) }.not_to yield_with_args("a", "b")
+      }.to fail_with(/expected given block not to yield with arguments, but yielded with expected arguments/)
+    end
+  end
+
+  describe "expect {...}.to yield_with_args( false )" do
+    it 'passes if the block yields with the given arguments' do
+      expect { |b| _yield_with_args(false, &b) }.to yield_with_args(false)
+    end
+
+    it 'passes if the block yields with the given arguments using instance_eval' do
+      expect { |b| InstanceEvaler.new.yield_with_args(false, &b) }.to yield_with_args(false)
+    end
+
+    it 'fails if the block does not yield' do
+      expect {
+        expect { |b| _dont_yield(&b) }.to yield_with_args(false)
+      }.to fail_with(/expected given block to yield with arguments, but did not yield/)
+    end
+
+    it 'fails if the block yields with no arguments' do
+      expect {
+        expect { |b| _yield_with_no_args(&b) }.to yield_with_args(false)
+      }.to fail_with(/expected given block to yield with arguments, but yielded with unexpected arguments/)
+    end
+
+    it 'fails if the block yields with different arguments' do
+      expect {
+        expect { |b| _yield_with_args(false, &b) }.to yield_with_args(true)
+      }.to fail_with(/expected given block to yield with arguments, but yielded with unexpected arguments/)
+    end
+  end
+
+  describe "expect {...}.to yield_with_args(/reg/, /ex/)" do
+    it "passes if the block yields strings matching the regexes" do
+      expect { |b| _yield_with_args("regular", "expression", &b) }.to yield_with_args(/reg/, /ex/)
+    end
+
+    it "fails if the block yields strings that do not match the regexes" do
+      expect {
+        expect { |b| _yield_with_args("no", "match", &b) }.to yield_with_args(/reg/, /ex/)
+      }.to fail_with(/expected given block to yield with arguments, but yielded with unexpected arguments/)
+    end
+  end
+
+  describe "expect {...}.to yield_with_args(String, Fixnum)" do
+    it "passes if the block yields objects of the given types" do
+      expect { |b| _yield_with_args("string", 15, &b) }.to yield_with_args(String, Fixnum)
+    end
+
+    it "passes if the block yields the given types" do
+      expect { |b| _yield_with_args(String, Fixnum, &b) }.to yield_with_args(String, Fixnum)
+    end
+
+    it "fails if the block yields objects of different types" do
+      expect {
+        expect { |b| _yield_with_args(15, "string", &b) }.to yield_with_args(String, Fixnum)
+      }.to fail_with(/expected given block to yield with arguments, but yielded with unexpected arguments/)
+    end
+  end
+end
+
+describe "yield_successive_args matcher" do
+  include YieldHelpers
+  extend  YieldHelpers
+
+  it_behaves_like "an RSpec matcher",
+      :valid_value => lambda { |b| [1, 2].each(&b) },
+      :invalid_value => lambda { |b| _dont_yield(&b) } do
+    let(:matcher) { yield_successive_args(1, 2) }
+  end
+
+  it 'has a description' do
+    expect(yield_successive_args(1, 3).description).to eq("yield successive args(1, 3)")
+    expect(yield_successive_args([:a, 1], [:b, 2]).description).to eq("yield successive args([:a, 1], [:b, 2])")
+  end
+
+  describe "expect {...}.to yield_successive_args([:a, 1], [:b, 2])" do
+    it 'passes when the block successively yields the given args' do
+      expect { |b| [ [:a, 1], [:b, 2] ].each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+    end
+
+    it 'fails when the block does not yield that many times' do
+      expect {
+        expect { |b| [[:a, 1]].each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+      }.to fail_with(/but yielded with unexpected arguments/)
+    end
+
+    it 'fails when the block yields the right number of times but with different arguments' do
+      expect {
+        expect { |b| [ [:a, 1], [:b, 3] ].each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+      }.to fail_with(/but yielded with unexpected arguments/)
+    end
+  end
+
+  describe "expect {...}.to yield_successive_args(1, 2, 3)" do
+    it 'passes when the block successively yields the given args' do
+      expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
+    end
+
+    it 'passes when the block successively yields the given args using instance_eval' do
+      expect { |b| InstanceEvaler.new.each_arg(1, 2, 3, &b) }.to yield_successive_args(1, 2, 3)
+    end
+
+    it 'fails when the block does not yield the expected args' do
+      expect {
+        expect { |b| [1, 2, 4].each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+      }.to fail_with(/but yielded with unexpected arguments/)
+    end
+  end
+
+  describe "expect {...}.not_to yield_successive_args(1, 2, 3)" do
+    it 'passes when the block does not yield' do
+      expect { |b| _dont_yield(&b) }.not_to yield_successive_args(1, 2, 3)
+    end
+
+    it 'passes when the block yields the wrong number of times' do
+      expect { |b| [1, 2].each(&b) }.not_to yield_successive_args(1, 2, 3)
+    end
+
+    it 'passes when the block yields the wrong arguments' do
+      expect { |b| [1, 2, 4].each(&b) }.not_to yield_successive_args(1, 2, 3)
+    end
+
+    it 'fails when the block yields the given arguments' do
+      expect {
+        expect { |b| [1, 2, 3].each(&b) }.not_to yield_successive_args(1, 2, 3)
+      }.to fail_with(/expected given block not to yield successively/)
+    end
+
+    it 'fails if the expect block does not accept an argument' do
+      expect {
+        expect { }.not_to yield_successive_args(1, 2, 3)
+      }.to raise_error(/expect block must accept an argument/)
+    end
+
+    it 'raises an error if the expect block arg is not passed to a method as a block' do
+      expect {
+        expect { |b| }.not_to yield_successive_args(1, 2, 3)
+      }.to raise_error(/must pass the argument.*as a block/)
+    end
+  end
+
+  describe "expect {...}.to yield_successive_args(String, Fixnum)" do
+    it "passes if the block successively yields objects of the given types" do
+      expect { |b| ["string", 15].each(&b) }.to yield_successive_args(String, Fixnum)
+    end
+
+    it "passes if the block yields the given types" do
+      expect { |b| [String, Fixnum].each(&b) }.to yield_successive_args(String, Fixnum)
+    end
+
+    it "fails if the block yields objects of different types" do
+      expect {
+        expect { |b| [15, "string"].each(&b) }.to yield_successive_args(String, Fixnum)
+      }.to fail_with(/expected given block to yield successively with arguments/)
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/spec_helper.rb b/rspec-expectations/spec/spec_helper.rb
new file mode 100644
index 0000000..92e9451
--- /dev/null
+++ b/rspec-expectations/spec/spec_helper.rb
@@ -0,0 +1,54 @@
+Dir['./spec/support/**/*'].each {|f| require f}
+
+RSpec::configure do |config|
+  config.treat_symbols_as_metadata_keys_with_true_values = true
+  config.color_enabled = true
+  config.filter_run :focused
+  config.run_all_when_everything_filtered = true
+  config.order = :random
+
+  config.expect_with :rspec do |expectations|
+    $default_expectation_syntax = expectations.syntax
+    expectations.syntax = :expect
+  end
+end
+
+shared_context "with #should enabled", :uses_should do
+  orig_syntax = nil
+
+  before(:all) do
+    orig_syntax = RSpec::Matchers.configuration.syntax
+    RSpec::Matchers.configuration.syntax = [:expect, :should]
+  end
+
+  after(:all) do
+    RSpec::Matchers.configuration.syntax = orig_syntax
+  end
+end
+
+
+shared_context "with #should exclusively enabled", :uses_only_should do
+  orig_syntax = nil
+
+  before(:all) do
+    orig_syntax = RSpec::Matchers.configuration.syntax
+    RSpec::Matchers.configuration.syntax = :should
+  end
+
+  after(:all) do
+    RSpec::Matchers.configuration.syntax = orig_syntax
+  end
+end
+
+module TestUnitIntegrationSupport
+  include InSubProcess
+
+  def with_test_unit_loaded
+    in_sub_process do
+      require 'test/unit'
+      load 'rspec/matchers/test_unit_integration.rb'
+      yield
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/support/classes.rb b/rspec-expectations/spec/support/classes.rb
new file mode 100644
index 0000000..e6f18f3
--- /dev/null
+++ b/rspec-expectations/spec/support/classes.rb
@@ -0,0 +1,56 @@
+# various classes used by the specs
+module RSpec
+  module Expectations
+    module Helper
+      class CollectionWithSizeMethod
+        def initialize; @list = []; end
+        def size; @list.size; end
+        def push(item); @list.push(item); end
+      end
+
+      class CollectionWithLengthMethod
+        def initialize; @list = []; end
+        def length; @list.size; end
+        def push(item); @list.push(item); end
+      end
+
+      class CollectionWithCountMethod
+        def initialize; @list = []; end
+        def count; @list.count; end
+        def push(item); @list.push(item); end
+      end
+
+      class CollectionOwner
+        attr_reader :items_in_collection_with_size_method, :items_in_collection_with_length_method, :items_in_collection_with_count_method
+
+        def initialize
+          @items_in_collection_with_size_method = CollectionWithSizeMethod.new
+          @items_in_collection_with_length_method = CollectionWithLengthMethod.new
+          @items_in_collection_with_count_method = CollectionWithCountMethod.new
+        end
+
+        def add_to_collection_with_size_method(item)
+          @items_in_collection_with_size_method.push(item)
+        end
+
+      def add_to_collection_with_length_method(item)
+        @items_in_collection_with_length_method.push(item)
+      end
+
+      def add_to_collection_with_count_method(item)
+        @items_in_collection_with_count_method.push(item)
+      end
+
+        def items_for(arg)
+          return [1, 2, 3] if arg == 'a'
+          [1]
+        end
+
+        def items
+          @items_in_collection_with_size_method
+        end
+      end
+
+    end
+  end
+end
diff --git a/rspec-expectations/spec/support/in_sub_process.rb b/rspec-expectations/spec/support/in_sub_process.rb
new file mode 100644
index 0000000..6593a39
--- /dev/null
+++ b/rspec-expectations/spec/support/in_sub_process.rb
@@ -0,0 +1,38 @@
+module InSubProcess
+  if RUBY_PLATFORM == 'java'
+    def in_sub_process
+      pending "This spec requires forking to work properly, " +
+              "and JRuby does not support forking"
+    end
+  else
+    # Useful as a way to isolate a global change to a subprocess.
+    def in_sub_process
+      readme, writeme = IO.pipe
+
+      pid = Process.fork do
+        value = nil
+        begin
+          yield
+        rescue => e
+          value = e
+        end
+
+        writeme.write Marshal.dump(value)
+
+        readme.close
+        writeme.close
+        exit! # prevent at_exit hooks from running (e.g. minitest)
+      end
+
+      writeme.close
+      Process.waitpid(pid)
+
+      if exception = Marshal.load(readme.read)
+        raise exception
+      end
+
+      readme.close
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/support/matchers.rb b/rspec-expectations/spec/support/matchers.rb
new file mode 100644
index 0000000..aecc477
--- /dev/null
+++ b/rspec-expectations/spec/support/matchers.rb
@@ -0,0 +1,22 @@
+RSpec::Matchers.define :include_method do |expected|
+  match do |actual|
+    actual.map { |m| m.to_s }.include?(expected.to_s)
+  end
+end
+
+module RSpec
+  module Matchers
+    def fail
+      raise_error(RSpec::Expectations::ExpectationNotMetError)
+    end
+
+    def fail_with(message)
+      raise_error(RSpec::Expectations::ExpectationNotMetError, message)
+    end
+
+    def fail_matching(message)
+      raise_error(RSpec::Expectations::ExpectationNotMetError, /#{Regexp.escape(message)}/)
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/support/ruby_version.rb b/rspec-expectations/spec/support/ruby_version.rb
new file mode 100644
index 0000000..71a9d8c
--- /dev/null
+++ b/rspec-expectations/spec/support/ruby_version.rb
@@ -0,0 +1,10 @@
+module RSpec
+  module Ruby
+    class << self
+      def version
+        RUBY_VERSION
+      end
+    end
+  end
+end
+
diff --git a/rspec-expectations/spec/support/shared_examples.rb b/rspec-expectations/spec/support/shared_examples.rb
new file mode 100644
index 0000000..92d4d64
--- /dev/null
+++ b/rspec-expectations/spec/support/shared_examples.rb
@@ -0,0 +1,13 @@
+shared_examples_for "an RSpec matcher" do |options|
+  let(:valid_value)   { options.fetch(:valid_value) }
+  let(:invalid_value) { options.fetch(:invalid_value) }
+
+  it 'matches a valid value when using #== so it can be composed' do
+    expect(matcher).to eq(valid_value)
+  end
+
+  it 'does not match an invalid value when using #== so it can be composed' do
+    expect(matcher).not_to eq(invalid_value)
+  end
+end
+
diff --git a/rspec-mocks/Changelog.md b/rspec-mocks/Changelog.md
new file mode 100644
index 0000000..55ad5a6
--- /dev/null
+++ b/rspec-mocks/Changelog.md
@@ -0,0 +1,410 @@
+### 2.14.3 / 2013-08-08
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.2...v2.14.3)
+
+Bug Fixes:
+
+* Fix stubbing some instance methods for classes whose hierarchy includes
+  a prepended Module (Bradley Schaefer)
+
+### 2.14.2 / 2013-07-30
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.1...v2.14.2)
+
+Bug Fixes:
+
+* Fix `as_null_object` doubles so that they return `nil` from `to_ary`
+  (Jon Rowe).
+* Fix regression in 2.14 that made `stub!` (with an implicit receiver)
+  return a test double rather than stub a method (Myron Marston).
+
+### 2.14.1 / 2013-07-07
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.0...v2.14.1)
+
+Bug Fixes:
+
+* Restore `double.as_null_object` behavior from 2.13 and earlier: a
+  double's nullness persisted between examples in earlier examples.
+  While this is not an intended use case (test doubles are meant to live
+  for only one example), we don't want to break behavior users rely
+  on in a minor relase.  This will be deprecated in 2.99 and removed
+  in 3.0. (Myron Marston)
+
+### 2.14.0 / 2013-07-06
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.14.0.rc1...v2.14.0)
+
+Enhancements:
+
+* Document test spies in the readme. (Adarsh Pandit)
+* Add an `array_including` matcher. (Sam Phippen)
+* Add a syntax-agnostic API for mocking or stubbing a method. This is
+  intended for use by libraries such as rspec-rails that need to mock
+  or stub a method, and work regardless of the syntax the user has
+  configured (Paul Annesley, Myron Marston and Sam Phippen).
+
+Bug Fixes:
+
+* Fix `double` so that it sets up passed stubs correctly regardless of
+  the configured syntax (Paul Annesley).
+* Allow a block implementation to be used in combination with
+  `and_yield`, `and_raise`, `and_return` or `and_throw`. This got fixed
+  in 2.13.1 but failed to get merged into master for the 2.14.0.rc1
+  release (Myron Marston).
+* `Marshal.dump` does not unnecessarily duplicate objects when rspec-mocks has
+  not been fully initialized. This could cause errors when using `spork` or
+  similar preloading gems (Andy Lindeman).
+
+### 2.14.0.rc1 / 2013-05-27
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.13.0...v2.14.0.rc1)
+
+Enhancements:
+
+* Refactor internals so that the mock proxy methods and state are held
+  outside of the mocked object rather than inside it. This paves the way
+  for future syntax enhancements and removes the need for some hacky
+  work arounds for `any_instance` dup'ing and `YAML` serialization,
+  among other things. Note that the code now relies upon `__id__`
+  returning a unique, consistent value for any object you want to
+  mock or stub (Myron Marston).
+* Add support for test spies. This allows you to verify a message
+  was received afterwards using the `have_received` matcher.
+  Note that you must first stub the method or use a null double.
+  (Joe Ferris and Joël Quenneville)
+* Make `at_least` and `at_most` style receive expectations print that they were
+  expecting at least or at most some number of calls, rather than just the
+  number of calls given in the expectation (Sam Phippen)
+* Make `with` style receive expectations print the args they were expecting, and
+  the args that they got (Sam Phippen)
+* Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).
+* Add a new `:expect` syntax for message expectations
+  (Myron Marston and Sam Phippen).
+
+Bug fixes
+
+* Fix `any_instance` so that a frozen object can be `dup`'d when methods
+  have been stubbed on that type using `any_instance` (Jon Rowe).
+* Fix `and_call_original` so that it properly raises an `ArgumentError`
+  when the wrong number of args are passed (Jon Rowe).
+* Fix `double` on 1.9.2 so you can wrap them in an Array
+  using `Array(my_double)` (Jon Rowe).
+* Fix `stub_const` and `hide_const` to handle constants that redefine `send`
+  (Sam Phippen).
+* Fix `Marshal.dump` extension so that it correctly handles nil.
+  (Luke Imhoff, Jon Rowe)
+* Fix isolation of `allow_message_expectations_on_nil` (Jon Rowe)
+* Use inspect to format actual arguments on expectations in failure messages (#280, Ben Langfeld)
+* Protect against improperly initialised test doubles (#293) (Joseph Shraibman and Jon Rowe)
+
+Deprecations
+
+* Deprecate `stub` and `mock` as aliases for `double`. `double` is the
+  best term for creating a test double, and it reduces confusion to
+  have only one term (Michi Huber).
+* Deprecate `stub!` and `unstub!` in favor of `stub` and `unstub`
+  (Jon Rowe).
+* Deprecate `at_least(0).times` and `any_number_of_times` (Michi Huber).
+
+### 2.13.1 / 2013-04-06
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.13.0...v2.13.1)
+
+Bug fixes
+
+* Allow a block implementation to be used in combination with
+  `and_yield`, `and_raise`, `and_return` or `and_throw` (Myron Marston).
+
+### 2.13.0 / 2013-02-23
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.12.2...v2.13.0)
+
+Bug fixes
+
+* Fix bug that caused weird behavior when a method that had
+  previously been stubbed with multiple return values (e.g.
+  `obj.stub(:foo).and_return(1, 2)`) was later mocked with a
+  single return value (e.g. `obj.should_receive(:foo).once.and_return(1)`).
+  (Myron Marston)
+* Fix bug related to a mock expectation for a method that already had
+  multiple stubs with different `with` constraints. Previously, the
+  first stub was used, even though it may not have matched the passed
+  args. The fix defers this decision until the message is received so
+  that the proper stub response can be chosen based on the passed
+  arguments (Myron Marston).
+* Do not call `nil?` extra times on a mocked object, in case `nil?`
+  itself is expected a set number of times (Myron Marston).
+* Fix `missing_default_stub_error` message so array args are handled
+  properly (Myron Marston).
+* Explicitly disallow `any_instance.unstub!` (Ryan Jones).
+* Fix `any_instance` stubbing so that it works with `Delegator`
+  subclasses (Myron Marston).
+* Fix `and_call_original` so that it works with `Delegator` subclasses
+  (Myron Marston).
+* Fix `any_instance.should_not_receive` when `any_instance.should_receive`
+  is used on the same class in the same example. Previously it would
+  wrongly report a failure even when the message was not received
+  (Myron Marston).
+
+### 2.12.2 / 2013-01-27
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.12.1...v.2.12.2)
+
+Bug fixes
+
+* Fix `and_call_original` to work properly for methods defined
+  on a module extended onto an object instance (Myron Marston).
+* Fix `stub_const` with an undefined constnat name to work properly
+  with constant strings that are prefixed with `::` -- and edge case
+  I missed in the bug fix in the 2.12.1 release (Myron Marston).
+* Ensure method visibility on a partial mock is restored after reseting
+  method stubs, even on a singleton module (created via `extend self`)
+  when the method visibility differs between the instance and singleton
+  versions (Andy Lindeman).
+
+### 2.12.1 / 2012-12-21
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.12.0...v2.12.1)
+
+Bug fixes
+
+* Fix `any_instance` to support `and_call_original`.
+  (Myron Marston)
+* Properly restore stubbed aliased methods on rubies
+  that report the incorrect owner (Myron Marston and Andy Lindeman).
+* Fix `hide_const` and `stub_const` with a defined constnat name to
+  work properly with constant strings that are prefixed with `::` (Myron Marston).
+
+### 2.12.0 / 2012-11-12
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.3...v2.12.0)
+
+Enhancements
+
+* `and_raise` can accept an exception class and message, more closely
+  matching `Kernel#raise` (e.g., `foo.stub(:bar).and_raise(RuntimeError, "message")`)
+  (Bas Vodde)
+* Add `and_call_original`, which will delegate the message to the
+  original method (Myron Marston).
+
+Deprecations:
+
+* Add deprecation warning when using `and_return` with `should_not_receive`
+  (Neha Kumari)
+
+### 2.11.3 / 2012-09-19
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.2...v2.11.3)
+
+Bug fixes
+
+* Fix `:transfer_nested_constants` option of `stub_const` so that it
+  doesn't blow up when there are inherited constants. (Myron Marston)
+* `any_instance` stubs can be used on classes that override `Object#method`.
+  (Andy Lindeman)
+* Methods stubbed with `any_instance` are unstubbed after the test finishes.
+  (Andy Lindeman)
+* Fix confusing error message when calling a mocked class method an
+  extra time with the wrong arguments (Myron Marston).
+
+### 2.11.2 / 2012-08-11
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.1...v2.11.2)
+
+Bug fixes
+
+* Don't modify `dup` on classes that don't support `dup` (David Chelimsky)
+* Fix `any_instance` so that it works properly with methods defined on
+  a superclass. (Daniel Eguzkiza)
+* Fix `stub_const` so that it works properly for nested constants that
+  share a name with a top-level constant (e.g. "MyGem::Hash"). (Myron
+  Marston)
+
+### 2.11.1 / 2012-07-09
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.11.0...v2.11.1)
+
+Bug fixes
+
+* Fix `should_receive` so that when it is called on an `as_null_object`
+  double with no implementation, and there is a previous explicit stub
+  for the same method, the explicit stub remains (rather than being
+  overriden with the null object implementation--`return self`). (Myron Marston)
+
+### 2.11.0 / 2012-07-07
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.10.1...v2.11.0)
+
+Enhancements
+
+* Expose ArgumentListMatcher as a formal API
+    * supports use by 3rd party mock frameworks like Surrogate
+* Add `stub_const` API to stub constants for the duration of an
+  example (Myron Marston).
+
+Bug fixes
+
+* Fix regression of edge case behavior. `double.should_receive(:foo) { a }`
+  was causing a NoMethodError when `double.stub(:foo).and_return(a, b)`
+  had been setup before (Myron Marston).
+* Infinite loop generated by using `any_instance` and `dup`. (Sidu Ponnappa @kaiwren)
+* `double.should_receive(:foo).at_least(:once).and_return(a)` always returns a
+  even if `:foo` is already stubbed.
+* Prevent infinite loop when interpolating a null double into a string
+  as an integer (`"%i" % double.as_null_object`). (Myron Marston)
+* Fix `should_receive` so that null object behavior (e.g. returning
+  self) is preserved if no implementation is given (Myron Marston).
+* Fix `and_raise` so that it raises `RuntimeError` rather than
+  `Exception` by default, just like ruby does. (Andrew Marshall)
+
+### 2.10.1 / 2012-05-05
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.10.0...v2.10.1)
+
+Bug fixes
+
+* fix regression of edge case behavior
+  (https://github.com/rspec/rspec-mocks/issues/132)
+    * fixed failure of `object.should_receive(:message).at_least(0).times.and_return value`
+    * fixed failure of `object.should_not_receive(:message).and_return value`
+
+### 2.10.0 / 2012-05-03
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.9.0...v2.10.0)
+
+Bug fixes
+
+* fail fast when an `exactly` or `at_most` expectation is exceeded
+
+### 2.9.0 / 2012-03-17
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0...v2.9.0)
+
+Enhancements
+
+* Support order constraints across objects (preethiramdev)
+
+Bug fixes
+
+* Allow a `as_null_object` to be passed to `with`
+* Pass proc to block passed to stub (Aubrey Rhodes)
+* Initialize child message expectation args to match any args (#109 -
+  preethiramdev)
+
+### 2.8.0 / 2012-01-04
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0.rc2...v2.8.0)
+
+No changes for this release. Just releasing with the other rspec gems.
+
+### 2.8.0.rc2 / 2011-12-19
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.8.0.rc1...v2.8.0.rc2)
+
+No changes for this release. Just releasing with the other rspec gems.
+
+### 2.8.0.rc1 / 2011-11-06
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.7.0...v2.8.0.rc1)
+
+Enhancements
+
+* Eliminate Ruby warnings (Matijs van Zuijlen)
+
+### 2.7.0 / 2011-10-16
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.6.0...v2.7.0)
+
+Enhancements
+
+* Use `__send__` rather than `send` (alextk)
+* Add support for `any_instance.stub_chain` (Sidu Ponnappa)
+* Add support for `any_instance` argument matching based on `with` (Sidu
+  Ponnappa and Andy Lindeman)
+
+Changes
+
+* Check for `failure_message_for_should` or `failure_message` instead of
+  `description` to detect a matcher (Tibor Claassen)
+
+Bug fixes
+
+* pass a hash to `any_instance.stub`. (Justin Ko)
+* allow `to_ary` to be called without raising `NoMethodError` (Mikhail
+  Dieterle)
+* `any_instance` properly restores private methods (Sidu Ponnappa)
+
+### 2.6.0 / 2011-05-12
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.5.0...v2.6.0)
+
+Enhancements
+
+* Add support for `any_instance.stub` and `any_instance.should_receive` (Sidu
+  Ponnappa and Andy Lindeman)
+
+Bug fixes
+
+* fix bug in which multiple chains with shared messages ending in hashes failed
+  to return the correct value
+
+### 2.5.0 / 2011-02-05
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.4.0...v2.5.0)
+
+Bug fixes
+
+* message expectation counts now work in combination with a stub (Damian
+  Nurzynski)
+* fix failure message when message received with incorrect args (Josep M.
+  Bach)
+
+### 2.4.0 / 2011-01-02
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.3.0...v2.4.0)
+
+No functional changes in this release, which was made to align with the
+rspec-core-2.4.0 release.
+
+### 2.3.0 / 2010-12-12
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.2.0...v2.3.0)
+
+Bug fixes
+
+* Fix our Marshal extension so that it does not interfere with objects that
+  have their own `@mock_proxy` instance variable. (Myron Marston)
+
+### 2.2.0 / 2010-11-28
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.1.0...v2.2.0)
+
+Enhancements
+
+* Added "rspec/mocks/standalone" for exploring the rspec-mocks in irb.
+
+Bug fix
+
+* Eliminate warning on splat args without parens (Gioele Barabucci)
+* Fix bug where `obj.should_receive(:foo).with(stub.as_null_object)` would pass
+  with a false positive.
+
+### 2.1.0 / 2010-11-07
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.1...v2.1.0)
+
+Bug fixes
+
+* Fix serialization of stubbed object (Josep M Bach)
+
+### 2.0.0 / 2010-10-10
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.22...v2.0.0)
+
+### 2.0.0.rc / 2010-10-05
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.22...v2.0.0.rc)
+
+Enhancements
+
+* support passing a block to an expectation block (Nicolas Braem)
+    * `obj.should_receive(:msg) {|&block| ... }`
+
+Bug fixes
+
+* Fix YAML serialization of stub (Myron Marston)
+* Fix rdoc rake task (Hans de Graaff)
+
+### 2.0.0.beta.22 / 2010-09-12
+
+[full changelog](http://github.com/rspec/rspec-mocks/compare/v2.0.0.beta.20...v2.0.0.beta.22)
+
+Bug fixes
+
+* fixed regression that broke `obj.stub_chain(:a, :b => :c)`
+* fixed regression that broke `obj.stub_chain(:a, :b) { :c }`
+* `respond_to?` always returns true when using `as_null_object`
diff --git a/License.txt b/rspec-mocks/License.txt
similarity index 95%
copy from License.txt
copy to rspec-mocks/License.txt
index 02bc06c..84edafa 100644
--- a/License.txt
+++ b/rspec-mocks/License.txt
@@ -1,6 +1,5 @@
 (The MIT License)
 
-Copyright (c) 2009 Chad Humphries, David Chelimsky
 Copyright (c) 2006 David Chelimsky, The RSpec Development Team
 Copyright (c) 2005 Steven Baker
 
diff --git a/rspec-mocks/README.md b/rspec-mocks/README.md
new file mode 100644
index 0000000..46dc69a
--- /dev/null
+++ b/rspec-mocks/README.md
@@ -0,0 +1,315 @@
+# RSpec Mocks [![Build Status](https://secure.travis-ci.org/rspec/rspec-mocks.png?branch=master)](http://travis-ci.org/rspec/rspec-mocks) [![Code Climate](https://codeclimate.com/github/rspec/rspec-mocks.png)](https://codeclimate.com/github/rspec/rspec-mocks)
+
+rspec-mocks is a test-double framework for rspec with support for method stubs,
+fakes, and message expectations on generated test-doubles and real objects
+alike.
+
+## Install
+
+    gem install rspec       # for rspec-core, rspec-expectations, rspec-mocks
+    gem install rspec-mocks # for rspec-mocks only
+
+## Test Doubles
+
+A Test Double is an object that stands in for a real object in a test.
+RSpec creates test doubles that support method stubs and message
+expectations.
+
+```ruby
+book = double("book")
+```
+
+## Method Stubs
+
+A method stub is an implementation that returns a pre-determined value.  Method
+stubs can be declared on test doubles or real objects using the same syntax.
+rspec-mocks supports 3 forms for declaring method stubs:
+
+```ruby
+book.stub(:title) { "The RSpec Book" }
+book.stub(:title => "The RSpec Book")
+book.stub(:title).and_return("The RSpec Book")
+```
+
+You can also use this shortcut, which creates a test double and declares a
+method stub in one statement:
+
+```ruby
+book = double("book", :title => "The RSpec Book")
+```
+
+The first argument is a name, which is used for documentation and appears in
+failure messages. If you don't care about the name, you can leave it out,
+making the combined instantiation/stub declaration very terse:
+
+```ruby
+double(:foo => 'bar')
+```
+
+This is particularly nice when providing a list of test doubles to a method
+that iterates through them:
+
+```ruby
+order.calculate_total_price(double(:price => 1.99),double(:price => 2.99))
+```
+
+## Consecutive return values
+
+When a stub might be invoked more than once, you can provide additional
+arguments to `and_return`.  The invocations cycle through the list. The last
+value is returned for any subsequent invocations:
+
+```ruby
+die.stub(:roll).and_return(1,2,3)
+die.roll # => 1
+die.roll # => 2
+die.roll # => 3
+die.roll # => 3
+die.roll # => 3
+```
+
+To return an array in a single invocation, declare an array:
+
+```ruby
+team.stub(:players).and_return([stub(:name => "David")])
+```
+
+## Message Expectations
+
+A message expectation is an expectation that the test double will receive a
+message some time before the example ends. If the message is received, the
+expectation is satisfied. If not, the example fails.
+
+```ruby
+validator = double("validator")
+validator.should_receive(:validate).with("02134")
+zipcode = Zipcode.new("02134", validator)
+zipcode.valid?
+```
+
+## Nomenclature
+
+### Mock Objects and Test Stubs
+
+The names Mock Object and Test Stub suggest specialized Test Doubles.  i.e.
+a Test Stub is a Test Double that only supports method stubs, and a Mock
+Object is a Test Double that supports message expectations and method
+stubs.
+
+There is a lot of overlapping nomenclature here, and there are many
+variations of these patterns (fakes, spies, etc). Keep in mind that most of
+the time we're talking about method-level concepts that are variations of
+method stubs and message expectations, and we're applying to them to _one_
+generic kind of object: a Test Double.
+
+### Test-Specific Extension
+
+a.k.a. Partial Stub/Mock, a Test-Specific Extension is an extension of a
+real object in a system that is instrumented with test-double like
+behaviour in the context of a test. This technique is very common in Ruby
+because we often see class objects acting as global namespaces for methods.
+For example, in Rails:
+
+```ruby
+person = double("person")
+Person.stub(:find) { person }
+```
+
+In this case we're instrumenting Person to return the person object we've
+defined whenever it receives the `find` message. We can also set a message
+expectation so that the example fails if `find` is not called:
+
+```ruby
+person = double("person")
+Person.should_receive(:find) { person }
+```
+
+We can do this with any object in a system because rspec-mocks adds the `stub`
+and `should_receive` methods to every object, including class objects. When we
+use either, RSpec replaces the method we're stubbing or mocking with its own
+test-double-like method. At the end of the example, RSpec verifies any message
+expectations, and then restores the original methods.
+
+## Expecting Arguments
+
+```ruby
+double.should_receive(:msg).with(*args)
+double.should_not_receive(:msg).with(*args)
+```
+
+You can set multiple expectations for the same message if you need to:
+
+```ruby
+double.should_receive(:msg).with("A", 1, 3)
+double.should_receive(:msg).with("B", 2, 4)
+```
+
+## Argument Matchers
+
+Arguments that are passed to `with` are compared with actual arguments
+received using ==. In cases in which you want to specify things about the
+arguments rather than the arguments themselves, you can use any of the
+matchers that ship with rspec-expectations. They don't all make syntactic
+sense (they were primarily designed for use with RSpec::Expectations), but
+you are free to create your own custom RSpec::Matchers.
+
+rspec-mocks also adds some keyword Symbols that you can use to
+specify certain kinds of arguments:
+
+```ruby
+double.should_receive(:msg).with(no_args())
+double.should_receive(:msg).with(any_args())
+double.should_receive(:msg).with(1, kind_of(Numeric), "b") #2nd argument can be any kind of Numeric
+double.should_receive(:msg).with(1, boolean(), "b") #2nd argument can be true or false
+double.should_receive(:msg).with(1, /abc/, "b") #2nd argument can be any String matching the submitted Regexp
+double.should_receive(:msg).with(1, anything(), "b") #2nd argument can be anything at all
+double.should_receive(:msg).with(1, duck_type(:abs, :div), "b")
+                    #2nd argument can be object that responds to #abs and #div
+```
+
+## Receive Counts
+
+```ruby
+double.should_receive(:msg).once
+double.should_receive(:msg).twice
+double.should_receive(:msg).exactly(n).times
+double.should_receive(:msg).at_least(:once)
+double.should_receive(:msg).at_least(:twice)
+double.should_receive(:msg).at_least(n).times
+double.should_receive(:msg).at_most(:once)
+double.should_receive(:msg).at_most(:twice)
+double.should_receive(:msg).at_most(n).times
+double.should_receive(:msg).any_number_of_times
+```
+
+## Ordering
+
+```ruby
+double.should_receive(:msg).ordered
+double.should_receive(:other_msg).ordered
+  #This will fail if the messages are received out of order
+```
+
+This can include the same message with different arguments:
+
+```ruby
+double.should_receive(:msg).with("A", 1, 3).ordered
+double.should_receive(:msg).with("B", 2, 4).ordered
+```
+
+## Setting Responses
+
+Whether you are setting a message expectation or a method stub, you can
+tell the object precisely how to respond. The most generic way is to pass
+a block to `stub` or `should_receive`:
+
+```ruby
+double.should_receive(:msg) { value }
+```
+
+When the double receives the `msg` message, it evaluates the block and returns
+the result.
+
+```ruby
+double.should_receive(:msg).and_return(value)
+double.should_receive(:msg).exactly(3).times.and_return(value1, value2, value3)
+  # returns value1 the first time, value2 the second, etc
+double.should_receive(:msg).and_raise(error)
+  #error can be an instantiated object or a class
+  #if it is a class, it must be instantiable with no args
+double.should_receive(:msg).and_throw(:msg)
+double.should_receive(:msg).and_yield(values,to,yield)
+double.should_receive(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
+  # for methods that yield to a block multiple times
+```
+
+Any of these responses can be applied to a stub as well
+
+```ruby
+double.stub(:msg).and_return(value)
+double.stub(:msg).and_return(value1, value2, value3)
+double.stub(:msg).and_raise(error)
+double.stub(:msg).and_throw(:msg)
+double.stub(:msg).and_yield(values,to,yield)
+double.stub(:msg).and_yield(values,to,yield).and_yield(some,other,values,this,time)
+```
+
+## Arbitrary Handling
+
+Once in a while you'll find that the available expectations don't solve the
+particular problem you are trying to solve. Imagine that you expect the message
+to come with an Array argument that has a specific length, but you don't care
+what is in it. You could do this:
+
+```ruby
+double.should_receive(:msg) do |arg|
+  arg.size.should eq(7)
+end
+```
+
+If the method being stubbed itself takes a block, and you need to yield to it
+in some special way, you can use this:
+
+```ruby
+double.should_receive(:msg) do |&arg|
+  begin
+    arg.call
+  ensure
+    # cleanup
+  end
+end
+```
+
+## Delegating to the Original Implementation
+
+When working with a partial mock object, you may occasionally
+want to set a message expecation without interfering with how
+the object responds to the message. You can use `and_call_original`
+to achieve this:
+
+```ruby
+Person.should_receive(:find).and_call_original
+Person.find # => executes the original find method and returns the result
+```
+
+## Combining Expectation Details
+
+Combining the message name with specific arguments, receive counts and responses
+you can get quite a bit of detail in your expectations:
+
+```ruby
+double.should_receive(:<<).with("illegal value").once.and_raise(ArgumentError)
+```
+
+While this is a good thing when you really need it, you probably don't really
+need it! Take care to specify only the things that matter to the behavior of
+your code.
+
+## Stubbing and Hiding Constants
+
+See the [mutating constants
+README](https://github.com/rspec/rspec-mocks/blob/master/features/mutating_constants/README.md)
+for info on this feature.
+
+## Use `before(:each)`, not `before(:all)`
+
+Stubs in `before(:all)` are not supported. The reason is that all stubs and mocks get cleared out after each example, so any stub that is set in `before(:all)` would work in the first example that happens to run in that group, but not for any others.
+
+Instead of `before(:all)`, use `before(:each)`.
+
+## Further Reading
+
+There are many different viewpoints about the meaning of mocks and stubs. If
+you are interested in learning more, here is some recommended reading:
+
+* Mock Objects: http://www.mockobjects.com/
+* Endo-Testing: http://www.mockobjects.com/files/endotesting.pdf
+* Mock Roles, Not Objects: http://www.mockobjects.com/files/mockrolesnotobjects.pdf
+* Test Double Patterns: http://xunitpatterns.com/Test%20Double%20Patterns.html
+* Mocks aren't stubs: http://www.martinfowler.com/articles/mocksArentStubs.html
+
+## Also see
+
+* [http://github.com/rspec/rspec](http://github.com/rspec/rspec)
+* [http://github.com/rspec/rspec-core](http://github.com/rspec/rspec-core)
+* [http://github.com/rspec/rspec-expectations](http://github.com/rspec/rspec-expectations)
diff --git a/rspec-mocks/features/README.md b/rspec-mocks/features/README.md
new file mode 100644
index 0000000..a25f85c
--- /dev/null
+++ b/rspec-mocks/features/README.md
@@ -0,0 +1,67 @@
+rspec-mocks helps to control the context in a code example by letting you set
+known return values, fake implementations of methods, and even expectations
+that specific messages are received by an object.
+
+You can do these three things on test doubles that rspec-mocks creates for you
+on the fly, or you can do them on objects that are part of your system.
+
+## Messages and Methods
+
+_Message_ and _method_ are metaphors that we use somewhat interchangeably, but
+they are subtly different.  In Object Oriented Programming, objects communicate
+by sending _messages_ to one another. When an object receives a message, it
+invokes a _method_ with the same name as the message.
+
+## Test Doubles
+
+A test double is an object that stands in for another object in your system
+during a code example. Use the `double` method to create one:
+
+    double_account = double("Account")
+
+You can also use the `mock` and `stub` methods to create test doubles, however
+these methods are there for backward compatibility only and will likely be
+deprecated and then removed from future versions.
+
+## Method Stubs
+
+A method stub is an instruction to an object (real or test double) to return a
+known value in response to a message:
+
+    die.stub(:roll) { 3 }
+
+This tells the `die` object to return the value `3` when it receives the `roll`
+message.
+
+## Message Expectations
+
+A message expectation is an expectation that an object should receive a
+specific message during the course of a code example:
+
+    describe Account do
+      context "when closed" do
+        it "logs an 'account closed' message" do
+          logger = double()
+          account = Account.new
+          account.logger = logger
+
+          logger.should_receive(:account_closed).with(account)
+
+          account.close
+        end
+      end
+    end
+
+This example specifies that the `account` object sends the `logger` the
+`account_closed` message (with itself as an argument) when it receives the
+`close` message.
+
+## Issues
+
+The documentation for rspec-mocks is a work in progress. We'll be adding
+Cucumber features over time, and clarifying existing ones.  If you have
+specific features you'd like to see added, find the existing documentation
+incomplete or confusing, or, better yet, wish to write a missing Cucumber
+feature yourself, please [submit an
+issue](http://github.com/rspec/rspec-mocks/issues) or a [pull
+request](http://github.com/rspec/rspec-mocks).
diff --git a/rspec-mocks/features/Scope.md b/rspec-mocks/features/Scope.md
new file mode 100644
index 0000000..c9d0a08
--- /dev/null
+++ b/rspec-mocks/features/Scope.md
@@ -0,0 +1,17 @@
+Doubles, stubs, and message expectations are all cleaned out after each
+example. This ensures that each example can be run in isolation, and in any
+order.
+
+### `before(:each)`
+
+It is perfectly fine to set up doubles, stubs, and message expectations in
+a `before(:each)` hook, as that hook is executed in the scope of the example:
+
+    before(:each) do
+      @account = double('account')
+    end
+
+### Do not create doubles, stubs, or message expectations in `before(:all)`
+
+If you do, they'll get cleaned out after the first example, and you will be
+very confused as to what's going on in the second example.
diff --git a/rspec-mocks/features/Upgrade.md b/rspec-mocks/features/Upgrade.md
new file mode 100644
index 0000000..4d9556f
--- /dev/null
+++ b/rspec-mocks/features/Upgrade.md
@@ -0,0 +1,22 @@
+## rspec-mocks-2.6
+
+### `any_instance`
+
+Set method stubs and message expectations on any instance of a class:
+
+    class Foo; end
+    Foo.any_instance.stub(:bar) { 'bar' }
+    Foo.new.bar # => 'bar'
+
+## rspec-mocks-2.2
+
+### `require "rspec/mocks/standalone"`
+
+Sets up top-level environment to explore rspec-mocks. Mostly useful in irb:
+
+    $ irb
+    > require 'rspec/mocks/standalone'
+    > foo = double()
+    > foo.stub(:bar) { :baz }
+    > foo.bar
+      => :baz
diff --git a/rspec-mocks/features/argument_matchers/README.md b/rspec-mocks/features/argument_matchers/README.md
new file mode 100644
index 0000000..1d1c9e9
--- /dev/null
+++ b/rspec-mocks/features/argument_matchers/README.md
@@ -0,0 +1,27 @@
+### Introduction
+
+Argument matchers can be used:
+
+* In stubs to constrain the scope of the stubbed method
+
+    obj.stub(:foo).with(:bar) do |arg|
+      #do something for :bar
+    end
+    obj.stub(:foo).with(:baz) do |arg|
+      #do something for :baz
+    end
+
+* In expectations to validate the arguments that should be received in a method call
+
+    #create a double
+    obj = double()
+
+    #expect a message with given args
+    obj.should_receive(:message).with('an argument')
+
+If more control is needed, one can use a block
+
+    obj.should_receive(:message) do |arg1,  arg2|
+      # set expectations about the args in this block
+      # and optionally set a return value
+    end
\ No newline at end of file
diff --git a/rspec-mocks/features/argument_matchers/explicit.feature b/rspec-mocks/features/argument_matchers/explicit.feature
new file mode 100644
index 0000000..671ea61
--- /dev/null
+++ b/rspec-mocks/features/argument_matchers/explicit.feature
@@ -0,0 +1,59 @@
+Feature: explicit arguments
+
+  Allows you to explicitly specify the argument values
+
+  Scenario: explicit arguments
+    Given a file named "stub_explicit_args_spec.rb" with:
+      """ruby
+      describe "stubbed explicit arguments" do
+        it "works on stubs" do
+          object = Object.new
+          object.stub(:foo).with(:this) do |arg|
+            "got this"
+          end
+          object.stub(:foo).with(:that) do |arg|
+            "got that"
+          end
+
+          object.foo(:this).should eq("got this")
+          object.foo(:that).should eq("got that")
+        end
+
+        it "works on doubles and expectations" do
+          object = double('foo')
+          object.should_receive(:bar).with(:foo)
+
+          object.bar(:foo)
+        end
+      end
+      """
+    When I run `rspec stub_explicit_args_spec.rb`
+    Then the output should contain "2 examples, 0 failures"
+
+  Scenario: explicit arguments with multiple arities
+    Given a file named "stub_multiple_explicit_args_spec.rb" with:
+      """ruby
+      describe "stubbed multiple explicit arguments" do
+        it "works on stubs" do
+          object = Object.new
+          object.stub(:foo).with(:this) do |arg|
+            "got this"
+          end
+          object.stub(:foo).with(:this, :that) do |arg1, arg2|
+            "got this and that"
+          end
+
+          object.foo(:this).should eq("got this")
+          object.foo(:this, :that).should eq("got this and that")
+        end
+
+        it "works on mocks" do
+          object = double('foo')
+          object.should_receive(:foo).with(:this, :that)
+
+          object.foo(:this, :that)
+        end
+      end
+      """
+    When I run `rspec stub_multiple_explicit_args_spec.rb`
+    Then the output should contain "2 examples, 0 failures"
\ No newline at end of file
diff --git a/rspec-mocks/features/argument_matchers/general_matchers.feature b/rspec-mocks/features/argument_matchers/general_matchers.feature
new file mode 100644
index 0000000..76d845a
--- /dev/null
+++ b/rspec-mocks/features/argument_matchers/general_matchers.feature
@@ -0,0 +1,85 @@
+Feature: General matchers
+
+  The `anything`,  `any_args`,  and `no_args` matchers can be used to require the method
+  to have arguments (or not) without constraining the details of the argument, such as its
+  type,  pattern or value. The `anything` matcher only reflects a single argument, while
+  the `any_args` matcher matches any arity.
+
+  Scenario: anything argument matcher
+    Given a file named "stub_anything_args_spec.rb" with:
+      """ruby
+      describe "stubbed anything() args spec" do
+        it "works" do
+          object = Object.new
+          object.stub(:foo).with(anything) do
+            "anything"
+          end
+
+          object.foo(1).should eq("anything")
+          object.foo(:that).should eq("anything")
+        end
+      end
+      """
+    When I run `rspec stub_anything_args_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: any_args argument matcher
+    Given a file named "stub_any_args_spec.rb" with:
+      """ruby
+      describe "stubbed any_args() args spec" do
+        it "works" do
+          object = Object.new
+          object.stub(:foo).with(any_args) do
+            "anything"
+          end
+
+          object.foo(1).should eq("anything")
+          object.foo(:that).should eq("anything")
+          object.foo.should eq("anything")
+        end
+      end
+      """
+    When I run `rspec stub_any_args_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: no_args argument matcher
+    Given a file named "stub_no_args_spec.rb" with:
+      """ruby
+      describe "stubbed no_args() args spec" do
+        it "works for no args" do
+          object = Object.new
+          object.stub(:foo).with(no_args) do
+            "nothing"
+          end
+          object.stub(:foo).with(anything) do
+            "something"
+          end
+
+          object.foo(:that).should eq("something")
+          object.foo.should eq("nothing")
+        end
+      end
+      """
+    When I run `rspec stub_no_args_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: no_args argument matcher for expectations
+    Given a file named "stub_no_args_expectations_spec.rb" with:
+      """ruby
+      describe "stubbed no_args() args spec for expectations" do
+        it "works for no args" do
+          object = Object.new
+          object.should_receive(:foo).with(no_args)
+
+          object.foo
+        end
+        it "fails for args" do
+          object = Object.new
+          object.should_receive(:foo).with(no_args)
+
+          object.foo(:bar)
+        end
+      end
+      """
+    When I run `rspec stub_no_args_expectations_spec.rb`
+    Then the output should contain "2 examples, 1 failure"
\ No newline at end of file
diff --git a/rspec-mocks/features/argument_matchers/type_matchers.feature b/rspec-mocks/features/argument_matchers/type_matchers.feature
new file mode 100644
index 0000000..9652286
--- /dev/null
+++ b/rspec-mocks/features/argument_matchers/type_matchers.feature
@@ -0,0 +1,26 @@
+Feature: stub with argument constraints
+
+  You can further specify the behavior by constraining the type,
+  format and/or number of arguments with the `#with()` method
+  chained off of `#stub()`
+
+  Scenario: an_instance_of argument matcher
+    Given a file named "stub_an_instance_of_args_spec.rb" with:
+      """ruby
+      describe "stubbed an_instance_of() args spec" do
+        it "works" do
+          object = Object.new
+          object.stub(:foo).with(an_instance_of(Symbol)) do
+            "symbol"
+          end
+          object.stub(:foo).with(an_instance_of(String)) do
+            "string"
+          end
+
+          object.foo("bar").should eq("string")
+          object.foo(:that).should eq("symbol")
+        end
+      end
+      """
+    When I run `rspec stub_an_instance_of_args_spec.rb`
+    Then the output should contain "1 example, 0 failures"
\ No newline at end of file
diff --git a/rspec-mocks/features/message_expectations/README.md b/rspec-mocks/features/message_expectations/README.md
new file mode 100644
index 0000000..35f39ed
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/README.md
@@ -0,0 +1,73 @@
+### Basics
+
+    # create a double
+    obj = double()
+
+    # expect a message
+    obj.should_receive(:message)
+
+    # specify a return value
+    obj.should_receive(:message) { :value }
+    obj.should_receive(:message => :value)
+    obj.should_receive(:message).and_return(:value)
+
+These forms are somewhat interchangeable. The difference is that the
+block contents are evaluated lazily when the `obj` receives the
+`message` message, whereas the others are evaluated as they are read.
+
+### Fake implementation
+
+    obj.should_receive(:message) do |arg1, arg2|
+      # set expectations about the args in this block
+      # and set a return value
+    end
+
+### Using the original implementation
+
+    obj.should_receive(:message).and_call_original
+
+### Raising/Throwing
+
+    obj.should_receive(:message).and_raise("this error")
+    obj.should_receive(:message).and_throw(:this_symbol)
+
+You can also use the block format:
+
+    obj.should_receive(:message) { raise "this error" }
+    obj.should_receive(:message) { throw :this_symbol }
+
+### Argument constraints
+
+#### Explicit arguments
+
+    obj.should_receive(:message).with('an argument')
+    obj.should_receive(:message).with('more_than', 'one_argument')
+
+#### Argument matchers
+
+    obj.should_receive(:message).with(anything())
+    obj.should_receive(:message).with(an_instance_of(Money))
+    obj.should_receive(:message).with(hash_including(:a => 'b'))
+
+#### Regular expressions
+
+    obj.should_receive(:message).with(/abc/)
+
+### Counts
+
+    obj.should_receive(:message).once
+    obj.should_receive(:message).twice
+    obj.should_receive(:message).exactly(3).times
+
+    obj.should_receive(:message).at_least(:once)
+    obj.should_receive(:message).at_least(:twice)
+    obj.should_receive(:message).at_least(n).times
+
+    obj.should_receive(:message).at_most(:once)
+    obj.should_receive(:message).at_most(:twice)
+    obj.should_receive(:message).at_most(n).times
+
+### Ordering
+
+    obj.should_receive(:one).ordered
+    obj.should_receive(:two).ordered
diff --git a/rspec-mocks/features/message_expectations/allow_any_instance_of.feature b/rspec-mocks/features/message_expectations/allow_any_instance_of.feature
new file mode 100644
index 0000000..5bf42dd
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/allow_any_instance_of.feature
@@ -0,0 +1,26 @@
+Feature: allow a message on any instance of a class
+
+  Use `allow_any_instance_of(Class).to receive` when you want to configure how
+  instances of the given class respond to a message without setting an
+  expectation that the message will be received.
+
+  Scenario: allowing a message on any instance of a class
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "any_instance.should_receive" do
+        before do
+          allow_any_instance_of(Object).to receive(:foo).and_return(:return_value)
+        end
+
+        it "allows any instance of the class to receive the message" do
+          o = Object.new
+          expect(o.foo).to eq(:return_value)
+        end
+
+        it "passes even if no instances receive that message" do
+          o = Object.new
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/message_expectations/any_instance.feature b/rspec-mocks/features/message_expectations/any_instance.feature
new file mode 100644
index 0000000..fb3239b
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/any_instance.feature
@@ -0,0 +1,21 @@
+Feature: expect a message on any instance of a class
+
+  Use `any_instance.should_receive` to set an expectation that one (and only
+  one) instance of a class receives a message before the example is completed.
+
+  The spec will fail if no instance receives a message.
+
+  Scenario: expect a message on any instance of a class
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "any_instance.should_receive" do
+        it "verifies that one instance of the class receives the message" do
+          Object.any_instance.should_receive(:foo).and_return(:return_value)
+
+          o = Object.new
+          o.foo.should eq(:return_value)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
\ No newline at end of file
diff --git a/rspec-mocks/features/message_expectations/block_local_expectations.feature.pending b/rspec-mocks/features/message_expectations/block_local_expectations.feature.pending
new file mode 100644
index 0000000..40fb7bd
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/block_local_expectations.feature.pending
@@ -0,0 +1,55 @@
+Feature: block local expectations
+
+  Background:
+    Given a file named "lib/account.rb" with:
+      """
+      class Account
+        def self.create
+          yield new
+        end
+
+        def opening_balance(amount, currency)
+        end
+      end
+      """
+
+  Scenario: passing example
+    Given a file named "spec/account_spec.rb" with:
+      """
+      require 'account'
+
+      describe "account DSL" do
+        it "it succeeds when the block local receives the given call" do
+          account = double("Account")
+          Account.should_receive(:create).and_yield(account) do |account|
+            account.should_receive(:opening_balance).with(100, :USD)
+          end
+          Account.create do |account|
+            account.opening_balance 100, :USD
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: failing example
+
+    Given a file named "spec/account_spec.rb" with:
+      """
+      require 'account'
+
+      describe "account DSL" do
+        it "fails when the block local does not receive the expected call" do
+          Account.should_receive(:create).and_yield do |account|
+            account.should_receive(:opening_balance).with(100, :USD)
+          end
+          Account.create do |account|
+            # opening_balance is not called here
+          end
+        end
+      end
+      """
+
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 1 failure"
\ No newline at end of file
diff --git a/rspec-mocks/features/message_expectations/call_original.feature b/rspec-mocks/features/message_expectations/call_original.feature
new file mode 100644
index 0000000..9875940
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/call_original.feature
@@ -0,0 +1,24 @@
+Feature: Calling the original method
+
+  You can use `and_call_original` on the fluent interface
+  to "pass through" the received message to the original method.
+
+  Scenario: expect a message
+    Given a file named "call_original_spec.rb" with:
+      """ruby
+      class Addition
+        def self.two_plus_two
+          4
+        end
+      end
+
+      describe "and_call_original" do
+        it "delegates the message to the original implementation" do
+          Addition.should_receive(:two_plus_two).and_call_original
+          Addition.two_plus_two.should eq(4)
+        end
+      end
+      """
+    When I run `rspec call_original_spec.rb`
+    Then the examples should all pass
+
diff --git a/rspec-mocks/features/message_expectations/expect_any_instance_of.feature b/rspec-mocks/features/message_expectations/expect_any_instance_of.feature
new file mode 100644
index 0000000..b0b0618
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/expect_any_instance_of.feature
@@ -0,0 +1,27 @@
+Feature: expect a message on any instance of a class
+
+  Use `expect_any_instance_of(Class).to receive` to set an expectation that one
+  (and only one) instance of a class receives a message before the example is
+  completed. The spec will fail if no instance receives a message.
+
+  Scenario: expect a message on any instance of a class
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "expect_any_instance_of" do
+        before do
+          expect_any_instance_of(Object).to receive(:foo).and_return(:return_value)
+        end
+
+        it "verifies that one instance of the class receives the message" do
+          o = Object.new
+          expect(o.foo).to eq(:return_value)
+        end
+
+        it "fails unless an instance receives that message" do
+          o = Object.new
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "2 examples, 1 failure"
+    And the output should contain "1) expect_any_instance_of fails unless an instance receives that message"
diff --git a/rspec-mocks/features/message_expectations/expect_message_using_expect.feature b/rspec-mocks/features/message_expectations/expect_message_using_expect.feature
new file mode 100644
index 0000000..3a86ec6
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/expect_message_using_expect.feature
@@ -0,0 +1,107 @@
+Feature: expect message using `expect`
+
+  Use `expect(object).to receive(:message)` to set an expectation that
+  `object` should receive the message `:message` before the example is
+  completed.
+
+  Note: You can use `expect_any_instance_of` when you don't have a reference
+  to the object that receives a message in your test. For more information,
+  see the message_expectations/expect_any_instance_of feature.
+
+  Scenario: expect a message
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      require "account"
+
+      describe Account do
+        context "when closed" do
+          it "logs an account closed message" do
+            logger = double("logger")
+            account = Account.new logger
+
+            expect(logger).to receive(:account_closed)
+
+            account.close
+          end
+        end
+      end
+      """
+    And a file named "lib/account.rb" with:
+      """ruby
+      Account = Struct.new(:logger) do
+        def close
+          logger.account_closed
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: expect a message with an argument
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      require "account"
+
+      describe Account do
+        context "when closed" do
+          it "logs an account closed message" do
+            logger = double("logger")
+            account = Account.new logger
+
+            expect(logger).to receive(:account_closed).with(account)
+
+            account.close
+          end
+        end
+      end
+      """
+    And a file named "lib/account.rb" with:
+      """ruby
+      Account = Struct.new(:logger) do
+        def close
+          logger.account_closed(self)
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: provide a return value
+    Given a file named "spec/message_expectation_spec.rb" with:
+      """ruby
+
+      describe "a message expectation with a return value" do
+        context "specified in a block" do
+          it "returns the specified value" do
+            object = double("object")
+            expect(object).to receive(:message) { :return_value }
+            object.message.should eq(:return_value)
+          end
+        end
+
+        context "specified with and_return" do
+          it "returns the specified value" do
+            object = double("object")
+            expect(object).to receive(:message).and_return(:return_value)
+            object.message.should eq(:return_value)
+          end
+        end
+      end
+      """
+    When I run `rspec spec/message_expectation_spec.rb`
+    Then the output should contain "2 examples, 0 failures"
+
+  Scenario: expect a specific number of calls
+    Given a file named "spec/message_count_spec.rb" with:
+      """ruby
+      describe "a message expectation with a count" do
+        it "passes if the expected number of calls happen" do
+          string = "hi"
+          expect(string).to receive(:length).exactly(3).times
+
+          3.times { string.length }
+        end
+      end
+      """
+    When I run `rspec spec/message_count_spec.rb`
+    Then the output should contain "1 example, 0 failures"
diff --git a/rspec-mocks/features/message_expectations/expect_message_using_should_receive.feature b/rspec-mocks/features/message_expectations/expect_message_using_should_receive.feature
new file mode 100644
index 0000000..747f055
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/expect_message_using_should_receive.feature
@@ -0,0 +1,118 @@
+Feature: expect message using `should_receive`
+
+  Use `object.should_receive(:message)` to set an expectation that
+  `object` should receive the message `:message` before the example is
+  completed.
+
+  Background:
+    Given a file named "spec/spec_helper.rb" with:
+      """ruby
+      RSpec.configure do |config|
+        config.mock_with :rspec do |mocks|
+          mocks.syntax = :should
+        end
+      end
+      """
+
+  Scenario: expect a message
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      require "account"
+      require "spec_helper"
+
+      describe Account do
+        context "when closed" do
+          it "logs an account closed message" do
+            logger = double("logger")
+            account = Account.new logger
+
+            logger.should_receive(:account_closed)
+
+            account.close
+          end
+        end
+      end
+      """
+    And a file named "lib/account.rb" with:
+      """ruby
+      Account = Struct.new(:logger) do
+        def close
+          logger.account_closed
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: expect a message with an argument
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      require "account"
+      require "spec_helper"
+
+      describe Account do
+        context "when closed" do
+          it "logs an account closed message" do
+            logger = double("logger")
+            account = Account.new logger
+
+            logger.should_receive(:account_closed).with(account)
+
+            account.close
+          end
+        end
+      end
+      """
+    And a file named "lib/account.rb" with:
+      """ruby
+      Account = Struct.new(:logger) do
+        def close
+          logger.account_closed(self)
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: provide a return value
+    Given a file named "spec/message_expectation_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "a message expectation with a return value" do
+        context "specified in a block" do
+          it "returns the specified value" do
+            object = double("object")
+            object.should_receive(:message) { :return_value }
+            object.message.should eq(:return_value)
+          end
+        end
+
+        context "specified with and_return" do
+          it "returns the specified value" do
+            object = double("object")
+            object.should_receive(:message).and_return(:return_value)
+            object.message.should eq(:return_value)
+          end
+        end
+      end
+      """
+    When I run `rspec spec/message_expectation_spec.rb`
+    Then the output should contain "2 examples, 0 failures"
+
+  Scenario: expect a specific number of calls
+    Given a file named "spec/message_count_spec.rb" with:
+      """ruby
+      require "spec_helper"
+
+      describe "a message expectation with a count" do
+        it "passes if the expected number of calls happen" do
+          string = "hi"
+          string.should_receive(:length).exactly(3).times
+
+          3.times { string.length }
+        end
+      end
+      """
+    When I run `rspec spec/message_count_spec.rb`
+    Then the output should contain "1 example, 0 failures"
diff --git a/rspec-mocks/features/message_expectations/receive_counts.feature b/rspec-mocks/features/message_expectations/receive_counts.feature
new file mode 100644
index 0000000..d49a656
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/receive_counts.feature
@@ -0,0 +1,209 @@
+Feature: receive counts
+
+  Scenario: expect a message once
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      class Account
+        attr_accessor :logger
+
+        def open
+          logger.account_opened
+        end
+      end
+
+      describe Account do
+        context "when opened" do
+          it "logger#account_opened was called once" do
+            logger = double("logger")
+            account = Account.new
+            account.logger = logger
+
+            logger.should_receive(:account_opened).once
+
+            account.open
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: expect a message twice
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      class Account
+        attr_accessor :logger
+
+        def open
+          logger.account_opened
+        end
+      end
+
+      describe Account do
+        context "when opened" do
+          it "logger#account_opened was called once" do
+            logger = double("logger")
+            account = Account.new
+            account.logger = logger
+
+            logger.should_receive(:account_opened).twice
+
+            account.open
+            account.open
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: expect a message 3 times
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      class Account
+        attr_accessor :logger
+
+        def open
+          logger.account_opened
+        end
+      end
+
+      describe Account do
+        context "when opened" do
+          it "logger#account_opened was called once" do
+            logger = double("logger")
+            account = Account.new
+            account.logger = logger
+
+            logger.should_receive(:account_opened).exactly(3).times
+
+            account.open
+            account.open
+            account.open
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: expect a message at least (:once)
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      class Account
+        attr_accessor :logger
+
+        def open
+          logger.account_opened
+        end
+      end
+
+      describe Account do
+        context "when opened" do
+          it "logger#account_opened was called once" do
+            logger = double("logger")
+            account = Account.new
+            account.logger = logger
+
+            logger.should_receive(:account_opened).at_least(:once)
+
+            account.open
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+
+  Scenario: expect a message at least (n) times
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      class Account
+        attr_accessor :logger
+
+        def open
+          logger.account_opened
+        end
+      end
+
+      describe Account do
+        context "when opened" do
+          it "logger#account_opened was called once" do
+            logger = double("logger")
+            account = Account.new
+            account.logger = logger
+
+            logger.should_receive(:account_opened).at_least(3).times
+
+            # Note that I am calling method under test 4 times
+            # and I specified it to be called at least 3 times
+            account.open
+            account.open
+            account.open
+            account.open
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
+
+  Scenario: expect a message at most (:once)
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      class Account
+        attr_accessor :logger
+
+        def open
+          logger.account_opened
+        end
+      end
+
+      describe Account do
+        context "when opened" do
+          it "logger#account_opened was called once" do
+            logger = double("logger")
+            account = Account.new
+            account.logger = logger
+
+            logger.should_receive(:account_opened).at_most(:once)
+
+            account.open
+            account.open
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "expected: at most 1 time"
+     And the output should contain "received: 2 times"
+
+  Scenario: expect a message at most (n) times
+    Given a file named "spec/account_spec.rb" with:
+      """ruby
+      class Account
+        attr_accessor :logger
+
+        def open
+          logger.account_opened
+        end
+      end
+
+      describe Account do
+        context "when opened" do
+          it "logger#account_opened was called once" do
+            logger = double("logger")
+            account = Account.new
+            account.logger = logger
+
+            logger.should_receive(:account_opened).at_most(2).times
+
+            account.open
+            account.open
+          end
+        end
+      end
+      """
+    When I run `rspec spec/account_spec.rb`
+    Then the output should contain "1 example, 0 failures"
diff --git a/rspec-mocks/features/message_expectations/warn_when_expectation_is_set_on_nil.feature b/rspec-mocks/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
new file mode 100644
index 0000000..d827475
--- /dev/null
+++ b/rspec-mocks/features/message_expectations/warn_when_expectation_is_set_on_nil.feature
@@ -0,0 +1,50 @@
+Feature: warn when expectation is set on nil
+
+  Scenario: nil instance variable
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure {|c| c.mock_with :rspec}
+      describe "something" do
+        it "does something" do
+          @i_do_not_exist.should_receive(:foo)
+          @i_do_not_exist.foo
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "An expectation of :foo was set on nil"
+
+  Scenario: allow
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure {|c| c.mock_with :rspec}
+      describe "something" do
+        it "does something" do
+          allow_message_expectations_on_nil
+          nil.should_receive(:foo)
+          nil.foo
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should not contain "An expectation"
+
+  Scenario: allow in one example, but not on another
+    Given a file named "example_spec.rb" with:
+      """ruby
+      RSpec.configure {|c| c.mock_with :rspec}
+      describe "something" do
+        it "does something (foo)" do
+          allow_message_expectations_on_nil
+          nil.should_receive(:foo)
+          nil.foo
+        end
+        it "does something (bar)" do
+          nil.should_receive(:bar)
+          nil.bar
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the output should contain "An expectation of :bar"
+    And  the output should not contain "An expectation of :foo"
diff --git a/rspec-mocks/features/method_stubs/README.md b/rspec-mocks/features/method_stubs/README.md
new file mode 100644
index 0000000..340e92e
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/README.md
@@ -0,0 +1,73 @@
+### Stub return values
+
+    # create a double
+    obj = double()
+
+    # specify a return value using `:expect` syntax
+    allow(obj).to receive(:message) { :value }
+    allow(obj).to receive(:message).and_return(:value)
+
+    # specify a return value using `:should` syntax
+    obj.stub(:message) { :value }
+    obj.stub(:message => :value)
+    obj.stub(:message).and_return(:value)
+
+These forms are somewhat interchangeable. The difference is that the
+block contents are evaluated lazily when the `obj` receives the
+`message` message, whereas the others are evaluated as they are read.
+
+### Fake implementation
+
+    allow(obj).to receive(:message) do |arg1, arg2|
+      # set expectations about the args in this block
+      # and/or return  value
+    end
+
+    obj.stub(:message) do |arg1, arg2|
+      # set expectations about the args in this block
+      # and/or return a value
+    end
+
+### Raising/Throwing
+
+    allow(obj).to receive(:message).and_raise("this error")
+    allow(obj).to receive(:message).and_throw(:this_symbol)
+
+    obj.stub(:message).and_raise("this error")
+    obj.stub(:message).and_throw(:this_symbol)
+
+You can also use the block format:
+
+    allow(obj).to receive(:message) { raise "this error" }
+    allow(obj).to receive(:message) { throw :this_symbol }
+
+    obj.stub(:message) { raise "this error" }
+    obj.stub(:message) { throw :this_symbol }
+
+### Argument constraints
+
+#### Explicit arguments
+
+    allow(obj).to receive(:message).with('an argument') { ... }
+
+    obj.stub(:message).with('an argument') { ... }
+    obj.stub(:message).with('more_than', 'one_argument') { ... }
+
+#### Argument matchers
+
+    allow(obj).to receive(:message).with(anything()) { ... }
+    allow(obj).to receive(:message).with(an_instance_of(Money)) { ... }
+    allow(obj).to receive(:message).with(hash_including(:a => 'b')) { ... }
+    allow(obj).to receive(:message).with(array_including(1,2,3)) { ... }
+    # or
+    allow(obj).to receive(:message).with(array_including([1,2,3])) { ... }
+
+    obj.stub(:message).with(anything()) { ... }
+    obj.stub(:message).with(an_instance_of(Money)) { ... }
+    obj.stub(:message).with(hash_including(:a => 'b')) { ... }
+
+#### Regular expressions
+
+    allow(obj).to receive(:message).with(/abc/) { ... }
+
+    obj.stub(:message).with(/abc/) { ... }
diff --git a/rspec-mocks/features/method_stubs/any_instance.feature b/rspec-mocks/features/method_stubs/any_instance.feature
new file mode 100644
index 0000000..65e84ee
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/any_instance.feature
@@ -0,0 +1,136 @@
+Feature: stub on any instance of a class
+
+  Use `any_instance.stub` on a class to tell any instance of that class to
+  return a value (or values) in response to a given message.  If no instance
+  receives the message, nothing happens.
+
+  Messages can be stubbed on any class, including those in Ruby's core library.
+
+  Note: You can use `allow_any_instance_of` when you don't have a reference
+  to the object that receives a message in your test. For more information,
+  see the message_expectations/allow_any_instance_of feature.
+
+  Scenario: any_instance stub with a single return value
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "any_instance.stub" do
+        it "returns the specified value on any instance of the class" do
+          Object.any_instance.stub(:foo).and_return(:return_value)
+
+          o = Object.new
+          o.foo.should eq(:return_value)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: any_instance stub with a hash
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "any_instance.stub" do
+        context "with a hash" do
+          it "returns the hash values on any instance of the class" do
+            Object.any_instance.stub(:foo => 'foo', :bar => 'bar')
+
+            o = Object.new
+            o.foo.should eq('foo')
+            o.bar.should eq('bar')
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: any_instance stub with specific arguments matchers
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "any_instance.stub" do
+        context "with arguments" do
+          it "returns the stubbed value when arguments match" do
+            Object.any_instance.stub(:foo).with(:param_one, :param_two).and_return(:result_one)
+            Object.any_instance.stub(:foo).with(:param_three, :param_four).and_return(:result_two)
+
+            o = Object.new
+            o.foo(:param_one, :param_two).should eq(:result_one)
+            o.foo(:param_three, :param_four).should eq(:result_two)
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: any_instance unstub
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "any_instance.unstub" do
+        it "unstubs a stubbed method" do
+          class Object
+            def foo
+              :foo
+            end
+          end
+
+          Object.any_instance.stub(:foo)
+          Object.any_instance.unstub(:foo)
+
+          Object.new.foo.should eq(:foo)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: any_instance unstub
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "any_instance.unstub" do
+        context "with both an expectation and a stub already set" do
+          it "only removes the stub" do
+            class Object
+              def foo
+                :foo
+              end
+            end
+            Object.any_instance.should_receive(:foo).and_return(:bar)
+            Object.any_instance.stub(:foo)
+            Object.any_instance.unstub(:foo)
+
+            Object.new.foo.should eq(:bar)
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: stub a chain of methods an any instance
+    Given a file named "stub_chain_spec.rb" with:
+      """ruby
+      describe "stubbing a chain of methods" do
+        context "given symbols representing methods" do
+          it "returns the correct value" do
+            Object.any_instance.stub_chain(:one, :two, :three).and_return(:four)
+            Object.new.one.two.three.should eq(:four)
+          end
+        end
+
+        context "given a hash at the end" do
+          it "returns the correct value" do
+            Object.any_instance.stub_chain(:one, :two, :three => :four)
+            Object.new.one.two.three.should eq(:four)
+          end
+        end
+
+        context "given a string of methods separated by dots" do
+          it "returns the correct value" do
+            Object.any_instance.stub_chain("one.two.three").and_return(:four)
+            Object.new.one.two.three.should eq(:four)
+          end
+        end
+      end
+      """
+    When I run `rspec stub_chain_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/method_stubs/as_null_object.feature b/rspec-mocks/features/method_stubs/as_null_object.feature
new file mode 100644
index 0000000..afddf9e
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/as_null_object.feature
@@ -0,0 +1,40 @@
+Feature: as_null_object
+
+  Use the `as_null_object` method to ignore any messages that aren't explicitly
+  set as stubs or message expectations.
+
+  EXCEPTION: `to_ary` will raise a NoMethodError unless explicitly stubbed in
+  order to support `flatten` on an Array containing a double.
+
+  Scenario: double acting as_null_object
+    Given a file named "as_null_object_spec.rb" with:
+      """ruby
+      describe "a double with as_null_object called" do
+        let(:null_object) { double('null object').as_null_object }
+
+        it "responds to any method that is not defined" do
+          null_object.should respond_to(:an_undefined_method)
+        end
+
+        it "allows explicit stubs using expect syntax" do
+          allow(null_object).to receive(:foo) { "bar" }
+          expect(null_object.foo).to eq("bar")
+        end
+
+        it "allows explicit stubs using should syntax" do
+          null_object.stub(:foo) { "bar" }
+          null_object.foo.should eq("bar")
+        end
+
+        it "allows explicit expectations" do
+          null_object.should_receive(:something)
+          null_object.something
+        end
+
+        it "supports Array#flatten" do
+          [null_object].flatten.should eq([null_object])
+        end
+      end
+      """
+    When I run `rspec as_null_object_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/method_stubs/simple_return_value_with_allow.feature b/rspec-mocks/features/method_stubs/simple_return_value_with_allow.feature
new file mode 100644
index 0000000..82fca75
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/simple_return_value_with_allow.feature
@@ -0,0 +1,44 @@
+Feature: allow with a simple return value
+
+  Use the `allow` method with the `receive` matcher on a test double or a real
+  object to tell the object to return a value (or values) in response to a given
+  message. Nothing happens if the message is never received.
+
+  Scenario: stub with no return value
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a stub with no return value specified" do
+        let(:collaborator) { double("collaborator") }
+
+        it "returns nil" do
+          allow(collaborator).to receive(:message)
+          expect(collaborator.message).to be(nil)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: stubs with return values
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a stub with a return value" do
+        context "specified in a block" do
+          it "returns the specified value" do
+            collaborator = double("collaborator")
+            allow(collaborator).to receive(:message) { :value }
+            expect(collaborator.message).to eq(:value)
+          end
+        end
+
+        context "specified with #and_return" do
+          it "returns the specified value" do
+            collaborator = double("collaborator")
+            allow(collaborator).to receive(:message).and_return(:value)
+            expect(collaborator.message).to eq(:value)
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/method_stubs/simple_return_value_with_stub.feature b/rspec-mocks/features/method_stubs/simple_return_value_with_stub.feature
new file mode 100644
index 0000000..c942aea
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/simple_return_value_with_stub.feature
@@ -0,0 +1,64 @@
+Feature: stub with a simple return value
+
+  Use the `stub` method on a test double or a real object to tell the object to
+  return a value (or values) in response to a given message. Nothing happens if
+  the message is never received.
+
+  Scenario: stub with no return value
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a stub with no return value specified" do
+        let(:collaborator) { double("collaborator") }
+
+        it "returns nil" do
+          collaborator.stub(:message)
+          collaborator.message.should be(nil)
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
+
+  Scenario: stubs with return values
+    Given a file named "example_spec.rb" with:
+      """ruby
+      describe "a stub with a return value" do
+        context "specified in a block" do
+          it "returns the specified value" do
+            collaborator = double("collaborator")
+            collaborator.stub(:message) { :value }
+            collaborator.message.should eq(:value)
+          end
+        end
+
+        context "specified with #and_return" do
+          it "returns the specified value" do
+            collaborator = double("collaborator")
+            collaborator.stub(:message).and_return(:value)
+            collaborator.message.should eq(:value)
+          end
+        end
+
+        context "specified with a hash passed to #stub" do
+          it "returns the specified value" do
+            collaborator = double("collaborator")
+            collaborator.stub(:message_1 => :value_1, :message_2 => :value_2)
+            collaborator.message_1.should eq(:value_1)
+            collaborator.message_2.should eq(:value_2)
+          end
+        end
+
+        context "specified with a hash passed to #double" do
+          it "returns the specified value" do
+            collaborator = double("collaborator",
+              :message_1 => :value_1,
+              :message_2 => :value_2
+            )
+            collaborator.message_1.should eq(:value_1)
+            collaborator.message_2.should eq(:value_2)
+          end
+        end
+      end
+      """
+    When I run `rspec example_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/method_stubs/stub_chain.feature b/rspec-mocks/features/method_stubs/stub_chain.feature
new file mode 100644
index 0000000..ba389bd
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/stub_chain.feature
@@ -0,0 +1,51 @@
+Feature: stub a chain of methods
+
+  Use the `stub_chain` method to stub a chain of two or more methods in one
+  statement.  Method chains are considered a design smell, but it's not really
+  the method chain itself that is the problem - it's the dependency chain
+  represented by a chain of messages to different objects:
+
+      foo.get_bar.get_baz
+
+  This is a Law of Demeter violation if `get_bar` returns an object other than
+  `foo`, and `get_baz` returns yet another object.
+
+  Fluent interfaces look similar from a caller's perspective, but don't
+  represent a dependency chain (the caller depends only on the object it is
+  calling). Consider this common example from Ruby on Rails:
+
+      Article.recent.by(current_user)
+
+  The `recent` and `by` methods return the same object, so this is not a Law of
+  Demeter violation.
+
+  Scenario: stub a chain of methods
+    Given a file named "stub_chain_spec.rb" with:
+      """ruby
+      describe "stubbing a chain of methods" do
+        subject { Object.new }
+
+        context "given symbols representing methods" do
+          it "returns the correct value" do
+            subject.stub_chain(:one, :two, :three).and_return(:four)
+            subject.one.two.three.should eq(:four)
+          end
+        end
+
+        context "given a hash at the end" do
+          it "returns the correct value" do
+            subject.stub_chain(:one, :two, :three => :four)
+            subject.one.two.three.should eq(:four)
+          end
+        end
+
+        context "given a string of methods separated by dots" do
+          it "returns the correct value" do
+            subject.stub_chain("one.two.three").and_return(:four)
+            subject.one.two.three.should eq(:four)
+          end
+        end
+      end
+      """
+    When I run `rspec stub_chain_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/method_stubs/stub_implementation.feature b/rspec-mocks/features/method_stubs/stub_implementation.feature
new file mode 100644
index 0000000..581e43d
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/stub_implementation.feature
@@ -0,0 +1,48 @@
+Feature: stub with substitute implementation
+
+  You can stub an implementation of a method (a.k.a. fake) by passing a block
+  to the `stub` method.
+
+  Scenario: stub implementation using `expect` syntax
+  Given a file named "stub_implementation_spec.rb" with:
+    """ruby
+    describe "a stubbed implementation" do
+      it "works" do
+        object = Object.new
+        allow(object).to receive(:foo) do |arg|
+          if arg == :this
+            "got this"
+          elsif arg == :that
+            "got that"
+          end
+        end
+
+        expect(object.foo(:this)).to eq("got this")
+        expect(object.foo(:that)).to eq("got that")
+      end
+    end
+    """
+  When I run `rspec stub_implementation_spec.rb`
+  Then the output should contain "1 example, 0 failures"
+
+  Scenario: stub implementation using `should` syntax
+    Given a file named "stub_implementation_spec.rb" with:
+      """ruby
+      describe "a stubbed implementation" do
+        it "works" do
+          object = Object.new
+          object.stub(:foo) do |arg|
+            if arg == :this
+              "got this"
+            elsif arg == :that
+              "got that"
+            end
+          end
+
+          object.foo(:this).should eq("got this")
+          object.foo(:that).should eq("got that")
+        end
+      end
+      """
+    When I run `rspec stub_implementation_spec.rb`
+    Then the output should contain "1 example, 0 failures"
diff --git a/rspec-mocks/features/method_stubs/to_ary.feature b/rspec-mocks/features/method_stubs/to_ary.feature
new file mode 100644
index 0000000..251fa50
--- /dev/null
+++ b/rspec-mocks/features/method_stubs/to_ary.feature
@@ -0,0 +1,51 @@
+Feature: double handling to_ary
+
+  Ruby implicitly sends `to_ary` to all of the objects in an `Array` when the
+  array receives `flatten`:
+
+      [obj].flatten # => obj.to_ary
+
+  If `to_ary` raises a `NoMethodError`, Ruby sees that the object can not be coerced
+  into an array and moves on to the next object.
+
+  To support this, an RSpec double will raise a NoMethodError when it receives
+  `to_ary` _even if it is set `as_null_object`_, unless `to_ary` is explicitly
+  stubbed.
+
+  Scenario: double receiving to_ary
+    Given a file named "example.rb" with:
+      """ruby
+      describe "#to_ary" do
+        shared_examples "to_ary" do
+          it "can be overridden with a stub" do
+            obj.stub(:to_ary) { :non_nil_value }
+            obj.to_ary.should be(:non_nil_value)
+          end
+
+          it "supports Array#flatten" do
+            obj = double('foo')
+            [obj].flatten.should eq([obj])
+          end
+        end
+
+        context "sent to a double as_null_object" do
+          let(:obj) { double('obj').as_null_object }
+          include_examples "to_ary"
+
+          it "returns nil" do
+            expect( obj.to_ary ).to eq nil
+          end
+        end
+
+        context "sent to a double without as_null_object" do
+          let(:obj) { double('obj') }
+          include_examples "to_ary"
+
+          it "raises a NoMethodError" do
+            expect { obj.to_ary }.to raise_error(NoMethodError)
+          end
+        end
+      end
+     """
+    When I run `rspec example.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/mutating_constants/README.md b/rspec-mocks/features/mutating_constants/README.md
new file mode 100644
index 0000000..024e82f
--- /dev/null
+++ b/rspec-mocks/features/mutating_constants/README.md
@@ -0,0 +1,82 @@
+## Mutating Constants
+
+### Stubbing
+
+Support is provided for stubbing constants. Like with method stubs, the
+stubbed constants will be restored to their original state when an
+example completes.
+
+``` ruby
+stub_const("Foo", fake_foo)
+Foo # => fake_foo
+```
+
+Stubbed constant names must be fully qualified; the current module
+nesting is not considered.
+
+``` ruby
+module MyGem
+  class SomeClass; end
+end
+
+module MyGem
+  describe "Something" do
+    let(:fake_class) { Class.new }
+
+    it "accidentally stubs the wrong constant" do
+      # this stubs ::SomeClass (in the top-level namespace),
+      # not MyGem::SomeClass like you probably mean.
+      stub_const("SomeClass", fake_class)
+    end
+
+    it "stubs the right constant" do
+      stub_const("MyGem::SomeClass", fake_class)
+    end
+  end
+end
+```
+
+When you stub a constant that is a module or a class, nested
+constants on the original module or class are not transferred
+by default, but you can use the `:transfer_nested_constants`
+option to tell rspec-mocks to transfer them:
+
+``` ruby
+class CardDeck
+  SUITS = [:Spades, :Diamonds, :Clubs, :Hearts]
+  NUM_CARDS = 52
+end
+
+fake_class = Class.new
+stub_const("CardDeck", fake_class)
+CardDeck # => fake_class
+CardDeck::SUITS # => raises uninitialized constant error
+CardDeck::NUM_CARDS # => raises uninitialized constant error
+
+stub_const("CardDeck", fake_class, :transfer_nested_constants => true)
+CardDeck::SUITS # => [:Spades, :Diamonds, :Clubs, :Hearts]
+CardDeck::NUM_CARDS # => 52
+
+stub_const("CardDeck", fake_class, :transfer_nested_constants => [:SUITS])
+CardDeck::SUITS # => [:Spades, :Diamonds, :Clubs, :Hearts]
+CardDeck::NUM_CARDS # => raises uninitialized constant error
+```
+
+### Hiding
+
+Support is also provided for hiding constants. Hiding a constant temporarily
+removes it; it is restored to its original value after the test completes.
+
+```ruby
+FOO = 42
+hide_const("FOO")
+FOO => NameError: uninitialized constant FOO
+```
+
+Like stubbed constants, names must be fully qualified.
+
+Hiding constants that are already undefined has no effect.
+
+```ruby
+hide_const("NO_OP")
+```
diff --git a/rspec-mocks/features/mutating_constants/hiding_defined_constant.feature b/rspec-mocks/features/mutating_constants/hiding_defined_constant.feature
new file mode 100644
index 0000000..296221f
--- /dev/null
+++ b/rspec-mocks/features/mutating_constants/hiding_defined_constant.feature
@@ -0,0 +1,64 @@
+Feature: Hide Defined Constant
+
+  Use `hide_const` to remove a constant for the duration of a test.
+
+  Scenario: Hide top-level constant
+    Given a file named "hide_const_spec.rb" with:
+      """ruby
+      FOO = 7
+
+      describe "hiding FOO" do
+        it "can hide FOO" do
+          hide_const("FOO")
+          expect { FOO }.to raise_error(NameError)
+        end
+
+        it "restores the hidden constant when the example completes" do
+          FOO.should eq(7)
+        end
+      end
+      """
+    When I run `rspec hide_const_spec.rb`
+    Then the examples should all pass
+
+  Scenario: Hide nested constant
+    Given a file named "hide_const_spec.rb" with:
+      """ruby
+      module MyGem
+        class SomeClass
+          FOO = 7
+        end
+      end
+
+      module MyGem
+        describe SomeClass do
+          it "hides the nested constant when it is fully qualified" do
+            hide_const("MyGem::SomeClass::FOO")
+            expect { SomeClass::FOO }.to raise_error(NameError)
+          end
+
+          it "restores the hidden constant when the example completes" do
+            MyGem::SomeClass::FOO.should eq(7)
+          end
+        end
+      end
+      """
+    When I run `rspec hide_const_spec.rb`
+    Then the examples should all pass
+
+  Scenario: Hiding undefined constant
+    Given a file named "hide_const_spec.rb" with:
+      """
+      describe "hiding UNDEFINED_CONSTANT" do
+        it "has no effect" do
+          hide_const("UNDEFINED_CONSTANT")
+          expect { UNDEFINED_CONSTANT }.to raise_error(NameError)
+        end
+
+        it "is still undefined after the example completes" do
+          expect { UNDEFINED_CONSTANT }.to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec hide_const_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/mutating_constants/stub_defined_constant.feature b/rspec-mocks/features/mutating_constants/stub_defined_constant.feature
new file mode 100644
index 0000000..8d16697
--- /dev/null
+++ b/rspec-mocks/features/mutating_constants/stub_defined_constant.feature
@@ -0,0 +1,79 @@
+Feature: Stub Defined Constant
+
+  Use `stub_const` to stub constants. When the constant is already defined,
+  the stubbed value will replace the original value for the duration of the
+  example.
+
+  Scenario: Stub top-level constant
+    Given a file named "stub_const_spec.rb" with:
+      """ruby
+      FOO = 7
+
+      describe "stubbing FOO" do
+        it "can stub FOO with a different value" do
+          stub_const("FOO", 5)
+          FOO.should eq(5)
+        end
+
+        it "restores the stubbed constant when the example completes" do
+          FOO.should eq(7)
+        end
+      end
+      """
+    When I run `rspec stub_const_spec.rb`
+    Then the examples should all pass
+
+  Scenario: Stub nested constant
+    Given a file named "stub_const_spec.rb" with:
+      """ruby
+      module MyGem
+        class SomeClass
+          FOO = 7
+        end
+      end
+
+      module MyGem
+        describe SomeClass do
+          it "stubs the nested constant when it is fully qualified" do
+            stub_const("MyGem::SomeClass::FOO", 5)
+            SomeClass::FOO.should eq(5)
+          end
+        end
+      end
+      """
+    When I run `rspec stub_const_spec.rb`
+    Then the examples should all pass
+
+  Scenario: Transfer nested constants
+    Given a file named "stub_const_spec.rb" with:
+      """ruby
+      module MyGem
+        class SomeClass
+          FOO = 7
+        end
+      end
+
+      module MyGem
+        describe SomeClass do
+          let(:fake_class) { Class.new }
+
+          it "does not transfer nested constants by default" do
+            stub_const("MyGem::SomeClass", fake_class)
+            expect { SomeClass::FOO }.to raise_error(NameError)
+          end
+
+          it "transfers nested constants when using :transfer_nested_constants => true" do
+            stub_const("MyGem::SomeClass", fake_class, :transfer_nested_constants => true)
+            SomeClass::FOO.should eq(7)
+          end
+
+          it "can specify a list of nested constants to transfer" do
+            stub_const("MyGem::SomeClass", fake_class, :transfer_nested_constants => [:FOO])
+            SomeClass::FOO.should eq(7)
+          end
+        end
+      end
+      """
+    When I run `rspec stub_const_spec.rb`
+    Then the examples should all pass
+
diff --git a/rspec-mocks/features/mutating_constants/stub_undefined_constant.feature b/rspec-mocks/features/mutating_constants/stub_undefined_constant.feature
new file mode 100644
index 0000000..0379ec4
--- /dev/null
+++ b/rspec-mocks/features/mutating_constants/stub_undefined_constant.feature
@@ -0,0 +1,50 @@
+Feature: Stub Undefined Constant
+
+  Use `stub_const` to stub constants. When the constant is not already defined,
+  all the necessary intermediary modules will be dynamically created. When the
+  example completes, the intermediary module constants will be removed to return
+  the constant state to how it started.
+
+  Scenario: Stub top-level constant
+    Given a file named "stub_const_spec.rb" with:
+      """ruby
+      describe "stubbing FOO" do
+        it "can stub undefined constant FOO" do
+          stub_const("FOO", 5)
+          FOO.should eq(5)
+        end
+
+        it "undefines the constant when the example completes" do
+          expect { FOO }.to raise_error(NameError)
+        end
+      end
+      """
+    When I run `rspec stub_const_spec.rb`
+    Then the examples should all pass
+
+  Scenario: Stub nested constant
+    Given a file named "stub_const_spec.rb" with:
+      """ruby
+      module MyGem
+        class SomeClass
+        end
+      end
+
+      module MyGem
+        describe SomeClass do
+          it "can stub an arbitrarily deep constant that is undefined" do
+            defined?(SomeClass::A).should be_false
+            stub_const("MyGem::SomeClass::A::B::C", 3)
+            SomeClass::A::B::C.should eq(3)
+            SomeClass::A.should be_a(Module)
+          end
+
+          it 'undefines the intermediary constants that were dynamically created' do
+            defined?(SomeClass).should be_true
+            defined?(SomeClass::A).should be_false
+          end
+        end
+      end
+      """
+    When I run `rspec stub_const_spec.rb`
+    Then the examples should all pass
diff --git a/rspec-mocks/features/outside_rspec/configuration.feature b/rspec-mocks/features/outside_rspec/configuration.feature
new file mode 100644
index 0000000..5ba3c38
--- /dev/null
+++ b/rspec-mocks/features/outside_rspec/configuration.feature
@@ -0,0 +1,62 @@
+Feature: configure any test framework to use rspec-mocks
+
+  Test frameworks that want to use rspec-mocks can use
+  RSpec::Mocks::setup(self) to hook into rspec-mocks. Doing so adds the
+  following:
+
+    To the object passed to setup:
+
+      double # creates a test double
+      mock   # creates a test double
+      stub   # creates a test double
+
+    To every object in the system:
+
+      should_receive
+      should_not_receive
+      stub
+
+  NOTICE: the stub() method that is added to the object passed to setup is not
+  the same stub() method that is added to every other object.
+
+  Scenario: RSpec::Mocks::setup(object) adds double, mock, and stub methods to the submitted object
+    Given a file named "foo.rb" with:
+      """ruby
+      require 'rspec/mocks'
+
+      class CodeExample
+        def init
+          RSpec::Mocks::setup(self)
+        end
+      end
+
+      example = CodeExample.new
+      example.init
+
+      puts example.respond_to?(:double)
+      puts example.respond_to?(:mock)
+      puts example.respond_to?(:stub)
+      """
+
+    When I run `ruby foo.rb`
+    Then the output should contain "true"
+    But  the output should not contain "false"
+
+  Scenario: RSpec::Mocks::setup(anything) adds methods to Object
+    Given a file named "foo.rb" with:
+      """ruby
+      require 'rspec/mocks'
+
+      RSpec::Mocks::setup(Object.new)
+
+      obj = Object.new
+
+      puts obj.respond_to?(:should_receive)
+      puts obj.respond_to?(:should_not_receive)
+      puts obj.respond_to?(:stub)
+      """
+
+    When I run `ruby foo.rb`
+    Then the output should contain "true"
+    But  the output should not contain "false"
+
diff --git a/rspec-mocks/features/outside_rspec/standalone.feature b/rspec-mocks/features/outside_rspec/standalone.feature
new file mode 100644
index 0000000..b6bec41
--- /dev/null
+++ b/rspec-mocks/features/outside_rspec/standalone.feature
@@ -0,0 +1,33 @@
+Feature: standalone
+
+  require "rspec/mocks/standalone" to expose the mock framework
+  outside the RSpec environment. This is especially useful for
+  exploring rspec-mocks in irb.
+
+  Scenario: method stub outside rspec
+    Given a file named "example.rb" with:
+      """ruby
+      require "rspec/mocks/standalone"
+
+      greeter = double("greeter")
+      greeter.stub(:say_hi) { "Hello!" }
+      puts greeter.say_hi
+      """
+    When I run `ruby example.rb`
+    Then the output should contain "Hello!"
+
+  Scenario: message expectation outside rspec
+    Given a file named "example.rb" with:
+      """ruby
+      require "rspec/mocks/standalone"
+
+      greeter = double("greeter")
+      greeter.should_receive(:say_hi)
+
+      RSpec::Mocks.verify
+      """
+    When I run `ruby example.rb`
+    Then the output should contain "RSpec::Mocks::MockExpectationError"
+    And the output should contain "say_hi(any args)"
+    And the output should contain "expected: 1 time"
+    And the output should contain "received: 0 times"
diff --git a/rspec-mocks/features/spies/spy_partial_mock_method.feature b/rspec-mocks/features/spies/spy_partial_mock_method.feature
new file mode 100644
index 0000000..26ee639
--- /dev/null
+++ b/rspec-mocks/features/spies/spy_partial_mock_method.feature
@@ -0,0 +1,34 @@
+Feature: Spy on a stubbed method on a partial mock
+
+  You can also use `have_received` to verify that a stubbed method was invoked
+  on a partial mock.
+
+  Scenario: verify a stubbed method
+    Given a file named "verified_spy_spec.rb" with:
+      """ruby
+      describe "have_received" do
+        it "passes when the expectation is met" do
+          invitation = Object.new
+          invitation.stub(:deliver => true)
+          invitation.deliver
+          invitation.should have_received(:deliver)
+        end
+      end
+      """
+    When I run `rspec verified_spy_spec.rb`
+    Then the examples should all pass
+
+  Scenario: fail to verify a stubbed method
+    Given a file named "failed_spy_spec.rb" with:
+      """ruby
+      describe "have_received" do
+        it "fails when the expectation is not met" do
+          invitation = Object.new
+          invitation.stub(:deliver => true)
+          invitation.should have_received(:deliver)
+        end
+      end
+      """
+    When I run `rspec failed_spy_spec.rb`
+    Then the output should contain "expected: 1 time"
+     And the output should contain "received: 0 times"
diff --git a/rspec-mocks/features/spies/spy_pure_mock_method.feature b/rspec-mocks/features/spies/spy_pure_mock_method.feature
new file mode 100644
index 0000000..1883f63
--- /dev/null
+++ b/rspec-mocks/features/spies/spy_pure_mock_method.feature
@@ -0,0 +1,76 @@
+Feature: Spy on a stubbed method on a pure mock
+
+  You can use `have_received` to verify that a stubbed method was invoked,
+  rather than setting an expectation for it to be invoked beforehand.
+
+  Scenario: verify a stubbed method
+    Given a file named "verified_spy_spec.rb" with:
+      """ruby
+      describe "have_received" do
+        it "passes when the expectation is met" do
+          invitation = double('invitation', :deliver => true)
+          invitation.deliver
+          invitation.should have_received(:deliver)
+        end
+      end
+      """
+    When I run `rspec verified_spy_spec.rb`
+    Then the examples should all pass
+
+  Scenario: verify a stubbed method with message expectations
+    Given a file named "verified_message_expectations_spec.rb" with:
+      """ruby
+      describe "have_received" do
+        it "passes when the expectation is met" do
+          invitation = double('invitation', :deliver => true)
+          2.times { invitation.deliver(:expected, :arguments) }
+          invitation.should have_received(:deliver).
+            with(:expected, :arguments).
+            twice
+        end
+      end
+      """
+    When I run `rspec verified_message_expectations_spec.rb`
+    Then the examples should all pass
+
+  Scenario: fail to verify a stubbed method
+    Given a file named "failed_spy_spec.rb" with:
+      """ruby
+      describe "have_received" do
+        it "fails when the expectation is not met" do
+          invitation = double('invitation', :deliver => true)
+          invitation.should have_received(:deliver)
+        end
+      end
+      """
+    When I run `rspec failed_spy_spec.rb`
+    Then the output should contain "expected: 1 time"
+     And the output should contain "received: 0 times"
+
+  Scenario: fail to verify message expectations
+    Given a file named "failed_message_expectations_spec.rb" with:
+      """ruby
+      describe "have_received" do
+        it "fails when the arguments are different" do
+          invitation = double('invitation', :deliver => true)
+          invitation.deliver(:unexpected)
+          invitation.should have_received(:deliver).with(:expected, :arguments)
+        end
+      end
+      """
+    When I run `rspec failed_message_expectations_spec.rb`
+    Then the output should contain "expected: (:expected, :arguments)"
+    And the output should contain "got: (:unexpected)"
+
+  Scenario: generate a spy message
+    Given a file named "spy_message_spec.rb" with:
+      """ruby
+      describe "have_received" do
+      subject(:invitation) { double('invitation', :deliver => true) }
+        before { invitation.deliver }
+
+        it { should have_received(:deliver) }
+      end
+      """
+    When I run `rspec --format documentation spy_message_spec.rb`
+    Then the output should contain "should have received deliver"
diff --git a/rspec-mocks/features/spies/spy_unstubbed_method.feature b/rspec-mocks/features/spies/spy_unstubbed_method.feature
new file mode 100644
index 0000000..8246ff9
--- /dev/null
+++ b/rspec-mocks/features/spies/spy_unstubbed_method.feature
@@ -0,0 +1,18 @@
+Feature: Spy on an unstubbed method
+
+  Using have_received on an unstubbed method will never pass, so rspec-mocks
+  issues a helpful error message.
+
+  Scenario: fail to verify a stubbed method
+    Given a file named "failed_spy_spec.rb" with:
+      """ruby
+      describe "have_received" do
+        it "raises a helpful error for unstubbed methods" do
+          object = Object.new
+          object.object_id
+          object.should have_received(:object_id)
+        end
+      end
+      """
+    When I run `rspec failed_spy_spec.rb`
+    Then the output should contain "that method has not been stubbed"
diff --git a/rspec-mocks/features/step_definitions/additional_cli_steps.rb b/rspec-mocks/features/step_definitions/additional_cli_steps.rb
new file mode 100644
index 0000000..22cd029
--- /dev/null
+++ b/rspec-mocks/features/step_definitions/additional_cli_steps.rb
@@ -0,0 +1,11 @@
+Then /^the example(?:s)? should(?: all)? pass$/ do
+  step %q{the output should contain "0 failures"}
+  step %q{the exit status should be 0}
+end
+
+# Useful for when the output is slightly different on different versions of ruby
+Then /^the output should contain "([^"]*)" or "([^"]*)"$/ do |string1, string2|
+  unless [string1, string2].any? { |s| all_output =~ regexp(s) }
+    fail %Q{Neither "#{string1}" or "#{string2}" were found in:\n#{all_output}}
+  end
+end
diff --git a/rspec-mocks/features/support/env.rb b/rspec-mocks/features/support/env.rb
new file mode 100644
index 0000000..9f58981
--- /dev/null
+++ b/rspec-mocks/features/support/env.rb
@@ -0,0 +1,13 @@
+require 'aruba/cucumber'
+require 'rspec/expectations'
+
+Before do
+  RUBY_PLATFORM =~ /java/ ? @aruba_timeout_seconds = 60 : @aruba_timeout_seconds = 5
+end
+
+Aruba.configure do |config|
+  config.before_cmd do |cmd|
+    set_env('JRUBY_OPTS', "-X-C #{ENV['JRUBY_OPTS']}") # disable JIT since these processes are so short lived
+  end
+end if RUBY_PLATFORM == 'java'
+
diff --git a/rspec-mocks/features/support/rubinius.rb b/rspec-mocks/features/support/rubinius.rb
new file mode 100644
index 0000000..3907962
--- /dev/null
+++ b/rspec-mocks/features/support/rubinius.rb
@@ -0,0 +1,6 @@
+# Required until https://github.com/rubinius/rubinius/issues/2430 is resolved
+ENV['RBXOPT'] = "#{ENV["RBXOPT"]} -Xcompiler.no_rbc"
+
+Around "@unsupported-on-rbx" do |scenario, block|
+  block.call unless defined?(Rubinius)
+end
diff --git a/rspec-mocks/features/test_frameworks/test_unit.feature b/rspec-mocks/features/test_frameworks/test_unit.feature
new file mode 100644
index 0000000..4897e7a
--- /dev/null
+++ b/rspec-mocks/features/test_frameworks/test_unit.feature
@@ -0,0 +1,43 @@
+Feature: Test::Unit integration
+
+  rspec-mocks is a stand-alone gem that can be used without the rest of
+  RSpec. If you like the way Test::Unit (or MiniTest) organizes tests, but
+  prefer RSpec's approach to mocking/stubbing/doubles etc, you can have both.
+
+  The one downside is that failures are reported as errors with MiniTest.
+
+  Scenario: use rspec/mocks with Test::Unit
+    Given a file named "rspec_mocks_test.rb" with:
+      """ruby
+      require 'test/unit'
+      require 'rspec/mocks'
+
+      class RSpecMocksTest < Test::Unit::TestCase
+        def setup
+          RSpec::Mocks.setup(Object)
+          RSpec::Mocks.setup(self)
+        end
+
+        def test_passing_expectation
+          obj = Object.new
+          expect(obj).to receive(:message)
+          obj.message
+        end
+
+        def test_failing_expectation
+          obj = Object.new
+          expect(obj).to_not receive(:message)
+          obj.message
+        end
+
+        def test_with_deprecation_warning
+          obj = Object.new
+          obj.stub(:old_message) { RSpec.deprecate(:old_message, :replacement => :message) }
+          obj.old_message
+        end
+      end
+      """
+     When I run `ruby rspec_mocks_test.rb`
+     Then the output should contain "3 tests, 0 assertions, 0 failures, 1 errors" or "3 tests, 0 assertions, 1 failures, 0 errors"
+     And the output should contain "expected: 0 times with any arguments"
+     And the output should contain "old_message is deprecated. Use message instead."
diff --git a/rspec-mocks/lib/rspec/mocks.rb b/rspec-mocks/lib/rspec/mocks.rb
new file mode 100644
index 0000000..ba724ea
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks.rb
@@ -0,0 +1,92 @@
+require 'rspec/mocks/framework'
+require 'rspec/mocks/version'
+
+module RSpec
+
+  module Mocks
+    class << self
+      attr_accessor :space
+
+      def setup(host)
+        (class << host; self; end).class_eval do
+          include RSpec::Mocks::ExampleMethods
+        end
+        self.space ||= RSpec::Mocks::Space.new
+      end
+
+      def verify
+        space.verify_all
+      end
+
+      def teardown
+        space.reset_all
+      end
+
+      def proxy_for(object)
+        space.proxy_for(object)
+      end
+
+      def any_instance_recorder_for(klass)
+        space.any_instance_recorder_for(klass)
+      end
+
+      # Adds an allowance (stub) on `subject`
+      #
+      # @param subject the subject to which the message will be added
+      # @param message a symbol, representing the message that will be
+      #                added.
+      # @param opts a hash of options, :expected_from is used to set the
+      #             original call site
+      # @param block an optional implementation for the allowance
+      #
+      # @example Defines the implementation of `foo` on `bar`, using the passed block
+      #   x = 0
+      #   RSpec::Mocks.allow_message(bar, :foo) { x += 1 }
+      def allow_message(subject, message, opts={}, &block)
+        orig_caller = opts.fetch(:expected_from) { caller(1)[0] }
+        ::RSpec::Mocks.proxy_for(subject).
+          add_stub(orig_caller, message.to_sym, opts, &block)
+      end
+
+      # Sets a message expectation on `subject`.
+      # @param subject the subject on which the message will be expected
+      # @param message a symbol, representing the message that will be
+      #                expected.
+      # @param opts a hash of options, :expected_from is used to set the
+      #             original call site
+      # @param block an optional implementation for the expectation
+      #
+      # @example Expect the message `foo` to receive `bar`, then call it
+      #   RSpec::Mocks.expect_message(bar, :foo)
+      #   bar.foo
+      def expect_message(subject, message, opts={}, &block)
+        orig_caller = opts.fetch(:expected_from) { caller(1)[0] }
+        ::RSpec::Mocks.proxy_for(subject).
+          add_message_expectation(orig_caller, message.to_sym, opts, &block)
+      end
+
+      # @api private
+      KERNEL_METHOD_METHOD = ::Kernel.instance_method(:method)
+
+      # @api private
+      # Used internally to get a method handle for a particular object
+      # and method name.
+      #
+      # Includes handling for a few special cases:
+      #
+      #   - Objects that redefine #method (e.g. an HTTPRequest struct)
+      #   - BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)
+      def method_handle_for(object, method_name)
+        if ::Kernel === object
+          KERNEL_METHOD_METHOD.bind(object).call(method_name)
+        else
+          object.method(method_name)
+        end
+      end
+    end
+
+    # @private
+    IGNORED_BACKTRACE_LINE = 'this backtrace line is ignored'
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/any_instance/chain.rb b/rspec-mocks/lib/rspec/mocks/any_instance/chain.rb
new file mode 100644
index 0000000..04b985a
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/any_instance/chain.rb
@@ -0,0 +1,93 @@
+module RSpec
+  module Mocks
+    module AnyInstance
+      class Chain
+        def initialize(*args, &block)
+          @expectation_args  = args
+          @expectation_block = block
+        end
+
+        module Customizations
+          # @macro [attach] record
+          #   @method $1(*args, &block)
+          #   Records the `$1` message for playback against an instance that
+          #   invokes a method stubbed or mocked using `any_instance`.
+          #
+          #   @see RSpec::Mocks::MessageExpectation#$1
+          #
+          def self.record(method_name)
+            class_eval(<<-EOM, __FILE__, __LINE__ + 1)
+              def #{method_name}(*args, &block)
+                record(:#{method_name}, *args, &block)
+              end
+            EOM
+          end
+
+          record :and_return
+          record :and_raise
+          record :and_throw
+          record :and_yield
+          record :and_call_original
+          record :with
+          record :once
+          record :twice
+          record :any_number_of_times
+          record :exactly
+          record :times
+          record :never
+          record :at_least
+          record :at_most
+        end
+
+        include Customizations
+
+        # @private
+        def playback!(instance)
+          message_expectation = create_message_expectation_on(instance)
+          messages.inject(message_expectation) do |object, message|
+            object.__send__(*message.first, &message.last)
+          end
+        end
+
+        # @private
+        def constrained_to_any_of?(*constraints)
+          constraints.any? do |constraint|
+            messages.any? do |message|
+              message.first.first == constraint
+            end
+          end
+        end
+
+        # @private
+        def expectation_fulfilled!
+          @expectation_fulfilled = true
+        end
+
+        def never
+          ErrorGenerator.raise_double_negation_error("expect_any_instance_of(MyClass)") if negated?
+          super
+        end
+
+        private
+
+        def negated?
+          messages.any? { |(message, *_), _| message.to_sym == :never }
+        end
+
+        def messages
+          @messages ||= []
+        end
+
+        def last_message
+          messages.last.first.first unless messages.empty?
+        end
+
+        def record(rspec_method_name, *args, &block)
+          verify_invocation_order(rspec_method_name, *args, &block)
+          messages << [args.unshift(rspec_method_name), block]
+          self
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/any_instance/expectation_chain.rb b/rspec-mocks/lib/rspec/mocks/any_instance/expectation_chain.rb
new file mode 100644
index 0000000..699a215
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/any_instance/expectation_chain.rb
@@ -0,0 +1,42 @@
+module RSpec
+  module Mocks
+    module AnyInstance
+      # @api private
+      class ExpectationChain < Chain
+        def expectation_fulfilled?
+          @expectation_fulfilled || constrained_to_any_of?(:never, :any_number_of_times)
+        end
+
+        def initialize(*args, &block)
+          @expectation_fulfilled = false
+          super
+        end
+
+        private
+        def verify_invocation_order(rspec_method_name, *args, &block)
+        end
+      end
+
+      # @api private
+      class PositiveExpectationChain < ExpectationChain
+
+        private
+
+        def create_message_expectation_on(instance)
+          proxy = ::RSpec::Mocks.proxy_for(instance)
+          expected_from = IGNORED_BACKTRACE_LINE
+          proxy.add_message_expectation(expected_from, *@expectation_args, &@expectation_block)
+        end
+
+        def invocation_order
+          @invocation_order ||= {
+            :with => [nil],
+            :and_return => [:with, nil],
+            :and_raise => [:with, nil]
+          }
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/any_instance/message_chains.rb b/rspec-mocks/lib/rspec/mocks/any_instance/message_chains.rb
new file mode 100644
index 0000000..eb2391b
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/any_instance/message_chains.rb
@@ -0,0 +1,60 @@
+module RSpec
+  module Mocks
+    module AnyInstance
+      # @private
+      class MessageChains < Hash
+        def initialize
+          super {|h,k| h[k] = []}
+        end
+
+        # @private
+        def add(method_name, chain)
+          self[method_name] << chain
+          chain
+        end
+
+        # @private
+        def remove_stub_chains_for!(method_name)
+          self[method_name].reject! {|chain| chain.is_a?(StubChain)}
+        end
+
+        # @private
+        def has_expectation?(method_name)
+          self[method_name].find {|chain| chain.is_a?(ExpectationChain)}
+        end
+
+        # @private
+        def all_expectations_fulfilled?
+          all? {|method_name, chains| chains.all? {|chain| chain.expectation_fulfilled?}}
+        end
+
+        # @private
+        def unfulfilled_expectations
+          map do |method_name, chains|
+            method_name.to_s if chains.last.is_a?(ExpectationChain) unless chains.last.expectation_fulfilled?
+          end.compact
+        end
+
+        # @private
+        def received_expected_message!(method_name)
+          self[method_name].each {|chain| chain.expectation_fulfilled!}
+        end
+
+        # @private
+        def playback!(instance, method_name)
+          raise_if_second_instance_to_receive_message(instance)
+          self[method_name].each {|chain| chain.playback!(instance)}
+        end
+
+        private
+
+        def raise_if_second_instance_to_receive_message(instance)
+          @instance_with_expectation ||= instance if instance.is_a?(ExpectationChain)
+          if instance.is_a?(ExpectationChain) && !@instance_with_expectation.equal?(instance)
+            raise RSpec::Mocks::MockExpectationError, "Exactly one instance should have received the following message(s) but didn't: #{unfulfilled_expectations.sort.join(', ')}"
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/any_instance/recorder.rb b/rspec-mocks/lib/rspec/mocks/any_instance/recorder.rb
new file mode 100644
index 0000000..64b0a8f
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/any_instance/recorder.rb
@@ -0,0 +1,206 @@
+module RSpec
+  module Mocks
+    module AnyInstance
+      # Given a class `TheClass`, `TheClass.any_instance` returns a `Recorder`,
+      # which records stubs and message expectations for later playback on
+      # instances of `TheClass`.
+      #
+      # Further constraints are stored in instances of [Chain](Chain).
+      #
+      # @see AnyInstance
+      # @see Chain
+      class Recorder
+        # @private
+        attr_reader :message_chains
+
+        def initialize(klass)
+          @message_chains = MessageChains.new
+          @observed_methods = []
+          @played_methods = {}
+          @klass = klass
+          @expectation_set = false
+        end
+
+        # Initializes the recording a stub to be played back against any
+        # instance of this object that invokes the submitted method.
+        #
+        # @see Methods#stub
+        def stub(method_name_or_method_map, &block)
+          if method_name_or_method_map.is_a?(Hash)
+            method_name_or_method_map.each do |method_name, return_value|
+              stub(method_name).and_return(return_value)
+            end
+          else
+            observe!(method_name_or_method_map)
+            message_chains.add(method_name_or_method_map, StubChain.new(method_name_or_method_map, &block))
+          end
+        end
+
+        # Initializes the recording a stub chain to be played back against any
+        # instance of this object that invokes the method matching the first
+        # argument.
+        #
+        # @see Methods#stub_chain
+        def stub_chain(*method_names_and_optional_return_values, &block)
+          normalize_chain(*method_names_and_optional_return_values) do |method_name, args|
+            observe!(method_name)
+            message_chains.add(method_name, StubChainChain.new(*args, &block))
+          end
+        end
+
+        # Initializes the recording a message expectation to be played back
+        # against any instance of this object that invokes the submitted
+        # method.
+        #
+        # @see Methods#should_receive
+        def should_receive(method_name, &block)
+          @expectation_set = true
+          observe!(method_name)
+          message_chains.add(method_name, PositiveExpectationChain.new(method_name, &block))
+        end
+
+        def should_not_receive(method_name, &block)
+          should_receive(method_name, &block).never
+        end
+
+        # Removes any previously recorded stubs, stub_chains or message
+        # expectations that use `method_name`.
+        #
+        # @see Methods#unstub
+        def unstub(method_name)
+          unless @observed_methods.include?(method_name.to_sym)
+            raise RSpec::Mocks::MockExpectationError, "The method `#{method_name}` was not stubbed or was already unstubbed"
+          end
+          message_chains.remove_stub_chains_for!(method_name)
+          stop_observing!(method_name) unless message_chains.has_expectation?(method_name)
+        end
+
+        # @api private
+        #
+        # Used internally to verify that message expectations have been
+        # fulfilled.
+        def verify
+          if @expectation_set && !message_chains.all_expectations_fulfilled?
+            raise RSpec::Mocks::MockExpectationError, "Exactly one instance should have received the following message(s) but didn't: #{message_chains.unfulfilled_expectations.sort.join(', ')}"
+          end
+        ensure
+          stop_all_observation!
+          ::RSpec::Mocks.space.remove_any_instance_recorder_for(@klass)
+        end
+
+        # @private
+        def stub!(*)
+          raise "stub! is not supported on any_instance. Use stub instead."
+        end
+
+        # @private
+        def unstub!(*)
+          raise "unstub! is not supported on any_instance. Use unstub instead."
+        end
+
+        # @private
+        def stop_all_observation!
+          @observed_methods.each {|method_name| restore_method!(method_name)}
+        end
+
+        # @private
+        def playback!(instance, method_name)
+          RSpec::Mocks.space.ensure_registered(instance)
+          message_chains.playback!(instance, method_name)
+          @played_methods[method_name] = instance
+          received_expected_message!(method_name) if message_chains.has_expectation?(method_name)
+        end
+
+        # @private
+        def instance_that_received(method_name)
+          @played_methods[method_name]
+        end
+
+        def build_alias_method_name(method_name)
+          "__#{method_name}_without_any_instance__"
+        end
+
+        def already_observing?(method_name)
+          @observed_methods.include?(method_name)
+        end
+
+        private
+
+        def normalize_chain(*args)
+          args.shift.to_s.split('.').map {|s| s.to_sym}.reverse.each {|a| args.unshift a}
+          yield args.first, args
+        end
+
+        def received_expected_message!(method_name)
+          message_chains.received_expected_message!(method_name)
+          restore_method!(method_name)
+          mark_invoked!(method_name)
+        end
+
+        def restore_method!(method_name)
+          if public_protected_or_private_method_defined?(build_alias_method_name(method_name))
+            restore_original_method!(method_name)
+          else
+            remove_dummy_method!(method_name)
+          end
+        end
+
+        def restore_original_method!(method_name)
+          alias_method_name = build_alias_method_name(method_name)
+          @klass.class_eval do
+            remove_method method_name
+            alias_method  method_name, alias_method_name
+            remove_method alias_method_name
+          end
+        end
+
+        def remove_dummy_method!(method_name)
+          @klass.class_eval do
+            remove_method method_name
+          end
+        end
+
+        def backup_method!(method_name)
+          alias_method_name = build_alias_method_name(method_name)
+          @klass.class_eval do
+            alias_method alias_method_name, method_name
+          end if public_protected_or_private_method_defined?(method_name)
+        end
+
+        def public_protected_or_private_method_defined?(method_name)
+          @klass.method_defined?(method_name) || @klass.private_method_defined?(method_name)
+        end
+
+        def stop_observing!(method_name)
+          restore_method!(method_name)
+          @observed_methods.delete(method_name)
+        end
+
+        def observe!(method_name)
+          stop_observing!(method_name) if already_observing?(method_name)
+          @observed_methods << method_name
+          backup_method!(method_name)
+          @klass.class_eval(<<-EOM, __FILE__, __LINE__ + 1)
+            def #{method_name}(*args, &blk)
+              klass = ::RSpec::Mocks.method_handle_for(self, :#{method_name}).owner
+              ::RSpec::Mocks.any_instance_recorder_for(klass).playback!(self, :#{method_name})
+              self.__send__(:#{method_name}, *args, &blk)
+            end
+          EOM
+        end
+
+        def mark_invoked!(method_name)
+          backup_method!(method_name)
+          @klass.class_eval(<<-EOM, __FILE__, __LINE__ + 1)
+            def #{method_name}(*args, &blk)
+              method_name = :#{method_name}
+              klass = ::RSpec::Mocks.method_handle_for(self, :#{method_name}).owner
+              invoked_instance = ::RSpec::Mocks.any_instance_recorder_for(klass).instance_that_received(method_name)
+              raise RSpec::Mocks::MockExpectationError, "The message '#{method_name}' was received by \#{self.inspect} but has already been received by \#{invoked_instance}"
+            end
+          EOM
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb b/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb
new file mode 100644
index 0000000..9b1712a
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain.rb
@@ -0,0 +1,38 @@
+module RSpec
+  module Mocks
+    module AnyInstance
+      # @private
+      class StubChain < Chain
+
+        # @private
+        def expectation_fulfilled?
+          true
+        end
+
+        private
+
+        def create_message_expectation_on(instance)
+          proxy = ::RSpec::Mocks.proxy_for(instance)
+          expected_from = IGNORED_BACKTRACE_LINE
+          proxy.add_stub(expected_from, *@expectation_args, &@expectation_block)
+        end
+
+        def invocation_order
+          @invocation_order ||= {
+            :with => [nil],
+            :and_return => [:with, nil],
+            :and_raise => [:with, nil],
+            :and_yield => [:with, nil],
+            :and_call_original => [:with, nil]
+          }
+        end
+
+        def verify_invocation_order(rspec_method_name, *args, &block)
+          unless invocation_order[rspec_method_name].include?(last_message)
+            raise(NoMethodError, "Undefined method #{rspec_method_name}")
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain_chain.rb b/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain_chain.rb
new file mode 100644
index 0000000..e16d92a
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/any_instance/stub_chain_chain.rb
@@ -0,0 +1,23 @@
+module RSpec
+  module Mocks
+    module AnyInstance
+      # @private
+      class StubChainChain < StubChain
+
+        private
+
+        def create_message_expectation_on(instance)
+          ::RSpec::Mocks::StubChain.stub_chain_on(instance, *@expectation_args, &@expectation_block)
+        end
+
+        def invocation_order
+          @invocation_order ||= {
+            :and_return => [nil],
+            :and_raise => [nil],
+            :and_yield => [nil]
+          }
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/argument_list_matcher.rb b/rspec-mocks/lib/rspec/mocks/argument_list_matcher.rb
new file mode 100644
index 0000000..ee17eb9
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/argument_list_matcher.rb
@@ -0,0 +1,97 @@
+require 'rspec/mocks/argument_matchers'
+
+module RSpec
+  module Mocks
+    # Wrapper for matching arguments against a list of expected values. Used by
+    # the `with` method on a `MessageExpectation`:
+    #
+    #     object.should_receive(:message).with(:a, 'b', 3)
+    #     object.message(:a, 'b', 3)
+    #
+    # Values passed to `with` can be literal values or argument matchers that
+    # match against the real objects .e.g.
+    #
+    #     object.should_receive(:message).with(hash_including(:a => 'b'))
+    #
+    # Can also be used directly to match the contents of any `Array`. This
+    # enables 3rd party mocking libs to take advantage of rspec's argument
+    # matching without using the rest of rspec-mocks.
+    #
+    #     require 'rspec/mocks/argument_list_matcher'
+    #     include RSpec::Mocks::ArgumentMatchers
+    #
+    #     arg_list_matcher = RSpec::Mocks::ArgumentListMatcher.new(123, hash_including(:a => 'b'))
+    #     arg_list_matcher.args_match?(123, :a => 'b')
+    #
+    # @see ArgumentMatchers
+    class ArgumentListMatcher
+      # @private
+      attr_reader :expected_args
+
+      # @api public
+      # @param [Array] *expected_args a list of expected literals and/or argument matchers
+      # @param [Block] block a block with arity matching the expected
+      #
+      # Initializes an `ArgumentListMatcher` with a collection of literal
+      # values and/or argument matchers, or a block that handles the evaluation
+      # for you.
+      #
+      # @see ArgumentMatchers
+      # @see #args_match?
+      def initialize(*expected_args, &block)
+        @expected_args = expected_args
+        @block = expected_args.empty? ? block : nil
+        @match_any_args = false
+        @matchers = nil
+
+        case expected_args.first
+        when ArgumentMatchers::AnyArgsMatcher
+          @match_any_args = true
+        when ArgumentMatchers::NoArgsMatcher
+          @matchers = []
+        else
+          @matchers = expected_args.collect {|arg| matcher_for(arg)}
+        end
+      end
+
+      # @api public
+      # @param [Array] *args
+      #
+      # Matches each element in the `expected_args` against the element in the same
+      # position of the arguments passed to `new`.
+      #
+      # @see #initialize
+      def args_match?(*args)
+        match_any_args? || block_passes?(*args) || matchers_match?(*args)
+      end
+
+      private
+
+      def matcher_for(arg)
+        return ArgumentMatchers::MatcherMatcher.new(arg) if is_matcher?(arg)
+        return ArgumentMatchers::RegexpMatcher.new(arg)  if arg.is_a?(Regexp)
+        return ArgumentMatchers::EqualityProxy.new(arg)
+      end
+
+      def is_matcher?(object)
+        return false if object.respond_to?(:i_respond_to_everything_so_im_not_really_a_matcher)
+
+        [:failure_message_for_should, :failure_message].any? do |msg|
+          object.respond_to?(msg)
+        end && object.respond_to?(:matches?)
+      end
+
+      def block_passes?(*args)
+        @block.call(*args) if @block
+      end
+
+      def matchers_match?(*args)
+        @matchers == args
+      end
+
+      def match_any_args?
+        @match_any_args
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/argument_matchers.rb b/rspec-mocks/lib/rspec/mocks/argument_matchers.rb
new file mode 100644
index 0000000..164a998
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/argument_matchers.rb
@@ -0,0 +1,238 @@
+module RSpec
+  module Mocks
+
+    # ArgumentMatchers are placeholders that you can include in message
+    # expectations to match arguments against a broader check than simple
+    # equality.
+    #
+    # With the exception of `any_args` and `no_args`, they all match against
+    # the arg in same position in the argument list.
+    #
+    # @see ArgumentListMatcher
+    module ArgumentMatchers
+
+      class AnyArgsMatcher
+        def description
+          "any args"
+        end
+      end
+
+      class AnyArgMatcher
+        def initialize(ignore)
+        end
+
+        def ==(other)
+          true
+        end
+      end
+
+      class NoArgsMatcher
+        def description
+          "no args"
+        end
+      end
+
+      class RegexpMatcher
+        def initialize(regexp)
+          @regexp = regexp
+        end
+
+        def ==(value)
+          Regexp === value ? value == @regexp : value =~ @regexp
+        end
+      end
+
+      class BooleanMatcher
+        def initialize(ignore)
+        end
+
+        def ==(value)
+          [true,false].include?(value)
+        end
+      end
+
+      class HashIncludingMatcher
+        def initialize(expected)
+          @expected = expected
+        end
+
+        def ==(actual)
+          @expected.all? {|k,v| actual.has_key?(k) && v == actual[k]}
+        rescue NoMethodError
+          false
+        end
+
+        def description
+          "hash_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
+        end
+      end
+
+      class HashExcludingMatcher
+        def initialize(expected)
+          @expected = expected
+        end
+
+        def ==(actual)
+          @expected.none? {|k,v| actual.has_key?(k) && v == actual[k]}
+        rescue NoMethodError
+          false
+        end
+
+        def description
+          "hash_not_including(#{@expected.inspect.sub(/^\{/,"").sub(/\}$/,"")})"
+        end
+      end
+
+      class DuckTypeMatcher
+        def initialize(*methods_to_respond_to)
+          @methods_to_respond_to = methods_to_respond_to
+        end
+
+        def ==(value)
+          @methods_to_respond_to.all? {|message| value.respond_to?(message)}
+        end
+      end
+
+      class MatcherMatcher
+        def initialize(matcher)
+          @matcher = matcher
+        end
+
+        def ==(value)
+          @matcher.matches?(value)
+        end
+      end
+
+      class EqualityProxy
+        def initialize(given)
+          @given = given
+        end
+
+        def ==(expected)
+          @given == expected
+        end
+      end
+
+      class InstanceOf
+        def initialize(klass)
+          @klass = klass
+        end
+
+        def ==(actual)
+          actual.instance_of?(@klass)
+        end
+      end
+
+      class KindOf
+        def initialize(klass)
+          @klass = klass
+        end
+
+        def ==(actual)
+          actual.kind_of?(@klass)
+        end
+      end
+
+      # Matches any args at all. Supports a more explicit variation of
+      # `object.should_receive(:message)`
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(any_args)
+      def any_args
+        AnyArgsMatcher.new
+      end
+
+      # Matches any argument at all.
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(anything)
+      def anything
+        AnyArgMatcher.new(nil)
+      end
+
+      # Matches no arguments.
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(no_args)
+      def no_args
+        NoArgsMatcher.new
+      end
+
+      # Matches if the actual argument responds to the specified messages.
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(duck_type(:hello))
+      #   object.should_receive(:message).with(duck_type(:hello, :goodbye))
+      def duck_type(*args)
+        DuckTypeMatcher.new(*args)
+      end
+
+      # Matches a boolean value.
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(boolean())
+      def boolean
+        BooleanMatcher.new(nil)
+      end
+
+      # Matches a hash that includes the specified key(s) or key/value pairs.
+      # Ignores any additional keys.
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(hash_including(:key => val))
+      #   object.should_receive(:message).with(hash_including(:key))
+      #   object.should_receive(:message).with(hash_including(:key, :key2 => val2))
+      def hash_including(*args)
+        HashIncludingMatcher.new(anythingize_lonely_keys(*args))
+      end
+
+      # Matches a hash that doesn't include the specified key(s) or key/value.
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(hash_excluding(:key => val))
+      #   object.should_receive(:message).with(hash_excluding(:key))
+      #   object.should_receive(:message).with(hash_excluding(:key, :key2 => :val2))
+      def hash_excluding(*args)
+        HashExcludingMatcher.new(anythingize_lonely_keys(*args))
+      end
+
+      alias_method :hash_not_including, :hash_excluding
+
+      # Matches if `arg.instance_of?(klass)`
+      #
+      # @example
+      #
+      #   object.should_receive(:message).with(instance_of(Thing))
+      def instance_of(klass)
+        InstanceOf.new(klass)
+      end
+
+      alias_method :an_instance_of, :instance_of
+
+      # Matches if `arg.kind_of?(klass)`
+      # @example
+      #
+      #   object.should_receive(:message).with(kind_of(Thing))
+      def kind_of(klass)
+        KindOf.new(klass)
+      end
+
+      alias_method :a_kind_of, :kind_of
+
+      private
+
+      def anythingize_lonely_keys(*args)
+        hash = args.last.class == Hash ? args.delete_at(-1) : {}
+        args.each { | arg | hash[arg] = anything }
+        hash
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/configuration.rb b/rspec-mocks/lib/rspec/mocks/configuration.rb
new file mode 100644
index 0000000..4e5cd8c
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/configuration.rb
@@ -0,0 +1,55 @@
+module RSpec
+  module Mocks
+    # Provides configuration options for rspec-mocks.
+    class Configuration
+      # Adds `stub` and `should_receive` to the given
+      # modules or classes. This is usually only necessary
+      # if you application uses some proxy classes that
+      # "strip themselves down" to a bare minimum set of
+      # methods and remove `stub` and `should_receive` in
+      # the process.
+      #
+      # @example
+      #
+      #   RSpec.configure do |rspec|
+      #     rspec.mock_with :rspec do |mocks|
+      #       mocks.add_stub_and_should_receive_to Delegator
+      #     end
+      #   end
+      #
+      def add_stub_and_should_receive_to(*modules)
+        modules.each do |mod|
+          Syntax.enable_should(mod)
+        end
+      end
+
+      def syntax=(values)
+        if Array(values).include?(:expect)
+          Syntax.enable_expect
+        else
+          Syntax.disable_expect
+        end
+
+        if Array(values).include?(:should)
+          Syntax.enable_should
+        else
+          Syntax.disable_should
+        end
+      end
+
+      def syntax
+        syntaxes = []
+        syntaxes << :should  if Syntax.should_enabled?
+        syntaxes << :expect if Syntax.expect_enabled?
+        syntaxes
+      end
+    end
+
+    def self.configuration
+      @configuration ||= Configuration.new
+    end
+
+    configuration.syntax = [:should, :expect]
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/deprecation.rb b/rspec-mocks/lib/rspec/mocks/deprecation.rb
new file mode 100644
index 0000000..50ff01d
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/deprecation.rb
@@ -0,0 +1,18 @@
+module RSpec
+  module Mocks
+    module Deprecation
+      # @private
+      #
+      # Used internally to print deprecation warnings
+      def deprecate(deprecated, options={})
+        message = "DEPRECATION: #{deprecated} is deprecated."
+        message << " Use #{options[:replacement]} instead." if options[:replacement]
+        message << " Called from #{caller(0)[2]}."
+        warn message
+      end
+    end
+  end
+
+  extend(Mocks::Deprecation) unless respond_to?(:deprecate)
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/error_generator.rb b/rspec-mocks/lib/rspec/mocks/error_generator.rb
new file mode 100644
index 0000000..6e39238
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/error_generator.rb
@@ -0,0 +1,179 @@
+module RSpec
+  module Mocks
+    # @private
+    class ErrorGenerator
+      attr_writer :opts
+
+      def initialize(target, name, options={})
+        @declared_as = options[:__declared_as] || 'Mock'
+        @target = target
+        @name = name
+      end
+
+      # @private
+      def opts
+        @opts ||= {}
+      end
+
+      # @private
+      def raise_unexpected_message_error(message, *args)
+        __raise "#{intro} received unexpected message :#{message}#{arg_message(*args)}"
+      end
+
+      # @private
+      def raise_unexpected_message_args_error(expectation, *args)
+        expected_args = format_args(*expectation.expected_args)
+        actual_args = format_received_args(*args)
+        __raise "#{intro} received #{expectation.message.inspect} with unexpected arguments\n  expected: #{expected_args}\n       got: #{actual_args}"
+      end
+
+      # @private
+      def raise_missing_default_stub_error(expectation, *args)
+        expected_args = format_args(*expectation.expected_args)
+        actual_args = format_received_args(*args)
+        __raise "#{intro} received #{expectation.message.inspect} with unexpected arguments\n  expected: #{expected_args}\n       got: #{actual_args}\n Please stub a default value first if message might be received with other args as well. \n"
+      end
+
+      # @private
+      def raise_similar_message_args_error(expectation, *args_for_multiple_calls)
+        expected_args = format_args(*expectation.expected_args)
+        actual_args = args_for_multiple_calls.collect {|a| format_received_args(*a)}.join(", ")
+        __raise "#{intro} received #{expectation.message.inspect} with unexpected arguments\n  expected: #{expected_args}\n       got: #{actual_args}"
+      end
+
+      # @private
+      def raise_expectation_error(message, expected_received_count, argument_list_matcher, actual_received_count, expectation_count_type, *args)
+        expected_part = expected_part_of_expectation_error(expected_received_count, expectation_count_type, argument_list_matcher)
+        received_part = received_part_of_expectation_error(actual_received_count, *args)
+        __raise "(#{intro}).#{message}#{format_args(*args)}\n    #{expected_part}\n    #{received_part}"
+      end
+
+      # @private
+      def received_part_of_expectation_error(actual_received_count, *args)
+        "received: #{count_message(actual_received_count)}" +
+          method_call_args_description(args)
+      end
+
+      # @private
+      def expected_part_of_expectation_error(expected_received_count, expectation_count_type, argument_list_matcher)
+        "expected: #{count_message(expected_received_count, expectation_count_type)}" +
+          method_call_args_description(argument_list_matcher.expected_args)
+      end
+
+      # @private
+      def method_call_args_description(args)
+        if args.first.is_a?(ArgumentMatchers::AnyArgsMatcher)
+          " with any arguments"
+        elsif args.first.is_a?(ArgumentMatchers::NoArgsMatcher)
+          " with no arguments"
+        elsif args.length > 0
+          " with arguments: #{args.inspect.gsub(/\A\[(.+)\]\z/, '(\1)')}"
+        else
+          ""
+        end
+      end
+
+      # @private
+      def describe_expectation(message, expected_received_count, actual_received_count, *args)
+        "have received #{message}#{format_args(*args)} #{count_message(expected_received_count)}"
+      end
+
+      # @private
+      def raise_out_of_order_error(message)
+        __raise "#{intro} received :#{message} out of order"
+      end
+
+      # @private
+      def raise_block_failed_error(message, detail)
+        __raise "#{intro} received :#{message} but passed block failed with: #{detail}"
+      end
+
+      # @private
+      def raise_missing_block_error(args_to_yield)
+        __raise "#{intro} asked to yield |#{arg_list(*args_to_yield)}| but no block was passed"
+      end
+
+      # @private
+      def raise_wrong_arity_error(args_to_yield, arity)
+        __raise "#{intro} yielded |#{arg_list(*args_to_yield)}| to block with arity of #{arity}"
+      end
+
+      # @private
+      def raise_only_valid_on_a_partial_mock(method)
+        __raise "#{intro} is a pure mock object. `#{method}` is only " +
+                "available on a partial mock object."
+      end
+
+      # @private
+      def raise_expectation_on_unstubbed_method(method)
+        __raise "#{intro} expected to have received #{method}, but that " +
+                "method has not been stubbed."
+      end
+
+      # @private
+      def raise_expectation_on_mocked_method(method)
+        __raise "#{intro} expected to have received #{method}, but that " +
+                "method has been mocked instead of stubbed."
+      end
+
+      def self.raise_double_negation_error(wrapped_expression)
+        raise "Isn't life confusing enough? You've already set a " +
+              "negative message expectation and now you are trying to " +
+              "negate it again with `never`. What does an expression like " +
+              "`#{wrapped_expression}.not_to receive(:msg).never` even mean?"
+      end
+
+      private
+
+      def intro
+        if @name
+          "#{@declared_as} #{@name.inspect}"
+        elsif TestDouble === @target
+          @declared_as
+        elsif Class === @target
+          "<#{@target.inspect} (class)>"
+        elsif @target
+          @target
+        else
+          "nil"
+        end
+      end
+
+      def __raise(message)
+        message = opts[:message] unless opts[:message].nil?
+        Kernel::raise(RSpec::Mocks::MockExpectationError, message)
+      end
+
+      def arg_message(*args)
+        " with " + format_args(*args)
+      end
+
+      def format_args(*args)
+        args.empty? ? "(no args)" : "(" + arg_list(*args) + ")"
+      end
+
+      def arg_list(*args)
+        args.collect {|arg| arg.respond_to?(:description) ? arg.description : arg.inspect}.join(", ")
+      end
+
+      def format_received_args(*args)
+        args.empty? ? "(no args)" : "(" + received_arg_list(*args) + ")"
+      end
+
+      def received_arg_list(*args)
+        args.collect(&:inspect).join(", ")
+      end
+
+      def count_message(count, expectation_count_type=nil)
+        return "at least #{pretty_print(count.abs)}" if count < 0 || expectation_count_type == :at_least
+        return "at most #{pretty_print(count)}" if expectation_count_type == :at_most
+        return pretty_print(count)
+      end
+
+      def pretty_print(count)
+        "#{count} time#{count == 1 ? '' : 's'}"
+      end
+
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/errors.rb b/rspec-mocks/lib/rspec/mocks/errors.rb
new file mode 100644
index 0000000..0e8787e
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/errors.rb
@@ -0,0 +1,12 @@
+module RSpec
+  module Mocks
+    # @private
+    class MockExpectationError < Exception
+    end
+
+    # @private
+    class AmbiguousReturnError < StandardError
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/example_methods.rb b/rspec-mocks/lib/rspec/mocks/example_methods.rb
new file mode 100644
index 0000000..d49f5bf
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/example_methods.rb
@@ -0,0 +1,156 @@
+module RSpec
+  module Mocks
+    module ExampleMethods
+      include RSpec::Mocks::ArgumentMatchers
+
+      # @overload double()
+      # @overload double(name)
+      # @overload double(stubs)
+      # @overload double(name, stubs)
+      # @param name [String/Symbol] (optional) used in
+      #   clarify intent
+      # @param stubs (Hash) (optional) hash of method/return-value pairs
+      # @return (Mock)
+      #
+      # Constructs an instance of [RSpec::Mocks::Mock](RSpec::Mocks::Mock) configured
+      # with an optional name, used for reporting in failure messages, and an optional
+      # hash of method/return-value pairs.
+      #
+      # @example
+      #
+      #   book = double("book", :title => "The RSpec Book")
+      #   book.title #=> "The RSpec Book"
+      #
+      #   card = double("card", :suit => "Spades", :rank => "A")
+      #   card.suit  #=> "Spades"
+      #   card.rank  #=> "A"
+      #
+      # @see #mock
+      # @see #stub
+      def double(*args)
+        declare_double('Double', *args)
+      end
+
+      # Deprecated: Use [double](#double-instance_method).
+      def mock(*args)
+        RSpec.deprecate "mock", :replacement => "double"
+        declare_double('Mock', *args)
+      end
+
+      # Deprecated: Use [double](#double-instance_method).
+      def stub(*args)
+        RSpec.deprecate "stub", :replacement => "double"
+        declare_double('Stub', *args)
+      end
+
+      # Disables warning messages about expectations being set on nil.
+      #
+      # By default warning messages are issued when expectations are set on
+      # nil.  This is to prevent false-positives and to catch potential bugs
+      # early on.
+      def allow_message_expectations_on_nil
+        RSpec::Mocks.space.proxy_for(nil).warn_about_expectations = false
+      end
+
+      # Stubs the named constant with the given value.
+      # Like method stubs, the constant will be restored
+      # to its original value (or lack of one, if it was
+      # undefined) when the example completes.
+      #
+      # @param constant_name [String] The fully qualified name of the constant. The current
+      #   constant scoping at the point of call is not considered.
+      # @param value [Object] The value to make the constant refer to. When the
+      #   example completes, the constant will be restored to its prior state.
+      # @param options [Hash] Stubbing options.
+      # @option options :transfer_nested_constants [Boolean, Array<Symbol>] Determines
+      #   what nested constants, if any, will be transferred from the original value
+      #   of the constant to the new value of the constant. This only works if both
+      #   the original and new values are modules (or classes).
+      # @return [Object] the stubbed value of the constant
+      #
+      # @example
+      #
+      #   stub_const("MyClass", Class.new) # => Replaces (or defines) MyClass with a new class object.
+      #   stub_const("SomeModel::PER_PAGE", 5) # => Sets SomeModel::PER_PAGE to 5.
+      #
+      #   class CardDeck
+      #     SUITS = [:Spades, :Diamonds, :Clubs, :Hearts]
+      #     NUM_CARDS = 52
+      #   end
+      #
+      #   stub_const("CardDeck", Class.new)
+      #   CardDeck::SUITS # => uninitialized constant error
+      #   CardDeck::NUM_CARDS # => uninitialized constant error
+      #
+      #   stub_const("CardDeck", Class.new, :transfer_nested_constants => true)
+      #   CardDeck::SUITS # => our suits array
+      #   CardDeck::NUM_CARDS # => 52
+      #
+      #   stub_const("CardDeck", Class.new, :transfer_nested_constants => [:SUITS])
+      #   CardDeck::SUITS # => our suits array
+      #   CardDeck::NUM_CARDS # => uninitialized constant error
+      def stub_const(constant_name, value, options = {})
+        ConstantMutator.stub(constant_name, value, options)
+      end
+
+      # Hides the named constant with the given value. The constant will be
+      # undefined for the duration of the test.
+      #
+      # Like method stubs, the constant will be restored to its original value
+      # when the example completes.
+      #
+      # @param constant_name [String] The fully qualified name of the constant.
+      #   The current constant scoping at the point of call is not considered.
+      #
+      # @example
+      #
+      #   hide_const("MyClass") # => MyClass is now an undefined constant
+      def hide_const(constant_name)
+        ConstantMutator.hide(constant_name)
+      end
+
+      # Verifies that the given object received the expected message during the
+      # course of the test. The method must have previously been stubbed in
+      # order for messages to be verified.
+      #
+      # Stubbing and verifying messages received in this way implements the
+      # Test Spy pattern.
+      #
+      # @param method_name [Symbol] name of the method expected to have been
+      #   called.
+      #
+      # @example
+      #
+      #   invitation = double('invitation', accept: true)
+      #   user.accept_invitation(invitation)
+      #   expect(invitation).to have_received(:accept)
+      #
+      #   # You can also use most message expectations:
+      #   expect(invitation).to have_received(:accept).with(mailer).once
+      def have_received(method_name)
+        Matchers::HaveReceived.new(method_name)
+      end
+
+      def self.included(klass)
+        klass.class_eval do
+          # This gets mixed in so that if `RSpec::Matchers` is included in
+          # `klass` later, it's definition of `expect` will take precedence.
+          include ExpectHost unless method_defined?(:expect)
+        end
+      end
+
+    private
+
+      def declare_double(declared_as, *args)
+        args << {} unless Hash === args.last
+        args.last[:__declared_as] = declared_as
+        RSpec::Mocks::Mock.new(*args)
+      end
+
+      # This module exists to host the `expect` method for cases where
+      # rspec-mocks is used w/o rspec-expectations.
+      module ExpectHost
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/extensions/instance_exec.rb b/rspec-mocks/lib/rspec/mocks/extensions/instance_exec.rb
new file mode 100644
index 0000000..eb7960b
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/extensions/instance_exec.rb
@@ -0,0 +1,34 @@
+module RSpec
+  module Mocks
+    # @private
+    module InstanceExec
+      unless respond_to?(:instance_exec)
+        # @private
+        #
+        # based on Bounded Spec InstanceExec (Mauricio Fernandez)
+        # http://eigenclass.org/hiki/bounded+space+instance_exec
+        # - uses singleton_class of matcher instead of global
+        #   InstanceExecHelper module
+        # - this keeps it scoped to this class only, which is the
+        #   only place we need it
+        # - only necessary for ruby 1.8.6
+        def instance_exec(*args, &block)
+          singleton_class = (class << self; self; end)
+          begin
+            orig_critical, Thread.critical = Thread.critical, true
+            n = 0
+            n += 1 while respond_to?(method_name="__instance_exec#{n}")
+            singleton_class.module_eval{ define_method(method_name, &block) }
+          ensure
+            Thread.critical = orig_critical
+          end
+          begin
+            return send(method_name, *args)
+          ensure
+            singleton_class.module_eval{ remove_method(method_name) } rescue nil
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/extensions/marshal.rb b/rspec-mocks/lib/rspec/mocks/extensions/marshal.rb
new file mode 100644
index 0000000..b8cf7b5
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/extensions/marshal.rb
@@ -0,0 +1,17 @@
+module Marshal
+  class << self
+    # Duplicates any mock objects before serialization. Otherwise,
+    # serialization will fail because methods exist on the singleton class.
+    def dump_with_mocks(object, *rest)
+      if ::RSpec::Mocks.space.nil? || !::RSpec::Mocks.space.registered?(object) || NilClass === object
+        dump_without_mocks(object, *rest)
+      else
+        dump_without_mocks(object.dup, *rest)
+      end
+    end
+
+    alias_method :dump_without_mocks, :dump
+    undef_method :dump
+    alias_method :dump, :dump_with_mocks
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/framework.rb b/rspec-mocks/lib/rspec/mocks/framework.rb
new file mode 100644
index 0000000..b487ede
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/framework.rb
@@ -0,0 +1,34 @@
+# Require everything except the global extensions of class and object. This
+# supports wrapping rspec's mocking functionality without invading every
+# object in the system.
+
+require 'rspec/mocks/deprecation'
+require 'rspec/mocks/extensions/instance_exec'
+require 'rspec/mocks/instance_method_stasher'
+require 'rspec/mocks/method_double'
+require 'rspec/mocks/argument_matchers'
+require 'rspec/mocks/example_methods'
+require 'rspec/mocks/proxy'
+require 'rspec/mocks/proxy_for_nil'
+require 'rspec/mocks/test_double'
+require 'rspec/mocks/mock'
+require 'rspec/mocks/argument_list_matcher'
+require 'rspec/mocks/message_expectation'
+require 'rspec/mocks/order_group'
+require 'rspec/mocks/errors'
+require 'rspec/mocks/error_generator'
+require 'rspec/mocks/space'
+require 'rspec/mocks/extensions/marshal'
+require 'rspec/mocks/any_instance/chain'
+require 'rspec/mocks/any_instance/stub_chain'
+require 'rspec/mocks/any_instance/stub_chain_chain'
+require 'rspec/mocks/any_instance/expectation_chain'
+require 'rspec/mocks/any_instance/message_chains'
+require 'rspec/mocks/any_instance/recorder'
+require 'rspec/mocks/mutate_const'
+require 'rspec/mocks/matchers/have_received'
+require 'rspec/mocks/matchers/receive'
+require 'rspec/mocks/stub_chain'
+require 'rspec/mocks/targets'
+require 'rspec/mocks/syntax'
+require 'rspec/mocks/configuration'
diff --git a/rspec-mocks/lib/rspec/mocks/instance_method_stasher.rb b/rspec-mocks/lib/rspec/mocks/instance_method_stasher.rb
new file mode 100644
index 0000000..bfea8f7
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/instance_method_stasher.rb
@@ -0,0 +1,94 @@
+module RSpec
+  module Mocks
+    # @private
+    class InstanceMethodStasher
+      def initialize(klass, method)
+        @klass = klass
+        @method = method
+
+        @method_is_stashed = false
+      end
+
+      # @private
+      def method_is_stashed?
+        @method_is_stashed
+      end
+
+      # @private
+      def stash
+        return if !method_defined_directly_on_klass? || @method_is_stashed
+
+        @klass.__send__(:alias_method, stashed_method_name, @method)
+        @method_is_stashed = true
+      end
+
+      private
+
+      # @private
+      def method_defined_directly_on_klass?
+        method_defined_on_klass? && method_owned_by_klass?
+      end
+
+      # @private
+      def method_defined_on_klass?(klass = @klass)
+        klass.method_defined?(@method) || klass.private_method_defined?(@method)
+      end
+
+      if ::UnboundMethod.method_defined?(:owner)
+        # @private
+        def method_owned_by_klass?
+          owner = @klass.instance_method(@method).owner
+
+          # On Ruby 2.0.0+ the owner of a method on a class which has been
+          # `prepend`ed may actually be an instance, e.g.
+          # `#<MyClass:0x007fbb94e3cd10>`, rather than the expected `MyClass`.
+          owner = owner.class unless owner.is_a? Class
+
+          # On 1.8 (and some 1.9s -- e.g. rubinius) aliased methods
+          # can report the wrong owner. Example:
+          # class MyClass
+          #   class << self
+          #     alias alternate_new new
+          #   end
+          # end
+          #
+          # MyClass.owner(:alternate_new) returns `Class` on 1.8,
+          # but we need to consider the owner to be `MyClass` because
+          # it is not actually available on `Class` but is on `MyClass`.
+          # Hence, we verify that the owner actually has the method defined.
+          # If the given owner does not have the method defined, we assume
+          # that the method is actually owned by @klass.
+          owner == @klass || !(method_defined_on_klass?(owner))
+        end
+      else
+        # @private
+        def method_owned_by_klass?
+          # On 1.8.6, which does not support Method#owner, we have no choice but
+          # to assume it's defined on the klass even if it may be defined on
+          # a superclass.
+          true
+        end
+      end
+
+      public
+
+      # @private
+      def stashed_method_name
+        "obfuscated_by_rspec_mocks__#{@method}"
+      end
+
+      # @private
+      def restore
+        return unless @method_is_stashed
+
+        if @klass.__send__(:method_defined?, @method)
+          @klass.__send__(:undef_method, @method)
+        end
+        @klass.__send__(:alias_method, @method, stashed_method_name)
+        @klass.__send__(:remove_method, stashed_method_name)
+        @method_is_stashed = false
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/matchers/have_received.rb b/rspec-mocks/lib/rspec/mocks/matchers/have_received.rb
new file mode 100644
index 0000000..63cd1c3
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/matchers/have_received.rb
@@ -0,0 +1,93 @@
+module RSpec
+  module Mocks
+    module Matchers
+      class HaveReceived
+        COUNT_CONSTRAINTS = %w(exactly at_least at_most times once twice)
+        ARGS_CONSTRAINTS = %w(with)
+        CONSTRAINTS = COUNT_CONSTRAINTS + ARGS_CONSTRAINTS
+
+        def initialize(method_name)
+          @method_name = method_name
+          @constraints = []
+          @subject = nil
+        end
+
+        def matches?(subject)
+          @subject = subject
+          @expectation = expect
+          expected_messages_received?
+        end
+
+        def does_not_match?(subject)
+          @subject = subject
+          ensure_count_unconstrained
+          @expectation = expect.never
+          expected_messages_received?
+        end
+
+        def failure_message
+          generate_failure_message
+        end
+
+        def negative_failure_message
+          generate_failure_message
+        end
+
+        def description
+          expect.description
+        end
+
+        CONSTRAINTS.each do |expectation|
+          define_method expectation do |*args|
+            @constraints << [expectation, *args]
+            self
+          end
+        end
+
+        private
+
+        def expect
+          expectation = mock_proxy.build_expectation(@method_name)
+          apply_constraints_to expectation
+          expectation
+        end
+
+        def apply_constraints_to(expectation)
+          @constraints.each do |constraint|
+            expectation.send(*constraint)
+          end
+        end
+
+        def ensure_count_unconstrained
+          if count_constraint
+            raise RSpec::Mocks::MockExpectationError,
+              "can't use #{count_constraint} when negative"
+          end
+        end
+
+        def count_constraint
+          @constraints.map(&:first).detect do |constraint|
+            COUNT_CONSTRAINTS.include?(constraint)
+          end
+        end
+
+        def generate_failure_message
+          mock_proxy.check_for_unexpected_arguments(@expectation)
+          @expectation.generate_error
+        rescue RSpec::Mocks::MockExpectationError => error
+          error.message
+        end
+
+        def expected_messages_received?
+          mock_proxy.replay_received_message_on @expectation
+          @expectation.expected_messages_received?
+        end
+
+        def mock_proxy
+          RSpec::Mocks.proxy_for(@subject)
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/matchers/receive.rb b/rspec-mocks/lib/rspec/mocks/matchers/receive.rb
new file mode 100644
index 0000000..824d815
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/matchers/receive.rb
@@ -0,0 +1,96 @@
+module RSpec
+  module Mocks
+    module Matchers
+      class Receive
+        def initialize(message, block)
+          @message                 = message
+          @block                   = block
+          @recorded_customizations = []
+
+          # MRI, JRuby and RBX report the caller inconsistently; MRI
+          # reports an extra "in `new'" line in the backtrace that the
+          # others do not include. The safest way to find the right
+          # line is to search for the first line BEFORE rspec/mocks/syntax.rb.
+          @backtrace_line          = caller.find do |line|
+            !line.split(':').first.end_with?('rspec/mocks/syntax.rb')
+          end
+        end
+
+        def setup_expectation(subject, &block)
+          setup_mock_proxy_method_substitute(subject, :add_message_expectation, block)
+        end
+        alias matches? setup_expectation
+
+        def setup_negative_expectation(subject, &block)
+          # ensure `never` goes first for cases like `never.and_return(5)`,
+          # where `and_return` is meant to raise an error
+          @recorded_customizations.unshift Customization.new(:never, [], nil)
+
+          setup_expectation(subject, &block)
+        end
+        alias does_not_match? setup_negative_expectation
+
+        def setup_allowance(subject, &block)
+          setup_mock_proxy_method_substitute(subject, :add_stub, block)
+        end
+
+        def setup_any_instance_expectation(subject, &block)
+          setup_any_instance_method_substitute(subject, :should_receive, block)
+        end
+
+        def setup_any_instance_negative_expectation(subject, &block)
+          setup_any_instance_method_substitute(subject, :should_not_receive, block)
+        end
+
+        def setup_any_instance_allowance(subject, &block)
+          setup_any_instance_method_substitute(subject, :stub, block)
+        end
+
+        MessageExpectation.public_instance_methods(false).each do |method|
+          next if method_defined?(method)
+
+          class_eval(<<-RUBY)
+            def #{method}(*args, &block)
+              @recorded_customizations << Customization.new(#{method.inspect}, args, block)
+              self
+            end
+          RUBY
+        end
+
+      private
+
+        def setup_mock_proxy_method_substitute(subject, method, block)
+          proxy = ::RSpec::Mocks.proxy_for(subject)
+          setup_method_substitute(proxy, method, block, @backtrace_line)
+        end
+
+        def setup_any_instance_method_substitute(subject, method, block)
+          any_instance_recorder = ::RSpec::Mocks.any_instance_recorder_for(subject)
+          setup_method_substitute(any_instance_recorder, method, block)
+        end
+
+        def setup_method_substitute(host, method, block, *args)
+          args << @message.to_sym
+          expectation = host.__send__(method, *args, &(@block || block))
+
+          @recorded_customizations.each do |customization|
+            customization.playback_onto(expectation)
+          end
+        end
+
+        class Customization
+          def initialize(method_name, args, block)
+            @method_name = method_name
+            @args        = args
+            @block       = block
+          end
+
+          def playback_onto(expectation)
+            expectation.__send__(@method_name, *@args, &@block)
+          end
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/message_expectation.rb b/rspec-mocks/lib/rspec/mocks/message_expectation.rb
new file mode 100644
index 0000000..99be4c9
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/message_expectation.rb
@@ -0,0 +1,583 @@
+module RSpec
+  module Mocks
+
+    class MessageExpectation
+      # @private
+      attr_accessor :error_generator, :implementation
+      attr_reader :message
+      attr_writer :expected_received_count, :expected_from, :argument_list_matcher
+      protected :expected_received_count=, :expected_from=, :error_generator, :error_generator=, :implementation=
+
+      # @private
+      def initialize(error_generator, expectation_ordering, expected_from, method_double,
+                     expected_received_count=1, opts={}, &implementation_block)
+        @error_generator = error_generator
+        @error_generator.opts = opts
+        @expected_from = expected_from
+        @method_double = method_double
+        @message = @method_double.method_name
+        @actual_received_count = 0
+        @expected_received_count = expected_received_count
+        @argument_list_matcher = ArgumentListMatcher.new(ArgumentMatchers::AnyArgsMatcher.new)
+        @order_group = expectation_ordering
+        @at_least = @at_most = @exactly = nil
+        @args_to_yield = []
+        @failed_fast = nil
+        @eval_context = nil
+
+        @implementation = Implementation.new
+        self.inner_implementation_action = implementation_block
+      end
+
+      # @private
+      def expected_args
+        @argument_list_matcher.expected_args
+      end
+
+      # @overload and_return(value)
+      # @overload and_return(first_value, second_value)
+      # @overload and_return(&block)
+      #
+      # Tells the object to return a value when it receives the message.  Given
+      # more than one value, the first value is returned the first time the
+      # message is received, the second value is returned the next time, etc,
+      # etc.
+      #
+      # If the message is received more times than there are values, the last
+      # value is received for every subsequent call.
+      #
+      # The block format is still supported, but is unofficially deprecated in
+      # favor of just passing a block to the stub method.
+      #
+      # @example
+      #
+      #   counter.stub(:count).and_return(1)
+      #   counter.count # => 1
+      #   counter.count # => 1
+      #
+      #   counter.stub(:count).and_return(1,2,3)
+      #   counter.count # => 1
+      #   counter.count # => 2
+      #   counter.count # => 3
+      #   counter.count # => 3
+      #   counter.count # => 3
+      #   # etc
+      #
+      #   # Supported, but ...
+      #   counter.stub(:count).and_return { 1 }
+      #   counter.count # => 1
+      #
+      #   # ... this is prefered
+      #   counter.stub(:count) { 1 }
+      #   counter.count # => 1
+      def and_return(*values, &implementation)
+        if negative?
+          RSpec.deprecate "`and_return` on a negative message expectation"
+        end
+
+        @expected_received_count = [@expected_received_count, values.size].max unless ignoring_args? || (@expected_received_count == 0 and @at_least)
+
+        if implementation
+          # TODO: deprecate `and_return { value }`
+          self.inner_implementation_action = implementation
+        else
+          self.terminal_implementation_action = AndReturnImplementation.new(values)
+        end
+
+        nil
+      end
+
+      # Tells the object to delegate to the original unmodified method
+      # when it receives the message.
+      #
+      # @note This is only available on partial mock objects.
+      #
+      # @example
+      #
+      #   counter.should_receive(:increment).and_call_original
+      #   original_count = counter.count
+      #   counter.increment
+      #   expect(counter.count).to eq(original_count + 1)
+      def and_call_original
+        if @method_double.object.is_a?(RSpec::Mocks::TestDouble)
+          @error_generator.raise_only_valid_on_a_partial_mock(:and_call_original)
+        else
+          @implementation = AndCallOriginalImplementation.new(@method_double.original_method)
+        end
+      end
+
+      # @overload and_raise
+      # @overload and_raise(ExceptionClass)
+      # @overload and_raise(ExceptionClass, message)
+      # @overload and_raise(exception_instance)
+      #
+      # Tells the object to raise an exception when the message is received.
+      #
+      # @note
+      #
+      #   When you pass an exception class, the MessageExpectation will raise
+      #   an instance of it, creating it with `exception` and passing `message`
+      #   if specified.  If the exception class initializer requires more than
+      #   one parameters, you must pass in an instance and not the class,
+      #   otherwise this method will raise an ArgumentError exception.
+      #
+      # @example
+      #
+      #   car.stub(:go).and_raise
+      #   car.stub(:go).and_raise(OutOfGas)
+      #   car.stub(:go).and_raise(OutOfGas, "At least 2 oz of gas needed to drive")
+      #   car.stub(:go).and_raise(OutOfGas.new(2, :oz))
+      def and_raise(exception = RuntimeError, message = nil)
+        if exception.respond_to?(:exception)
+          exception = message ? exception.exception(message) : exception.exception
+        end
+
+        self.terminal_implementation_action = Proc.new { raise exception }
+        nil
+      end
+
+      # @overload and_throw(symbol)
+      # @overload and_throw(symbol, object)
+      #
+      # Tells the object to throw a symbol (with the object if that form is
+      # used) when the message is received.
+      #
+      # @example
+      #
+      #   car.stub(:go).and_throw(:out_of_gas)
+      #   car.stub(:go).and_throw(:out_of_gas, :level => 0.1)
+      def and_throw(*args)
+        self.terminal_implementation_action = Proc.new { throw(*args) }
+        nil
+      end
+
+      # Tells the object to yield one or more args to a block when the message
+      # is received.
+      #
+      # @example
+      #
+      #   stream.stub(:open).and_yield(StringIO.new)
+      def and_yield(*args, &block)
+        yield @eval_context = Object.new.extend(RSpec::Mocks::InstanceExec) if block
+        @args_to_yield << args
+        self.initial_implementation_action = AndYieldImplementation.new(@args_to_yield, @eval_context, @error_generator)
+        self
+      end
+
+      # @private
+      def matches?(message, *args)
+        @message == message && @argument_list_matcher.args_match?(*args)
+      end
+
+      # @private
+      def invoke(parent_stub, *args, &block)
+        if negative? || ((@exactly || @at_most) && (@actual_received_count == @expected_received_count))
+          @actual_received_count += 1
+          @failed_fast = true
+          #args are the args we actually received, @argument_list_matcher is the
+          #list of args we were expecting
+          @error_generator.raise_expectation_error(@message, @expected_received_count, @argument_list_matcher, @actual_received_count, expectation_count_type, *args)
+        end
+
+        @order_group.handle_order_constraint self
+
+        begin
+          if implementation.present?
+            implementation.call(*args, &block)
+          elsif parent_stub
+            parent_stub.invoke(nil, *args, &block)
+          end
+        ensure
+          @actual_received_count += 1
+        end
+      end
+
+      # @private
+      def negative?
+        @expected_received_count == 0 && !@at_least
+      end
+
+      # @private
+      def called_max_times?
+        @expected_received_count != :any &&
+          !@at_least &&
+          @expected_received_count > 0 &&
+          @actual_received_count >= @expected_received_count
+      end
+
+      # @private
+      def matches_name_but_not_args(message, *args)
+        @message == message and not @argument_list_matcher.args_match?(*args)
+      end
+
+      # @private
+      def verify_messages_received
+        generate_error unless expected_messages_received? || failed_fast?
+      rescue RSpec::Mocks::MockExpectationError => error
+        error.backtrace.insert(0, @expected_from)
+        Kernel::raise error
+      end
+
+      # @private
+      def expected_messages_received?
+        ignoring_args? || matches_exact_count? || matches_at_least_count? || matches_at_most_count?
+      end
+
+      # @private
+      def ignoring_args?
+        @expected_received_count == :any
+      end
+
+      # @private
+      def matches_at_least_count?
+        @at_least && @actual_received_count >= @expected_received_count
+      end
+
+      # @private
+      def matches_at_most_count?
+        @at_most && @actual_received_count <= @expected_received_count
+      end
+
+      # @private
+      def matches_exact_count?
+        @expected_received_count == @actual_received_count
+      end
+
+      # @private
+      def similar_messages
+        @similar_messages ||= []
+      end
+
+      # @private
+      def advise(*args)
+        similar_messages << args
+      end
+
+      # @private
+      def generate_error
+        if similar_messages.empty?
+          @error_generator.raise_expectation_error(@message, @expected_received_count, @argument_list_matcher, @actual_received_count, expectation_count_type, *expected_args)
+        else
+          @error_generator.raise_similar_message_args_error(self, *@similar_messages)
+        end
+      end
+
+      def expectation_count_type
+        return :at_least if @at_least
+        return :at_most if @at_most
+        return nil
+      end
+
+      # @private
+      def description
+        @error_generator.describe_expectation(@message, @expected_received_count, @actual_received_count, *expected_args)
+      end
+
+      def raise_out_of_order_error
+        @error_generator.raise_out_of_order_error @message
+      end
+
+      # Constrains a stub or message expectation to invocations with specific
+      # arguments.
+      #
+      # With a stub, if the message might be received with other args as well,
+      # you should stub a default value first, and then stub or mock the same
+      # message using `with` to constrain to specific arguments.
+      #
+      # A message expectation will fail if the message is received with different
+      # arguments.
+      #
+      # @example
+      #
+      #   cart.stub(:add) { :failure }
+      #   cart.stub(:add).with(Book.new(:isbn => 1934356379)) { :success }
+      #   cart.add(Book.new(:isbn => 1234567890))
+      #   # => :failure
+      #   cart.add(Book.new(:isbn => 1934356379))
+      #   # => :success
+      #
+      #   cart.should_receive(:add).with(Book.new(:isbn => 1934356379)) { :success }
+      #   cart.add(Book.new(:isbn => 1234567890))
+      #   # => failed expectation
+      #   cart.add(Book.new(:isbn => 1934356379))
+      #   # => passes
+      def with(*args, &block)
+        self.inner_implementation_action = block if block_given? unless args.empty?
+        @argument_list_matcher = ArgumentListMatcher.new(*args, &block)
+        self
+      end
+
+      # Constrain a message expectation to be received a specific number of
+      # times.
+      #
+      # @example
+      #
+      #   dealer.should_receive(:deal_card).exactly(10).times
+      def exactly(n, &block)
+        self.inner_implementation_action = block
+        set_expected_received_count :exactly, n
+        self
+      end
+
+      # Constrain a message expectation to be received at least a specific
+      # number of times.
+      #
+      # @example
+      #
+      #   dealer.should_receive(:deal_card).at_least(9).times
+      def at_least(n, &block)
+        if n == 0
+          RSpec.deprecate "at_least(0) with should_receive", :replacement => "stub"
+        end
+
+        self.inner_implementation_action = block
+        set_expected_received_count :at_least, n
+        self
+      end
+
+      # Constrain a message expectation to be received at most a specific
+      # number of times.
+      #
+      # @example
+      #
+      #   dealer.should_receive(:deal_card).at_most(10).times
+      def at_most(n, &block)
+        self.inner_implementation_action = block
+        set_expected_received_count :at_most, n
+        self
+      end
+
+      # Syntactic sugar for `exactly`, `at_least` and `at_most`
+      #
+      # @example
+      #
+      #   dealer.should_receive(:deal_card).exactly(10).times
+      #   dealer.should_receive(:deal_card).at_least(10).times
+      #   dealer.should_receive(:deal_card).at_most(10).times
+      def times(&block)
+        self.inner_implementation_action = block
+        self
+      end
+
+
+      # Allows an expected message to be received any number of times.
+      def any_number_of_times(&block)
+        RSpec.deprecate "any_number_of_times", :replacement => "stub"
+        self.inner_implementation_action = block
+        @expected_received_count = :any
+        self
+      end
+
+      # Expect a message not to be received at all.
+      #
+      # @example
+      #
+      #   car.should_receive(:stop).never
+      def never
+        ErrorGenerator.raise_double_negation_error("expect(obj)") if negative?
+        @expected_received_count = 0
+        self
+      end
+
+      # Expect a message to be received exactly one time.
+      #
+      # @example
+      #
+      #   car.should_receive(:go).once
+      def once(&block)
+        self.inner_implementation_action = block
+        set_expected_received_count :exactly, 1
+        self
+      end
+
+      # Expect a message to be received exactly two times.
+      #
+      # @example
+      #
+      #   car.should_receive(:go).twice
+      def twice(&block)
+        self.inner_implementation_action = block
+        set_expected_received_count :exactly, 2
+        self
+      end
+
+      # Expect messages to be received in a specific order.
+      #
+      # @example
+      #
+      #   api.should_receive(:prepare).ordered
+      #   api.should_receive(:run).ordered
+      #   api.should_receive(:finish).ordered
+      def ordered(&block)
+        self.inner_implementation_action = block
+        @order_group.register(self)
+        @ordered = true
+        self
+      end
+
+      # @private
+      def negative_expectation_for?(message)
+        @message == message && negative?
+      end
+
+      # @private
+      def actual_received_count_matters?
+        @at_least || @at_most || @exactly
+      end
+
+      # @private
+      def increase_actual_received_count!
+        @actual_received_count += 1
+      end
+
+    private
+
+      def failed_fast?
+        @failed_fast
+      end
+
+      def set_expected_received_count(relativity, n)
+        @at_least = (relativity == :at_least)
+        @at_most  = (relativity == :at_most)
+        @exactly  = (relativity == :exactly)
+        @expected_received_count = case n
+                                   when Numeric then n
+                                   when :once   then 1
+                                   when :twice  then 2
+                                   end
+      end
+
+      def initial_implementation_action=(action)
+        implementation.initial_action = action
+      end
+
+      def inner_implementation_action=(action)
+        implementation.inner_action = action if action
+      end
+
+      def terminal_implementation_action=(action)
+        implementation.terminal_action = action
+      end
+    end
+
+    # Handles the implementation of an `and_yield` declaration.
+    # @private
+    class AndYieldImplementation
+      def initialize(args_to_yield, eval_context, error_generator)
+        @args_to_yield = args_to_yield
+        @eval_context = eval_context
+        @error_generator = error_generator
+      end
+
+      def arity
+        -1
+      end
+
+      def call(*args_to_ignore, &block)
+        return if @args_to_yield.empty? && @eval_context.nil?
+
+        @error_generator.raise_missing_block_error @args_to_yield unless block
+        value = nil
+        @args_to_yield.each do |args|
+          if block.arity > -1 && args.length != block.arity
+            @error_generator.raise_wrong_arity_error args, block.arity
+          end
+          value = @eval_context ? @eval_context.instance_exec(*args, &block) : block.call(*args)
+        end
+        value
+      end
+    end
+
+    # Handles the implementation of an `and_return` implementation.
+    # @private
+    class AndReturnImplementation
+      def initialize(values_to_return)
+        @values_to_return = values_to_return
+      end
+
+      def arity
+        -1
+      end
+
+      def call(*args_to_ignore, &block)
+        if @values_to_return.size > 1
+          @values_to_return.shift
+        else
+          @values_to_return.first
+        end
+      end
+    end
+
+    # Represents a configured implementation. Takes into account
+    # any number of sub-implementations.
+    # @private
+    class Implementation
+      attr_accessor :initial_action, :inner_action, :terminal_action
+
+      def call(*args, &block)
+        actions.map do |action|
+          action.call(*arg_slice_for(args, action.arity), &block)
+        end.last
+      end
+
+      def arg_slice_for(args, arity)
+        if arity >= 0
+          args.slice(0, arity)
+        else
+          args
+        end
+      end
+
+      def present?
+        actions.any?
+      end
+
+    private
+
+      def actions
+        [initial_action, inner_action, terminal_action].compact
+      end
+    end
+
+    # Represents an `and_call_original` implementation.
+    # @private
+    class AndCallOriginalImplementation
+      def initialize(method)
+        @method = method
+      end
+
+      CannotModifyFurtherError = Class.new(StandardError)
+
+      def arity
+        @method.arity
+      end
+
+      def initial_action=(value)
+        raise cannot_modify_further_error
+      end
+
+      def inner_action=(value)
+        raise cannot_modify_further_error
+      end
+
+      def terminal_action=(value)
+        raise cannot_modify_further_error
+      end
+
+      def present?
+        true
+      end
+
+      def call(*args, &block)
+        @method.call(*args, &block)
+      end
+
+    private
+
+      def cannot_modify_further_error
+        CannotModifyFurtherError.new "This method has already been configured " +
+          "to call the original implementation, and cannot be modified further."
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/method_double.rb b/rspec-mocks/lib/rspec/mocks/method_double.rb
new file mode 100644
index 0000000..268e77b
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/method_double.rb
@@ -0,0 +1,265 @@
+module RSpec
+  module Mocks
+    # @private
+    class MethodDouble < Hash
+      # @private
+      attr_reader :method_name, :object
+
+      # @private
+      def initialize(object, method_name, proxy)
+        @method_name = method_name
+        @object = object
+        @proxy = proxy
+
+        @method_stasher = InstanceMethodStasher.new(object_singleton_class, @method_name)
+        @method_is_proxied = false
+        store(:expectations, [])
+        store(:stubs, [])
+      end
+
+      # @private
+      def expectations
+        self[:expectations]
+      end
+
+      # @private
+      def stubs
+        self[:stubs]
+      end
+
+      # @private
+      def visibility
+        if TestDouble === @object
+          'public'
+        elsif object_singleton_class.private_method_defined?(@method_name)
+          'private'
+        elsif object_singleton_class.protected_method_defined?(@method_name)
+          'protected'
+        else
+          'public'
+        end
+      end
+
+      class ProcWithBlock < Struct.new(:object, :method_name)
+
+        def call(*args, &block)
+          self.object.__send__(:method_missing, self.method_name, *args, &block)
+        end
+
+      end
+
+      # @private
+      def original_method
+        if @method_stasher.method_is_stashed?
+          # Example: a singleton method defined on @object
+          ::RSpec::Mocks.method_handle_for(@object, @method_stasher.stashed_method_name)
+        elsif meth = original_unrecorded_any_instance_method
+          # Example: a method that has been mocked through
+          #   klass.any_instance.should_receive(:msg).and_call_original
+          # any_instance.should_receive(:msg) causes the method to be
+          # replaced with a proxy method, and then `and_call_original`
+          # is recorded and played back on the object instance. We need
+          # special handling here to get a handle on the original method
+          # object rather than the proxy method.
+          meth
+        else
+          # Example: an instance method defined on one of @object's ancestors.
+          original_method_from_ancestry
+        end
+      rescue NameError
+        # We have no way of knowing if the object's method_missing
+        # will handle this message or not...but we can at least try.
+        # If it's not handled, a `NoMethodError` will be raised, just
+        # like normally.
+        ProcWithBlock.new(@object, at method_name)
+      end
+
+      def original_unrecorded_any_instance_method
+        return nil unless any_instance_class_recorder_observing_method?(@object.class)
+        alias_name = ::RSpec::Mocks.any_instance_recorder_for(@object.class).build_alias_method_name(@method_name)
+        @object.method(alias_name)
+      end
+
+      def any_instance_class_recorder_observing_method?(klass)
+        return true if ::RSpec::Mocks.any_instance_recorder_for(klass).already_observing?(@method_name)
+        superklass = klass.superclass
+        return false if superklass.nil?
+        any_instance_class_recorder_observing_method?(superklass)
+      end
+
+      our_singleton_class = class << self; self; end
+      if our_singleton_class.ancestors.include? our_singleton_class
+        # In Ruby 2.1, ancestors include the correct ancestors, including the singleton classes
+        def original_method_from_ancestry
+          # Lookup in the ancestry, skipping over the singleton class itself
+          original_method_from_ancestor(object_singleton_class.ancestors.drop(1))
+        end
+      else
+        # @private
+        def original_method_from_ancestry
+          original_method_from_ancestor(object_singleton_class.ancestors)
+        rescue NameError
+          raise unless @object.respond_to?(:superclass)
+
+          # Example: a singleton method defined on @object's superclass.
+          #
+          # Note: we have to give precedence to instance methods
+          # defined on @object's class, because in a case like:
+          #
+          # `klass.should_receive(:new).and_call_original`
+          #
+          # ...we want `Class#new` bound to `klass` (which will return
+          # an instance of `klass`), not `klass.superclass.new` (which
+          # would return an instance of `klass.superclass`).
+          original_method_from_superclass
+        end
+      end
+
+      def original_method_from_ancestor(ancestors)
+        klass, *rest = ancestors
+        klass.instance_method(@method_name).bind(@object)
+      rescue NameError
+        raise if rest.empty?
+        original_method_from_ancestor(rest)
+      end
+
+      if RUBY_VERSION.to_f > 1.8
+        # @private
+        def original_method_from_superclass
+          @object.superclass.
+                  singleton_class.
+                  instance_method(@method_name).
+                  bind(@object)
+        end
+      else
+        # Our implementation for 1.9 (above) causes an error on 1.8:
+        # TypeError: singleton method bound for a different object
+        #
+        # This doesn't work quite right in all circumstances but it's the
+        # best we can do.
+        # @private
+        def original_method_from_superclass
+          ::Kernel.warn <<-WARNING.gsub(/^ +\|/, '')
+            |
+            |WARNING: On ruby 1.8, rspec-mocks is unable to bind the original
+            |`#{@method_name}` method to your partial mock object (#{@object})
+            |for `and_call_original`. The superclass's `#{@method_name}` is being
+            |used instead; however, it may not work correctly when executed due
+            |to the fact that `self` will be #{@object.superclass}, not #{@object}.
+            |
+            |Called from: #{caller[2]}
+          WARNING
+
+          @object.superclass.method(@method_name)
+        end
+      end
+      # @private
+      def object_singleton_class
+        class << @object; self; end
+      end
+
+      # @private
+      def configure_method
+        @original_visibility = visibility_for_method
+        @method_stasher.stash unless @method_is_proxied
+        define_proxy_method
+      end
+
+      # @private
+      def define_proxy_method
+        return if @method_is_proxied
+
+        object_singleton_class.class_eval <<-EOF, __FILE__, __LINE__ + 1
+          def #{@method_name}(*args, &block)
+            ::RSpec::Mocks.proxy_for(self).message_received :#{@method_name}, *args, &block
+          end
+          #{visibility_for_method}
+        EOF
+        @method_is_proxied = true
+      end
+
+      # @private
+      def visibility_for_method
+        "#{visibility} :#{method_name}"
+      end
+
+      # @private
+      def restore_original_method
+        return unless @method_is_proxied
+
+        object_singleton_class.__send__(:remove_method, @method_name)
+        @method_stasher.restore
+        restore_original_visibility
+
+        @method_is_proxied = false
+      end
+
+      # @private
+      def restore_original_visibility
+        return unless object_singleton_class.method_defined?(@method_name) || object_singleton_class.private_method_defined?(@method_name)
+        object_singleton_class.class_eval(@original_visibility, __FILE__, __LINE__)
+      end
+
+      # @private
+      def verify
+        expectations.each {|e| e.verify_messages_received}
+      end
+
+      # @private
+      def reset
+        restore_original_method
+        clear
+      end
+
+      # @private
+      def clear
+        expectations.clear
+        stubs.clear
+      end
+
+      # @private
+      def add_expectation(error_generator, expectation_ordering, expected_from, opts, &implementation)
+        configure_method
+        expectation = MessageExpectation.new(error_generator, expectation_ordering,
+                                             expected_from, self, 1, opts, &implementation)
+        expectations << expectation
+        expectation
+      end
+
+      # @private
+      def build_expectation(error_generator, expectation_ordering)
+        expected_from = IGNORED_BACKTRACE_LINE
+        MessageExpectation.new(error_generator, expectation_ordering, expected_from, self)
+      end
+
+      # @private
+      def add_stub(error_generator, expectation_ordering, expected_from, opts={}, &implementation)
+        configure_method
+        stub = MessageExpectation.new(error_generator, expectation_ordering, expected_from,
+                                      self, :any, opts, &implementation)
+        stubs.unshift stub
+        stub
+      end
+
+      # @private
+      def add_default_stub(*args, &implementation)
+        return if stubs.any?
+        add_stub(*args, &implementation)
+      end
+
+      # @private
+      def remove_stub
+        raise_method_not_stubbed_error if stubs.empty?
+        expectations.empty? ? reset : stubs.clear
+      end
+
+      # @private
+      def raise_method_not_stubbed_error
+        raise MockExpectationError, "The method `#{method_name}` was not stubbed or was already unstubbed"
+      end
+
+      # @private
+      IGNORED_BACKTRACE_LINE = 'this backtrace line is ignored'
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/mock.rb b/rspec-mocks/lib/rspec/mocks/mock.rb
new file mode 100644
index 0000000..4789a1f
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/mock.rb
@@ -0,0 +1,7 @@
+module RSpec
+  module Mocks
+    class Mock
+      include TestDouble
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/mutate_const.rb b/rspec-mocks/lib/rspec/mocks/mutate_const.rb
new file mode 100644
index 0000000..cc0ecf5
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/mutate_const.rb
@@ -0,0 +1,403 @@
+module RSpec
+  module Mocks
+    # Provides recursive constant lookup methods useful for
+    # constant stubbing.
+    # @api private
+    module RecursiveConstMethods
+      # We only want to consider constants that are defined directly on a
+      # particular module, and not include top-level/inherited constants.
+      # Unfortunately, the constant API changed between 1.8 and 1.9, so
+      # we need to conditionally define methods to ignore the top-level/inherited
+      # constants.
+      #
+      # Given:
+      #   class A; B = 1; end
+      #   class C < A; end
+      #
+      # On 1.8:
+      #   - C.const_get("Hash") # => ::Hash
+      #   - C.const_defined?("Hash") # => false
+      #   - C.constants # => ["B"]
+      #   - None of these methods accept the extra `inherit` argument
+      # On 1.9:
+      #   - C.const_get("Hash") # => ::Hash
+      #   - C.const_defined?("Hash") # => true
+      #   - C.const_get("Hash", false) # => raises NameError
+      #   - C.const_defined?("Hash", false) # => false
+      #   - C.constants # => [:B]
+      #   - C.constants(false) #=> []
+      if Module.method(:const_defined?).arity == 1
+        def const_defined_on?(mod, const_name)
+          mod.const_defined?(const_name)
+        end
+
+        def get_const_defined_on(mod, const_name)
+          if const_defined_on?(mod, const_name)
+            return mod.const_get(const_name)
+          end
+
+          raise NameError, "uninitialized constant #{mod.name}::#{const_name}"
+        end
+
+        def constants_defined_on(mod)
+          mod.constants.select { |c| const_defined_on?(mod, c) }
+        end
+      else
+        def const_defined_on?(mod, const_name)
+          mod.const_defined?(const_name, false)
+        end
+
+        def get_const_defined_on(mod, const_name)
+          mod.const_get(const_name, false)
+        end
+
+        def constants_defined_on(mod)
+          mod.constants(false)
+        end
+      end
+
+      def recursive_const_get(const_name)
+        normalize_const_name(const_name).split('::').inject(Object) do |mod, name|
+          get_const_defined_on(mod, name)
+        end
+      end
+
+      def recursive_const_defined?(const_name)
+        normalize_const_name(const_name).split('::').inject([Object, '']) do |(mod, full_name), name|
+          yield(full_name, name) if block_given? && !mod.is_a?(Module)
+          return false unless const_defined_on?(mod, name)
+          [get_const_defined_on(mod, name), [mod, name].join('::')]
+        end
+      end
+
+      def normalize_const_name(const_name)
+        const_name.sub(/\A::/, '')
+      end
+    end
+
+    # Provides information about constants that may (or may not)
+    # have been mutated by rspec-mocks.
+    class Constant
+      extend RecursiveConstMethods
+
+      # @api private
+      def initialize(name)
+        @name = name
+        @previously_defined = false
+        @stubbed = false
+        @hidden = false
+      end
+
+      # @return [String] The fully qualified name of the constant.
+      attr_reader :name
+
+      # @return [Object, nil] The original value (e.g. before it
+      #   was mutated by rspec-mocks) of the constant, or
+      #   nil if the constant was not previously defined.
+      attr_accessor :original_value
+
+      # @api private
+      attr_writer :previously_defined, :stubbed, :hidden
+
+      # @return [Boolean] Whether or not the constant was defined
+      #   before the current example.
+      def previously_defined?
+        @previously_defined
+      end
+
+      # @return [Boolean] Whether or not rspec-mocks has mutated
+      #   (stubbed or hidden) this constant.
+      def mutated?
+        @stubbed || @hidden
+      end
+
+      # @return [Boolean] Whether or not rspec-mocks has stubbed
+      #   this constant.
+      def stubbed?
+        @stubbed
+      end
+
+      # @return [Boolean] Whether or not rspec-mocks has hidden
+      #   this constant.
+      def hidden?
+        @hidden
+      end
+
+      def to_s
+        "#<#{self.class.name} #{name}>"
+      end
+      alias inspect to_s
+
+      # @api private
+      def self.unmutated(name)
+        const = new(name)
+        const.previously_defined = recursive_const_defined?(name)
+        const.stubbed = false
+        const.hidden = false
+        const.original_value = recursive_const_get(name) if const.previously_defined?
+
+        const
+      end
+      private_class_method :unmutated
+
+      # Queries rspec-mocks to find out information about the named constant.
+      #
+      # @param [String] name the name of the constant
+      # @return [Constant] an object contaning information about the named
+      #   constant.
+      def self.original(name)
+        mutator = ConstantMutator.find(name)
+        mutator ? mutator.to_constant : unmutated(name)
+      end
+    end
+
+    # Provides a means to stub constants.
+    class ConstantMutator
+      extend RecursiveConstMethods
+
+      # Stubs a constant.
+      #
+      # @param (see ExampleMethods#stub_const)
+      # @option (see ExampleMethods#stub_const)
+      # @return (see ExampleMethods#stub_const)
+      #
+      # @see ExampleMethods#stub_const
+      # @note It's recommended that you use `stub_const` in your
+      #  examples. This is an alternate public API that is provided
+      #  so you can stub constants in other contexts (e.g. helper
+      #  classes).
+      def self.stub(constant_name, value, options = {})
+        mutator = if recursive_const_defined?(constant_name, &raise_on_invalid_const)
+          DefinedConstantReplacer
+        else
+          UndefinedConstantSetter
+        end
+
+        mutate(mutator.new(constant_name, value, options[:transfer_nested_constants]))
+        value
+      end
+
+      # Hides a constant.
+      #
+      # @param (see ExampleMethods#hide_const)
+      #
+      # @see ExampleMethods#hide_const
+      # @note It's recommended that you use `hide_const` in your
+      #  examples. This is an alternate public API that is provided
+      #  so you can hide constants in other contexts (e.g. helper
+      #  classes).
+      def self.hide(constant_name)
+        return unless recursive_const_defined?(constant_name)
+
+        mutate(ConstantHider.new(constant_name, nil, { }))
+        nil
+      end
+
+      # Contains common functionality used by all of the constant mutators.
+      #
+      # @api private
+      class BaseMutator
+        include RecursiveConstMethods
+
+        attr_reader :original_value, :full_constant_name
+
+        def initialize(full_constant_name, mutated_value, transfer_nested_constants)
+          @full_constant_name        = normalize_const_name(full_constant_name)
+          @mutated_value             = mutated_value
+          @transfer_nested_constants = transfer_nested_constants
+          @context_parts             = @full_constant_name.split('::')
+          @const_name                = @context_parts.pop
+        end
+
+        def to_constant
+          const = Constant.new(full_constant_name)
+          const.original_value = original_value
+
+          const
+        end
+      end
+
+      # Hides a defined constant for the duration of an example.
+      #
+      # @api private
+      class ConstantHider < BaseMutator
+        def mutate
+          @context = recursive_const_get(@context_parts.join('::'))
+          @original_value = get_const_defined_on(@context, @const_name)
+
+          @context.__send__(:remove_const, @const_name)
+        end
+
+        def to_constant
+          const = super
+          const.hidden = true
+          const.previously_defined = true
+
+          const
+        end
+
+        def rspec_reset
+          @context.const_set(@const_name, @original_value)
+        end
+      end
+
+      # Replaces a defined constant for the duration of an example.
+      #
+      # @api private
+      class DefinedConstantReplacer < BaseMutator
+        def mutate
+          @context = recursive_const_get(@context_parts.join('::'))
+          @original_value = get_const_defined_on(@context, @const_name)
+
+          constants_to_transfer = verify_constants_to_transfer!
+
+          @context.__send__(:remove_const, @const_name)
+          @context.const_set(@const_name, @mutated_value)
+
+          transfer_nested_constants(constants_to_transfer)
+        end
+
+        def to_constant
+          const = super
+          const.stubbed = true
+          const.previously_defined = true
+
+          const
+        end
+
+        def rspec_reset
+          @context.__send__(:remove_const, @const_name)
+          @context.const_set(@const_name, @original_value)
+        end
+
+        def transfer_nested_constants(constants)
+          constants.each do |const|
+            @mutated_value.const_set(const, get_const_defined_on(original_value, const))
+          end
+        end
+
+        def verify_constants_to_transfer!
+          return [] unless @transfer_nested_constants
+
+          { @original_value => "the original value", @mutated_value => "the stubbed value" }.each do |value, description|
+            unless value.respond_to?(:constants)
+              raise ArgumentError,
+                "Cannot transfer nested constants for #{@full_constant_name} " +
+                "since #{description} is not a class or module and only classes " +
+                "and modules support nested constants."
+            end
+          end
+
+          if @transfer_nested_constants.is_a?(Array)
+            @transfer_nested_constants = @transfer_nested_constants.map(&:to_s) if RUBY_VERSION == '1.8.7'
+            undefined_constants = @transfer_nested_constants - constants_defined_on(@original_value)
+
+            if undefined_constants.any?
+              available_constants = constants_defined_on(@original_value) - @transfer_nested_constants
+              raise ArgumentError,
+                "Cannot transfer nested constant(s) #{undefined_constants.join(' and ')} " +
+                "for #{@full_constant_name} since they are not defined. Did you mean " +
+                "#{available_constants.join(' or ')}?"
+            end
+
+            @transfer_nested_constants
+          else
+            constants_defined_on(@original_value)
+          end
+        end
+      end
+
+      # Sets an undefined constant for the duration of an example.
+      #
+      # @api private
+      class UndefinedConstantSetter < BaseMutator
+        def mutate
+          remaining_parts = @context_parts.dup
+          @deepest_defined_const = @context_parts.inject(Object) do |klass, name|
+            break klass unless const_defined_on?(klass, name)
+            remaining_parts.shift
+            get_const_defined_on(klass, name)
+          end
+
+          context = remaining_parts.inject(@deepest_defined_const) do |klass, name|
+            klass.const_set(name, Module.new)
+          end
+
+          @const_to_remove = remaining_parts.first || @const_name
+          context.const_set(@const_name, @mutated_value)
+        end
+
+        def to_constant
+          const = super
+          const.stubbed = true
+          const.previously_defined = false
+
+          const
+        end
+
+        def rspec_reset
+          @deepest_defined_const.__send__(:remove_const, @const_to_remove)
+        end
+      end
+
+      # Uses the mutator to mutate (stub or hide) a constant. Ensures that
+      # the mutator is correctly registered so it can be backed out at the end
+      # of the test.
+      #
+      # @api private
+      def self.mutate(mutator)
+        register_mutator(mutator)
+        mutator.mutate
+      end
+
+      # Resets all stubbed constants. This is called automatically
+      # by rspec-mocks when an example finishes.
+      #
+      # @api private
+      def self.reset_all
+        # We use reverse order so that if the same constant
+        # was stubbed multiple times, the original value gets
+        # properly restored.
+        mutators.reverse.each { |s| s.rspec_reset }
+
+        mutators.clear
+      end
+
+      # The list of constant mutators that have been used for
+      # the current example.
+      #
+      # @api private
+      def self.mutators
+        @mutators ||= []
+      end
+
+      # @api private
+      def self.register_mutator(mutator)
+        mutators << mutator
+      end
+
+      def self.find(name)
+        mutators.find { |s| s.full_constant_name == name }
+      end
+
+      # Used internally by the constant stubbing to raise a helpful
+      # error when a constant like "A::B::C" is stubbed and A::B is
+      # not a module (and thus, it's impossible to define "A::B::C"
+      # since only modules can have nested constants).
+      #
+      # @api private
+      def self.raise_on_invalid_const
+        lambda do |const_name, failed_name|
+          raise "Cannot stub constant #{failed_name} on #{const_name} " +
+                "since #{const_name} is not a module."
+        end
+      end
+    end
+
+    # Keeps backwards compatibility since we had released an rspec-mocks that
+    # only supported stubbing. Later, we released the hide_const feature and
+    # decided that the term "mutator" was a better term to wrap up the concept
+    # of both stubbing and hiding.
+    ConstantStubber = ConstantMutator
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/order_group.rb b/rspec-mocks/lib/rspec/mocks/order_group.rb
new file mode 100644
index 0000000..b86ccca
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/order_group.rb
@@ -0,0 +1,40 @@
+module RSpec
+  module Mocks
+    # @private
+    class OrderGroup
+      def initialize
+        @ordering = Array.new
+      end
+
+      # @private
+      def register(expectation)
+        @ordering << expectation
+      end
+
+      # @private
+      def ready_for?(expectation)
+        @ordering.first == expectation
+      end
+
+      # @private
+      def consume
+        @ordering.shift
+      end
+
+      # @private
+      def handle_order_constraint(expectation)
+        return unless @ordering.include?(expectation)
+        return consume if ready_for?(expectation)
+        expectation.raise_out_of_order_error
+      end
+
+      def clear
+        @ordering.clear
+      end
+
+      def empty?
+        @ordering.empty?
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/proxy.rb b/rspec-mocks/lib/rspec/mocks/proxy.rb
new file mode 100644
index 0000000..5dc63b4
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/proxy.rb
@@ -0,0 +1,216 @@
+module RSpec
+  module Mocks
+    # @private
+    class Proxy
+
+      # @private
+      def initialize(object, name=nil, options={})
+        @object = object
+        @name = name
+        @error_generator = ErrorGenerator.new object, name, options
+        @expectation_ordering = RSpec::Mocks::space.expectation_ordering
+        @messages_received = []
+        @options = options
+        @already_proxied_respond_to = false
+        @null_object = false
+      end
+
+      # @private
+      def null_object?
+        @null_object
+      end
+
+      # @private
+      # Tells the object to ignore any messages that aren't explicitly set as
+      # stubs or message expectations.
+      def as_null_object
+        @null_object = true
+        @object
+      end
+
+      # @private
+      def already_proxied_respond_to
+        @already_proxied_respond_to = true
+      end
+
+      # @private
+      def already_proxied_respond_to?
+        @already_proxied_respond_to
+      end
+
+      # @private
+      def add_message_expectation(location, method_name, opts={}, &block)
+        meth_double = method_double[method_name]
+
+        if null_object? && !block
+          meth_double.add_default_stub(@error_generator, @expectation_ordering, location, opts) do
+            @object
+          end
+        end
+
+        meth_double.add_expectation @error_generator, @expectation_ordering, location, opts, &block
+      end
+
+      # @private
+      def build_expectation(method_name)
+        meth_double = method_double[method_name]
+
+        meth_double.build_expectation(
+          @error_generator,
+          @expectation_ordering
+        )
+      end
+
+      # @private
+      def replay_received_message_on(expectation)
+        expected_method_name = expectation.message
+        meth_double = method_double[expected_method_name]
+
+        if meth_double.expectations.any?
+          @error_generator.raise_expectation_on_mocked_method(expected_method_name)
+        end
+
+        unless null_object? || meth_double.stubs.any?
+          @error_generator.raise_expectation_on_unstubbed_method(expected_method_name)
+        end
+
+        @messages_received.each do |(actual_method_name, args, _)|
+          if expectation.matches?(actual_method_name, *args)
+            expectation.invoke(nil)
+          end
+        end
+      end
+
+      # @private
+      def check_for_unexpected_arguments(expectation)
+        @messages_received.each do |(method_name, args, _)|
+          if expectation.matches_name_but_not_args(method_name, *args)
+            raise_unexpected_message_args_error(expectation, *args)
+          end
+        end
+      end
+
+      # @private
+      def add_stub(location, method_name, opts={}, &implementation)
+        method_double[method_name].add_stub @error_generator, @expectation_ordering, location, opts, &implementation
+      end
+
+      # @private
+      def remove_stub(method_name)
+        method_double[method_name].remove_stub
+      end
+
+      # @private
+      def verify
+        method_doubles.each {|d| d.verify}
+      ensure
+        reset
+      end
+
+      # @private
+      def reset
+        method_doubles.each {|d| d.reset}
+        @messages_received.clear
+      end
+
+      # @private
+      def received_message?(method_name, *args, &block)
+        @messages_received.any? {|array| array == [method_name, args, block]}
+      end
+
+      # @private
+      def has_negative_expectation?(message)
+        method_double[message].expectations.detect {|expectation| expectation.negative_expectation_for?(message)}
+      end
+
+      # @private
+      def record_message_received(message, *args, &block)
+        @messages_received << [message, args, block]
+      end
+
+      # @private
+      def message_received(message, *args, &block)
+        record_message_received message, *args, &block
+        expectation = find_matching_expectation(message, *args)
+        stub = find_matching_method_stub(message, *args)
+
+        if (stub && expectation && expectation.called_max_times?) || (stub && !expectation)
+          expectation.increase_actual_received_count! if expectation && expectation.actual_received_count_matters?
+          if expectation = find_almost_matching_expectation(message, *args)
+            expectation.advise(*args) unless expectation.expected_messages_received?
+          end
+          stub.invoke(nil, *args, &block)
+        elsif expectation
+          expectation.invoke(stub, *args, &block)
+        elsif expectation = find_almost_matching_expectation(message, *args)
+          expectation.advise(*args) if null_object? unless expectation.expected_messages_received?
+          raise_unexpected_message_args_error(expectation, *args) unless (has_negative_expectation?(message) or null_object?)
+        elsif stub = find_almost_matching_stub(message, *args)
+          stub.advise(*args)
+          raise_missing_default_stub_error(stub, *args)
+        elsif @object.is_a?(Class)
+          @object.superclass.__send__(message, *args, &block)
+        else
+          @object.__send__(:method_missing, message, *args, &block)
+        end
+      end
+
+      # @private
+      def raise_unexpected_message_error(method_name, *args)
+        @error_generator.raise_unexpected_message_error method_name, *args
+      end
+
+      # @private
+      def raise_unexpected_message_args_error(expectation, *args)
+        @error_generator.raise_unexpected_message_args_error(expectation, *args)
+      end
+
+      # @private
+      def raise_missing_default_stub_error(expectation, *args)
+        @error_generator.raise_missing_default_stub_error(expectation, *args)
+      end
+
+      private
+
+      def method_double
+        @method_double ||= Hash.new {|h,k| h[k] = MethodDouble.new(@object, k, self) }
+      end
+
+      def method_doubles
+        method_double.values
+      end
+
+      def find_matching_expectation(method_name, *args)
+        find_best_matching_expectation_for(method_name) do |expectation|
+          expectation.matches?(method_name, *args)
+        end
+      end
+
+      def find_almost_matching_expectation(method_name, *args)
+        find_best_matching_expectation_for(method_name) do |expectation|
+          expectation.matches_name_but_not_args(method_name, *args)
+        end
+      end
+
+      def find_best_matching_expectation_for(method_name)
+        first_match = nil
+
+        method_double[method_name].expectations.each do |expectation|
+          next unless yield expectation
+          return expectation unless expectation.called_max_times?
+          first_match ||= expectation
+        end
+
+        first_match
+      end
+
+      def find_matching_method_stub(method_name, *args)
+        method_double[method_name].stubs.find {|stub| stub.matches?(method_name, *args)}
+      end
+
+      def find_almost_matching_stub(method_name, *args)
+        method_double[method_name].stubs.find {|stub| stub.matches_name_but_not_args(method_name, *args)}
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/proxy_for_nil.rb b/rspec-mocks/lib/rspec/mocks/proxy_for_nil.rb
new file mode 100644
index 0000000..434e083
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/proxy_for_nil.rb
@@ -0,0 +1,37 @@
+module RSpec
+  module Mocks
+    # @private
+    class ProxyForNil < Proxy
+
+      def initialize
+        @warn_about_expectations = true
+        super nil
+      end
+      attr_accessor :warn_about_expectations
+      alias warn_about_expectations? warn_about_expectations
+
+      def add_message_expectation(location, method_name, opts={}, &block)
+        warn(method_name) if warn_about_expectations?
+        super
+      end
+
+      def add_negative_message_expectation(location, method_name, &implementation)
+        warn(method_name) if warn_about_expectations?
+        super
+      end
+
+      def add_stub(location, method_name, opts={}, &implementation)
+        warn(method_name) if warn_about_expectations?
+        super
+      end
+
+      private
+
+      def warn method_name
+        non_rspec_caller = caller.find { |line| !line.include?('lib/rspec/mocks') }
+        Kernel.warn("An expectation of :#{method_name} was set on nil. Called from #{non_rspec_caller}. Use allow_message_expectations_on_nil to disable warnings.")
+      end
+
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/space.rb b/rspec-mocks/lib/rspec/mocks/space.rb
new file mode 100644
index 0000000..d8fdf20
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/space.rb
@@ -0,0 +1,87 @@
+module RSpec
+  module Mocks
+    # @api private
+    class Space
+      attr_reader :proxies, :any_instance_recorders
+
+      def initialize
+        @proxies = {}
+        @any_instance_recorders = {}
+      end
+
+      def verify_all
+        proxies.each_value do |object|
+          object.verify
+        end
+
+        any_instance_recorders.each_value do |recorder|
+          recorder.verify
+        end
+      end
+
+      def reset_all
+        ConstantMutator.reset_all
+
+        proxies.each_value do |object|
+          object.reset
+        end
+
+        proxies.clear
+        any_instance_recorders.clear
+        expectation_ordering.clear
+      end
+
+      def expectation_ordering
+        @expectation_ordering ||= OrderGroup.new
+      end
+
+      def any_instance_recorder_for(klass)
+        id = klass.__id__
+        any_instance_recorders.fetch(id) do
+          any_instance_recorders[id] = AnyInstance::Recorder.new(klass)
+        end
+      end
+
+      def remove_any_instance_recorder_for(klass)
+        any_instance_recorders.delete(klass.__id__)
+      end
+
+      def proxy_for(object)
+        id = id_for(object)
+        proxies.fetch(id) do
+          proxies[id] = case object
+                        when NilClass   then ProxyForNil.new
+                        when TestDouble then object.__build_mock_proxy
+                        else
+                          Proxy.new(object)
+                        end
+        end
+      end
+
+      alias ensure_registered proxy_for
+
+      def registered?(object)
+        proxies.has_key?(id_for object)
+      end
+
+      if defined?(::BasicObject) && !::BasicObject.method_defined?(:__id__) # for 1.9.2
+        require 'securerandom'
+
+        def id_for(object)
+          id = object.__id__
+
+          return id if object.equal?(::ObjectSpace._id2ref(id))
+          # this suggests that object.__id__ is proxying through to some wrapped object
+
+          object.instance_eval do
+            @__id_for_rspec_mocks_space ||= ::SecureRandom.uuid
+          end
+        end
+      else
+        def id_for(object)
+          object.__id__
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/standalone.rb b/rspec-mocks/lib/rspec/mocks/standalone.rb
new file mode 100644
index 0000000..05d9174
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/standalone.rb
@@ -0,0 +1,3 @@
+require 'rspec/mocks'
+
+RSpec::Mocks.setup(self)
diff --git a/rspec-mocks/lib/rspec/mocks/stub_chain.rb b/rspec-mocks/lib/rspec/mocks/stub_chain.rb
new file mode 100644
index 0000000..99dc01e
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/stub_chain.rb
@@ -0,0 +1,51 @@
+module RSpec
+  module Mocks
+    # @private
+    class StubChain
+      def self.stub_chain_on(object, *chain, &blk)
+        new(object, *chain, &blk).stub_chain
+      end
+
+      attr_reader :object, :chain, :block
+
+      def initialize(object, *chain, &blk)
+        @object = object
+        @chain, @block = format_chain(*chain, &blk)
+      end
+
+      def stub_chain
+        if chain.length > 1
+          if matching_stub = find_matching_stub
+            chain.shift
+            matching_stub.invoke(nil).stub_chain(*chain, &block)
+          else
+            next_in_chain = Mock.new
+            object.stub(chain.shift) { next_in_chain }
+            StubChain.stub_chain_on(next_in_chain, *chain, &block)
+          end
+        else
+          object.stub(chain.shift, &block)
+        end
+      end
+
+    private
+
+      def format_chain(*chain, &blk)
+        if Hash === chain.last
+          hash = chain.pop
+          hash.each do |k,v|
+            chain << k
+            blk = lambda { v }
+          end
+        end
+        return chain.join('.').split('.'), blk
+      end
+
+      def find_matching_stub
+        ::RSpec::Mocks.proxy_for(object).
+          __send__(:find_matching_method_stub, chain.first.to_sym)
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/syntax.rb b/rspec-mocks/lib/rspec/mocks/syntax.rb
new file mode 100644
index 0000000..cd6c439
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/syntax.rb
@@ -0,0 +1,349 @@
+module RSpec
+  module Mocks
+    # @api private
+    # Provides methods for enabling and disabling the available syntaxes
+    # provided by rspec-mocks.
+    module Syntax
+      # @api private
+      #
+      # Common stubbing logic for both `stub` and `stub!`. This used to
+      # live in `stub`, and `stub!` delegated to `stub`, but we discovered
+      # that `stub!` was delegating to `RSpec::Mocks::ExampleMethods#stub`
+      # (which declares a test double) when called with an implicit receiver,
+      # which was a regression in 2.14.0.
+      def self.stub_object(object, message_or_hash, opts = {}, &block)
+        if ::Hash === message_or_hash
+          message_or_hash.each {|message, value| stub_object(object, message).and_return value }
+        else
+          opts[:expected_from] = caller(1)[1]
+          ::RSpec::Mocks.allow_message(object, message_or_hash, opts, &block)
+        end
+      end
+
+      # @api private
+      # Enables the should syntax (`dbl.stub`, `dbl.should_receive`, etc).
+      def self.enable_should(syntax_host = default_should_syntax_host)
+        return if should_enabled?(syntax_host)
+
+        syntax_host.class_eval do
+          def should_receive(message, opts={}, &block)
+            opts[:expected_from] ||= caller(1)[0]
+            ::RSpec::Mocks.expect_message(self, message.to_sym, opts, &block)
+          end
+
+          def should_not_receive(message, &block)
+            opts = {:expected_from => caller(1)[0]}
+            ::RSpec::Mocks.expect_message(self, message.to_sym, opts, &block).never
+          end
+
+          def stub(message_or_hash, opts={}, &block)
+            ::RSpec::Mocks::Syntax.stub_object(self, message_or_hash, opts, &block)
+          end
+
+          def unstub(message)
+            ::RSpec::Mocks.space.proxy_for(self).remove_stub(message)
+          end
+
+          def stub!(message_or_hash, opts={}, &block)
+            ::RSpec.deprecate "stub!", :replacement => "stub"
+            ::RSpec::Mocks::Syntax.stub_object(self, message_or_hash, opts, &block)
+          end
+
+          def unstub!(message)
+            ::RSpec.deprecate "unstub!", :replacement => "unstub"
+            unstub(message)
+          end
+
+          def stub_chain(*chain, &blk)
+            ::RSpec::Mocks::StubChain.stub_chain_on(self, *chain, &blk)
+          end
+
+          def as_null_object
+            @_null_object = true
+            ::RSpec::Mocks.proxy_for(self).as_null_object
+          end
+
+          def null_object?
+            defined?(@_null_object)
+          end
+
+          def received_message?(message, *args, &block)
+            ::RSpec::Mocks.proxy_for(self).received_message?(message, *args, &block)
+          end
+
+          unless Class.respond_to? :any_instance
+            Class.class_eval do
+              def any_instance
+                ::RSpec::Mocks.any_instance_recorder_for(self)
+              end
+            end
+          end
+        end
+      end
+
+      # @api private
+      # Disables the should syntax (`dbl.stub`, `dbl.should_receive`, etc).
+      def self.disable_should(syntax_host = default_should_syntax_host)
+        return unless should_enabled?(syntax_host)
+
+        syntax_host.class_eval do
+          undef should_receive
+          undef should_not_receive
+          undef stub
+          undef unstub
+          undef stub!
+          undef unstub!
+          undef stub_chain
+          undef as_null_object
+          undef null_object?
+          undef received_message?
+        end
+
+        Class.class_eval do
+          undef any_instance
+        end
+      end
+
+      # @api private
+      # Enables the expect syntax (`expect(dbl).to receive`, `allow(dbl).to receive`, etc).
+      def self.enable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods)
+        return if expect_enabled?(syntax_host)
+
+        syntax_host.class_eval do
+          def receive(method_name, &block)
+            Matchers::Receive.new(method_name, block)
+          end
+
+          def allow(target)
+            AllowanceTarget.new(target)
+          end
+
+          def expect_any_instance_of(klass)
+            AnyInstanceExpectationTarget.new(klass)
+          end
+
+          def allow_any_instance_of(klass)
+            AnyInstanceAllowanceTarget.new(klass)
+          end
+        end
+
+        RSpec::Mocks::ExampleMethods::ExpectHost.class_eval do
+          def expect(target)
+            ExpectationTarget.new(target)
+          end
+        end
+      end
+
+      # @api private
+      # Disables the expect syntax (`expect(dbl).to receive`, `allow(dbl).to receive`, etc).
+      def self.disable_expect(syntax_host = ::RSpec::Mocks::ExampleMethods)
+        return unless expect_enabled?(syntax_host)
+
+        syntax_host.class_eval do
+          undef receive
+          undef allow
+          undef expect_any_instance_of
+          undef allow_any_instance_of
+        end
+
+        RSpec::Mocks::ExampleMethods::ExpectHost.class_eval do
+          undef expect
+        end
+      end
+
+      # @api private
+      # Indicates whether or not the should syntax is enabled.
+      def self.should_enabled?(syntax_host = default_should_syntax_host)
+        syntax_host.method_defined?(:should_receive)
+      end
+
+      # @api private
+      # Indicates whether or not the expect syntax is enabled.
+      def self.expect_enabled?(syntax_host = ::RSpec::Mocks::ExampleMethods)
+        syntax_host.method_defined?(:allow)
+      end
+
+      # @api private
+      # Determines where the methods like `should_receive`, and `stub` are added.
+      def self.default_should_syntax_host
+        # JRuby 1.7.4 introduces a regression whereby `defined?(::BasicObject) => nil`
+        # yet `BasicObject` still exists and patching onto ::Object breaks things
+        # e.g. SimpleDelegator expectations won't work
+        #
+        # See: https://github.com/jruby/jruby/issues/814
+        if defined?(JRUBY_VERSION) && JRUBY_VERSION == '1.7.4' && RUBY_VERSION.to_f > 1.8
+          return ::BasicObject
+        end
+
+        # On 1.8.7, Object.ancestors.last == Kernel but
+        # things blow up if we include `RSpec::Mocks::Methods`
+        # into Kernel...not sure why.
+        return Object unless defined?(::BasicObject)
+
+        # MacRuby has BasicObject but it's not the root class.
+        return Object unless Object.ancestors.last == ::BasicObject
+
+        ::BasicObject
+      end
+
+      # @method should_receive
+      # Sets an expectation that this object should receive a message before
+      # the end of the example.
+      #
+      # @example
+      #
+      #     logger = double('logger')
+      #     thing_that_logs = ThingThatLogs.new(logger)
+      #     logger.should_receive(:log)
+      #     thing_that_logs.do_something_that_logs_a_message
+      #
+      # @note This is only available when you have enabled the `should` syntax.
+
+      # @method should_not_receive
+      # Sets and expectation that this object should _not_ receive a message
+      # during this example.
+
+      # @method stub
+      # Tells the object to respond to the message with the specified value.
+      #
+      # @example
+      #
+      #     counter.stub(:count).and_return(37)
+      #     counter.stub(:count => 37)
+      #     counter.stub(:count) { 37 }
+      #
+      # @note This is only available when you have enabled the `should` syntax.
+
+      # @method unstub
+      # Removes a stub. On a double, the object will no longer respond to
+      # `message`. On a real object, the original method (if it exists) is
+      # restored.
+      #
+      # This is rarely used, but can be useful when a stub is set up during a
+      # shared `before` hook for the common case, but you want to replace it
+      # for a special case.
+      #
+      # @note This is only available when you have enabled the `should` syntax.
+
+      # @method stub_chain
+      # @overload stub_chain(method1, method2)
+      # @overload stub_chain("method1.method2")
+      # @overload stub_chain(method1, method_to_value_hash)
+      #
+      # Stubs a chain of methods.
+      #
+      # ## Warning:
+      #
+      # Chains can be arbitrarily long, which makes it quite painless to
+      # violate the Law of Demeter in violent ways, so you should consider any
+      # use of `stub_chain` a code smell. Even though not all code smells
+      # indicate real problems (think fluent interfaces), `stub_chain` still
+      # results in brittle examples.  For example, if you write
+      # `foo.stub_chain(:bar, :baz => 37)` in a spec and then the
+      # implementation calls `foo.baz.bar`, the stub will not work.
+      #
+      # @example
+      #
+      #     double.stub_chain("foo.bar") { :baz }
+      #     double.stub_chain(:foo, :bar => :baz)
+      #     double.stub_chain(:foo, :bar) { :baz }
+      #
+      #     # Given any of ^^ these three forms ^^:
+      #     double.foo.bar # => :baz
+      #
+      #     # Common use in Rails/ActiveRecord:
+      #     Article.stub_chain("recent.published") { [Article.new] }
+      #
+      # @note This is only available when you have enabled the `should` syntax.
+
+      # @method as_null_object
+      # Tells the object to respond to all messages. If specific stub values
+      # are declared, they'll work as expected. If not, the receiver is
+      # returned.
+      #
+      # @note This is only available when you have enabled the `should` syntax.
+
+      # @method null_object?
+      # Returns true if this object has received `as_null_object`
+      #
+      # @note This is only available when you have enabled the `should` syntax.
+
+      # @method any_instance
+      # Used to set stubs and message expectations on any instance of a given
+      # class. Returns a [Recorder](Recorder), which records messages like
+      # `stub` and `should_receive` for later playback on instances of the
+      # class.
+      #
+      # @example
+      #
+      #     Car.any_instance.should_receive(:go)
+      #     race = Race.new
+      #     race.cars << Car.new
+      #     race.go # assuming this delegates to all of its cars
+      #             # this example would pass
+      #
+      #     Account.any_instance.stub(:balance) { Money.new(:USD, 25) }
+      #     Account.new.balance # => Money.new(:USD, 25))
+      #
+      # @return [Recorder]
+      #
+      # @note This is only available when you have enabled the `should` syntax.
+
+      # @method expect
+      # Used to wrap an object in preparation for setting a mock expectation
+      # on it.
+      #
+      # @example
+      #
+      #   expect(obj).to receive(:foo).with(5).and_return(:return_value)
+      #
+      # @note This method is usually provided by rspec-expectations, unless
+      #   you are using rspec-mocks w/o rspec-expectations, in which case it
+      #   is only made available if you enable the `expect` syntax.
+
+      # @method allow
+      # Used to wrap an object in preparation for stubbing a method
+      # on it.
+      #
+      # @example
+      #
+      #   allow(dbl).to receive(:foo).with(5).and_return(:return_value)
+      #
+      # @note This is only available when you have enabled the `expect` syntax.
+
+      # @method expect_any_instance_of
+      # Used to wrap a class in preparation for setting a mock expectation
+      # on instances of it.
+      #
+      # @example
+      #
+      #   expect_any_instance_of(MyClass).to receive(:foo)
+      #
+      # @note This is only available when you have enabled the `expect` syntax.
+
+      # @method allow_any_instance_of
+      # Used to wrap a class in preparation for stubbing a method
+      # on instances of it.
+      #
+      # @example
+      #
+      #   allow_any_instance_of(MyClass).to receive(:foo)
+      #
+      # @note This is only available when you have enabled the `expect` syntax.
+
+      # @method receive
+      # Used to specify a message that you expect or allow an object
+      # to receive. The object returned by `receive` supports the same
+      # fluent interface that `should_receive` and `stub` have always
+      # supported, allowing you to constrain the arguments or number of
+      # times, and configure how the object should respond to the message.
+      #
+      # @example
+      #
+      #   expect(obj).to receive(:hello).with("world").exactly(3).times
+      #
+      # @note This is only available when you have enabled the `expect` syntax.
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/targets.rb b/rspec-mocks/lib/rspec/mocks/targets.rb
new file mode 100644
index 0000000..4430d01
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/targets.rb
@@ -0,0 +1,69 @@
+module RSpec
+  module Mocks
+    UnsupportedMatcherError  = Class.new(StandardError)
+    NegationUnsupportedError = Class.new(StandardError)
+
+    class TargetBase
+      def initialize(target)
+        @target = target
+      end
+
+      def self.delegate_to(matcher_method, options = {})
+        method_name = options.fetch(:from) { :to }
+        class_eval(<<-RUBY)
+        def #{method_name}(matcher, &block)
+          unless Matchers::Receive === matcher
+            raise UnsupportedMatcherError, "only the `receive` matcher is supported " +
+              "with `\#{expression}(...).\#{#{method_name.inspect}}`, but you have provided: \#{matcher}"
+          end
+
+          matcher.__send__(#{matcher_method.inspect}, @target, &block)
+        end
+        RUBY
+      end
+
+      def self.disallow_negation(method)
+        define_method method do |*args|
+          raise NegationUnsupportedError,
+            "`#{expression}(...).#{method} receive` is not supported since it " +
+            "doesn't really make sense. What would it even mean?"
+        end
+      end
+
+    private
+
+      def expression
+        self.class::EXPRESSION
+      end
+    end
+
+    class AllowanceTarget < TargetBase
+      EXPRESSION = :allow
+      delegate_to :setup_allowance
+      disallow_negation :not_to
+      disallow_negation :to_not
+    end
+
+    class ExpectationTarget < TargetBase
+      EXPRESSION = :expect
+      delegate_to :setup_expectation
+      delegate_to :setup_negative_expectation, :from => :not_to
+      delegate_to :setup_negative_expectation, :from => :to_not
+    end
+
+    class AnyInstanceAllowanceTarget < TargetBase
+      EXPRESSION = :expect_any_instance_of
+      delegate_to :setup_any_instance_allowance
+      disallow_negation :not_to
+      disallow_negation :to_not
+    end
+
+    class AnyInstanceExpectationTarget < TargetBase
+      EXPRESSION = :expect_any_instance_of
+      delegate_to :setup_any_instance_expectation
+      delegate_to :setup_any_instance_negative_expectation, :from => :not_to
+      delegate_to :setup_any_instance_negative_expectation, :from => :to_not
+    end
+  end
+end
+
diff --git a/rspec-mocks/lib/rspec/mocks/test_double.rb b/rspec-mocks/lib/rspec/mocks/test_double.rb
new file mode 100644
index 0000000..db111ae
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/test_double.rb
@@ -0,0 +1,135 @@
+module RSpec
+  module Mocks
+    # Implements the methods needed for a pure test double.  RSpec::Mocks::Mock
+    # includes this module, and it is provided for cases where you want a
+    # pure test double without subclassing RSpec::Mocks::Mock.
+    module TestDouble
+      # Extends the TestDouble module onto the given object and
+      # initializes it as a test double.
+      #
+      # @example
+      #
+      #   module = Module.new
+      #   RSpec::Mocks::TestDouble.extend_onto(module, "MyMixin", :foo => "bar")
+      #   module.foo  #=> "bar"
+      def self.extend_onto(object, name=nil, stubs_and_options={})
+        object.extend self
+        object.send(:__initialize_as_test_double, name, stubs_and_options)
+      end
+
+      # Creates a new test double with a `name` (that will be used in error
+      # messages only)
+      def initialize(name=nil, stubs_and_options={})
+        __initialize_as_test_double(name, stubs_and_options)
+      end
+
+      # Tells the object to respond to all messages. If specific stub values
+      # are declared, they'll work as expected. If not, the receiver is
+      # returned.
+      def as_null_object
+        @__null_object = true
+        __mock_proxy.as_null_object
+      end
+
+      # Returns true if this object has received `as_null_object`
+      def null_object?
+        @__null_object
+      end
+
+      # This allows for comparing the mock to other objects that proxy such as
+      # ActiveRecords belongs_to proxy objects. By making the other object run
+      # the comparison, we're sure the call gets delegated to the proxy
+      # target.
+      def ==(other)
+        other == __mock_proxy
+      end
+
+      # @private
+      def inspect
+        "#<#{self.class}:#{sprintf '0x%x', self.object_id} @name=#{@name.inspect}>"
+      end
+
+      # @private
+      def to_s
+        inspect.gsub('<','[').gsub('>',']')
+      end
+
+      alias_method :to_str, :to_s
+
+      # @private
+      def respond_to?(message, incl_private=false)
+        __mock_proxy.null_object? ? true : super
+      end
+
+      # @private
+      def __build_mock_proxy
+        proxy = Proxy.new(self, @name, @options || {})
+        proxy.as_null_object if null_object?
+        proxy
+      end
+
+    private
+
+      def __initialize_as_test_double(name=nil, stubs_and_options={})
+        @__null_object = false
+
+        if name.is_a?(Hash) && stubs_and_options.empty?
+          stubs_and_options = name
+          @name = nil
+        else
+          @name = name
+        end
+        @options = extract_options(stubs_and_options)
+        assign_stubs(stubs_and_options)
+      end
+
+      def method_missing(message, *args, &block)
+        if __mock_proxy.null_object?
+          case message
+          when :to_int        then return 0
+          when :to_a, :to_ary then return nil
+          end
+        end
+        __mock_proxy.record_message_received(message, *args, &block)
+
+        begin
+          __mock_proxy.null_object? ? self : super
+        rescue NameError
+          # Required wrapping doubles in an Array on Ruby 1.9.2
+          raise NoMethodError if [:to_a, :to_ary].include? message
+          __mock_proxy.raise_unexpected_message_error(message, *args)
+        end
+      end
+
+      def extract_options(stubs_and_options)
+        if stubs_and_options[:null_object]
+          @null_object = stubs_and_options.delete(:null_object)
+          RSpec.deprecate("double('name', :null_object => true)", :replacement => "double('name').as_null_object")
+        end
+        options = {}
+        extract_option(stubs_and_options, options, :__declared_as, 'Mock')
+        options
+      end
+
+      def extract_option(source, target, key, default=nil)
+        if source[key]
+          target[key] = source.delete(key)
+        elsif default
+          target[key] = default
+        end
+      end
+
+      def assign_stubs(stubs)
+        stubs.each_pair do |message, response|
+          Mocks.allow_message(self, message).and_return(response)
+        end
+      end
+
+    private
+
+      def __mock_proxy
+        ::RSpec::Mocks.proxy_for(self)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/lib/rspec/mocks/version.rb b/rspec-mocks/lib/rspec/mocks/version.rb
new file mode 100644
index 0000000..efeffa2
--- /dev/null
+++ b/rspec-mocks/lib/rspec/mocks/version.rb
@@ -0,0 +1,7 @@
+module RSpec
+  module Mocks
+    module Version
+      STRING = '2.14.3'
+    end
+  end
+end
diff --git a/rspec-mocks/lib/spec/mocks.rb b/rspec-mocks/lib/spec/mocks.rb
new file mode 100644
index 0000000..a6ca01e
--- /dev/null
+++ b/rspec-mocks/lib/spec/mocks.rb
@@ -0,0 +1,4 @@
+# For backward compatibility with rspec-1
+require 'rspec/mocks'
+
+RSpec.deprecate "require 'spec/mocks'", :replacement => "require 'rspec/mocks'"
diff --git a/rspec-mocks/metadata.yml b/rspec-mocks/metadata.yml
new file mode 100644
index 0000000..8706671
--- /dev/null
+++ b/rspec-mocks/metadata.yml
@@ -0,0 +1,328 @@
+--- !ruby/object:Gem::Specification
+name: rspec-mocks
+version: !ruby/object:Gem::Version
+  prerelease: 
+  version: 2.14.3
+platform: ruby
+authors:
+- Steven Baker
+- David Chelimsky
+autorequire: 
+bindir: bin
+cert_chain: []
+date: 2013-08-09 00:00:00.000000000 Z
+dependencies:
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 10.0.0
+    none: false
+  prerelease: false
+  name: rake
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 10.0.0
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.1.9
+    none: false
+  prerelease: false
+  name: cucumber
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: 1.1.9
+    none: false
+  type: :development
+- !ruby/object:Gem::Dependency
+  version_requirements: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '0.5'
+    none: false
+  prerelease: false
+  name: aruba
+  requirement: !ruby/object:Gem::Requirement
+    requirements:
+    - - ~>
+      - !ruby/object:Gem::Version
+        version: '0.5'
+    none: false
+  type: :development
+description: RSpec's 'test double' framework, with support for stubbing and mocking
+email: rspec-users at rubyforge.org
+executables: []
+extensions: []
+extra_rdoc_files: []
+files:
+- lib/rspec/mocks.rb
+- lib/rspec/mocks/any_instance/chain.rb
+- lib/rspec/mocks/any_instance/expectation_chain.rb
+- lib/rspec/mocks/any_instance/message_chains.rb
+- lib/rspec/mocks/any_instance/recorder.rb
+- lib/rspec/mocks/any_instance/stub_chain.rb
+- lib/rspec/mocks/any_instance/stub_chain_chain.rb
+- lib/rspec/mocks/argument_list_matcher.rb
+- lib/rspec/mocks/argument_matchers.rb
+- lib/rspec/mocks/configuration.rb
+- lib/rspec/mocks/deprecation.rb
+- lib/rspec/mocks/error_generator.rb
+- lib/rspec/mocks/errors.rb
+- lib/rspec/mocks/example_methods.rb
+- lib/rspec/mocks/extensions/instance_exec.rb
+- lib/rspec/mocks/extensions/marshal.rb
+- lib/rspec/mocks/framework.rb
+- lib/rspec/mocks/instance_method_stasher.rb
+- lib/rspec/mocks/matchers/have_received.rb
+- lib/rspec/mocks/matchers/receive.rb
+- lib/rspec/mocks/message_expectation.rb
+- lib/rspec/mocks/method_double.rb
+- lib/rspec/mocks/mock.rb
+- lib/rspec/mocks/mutate_const.rb
+- lib/rspec/mocks/order_group.rb
+- lib/rspec/mocks/proxy.rb
+- lib/rspec/mocks/proxy_for_nil.rb
+- lib/rspec/mocks/space.rb
+- lib/rspec/mocks/standalone.rb
+- lib/rspec/mocks/stub_chain.rb
+- lib/rspec/mocks/syntax.rb
+- lib/rspec/mocks/targets.rb
+- lib/rspec/mocks/test_double.rb
+- lib/rspec/mocks/version.rb
+- lib/spec/mocks.rb
+- README.md
+- License.txt
+- Changelog.md
+- .yardopts
+- .document
+- features/README.md
+- features/Scope.md
+- features/Upgrade.md
+- features/argument_matchers/README.md
+- features/argument_matchers/explicit.feature
+- features/argument_matchers/general_matchers.feature
+- features/argument_matchers/type_matchers.feature
+- features/message_expectations/README.md
+- features/message_expectations/allow_any_instance_of.feature
+- features/message_expectations/any_instance.feature
+- features/message_expectations/block_local_expectations.feature.pending
+- features/message_expectations/call_original.feature
+- features/message_expectations/expect_any_instance_of.feature
+- features/message_expectations/expect_message_using_expect.feature
+- features/message_expectations/expect_message_using_should_receive.feature
+- features/message_expectations/receive_counts.feature
+- features/message_expectations/warn_when_expectation_is_set_on_nil.feature
+- features/method_stubs/README.md
+- features/method_stubs/any_instance.feature
+- features/method_stubs/as_null_object.feature
+- features/method_stubs/simple_return_value_with_allow.feature
+- features/method_stubs/simple_return_value_with_stub.feature
+- features/method_stubs/stub_chain.feature
+- features/method_stubs/stub_implementation.feature
+- features/method_stubs/to_ary.feature
+- features/mutating_constants/README.md
+- features/mutating_constants/hiding_defined_constant.feature
+- features/mutating_constants/stub_defined_constant.feature
+- features/mutating_constants/stub_undefined_constant.feature
+- features/outside_rspec/configuration.feature
+- features/outside_rspec/standalone.feature
+- features/spies/spy_partial_mock_method.feature
+- features/spies/spy_pure_mock_method.feature
+- features/spies/spy_unstubbed_method.feature
+- features/step_definitions/additional_cli_steps.rb
+- features/support/env.rb
+- features/support/rubinius.rb
+- features/test_frameworks/test_unit.feature
+- spec/rspec/mocks/and_call_original_spec.rb
+- spec/rspec/mocks/and_yield_spec.rb
+- spec/rspec/mocks/any_instance/message_chains_spec.rb
+- spec/rspec/mocks/any_instance_spec.rb
+- spec/rspec/mocks/any_number_of_times_spec.rb
+- spec/rspec/mocks/argument_expectation_spec.rb
+- spec/rspec/mocks/at_least_spec.rb
+- spec/rspec/mocks/at_most_spec.rb
+- spec/rspec/mocks/block_return_value_spec.rb
+- spec/rspec/mocks/bug_report_10260_spec.rb
+- spec/rspec/mocks/bug_report_10263_spec.rb
+- spec/rspec/mocks/bug_report_11545_spec.rb
+- spec/rspec/mocks/bug_report_496_spec.rb
+- spec/rspec/mocks/bug_report_600_spec.rb
+- spec/rspec/mocks/bug_report_7611_spec.rb
+- spec/rspec/mocks/bug_report_8165_spec.rb
+- spec/rspec/mocks/bug_report_830_spec.rb
+- spec/rspec/mocks/bug_report_957_spec.rb
+- spec/rspec/mocks/combining_implementation_instructions_spec.rb
+- spec/rspec/mocks/configuration_spec.rb
+- spec/rspec/mocks/double_spec.rb
+- spec/rspec/mocks/extensions/marshal_spec.rb
+- spec/rspec/mocks/failing_argument_matchers_spec.rb
+- spec/rspec/mocks/hash_excluding_matcher_spec.rb
+- spec/rspec/mocks/hash_including_matcher_spec.rb
+- spec/rspec/mocks/instance_method_stasher_spec.rb
+- spec/rspec/mocks/matchers/have_received_spec.rb
+- spec/rspec/mocks/matchers/receive_spec.rb
+- spec/rspec/mocks/methods_spec.rb
+- spec/rspec/mocks/mock_ordering_spec.rb
+- spec/rspec/mocks/mock_space_spec.rb
+- spec/rspec/mocks/mock_spec.rb
+- spec/rspec/mocks/multiple_return_value_spec.rb
+- spec/rspec/mocks/mutate_const_spec.rb
+- spec/rspec/mocks/nil_expectation_warning_spec.rb
+- spec/rspec/mocks/null_object_mock_spec.rb
+- spec/rspec/mocks/once_counts_spec.rb
+- spec/rspec/mocks/options_hash_spec.rb
+- spec/rspec/mocks/partial_mock_spec.rb
+- spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb
+- spec/rspec/mocks/passing_argument_matchers_spec.rb
+- spec/rspec/mocks/precise_counts_spec.rb
+- spec/rspec/mocks/record_messages_spec.rb
+- spec/rspec/mocks/serialization_spec.rb
+- spec/rspec/mocks/stash_spec.rb
+- spec/rspec/mocks/stub_chain_spec.rb
+- spec/rspec/mocks/stub_implementation_spec.rb
+- spec/rspec/mocks/stub_spec.rb
+- spec/rspec/mocks/stubbed_message_expectations_spec.rb
+- spec/rspec/mocks/syntax_agnostic_message_matchers_spec.rb
+- spec/rspec/mocks/test_double_spec.rb
+- spec/rspec/mocks/to_ary_spec.rb
+- spec/rspec/mocks/twice_counts_spec.rb
+- spec/rspec/mocks_spec.rb
+- spec/spec_helper.rb
+homepage: http://github.com/rspec/rspec-mocks
+licenses:
+- MIT
+post_install_message: 
+rdoc_options:
+- --charset=UTF-8
+require_paths:
+- lib
+required_ruby_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+      segments:
+      - 0
+      hash: -4603029701728341322
+  none: false
+required_rubygems_version: !ruby/object:Gem::Requirement
+  requirements:
+  - - ! '>='
+    - !ruby/object:Gem::Version
+      version: '0'
+      segments:
+      - 0
+      hash: -4603029701728341322
+  none: false
+requirements: []
+rubyforge_project: rspec
+rubygems_version: 1.8.24
+signing_key: 
+specification_version: 3
+summary: rspec-mocks-2.14.3
+test_files:
+- features/README.md
+- features/Scope.md
+- features/Upgrade.md
+- features/argument_matchers/README.md
+- features/argument_matchers/explicit.feature
+- features/argument_matchers/general_matchers.feature
+- features/argument_matchers/type_matchers.feature
+- features/message_expectations/README.md
+- features/message_expectations/allow_any_instance_of.feature
+- features/message_expectations/any_instance.feature
+- features/message_expectations/block_local_expectations.feature.pending
+- features/message_expectations/call_original.feature
+- features/message_expectations/expect_any_instance_of.feature
+- features/message_expectations/expect_message_using_expect.feature
+- features/message_expectations/expect_message_using_should_receive.feature
+- features/message_expectations/receive_counts.feature
+- features/message_expectations/warn_when_expectation_is_set_on_nil.feature
+- features/method_stubs/README.md
+- features/method_stubs/any_instance.feature
+- features/method_stubs/as_null_object.feature
+- features/method_stubs/simple_return_value_with_allow.feature
+- features/method_stubs/simple_return_value_with_stub.feature
+- features/method_stubs/stub_chain.feature
+- features/method_stubs/stub_implementation.feature
+- features/method_stubs/to_ary.feature
+- features/mutating_constants/README.md
+- features/mutating_constants/hiding_defined_constant.feature
+- features/mutating_constants/stub_defined_constant.feature
+- features/mutating_constants/stub_undefined_constant.feature
+- features/outside_rspec/configuration.feature
+- features/outside_rspec/standalone.feature
+- features/spies/spy_partial_mock_method.feature
+- features/spies/spy_pure_mock_method.feature
+- features/spies/spy_unstubbed_method.feature
+- features/step_definitions/additional_cli_steps.rb
+- features/support/env.rb
+- features/support/rubinius.rb
+- features/test_frameworks/test_unit.feature
+- spec/rspec/mocks/and_call_original_spec.rb
+- spec/rspec/mocks/and_yield_spec.rb
+- spec/rspec/mocks/any_instance/message_chains_spec.rb
+- spec/rspec/mocks/any_instance_spec.rb
+- spec/rspec/mocks/any_number_of_times_spec.rb
+- spec/rspec/mocks/argument_expectation_spec.rb
+- spec/rspec/mocks/at_least_spec.rb
+- spec/rspec/mocks/at_most_spec.rb
+- spec/rspec/mocks/block_return_value_spec.rb
+- spec/rspec/mocks/bug_report_10260_spec.rb
+- spec/rspec/mocks/bug_report_10263_spec.rb
+- spec/rspec/mocks/bug_report_11545_spec.rb
+- spec/rspec/mocks/bug_report_496_spec.rb
+- spec/rspec/mocks/bug_report_600_spec.rb
+- spec/rspec/mocks/bug_report_7611_spec.rb
+- spec/rspec/mocks/bug_report_8165_spec.rb
+- spec/rspec/mocks/bug_report_830_spec.rb
+- spec/rspec/mocks/bug_report_957_spec.rb
+- spec/rspec/mocks/combining_implementation_instructions_spec.rb
+- spec/rspec/mocks/configuration_spec.rb
+- spec/rspec/mocks/double_spec.rb
+- spec/rspec/mocks/extensions/marshal_spec.rb
+- spec/rspec/mocks/failing_argument_matchers_spec.rb
+- spec/rspec/mocks/hash_excluding_matcher_spec.rb
+- spec/rspec/mocks/hash_including_matcher_spec.rb
+- spec/rspec/mocks/instance_method_stasher_spec.rb
+- spec/rspec/mocks/matchers/have_received_spec.rb
+- spec/rspec/mocks/matchers/receive_spec.rb
+- spec/rspec/mocks/methods_spec.rb
+- spec/rspec/mocks/mock_ordering_spec.rb
+- spec/rspec/mocks/mock_space_spec.rb
+- spec/rspec/mocks/mock_spec.rb
+- spec/rspec/mocks/multiple_return_value_spec.rb
+- spec/rspec/mocks/mutate_const_spec.rb
+- spec/rspec/mocks/nil_expectation_warning_spec.rb
+- spec/rspec/mocks/null_object_mock_spec.rb
+- spec/rspec/mocks/once_counts_spec.rb
+- spec/rspec/mocks/options_hash_spec.rb
+- spec/rspec/mocks/partial_mock_spec.rb
+- spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb
+- spec/rspec/mocks/passing_argument_matchers_spec.rb
+- spec/rspec/mocks/precise_counts_spec.rb
+- spec/rspec/mocks/record_messages_spec.rb
+- spec/rspec/mocks/serialization_spec.rb
+- spec/rspec/mocks/stash_spec.rb
+- spec/rspec/mocks/stub_chain_spec.rb
+- spec/rspec/mocks/stub_implementation_spec.rb
+- spec/rspec/mocks/stub_spec.rb
+- spec/rspec/mocks/stubbed_message_expectations_spec.rb
+- spec/rspec/mocks/syntax_agnostic_message_matchers_spec.rb
+- spec/rspec/mocks/test_double_spec.rb
+- spec/rspec/mocks/to_ary_spec.rb
+- spec/rspec/mocks/twice_counts_spec.rb
+- spec/rspec/mocks_spec.rb
+- spec/spec_helper.rb
+has_rdoc: 
diff --git a/rspec-mocks/spec/rspec/mocks/and_call_original_spec.rb b/rspec-mocks/spec/rspec/mocks/and_call_original_spec.rb
new file mode 100644
index 0000000..3cd07f0
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/and_call_original_spec.rb
@@ -0,0 +1,243 @@
+require 'spec_helper'
+require 'delegate'
+
+describe "and_call_original" do
+  context "on a partial mock object" do
+    let(:klass) do
+      Class.new do
+        def meth_1
+          :original
+        end
+
+        def meth_2(x)
+          yield x, :additional_yielded_arg
+        end
+
+        def self.new_instance
+          new
+        end
+      end
+    end
+
+    let(:instance) { klass.new }
+
+    it 'passes the received message through to the original method' do
+      instance.should_receive(:meth_1).and_call_original
+      expect(instance.meth_1).to eq(:original)
+    end
+
+    it 'passes args and blocks through to the original method' do
+      instance.should_receive(:meth_2).and_call_original
+      value = instance.meth_2(:submitted_arg) { |a, b| [a, b] }
+      expect(value).to eq([:submitted_arg, :additional_yielded_arg])
+    end
+
+    it 'errors when you pass through the wrong number of args' do
+      instance.stub(:meth_1).and_call_original
+      instance.stub(:meth_2).and_call_original
+      expect { instance.meth_1 :a }.to raise_error ArgumentError
+      expect { instance.meth_2 {} }.to raise_error ArgumentError
+      expect { instance.meth_2(:a, :b) {}  }.to raise_error ArgumentError
+    end
+
+    context "for singleton methods" do
+      it 'works' do
+        def instance.foo; :bar; end
+        instance.should_receive(:foo).and_call_original
+        expect(instance.foo).to eq(:bar)
+      end
+
+      it 'works for SimpleDelegator subclasses', :if => (RUBY_VERSION.to_f > 1.8) do
+        instance = Class.new(SimpleDelegator).new(1)
+        def instance.foo; :bar; end
+        instance.should_receive(:foo).and_call_original
+        expect(instance.foo).to eq(:bar)
+      end
+    end
+
+    it 'works for methods added through an extended module' do
+      instance.extend Module.new { def foo; :bar; end }
+      instance.should_receive(:foo).and_call_original
+      expect(instance.foo).to eq(:bar)
+    end
+
+    it "works for method added through an extended module onto a class's ancestor" do
+      sub_sub_klass = Class.new(Class.new(klass))
+      klass.extend Module.new { def foo; :bar; end }
+      sub_sub_klass.should_receive(:foo).and_call_original
+      expect(sub_sub_klass.foo).to eq(:bar)
+    end
+
+    it "finds the method on the most direct ancestor even if the method " +
+       "is available on more distant ancestors" do
+      klass.extend Module.new { def foo; :klass_bar; end }
+      sub_klass = Class.new(klass)
+      sub_klass.extend Module.new { def foo; :sub_klass_bar; end }
+      sub_klass.should_receive(:foo).and_call_original
+      expect(sub_klass.foo).to eq(:sub_klass_bar)
+    end
+
+    context 'when using any_instance' do
+      it 'works for instance methods defined on the class' do
+        klass.any_instance.should_receive(:meth_1).and_call_original
+        expect(klass.new.meth_1).to eq(:original)
+      end
+
+      it 'works for instance methods defined on the superclass of the class' do
+        subclass = Class.new(klass)
+        subclass.any_instance.should_receive(:meth_1).and_call_original
+        expect(subclass.new.meth_1).to eq(:original)
+      end
+
+      it 'works when mocking the method on one class and calling the method on an instance of a subclass' do
+        klass.any_instance.should_receive(:meth_1).and_call_original
+        expect(Class.new(klass).new.meth_1).to eq(:original)
+      end
+    end
+
+    if RUBY_VERSION.to_f > 1.8
+      it 'works for class methods defined on a superclass' do
+        subclass = Class.new(klass)
+        subclass.should_receive(:new_instance).and_call_original
+        expect(subclass.new_instance).to be_a(subclass)
+      end
+
+      it 'works for class methods defined on a grandparent class' do
+        sub_subclass = Class.new(Class.new(klass))
+        sub_subclass.should_receive(:new_instance).and_call_original
+        expect(sub_subclass.new_instance).to be_a(sub_subclass)
+      end
+    else
+      it 'attempts to work for class methods defined on a superclass but ' +
+         'executes the method with `self` as the superclass' do
+        ::Kernel.stub(:warn)
+        subclass = Class.new(klass)
+        subclass.should_receive(:new_instance).and_call_original
+        expect(subclass.new_instance).to be_an_instance_of(klass)
+       end
+
+      it 'prints a warning to notify users that `self` will not be correct' do
+        subclass = Class.new(klass)
+        ::Kernel.should_receive(:warn).with(/may not work correctly/)
+        subclass.should_receive(:new_instance).and_call_original
+        subclass.new_instance
+      end
+    end
+
+    it 'works for class methods defined on the Class class' do
+      klass.should_receive(:new).and_call_original
+      expect(klass.new).to be_an_instance_of(klass)
+    end
+
+    it "works for instance methods defined on the object's class's superclass" do
+      subclass = Class.new(klass)
+      inst = subclass.new
+      inst.should_receive(:meth_1).and_call_original
+      expect(inst.meth_1).to eq(:original)
+    end
+
+    it 'works for aliased methods' do
+      klass = Class.new do
+        class << self
+          alias alternate_new new
+        end
+      end
+
+      klass.should_receive(:alternate_new).and_call_original
+      expect(klass.alternate_new).to be_an_instance_of(klass)
+    end
+
+    context 'on an object that defines method_missing' do
+      before do
+        klass.class_eval do
+          private
+
+          def method_missing(name, *args)
+            if name.to_s == "greet_jack"
+              "Hello, jack"
+            else
+              super
+            end
+          end
+        end
+      end
+
+      it 'works when the method_missing definition handles the message' do
+        instance.should_receive(:greet_jack).and_call_original
+        expect(instance.greet_jack).to eq("Hello, jack")
+      end
+
+      it 'works for an any_instance partial mock' do
+        klass.any_instance.should_receive(:greet_jack).and_call_original
+        expect(instance.greet_jack).to eq("Hello, jack")
+      end
+
+      it 'raises an error for an unhandled message for an any_instance partial mock' do
+        klass.any_instance.should_receive(:not_a_handled_message).and_call_original
+        expect {
+          instance.not_a_handled_message
+        }.to raise_error(NameError, /not_a_handled_message/)
+      end
+
+      it 'raises an error on invocation if method_missing does not handle the message' do
+        instance.should_receive(:not_a_handled_message).and_call_original
+
+        # Note: it should raise a NoMethodError (and usually does), but
+        # due to a weird rspec-expectations issue (see #183) it sometimes
+        # raises a `NameError` when a `be_xxx` predicate matcher has been
+        # recently used. `NameError` is the superclass of `NoMethodError`
+        # so this example will pass regardless.
+        # If/when we solve the rspec-expectations issue, this can (and should)
+        # be changed to `NoMethodError`.
+        expect {
+          instance.not_a_handled_message
+        }.to raise_error(NameError, /not_a_handled_message/)
+      end
+    end
+  end
+
+  context "on a partial mock object that overrides #method" do
+    let(:request_klass) do
+      Struct.new(:method, :url) do
+        def perform
+          :the_response
+        end
+
+        def self.method
+          :some_method
+        end
+      end
+    end
+
+    let(:request) { request_klass.new(:get, "http://foo.com/bar") }
+
+    it 'still works even though #method has been overriden' do
+      request.should_receive(:perform).and_call_original
+      expect(request.perform).to eq(:the_response)
+    end
+
+    it 'works for a singleton method' do
+      def request.perform
+        :a_response
+      end
+
+      request.should_receive(:perform).and_call_original
+      expect(request.perform).to eq(:a_response)
+    end
+  end
+
+  context "on a pure mock object" do
+    let(:instance) { double }
+
+    it 'raises an error even if the mock object responds to the message' do
+      expect(instance.to_s).to be_a(String)
+      mock_expectation = instance.should_receive(:to_s)
+      instance.to_s # to satisfy the expectation
+
+      expect {
+        mock_expectation.and_call_original
+      }.to raise_error(/and_call_original.*partial mock/i)
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/and_yield_spec.rb b/rspec-mocks/spec/rspec/mocks/and_yield_spec.rb
new file mode 100644
index 0000000..f061a4e
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/and_yield_spec.rb
@@ -0,0 +1,127 @@
+require 'spec_helper'
+
+describe RSpec::Mocks::Mock do
+
+  let(:obj) { double }
+
+  describe "#and_yield" do
+    context 'when the method double has been constrained by `with`' do
+      it 'uses the default stub if the provided args do not match' do
+        obj.stub(:foo) { 15 }
+        obj.stub(:foo).with(:yield).and_yield
+
+        # should_receive is required to trigger the bug:
+        # https://github.com/rspec/rspec-mocks/issues/127
+        obj.should_receive(:foo)
+
+        expect(obj.foo(:dont_yield)).to eq(15)
+      end
+    end
+
+    context "with eval context as block argument" do
+
+      it "evaluates the supplied block as it is read" do
+        evaluated = false
+        obj.stub(:method_that_accepts_a_block).and_yield do |eval_context|
+          evaluated = true
+        end
+        expect(evaluated).to be_true
+      end
+
+      it "passes an eval context object to the supplied block" do
+        obj.stub(:method_that_accepts_a_block).and_yield do |eval_context|
+          expect(eval_context).not_to be_nil
+        end
+      end
+
+      it "evaluates the block passed to the stubbed method in the context of the supplied eval context" do
+        expected_eval_context = nil
+        actual_eval_context = nil
+
+        obj.stub(:method_that_accepts_a_block).and_yield do |eval_context|
+          expected_eval_context = eval_context
+        end
+
+        obj.method_that_accepts_a_block do
+          actual_eval_context = self
+        end
+
+        expect(actual_eval_context).to equal(expected_eval_context)
+      end
+
+      context "and no yielded arguments" do
+
+        it "passes when expectations set on the eval context are met" do
+          configured_eval_context = nil
+          obj.stub(:method_that_accepts_a_block).and_yield do |eval_context|
+            configured_eval_context = eval_context
+            configured_eval_context.should_receive(:foo)
+          end
+
+          obj.method_that_accepts_a_block do
+            foo
+          end
+
+          verify configured_eval_context
+        end
+
+        it "fails when expectations set on the eval context are not met" do
+          configured_eval_context = nil
+          obj.stub(:method_that_accepts_a_block).and_yield do |eval_context|
+            configured_eval_context = eval_context
+            configured_eval_context.should_receive(:foo)
+          end
+
+          obj.method_that_accepts_a_block do
+            # foo is not called here
+          end
+
+          expect { verify configured_eval_context }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+
+      end
+
+      context "and yielded arguments" do
+
+        it "passes when expectations set on the eval context and yielded arguments are met" do
+          configured_eval_context = nil
+          yielded_arg = Object.new
+          obj.stub(:method_that_accepts_a_block).and_yield(yielded_arg) do |eval_context|
+            configured_eval_context = eval_context
+            configured_eval_context.should_receive(:foo)
+            yielded_arg.should_receive(:bar)
+          end
+
+          obj.method_that_accepts_a_block do |obj|
+            obj.bar
+            foo
+          end
+
+          verify configured_eval_context
+          verify yielded_arg
+        end
+
+        it "fails when expectations set on the eval context and yielded arguments are not met" do
+          configured_eval_context = nil
+          yielded_arg = Object.new
+          obj.stub(:method_that_accepts_a_block).and_yield(yielded_arg) do |eval_context|
+            configured_eval_context = eval_context
+            configured_eval_context.should_receive(:foo)
+            yielded_arg.should_receive(:bar)
+          end
+
+          obj.method_that_accepts_a_block do |obj|
+            # obj.bar is not called here
+            # foo is not called here
+          end
+
+          expect { verify configured_eval_context }.to raise_error(RSpec::Mocks::MockExpectationError)
+          expect { verify yielded_arg }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+
+      end
+
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/any_instance/message_chains_spec.rb b/rspec-mocks/spec/rspec/mocks/any_instance/message_chains_spec.rb
new file mode 100644
index 0000000..398d4db
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/any_instance/message_chains_spec.rb
@@ -0,0 +1,40 @@
+require 'spec_helper'
+
+describe RSpec::Mocks::AnyInstance::MessageChains do
+  let(:chains) { RSpec::Mocks::AnyInstance::MessageChains.new }
+  let(:stub_chain) { RSpec::Mocks::AnyInstance::StubChain.new }
+  let(:expectation_chain) { RSpec::Mocks::AnyInstance::PositiveExpectationChain.new }
+
+  it "knows if a method does not have an expectation set on it" do
+    chains.add(:method_name, stub_chain)
+    expect(chains.has_expectation?(:method_name)).to be_false
+  end
+
+  it "knows if a method has an expectation set on it" do
+    chains.add(:method_name, stub_chain)
+    chains.add(:method_name, expectation_chain)
+    expect(chains.has_expectation?(:method_name)).to be_true
+  end
+
+  it "can remove all stub chains" do
+    chains.add(:method_name, stub_chain)
+    chains.add(:method_name, expectation_chain)
+    chains.add(:method_name, RSpec::Mocks::AnyInstance::StubChain.new)
+
+    chains.remove_stub_chains_for!(:method_name)
+    expect(chains[:method_name]).to eq([expectation_chain])
+  end
+
+  context "creating stub chains" do
+    it "understands how to add a stub chain for a method" do
+      chains.add(:method_name, stub_chain)
+      expect(chains[:method_name]).to eq([stub_chain])
+    end
+
+    it "allows multiple stub chains for a method" do
+      chains.add(:method_name, stub_chain)
+      chains.add(:method_name, another_stub_chain = RSpec::Mocks::AnyInstance::StubChain.new)
+      expect(chains[:method_name]).to eq([stub_chain, another_stub_chain])
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/any_instance_spec.rb b/rspec-mocks/spec/rspec/mocks/any_instance_spec.rb
new file mode 100644
index 0000000..d476866
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/any_instance_spec.rb
@@ -0,0 +1,963 @@
+require 'spec_helper'
+require 'delegate'
+
+module RSpec
+  module Mocks
+    describe "#any_instance" do
+      class CustomErrorForAnyInstanceSpec < StandardError;end
+
+      let(:klass) do
+        Class.new do
+          def existing_method; :existing_method_return_value; end
+          def existing_method_with_arguments(arg_one, arg_two = nil); :existing_method_with_arguments_return_value; end
+          def another_existing_method; end
+          private
+          def private_method; :private_method_return_value; end
+        end
+      end
+      let(:existing_method_return_value){ :existing_method_return_value }
+
+      context "invocation order" do
+        context "#stub" do
+          it "raises an error if 'stub' follows 'with'" do
+            expect { klass.any_instance.with("1").stub(:foo) }.to raise_error(NoMethodError)
+          end
+
+          it "raises an error if 'with' follows 'and_return'" do
+            expect { klass.any_instance.stub(:foo).and_return(1).with("1") }.to raise_error(NoMethodError)
+          end
+
+          it "raises an error if 'with' follows 'and_raise'" do
+            expect { klass.any_instance.stub(:foo).and_raise(1).with("1") }.to raise_error(NoMethodError)
+          end
+
+          it "raises an error if 'with' follows 'and_yield'" do
+            expect { klass.any_instance.stub(:foo).and_yield(1).with("1") }.to raise_error(NoMethodError)
+          end
+        end
+
+        context "#stub_chain" do
+          it "raises an error if 'stub_chain' follows 'any_instance'" do
+            expect { klass.any_instance.and_return("1").stub_chain(:foo, :bar) }.to raise_error(NoMethodError)
+          end
+        end
+
+        context "#should_receive" do
+          it "raises an error if 'should_receive' follows 'with'" do
+            expect { klass.any_instance.with("1").should_receive(:foo) }.to raise_error(NoMethodError)
+          end
+
+          it "raises an error if 'with' follows 'and_return'" do
+            pending "see Github issue #42"
+            expect { klass.any_instance.should_receive(:foo).and_return(1).with("1") }.to raise_error(NoMethodError)
+          end
+
+          it "raises an error if 'with' follows 'and_raise'" do
+            pending "see Github issue #42"
+            expect { klass.any_instance.should_receive(:foo).and_raise(1).with("1") }.to raise_error(NoMethodError)
+          end
+        end
+      end
+
+      context "with #stub" do
+        it "does not suppress an exception when a method that doesn't exist is invoked" do
+          klass.any_instance.stub(:foo)
+          expect { klass.new.bar }.to raise_error(NoMethodError)
+        end
+
+        context 'multiple methods' do
+          it "allows multiple methods to be stubbed in a single invocation" do
+            klass.any_instance.stub(:foo => 'foo', :bar => 'bar')
+            instance = klass.new
+            expect(instance.foo).to eq('foo')
+            expect(instance.bar).to eq('bar')
+          end
+
+          it "adheres to the contract of multiple method stubbing withou any instance" do
+            expect(Object.new.stub(:foo => 'foo', :bar => 'bar')).to eq(:foo => 'foo', :bar => 'bar')
+            expect(klass.any_instance.stub(:foo => 'foo', :bar => 'bar')).to eq(:foo => 'foo', :bar => 'bar')
+          end
+
+          context "allows a chain of methods to be stubbed using #stub_chain" do
+            it "given symbols representing the methods" do
+              klass.any_instance.stub_chain(:one, :two, :three).and_return(:four)
+              expect(klass.new.one.two.three).to eq(:four)
+            end
+
+            it "given a hash as the last argument uses the value as the expected return value" do
+              klass.any_instance.stub_chain(:one, :two, :three => :four)
+              expect(klass.new.one.two.three).to eq(:four)
+            end
+
+            it "given a string of '.' separated method names representing the chain" do
+              klass.any_instance.stub_chain('one.two.three').and_return(:four)
+              expect(klass.new.one.two.three).to eq(:four)
+            end
+          end
+        end
+
+        context "behaves as 'every instance'" do
+          it "stubs every instance in the spec" do
+            klass.any_instance.stub(:foo).and_return(result = Object.new)
+            expect(klass.new.foo).to eq(result)
+            expect(klass.new.foo).to eq(result)
+          end
+
+          it "stubs instance created before any_instance was called" do
+            instance = klass.new
+            klass.any_instance.stub(:foo).and_return(result = Object.new)
+            expect(instance.foo).to eq(result)
+          end
+
+          it 'handles freeze and duplication correctly' do
+            String.any_instance.stub(:any_method)
+
+            foo = 'foo'.freeze
+            expect(foo.dup.concat 'bar').to eq 'foobar'
+          end
+        end
+
+        context "with argument matching" do
+          before do
+            klass.any_instance.stub(:foo).with(:param_one, :param_two).and_return(:result_one)
+            klass.any_instance.stub(:foo).with(:param_three, :param_four).and_return(:result_two)
+          end
+
+          it "returns the stubbed value when arguments match" do
+            instance = klass.new
+            expect(instance.foo(:param_one, :param_two)).to eq(:result_one)
+            expect(instance.foo(:param_three, :param_four)).to eq(:result_two)
+          end
+
+          it "fails the spec with an expectation error when the arguments do not match" do
+            expect do
+              klass.new.foo(:param_one, :param_three)
+            end.to(raise_error(RSpec::Mocks::MockExpectationError))
+          end
+        end
+
+        context "with multiple stubs" do
+          before do
+            klass.any_instance.stub(:foo).and_return(1)
+            klass.any_instance.stub(:bar).and_return(2)
+          end
+
+          it "stubs a method" do
+            instance = klass.new
+            expect(instance.foo).to eq(1)
+            expect(instance.bar).to eq(2)
+          end
+
+          it "returns the same value for calls on different instances" do
+            expect(klass.new.foo).to eq(klass.new.foo)
+            expect(klass.new.bar).to eq(klass.new.bar)
+          end
+        end
+
+        context "with #and_return" do
+          it "stubs a method that doesn't exist" do
+            klass.any_instance.stub(:foo).and_return(1)
+            expect(klass.new.foo).to eq(1)
+          end
+
+          it "stubs a method that exists" do
+            klass.any_instance.stub(:existing_method).and_return(1)
+            expect(klass.new.existing_method).to eq(1)
+          end
+
+          it "returns the same object for calls on different instances" do
+            return_value = Object.new
+            klass.any_instance.stub(:foo).and_return(return_value)
+            expect(klass.new.foo).to be(return_value)
+            expect(klass.new.foo).to be(return_value)
+          end
+        end
+
+        context "with #and_yield" do
+          it "yields the value specified" do
+            yielded_value = Object.new
+            klass.any_instance.stub(:foo).and_yield(yielded_value)
+            klass.new.foo{|value| expect(value).to be(yielded_value)}
+          end
+        end
+
+        context 'with #and_call_original and competing #with' do
+          let(:klass) { Struct.new(:a_method) }
+
+          it 'can combine and_call_original, with, and_return' do
+            allow_any_instance_of(klass).to receive(:a_method).and_call_original
+            allow_any_instance_of(klass).to receive(:a_method).with(:arg).and_return('value')
+
+            expect(klass.new('org').a_method).to eq 'org'
+            expect(klass.new.a_method(:arg)).to  eq 'value'
+          end
+
+          it 'can combine and_call_original, with, and_return (old syntax)' do
+            klass.any_instance.stub(:a_method).and_call_original
+            klass.any_instance.stub(:a_method).with(:arg).and_return('value')
+
+            expect(klass.new('org').a_method).to eq 'org'
+            expect(klass.new.a_method(:arg)).to  eq 'value'
+          end
+        end
+
+        context "with #and_raise" do
+          it "stubs a method that doesn't exist" do
+            klass.any_instance.stub(:foo).and_raise(CustomErrorForAnyInstanceSpec)
+            expect { klass.new.foo}.to raise_error(CustomErrorForAnyInstanceSpec)
+          end
+
+          it "stubs a method that exists" do
+            klass.any_instance.stub(:existing_method).and_raise(CustomErrorForAnyInstanceSpec)
+            expect { klass.new.existing_method}.to raise_error(CustomErrorForAnyInstanceSpec)
+          end
+        end
+
+        context "with a block" do
+          it "stubs a method" do
+            klass.any_instance.stub(:foo) { 1 }
+            expect(klass.new.foo).to eq(1)
+          end
+
+          it "returns the same computed value for calls on different instances" do
+            klass.any_instance.stub(:foo) { 1 + 2 }
+            expect(klass.new.foo).to eq(klass.new.foo)
+          end
+        end
+
+        context "core ruby objects" do
+          it "works uniformly across *everything*" do
+            Object.any_instance.stub(:foo).and_return(1)
+            expect(Object.new.foo).to eq(1)
+          end
+
+          it "works with the non-standard constructor []" do
+            Array.any_instance.stub(:foo).and_return(1)
+            expect([].foo).to eq(1)
+          end
+
+          it "works with the non-standard constructor {}" do
+            Hash.any_instance.stub(:foo).and_return(1)
+            expect({}.foo).to eq(1)
+          end
+
+          it "works with the non-standard constructor \"\"" do
+            String.any_instance.stub(:foo).and_return(1)
+            expect("".foo).to eq(1)
+          end
+
+          it "works with the non-standard constructor \'\'" do
+            String.any_instance.stub(:foo).and_return(1)
+            expect(''.foo).to eq(1)
+          end
+
+          it "works with the non-standard constructor module" do
+            Module.any_instance.stub(:foo).and_return(1)
+            module RSpec::SampleRspecTestModule;end
+            expect(RSpec::SampleRspecTestModule.foo).to eq(1)
+          end
+
+          it "works with the non-standard constructor class" do
+            Class.any_instance.stub(:foo).and_return(1)
+            class RSpec::SampleRspecTestClass;end
+            expect(RSpec::SampleRspecTestClass.foo).to eq(1)
+          end
+        end
+      end
+
+      context "with #stub!" do
+        it "raises with a message instructing the user to use stub instead" do
+          expect do
+            klass.any_instance.stub!(:foo)
+          end.to raise_error(/Use stub instead/)
+        end
+      end
+
+      context "with #unstub!" do
+        it "raises with a message instructing the user to use unstub instead" do
+          expect do
+            klass.any_instance.unstub!(:foo)
+          end.to raise_error(/Use unstub instead/)
+        end
+      end
+
+      context "unstub implementation" do
+        it "replaces the stubbed method with the original method" do
+          klass.any_instance.stub(:existing_method)
+          klass.any_instance.unstub(:existing_method)
+          expect(klass.new.existing_method).to eq(:existing_method_return_value)
+        end
+
+        it "removes all stubs with the supplied method name" do
+          klass.any_instance.stub(:existing_method).with(1)
+          klass.any_instance.stub(:existing_method).with(2)
+          klass.any_instance.unstub(:existing_method)
+          expect(klass.new.existing_method).to eq(:existing_method_return_value)
+        end
+
+        it "does not remove any expectations with the same method name" do
+          klass.any_instance.should_receive(:existing_method_with_arguments).with(3).and_return(:three)
+          klass.any_instance.stub(:existing_method_with_arguments).with(1)
+          klass.any_instance.stub(:existing_method_with_arguments).with(2)
+          klass.any_instance.unstub(:existing_method_with_arguments)
+          expect(klass.new.existing_method_with_arguments(3)).to eq(:three)
+        end
+
+        it "raises a MockExpectationError if the method has not been stubbed" do
+          expect {
+            klass.any_instance.unstub(:existing_method)
+          }.to raise_error(RSpec::Mocks::MockExpectationError, 'The method `existing_method` was not stubbed or was already unstubbed')
+        end
+      end
+
+      context "with #should_not_receive" do
+        it "fails if the method is called" do
+          klass.any_instance.should_not_receive(:existing_method)
+          expect { klass.new.existing_method }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+
+        it "passes if no method is called" do
+          expect { klass.any_instance.should_not_receive(:existing_method) }.to_not raise_error
+        end
+
+        it "passes if only a different method is called" do
+          klass.any_instance.should_not_receive(:existing_method)
+          expect { klass.new.another_existing_method }.to_not raise_error
+        end
+
+        context "with constraints" do
+          it "fails if the method is called with the specified parameters" do
+            klass.any_instance.should_not_receive(:existing_method_with_arguments).with(:argument_one, :argument_two)
+            expect {
+              klass.new.existing_method_with_arguments(:argument_one, :argument_two)
+            }.to raise_error(RSpec::Mocks::MockExpectationError)
+          end
+
+          it "passes if the method is called with different parameters" do
+            klass.any_instance.should_not_receive(:existing_method_with_arguments).with(:argument_one, :argument_two)
+            expect { klass.new.existing_method_with_arguments(:argument_three, :argument_four) }.to_not raise_error
+          end
+        end
+
+        context 'when used in combination with should_receive' do
+          it 'passes if only the expected message is received' do
+            klass.any_instance.should_receive(:foo)
+            klass.any_instance.should_not_receive(:bar)
+            klass.new.foo
+            RSpec::Mocks.space.verify_all
+          end
+        end
+
+        it "prevents confusing double-negative expressions involving `never`" do
+          expect {
+            klass.any_instance.should_not_receive(:not_expected).never
+          }.to raise_error(/trying to negate it again/)
+        end
+      end
+
+      context "with #should_receive" do
+        let(:foo_expectation_error_message) { 'Exactly one instance should have received the following message(s) but didn\'t: foo' }
+        let(:existing_method_expectation_error_message) { 'Exactly one instance should have received the following message(s) but didn\'t: existing_method' }
+
+        context "with an expectation is set on a method which does not exist" do
+          it "returns the expected value" do
+            klass.any_instance.should_receive(:foo).and_return(1)
+            expect(klass.new.foo(1)).to eq(1)
+          end
+
+          it "fails if an instance is created but no invocation occurs" do
+            expect do
+              klass.any_instance.should_receive(:foo)
+              klass.new
+              RSpec::Mocks.space.verify_all
+            end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
+          end
+
+          it "fails if no instance is created" do
+            expect do
+              klass.any_instance.should_receive(:foo).and_return(1)
+              RSpec::Mocks.space.verify_all
+            end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
+          end
+
+          it "fails if no instance is created and there are multiple expectations" do
+            expect do
+              klass.any_instance.should_receive(:foo)
+              klass.any_instance.should_receive(:bar)
+              RSpec::Mocks.space.verify_all
+            end.to raise_error(RSpec::Mocks::MockExpectationError, 'Exactly one instance should have received the following message(s) but didn\'t: bar, foo')
+          end
+
+          it "allows expectations on instances to take priority" do
+            klass.any_instance.should_receive(:foo)
+            klass.new.foo
+
+            instance = klass.new
+            instance.should_receive(:foo).and_return(result = Object.new)
+            expect(instance.foo).to eq(result)
+          end
+
+          context "behaves as 'exactly one instance'" do
+            it "passes if subsequent invocations do not receive that message" do
+              klass.any_instance.should_receive(:foo)
+              klass.new.foo
+              klass.new
+            end
+
+            it "fails if the method is invoked on a second instance" do
+              instance_one = klass.new
+              instance_two = klass.new
+              expect do
+                klass.any_instance.should_receive(:foo)
+
+                instance_one.foo
+                instance_two.foo
+              end.to raise_error(RSpec::Mocks::MockExpectationError, "The message 'foo' was received by #{instance_two.inspect} but has already been received by #{instance_one.inspect}")
+            end
+          end
+
+          context "normal expectations on the class object" do
+            it "fail when unfulfilled" do
+              expect do
+                klass.any_instance.should_receive(:foo)
+                klass.should_receive(:woot)
+                klass.new.foo
+                RSpec::Mocks.space.verify_all
+              end.to(raise_error(RSpec::Mocks::MockExpectationError) do |error|
+                expect(error.message).not_to eq(existing_method_expectation_error_message)
+              end)
+            end
+
+
+            it "pass when expectations are met" do
+              klass.any_instance.should_receive(:foo)
+              klass.should_receive(:woot).and_return(result = Object.new)
+              klass.new.foo
+              expect(klass.woot).to eq(result)
+            end
+          end
+        end
+
+        context "with an expectation is set on a method that exists" do
+          it "returns the expected value" do
+            klass.any_instance.should_receive(:existing_method).and_return(1)
+            expect(klass.new.existing_method(1)).to eq(1)
+          end
+
+          it "fails if an instance is created but no invocation occurs" do
+            expect do
+              klass.any_instance.should_receive(:existing_method)
+              klass.new
+              RSpec::Mocks.space.verify_all
+            end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
+          end
+
+          it "fails if no instance is created" do
+            expect do
+              klass.any_instance.should_receive(:existing_method)
+              RSpec::Mocks.space.verify_all
+            end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
+          end
+
+          it "fails if no instance is created and there are multiple expectations" do
+            expect do
+              klass.any_instance.should_receive(:existing_method)
+              klass.any_instance.should_receive(:another_existing_method)
+              RSpec::Mocks.space.verify_all
+            end.to raise_error(RSpec::Mocks::MockExpectationError, 'Exactly one instance should have received the following message(s) but didn\'t: another_existing_method, existing_method')
+          end
+
+          context "after any one instance has received a message" do
+            it "passes if subsequent invocations do not receive that message" do
+              klass.any_instance.should_receive(:existing_method)
+              klass.new.existing_method
+              klass.new
+            end
+
+            it "fails if the method is invoked on a second instance" do
+              instance_one = klass.new
+              instance_two = klass.new
+              expect do
+                klass.any_instance.should_receive(:existing_method)
+
+                instance_one.existing_method
+                instance_two.existing_method
+              end.to raise_error(RSpec::Mocks::MockExpectationError, "The message 'existing_method' was received by #{instance_two.inspect} but has already been received by #{instance_one.inspect}")
+            end
+          end
+        end
+
+        it 'works with a BasicObject subclass that mixes in Kernel', :if => defined?(BasicObject) do
+          klass = Class.new(BasicObject) do
+            include ::Kernel
+            def foo; end
+          end
+
+          klass.any_instance.should_receive(:foo)
+          klass.new.foo
+        end
+
+        it 'works with a SimpleDelegator subclass', :if => (RUBY_VERSION.to_f > 1.8) do
+          klass = Class.new(SimpleDelegator) do
+            def foo; end
+          end
+
+          klass.any_instance.should_receive(:foo)
+          klass.new(Object.new).foo
+        end
+
+        context "with argument matching" do
+          before do
+            klass.any_instance.should_receive(:foo).with(:param_one, :param_two).and_return(:result_one)
+            klass.any_instance.should_receive(:foo).with(:param_three, :param_four).and_return(:result_two)
+          end
+
+          it "returns the expected value when arguments match" do
+            instance = klass.new
+            expect(instance.foo(:param_one, :param_two)).to eq(:result_one)
+            expect(instance.foo(:param_three, :param_four)).to eq(:result_two)
+          end
+
+          it "fails when the arguments match but different instances are used" do
+            instances = Array.new(2) { klass.new }
+            expect do
+              expect(instances[0].foo(:param_one, :param_two)).to eq(:result_one)
+              expect(instances[1].foo(:param_three, :param_four)).to eq(:result_two)
+            end.to raise_error(RSpec::Mocks::MockExpectationError)
+
+            # ignore the fact that should_receive expectations were not met
+            instances.each { |instance| reset instance }
+          end
+
+          it "is not affected by the invocation of existing methods on other instances" do
+            expect(klass.new.existing_method_with_arguments(:param_one, :param_two)).to eq(:existing_method_with_arguments_return_value)
+            instance = klass.new
+            expect(instance.foo(:param_one, :param_two)).to eq(:result_one)
+            expect(instance.foo(:param_three, :param_four)).to eq(:result_two)
+          end
+
+          it "fails when arguments do not match" do
+            instance = klass.new
+            expect do
+              instance.foo(:param_one, :param_three)
+            end.to raise_error(RSpec::Mocks::MockExpectationError)
+
+            # ignore the fact that should_receive expectations were not met
+            reset instance
+          end
+        end
+
+        context "message count" do
+          context "the 'once' constraint" do
+            it "passes for one invocation" do
+              klass.any_instance.should_receive(:foo).once
+              klass.new.foo
+            end
+
+            it "fails when no instances are declared" do
+              expect do
+                klass.any_instance.should_receive(:foo).once
+                RSpec::Mocks.space.verify_all
+              end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
+            end
+
+            it "fails when an instance is declared but there are no invocations" do
+              expect do
+                klass.any_instance.should_receive(:foo).once
+                klass.new
+                RSpec::Mocks.space.verify_all
+              end.to raise_error(RSpec::Mocks::MockExpectationError, foo_expectation_error_message)
+            end
+
+            it "fails for more than one invocation" do
+              expect do
+                klass.any_instance.should_receive(:foo).once
+                instance = klass.new
+                2.times { instance.foo }
+                verify instance
+              end.to raise_error(RSpec::Mocks::MockExpectationError)
+            end
+          end
+
+          context "the 'twice' constraint" do
+            it "passes for two invocations" do
+              klass.any_instance.should_receive(:foo).twice
+              instance = klass.new
+              2.times { instance.foo }
+            end
+
+            it "fails for more than two invocations" do
+              expect do
+                klass.any_instance.should_receive(:foo).twice
+                instance = klass.new
+                3.times { instance.foo }
+                verify instance
+              end.to raise_error(RSpec::Mocks::MockExpectationError)
+            end
+          end
+
+          context "the 'exactly(n)' constraint" do
+            it "passes for n invocations where n = 3" do
+              klass.any_instance.should_receive(:foo).exactly(3).times
+              instance = klass.new
+              3.times { instance.foo }
+            end
+
+            it "fails for n invocations where n < 3" do
+              expect do
+                klass.any_instance.should_receive(:foo).exactly(3).times
+                instance = klass.new
+                2.times { instance.foo }
+                verify instance
+              end.to raise_error(RSpec::Mocks::MockExpectationError)
+            end
+
+            it "fails for n invocations where n > 3" do
+              expect do
+                klass.any_instance.should_receive(:foo).exactly(3).times
+                instance = klass.new
+                4.times { instance.foo }
+                verify instance
+              end.to raise_error(RSpec::Mocks::MockExpectationError)
+            end
+          end
+
+          context "the 'at_least(n)' constraint" do
+            it "passes for n invocations where n = 3" do
+              klass.any_instance.should_receive(:foo).at_least(3).times
+              instance = klass.new
+              3.times { instance.foo }
+            end
+
+            it "fails for n invocations where n < 3" do
+              expect do
+                klass.any_instance.should_receive(:foo).at_least(3).times
+                instance = klass.new
+                2.times { instance.foo }
+                verify instance
+              end.to raise_error(RSpec::Mocks::MockExpectationError)
+            end
+
+            it "passes for n invocations where n > 3" do
+              klass.any_instance.should_receive(:foo).at_least(3).times
+              instance = klass.new
+              4.times { instance.foo }
+            end
+          end
+
+          context "the 'at_most(n)' constraint" do
+            it "passes for n invocations where n = 3" do
+              klass.any_instance.should_receive(:foo).at_most(3).times
+              instance = klass.new
+              3.times { instance.foo }
+            end
+
+            it "passes for n invocations where n < 3" do
+              klass.any_instance.should_receive(:foo).at_most(3).times
+              instance = klass.new
+              2.times { instance.foo }
+            end
+
+            it "fails for n invocations where n > 3" do
+              expect do
+                klass.any_instance.should_receive(:foo).at_most(3).times
+                instance = klass.new
+                4.times { instance.foo }
+                verify instance
+              end.to raise_error(RSpec::Mocks::MockExpectationError)
+            end
+          end
+
+          context "the 'never' constraint" do
+            it "passes for 0 invocations" do
+              klass.any_instance.should_receive(:foo).never
+              RSpec::Mocks.space.verify_all
+            end
+
+            it "fails on the first invocation" do
+              expect do
+                klass.any_instance.should_receive(:foo).never
+                klass.new.foo
+              end.to raise_error(RSpec::Mocks::MockExpectationError)
+            end
+
+            context "when combined with other expectations" do
+              it "passes when the other expecations are met" do
+                klass.any_instance.should_receive(:foo).never
+                klass.any_instance.should_receive(:existing_method).and_return(5)
+                expect(klass.new.existing_method).to eq(5)
+              end
+
+              it "fails when the other expecations are not met" do
+                expect do
+                  klass.any_instance.should_receive(:foo).never
+                  klass.any_instance.should_receive(:existing_method).and_return(5)
+                  RSpec::Mocks.space.verify_all
+                end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
+              end
+            end
+          end
+
+          context "the 'any_number_of_times' constraint" do
+            it "passes for 0 invocations" do
+              klass.any_instance.should_receive(:foo).any_number_of_times
+              verify klass.new
+            end
+
+            it "passes for a non-zero number of invocations" do
+              allow(RSpec).to receive(:deprecate).with("any_number_of_times", :replacement => "stub")
+
+              klass.any_instance.should_receive(:foo).any_number_of_times
+              instance = klass.new
+              instance.foo
+              verify instance
+            end
+
+            it "does not interfere with other expectations" do
+              klass.any_instance.should_receive(:foo).any_number_of_times
+              klass.any_instance.should_receive(:existing_method).and_return(5)
+              expect(klass.new.existing_method).to eq(5)
+            end
+
+            context "when combined with other expectations" do
+              it "passes when the other expecations are met" do
+                klass.any_instance.should_receive(:foo).any_number_of_times
+                klass.any_instance.should_receive(:existing_method).and_return(5)
+                expect(klass.new.existing_method).to eq(5)
+              end
+
+              it "fails when the other expecations are not met" do
+                expect do
+                  klass.any_instance.should_receive(:foo).any_number_of_times
+                  klass.any_instance.should_receive(:existing_method).and_return(5)
+                  RSpec::Mocks.space.verify_all
+                end.to raise_error(RSpec::Mocks::MockExpectationError, existing_method_expectation_error_message)
+              end
+            end
+          end
+        end
+      end
+
+      context "when resetting post-verification" do
+        let(:space) { RSpec::Mocks.space }
+
+        context "existing method" do
+          before(:each) do
+            klass.any_instance # to force it to be tracked
+          end
+
+          context "with stubbing" do
+            context "public methods" do
+              before(:each) do
+                klass.any_instance.stub(:existing_method).and_return(1)
+                expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_true
+              end
+
+              it "restores the class to its original state after each example when no instance is created" do
+                space.verify_all
+
+                expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
+                expect(klass.new.existing_method).to eq(existing_method_return_value)
+              end
+
+              it "restores the class to its original state after each example when one instance is created" do
+                klass.new.existing_method
+
+                space.verify_all
+
+                expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
+                expect(klass.new.existing_method).to eq(existing_method_return_value)
+              end
+
+              it "restores the class to its original state after each example when more than one instance is created" do
+                klass.new.existing_method
+                klass.new.existing_method
+
+                space.verify_all
+
+                expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
+                expect(klass.new.existing_method).to eq(existing_method_return_value)
+              end
+            end
+
+            context "private methods" do
+              before :each do
+                klass.any_instance.stub(:private_method).and_return(:something)
+                space.verify_all
+              end
+
+              it "cleans up the backed up method" do
+                expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
+              end
+
+              it "restores a stubbed private method after the spec is run" do
+                expect(klass.private_method_defined?(:private_method)).to be_true
+              end
+
+              it "ensures that the restored method behaves as it originally did" do
+                expect(klass.new.send(:private_method)).to eq(:private_method_return_value)
+              end
+            end
+          end
+
+          context "with expectations" do
+            context "private methods" do
+              before :each do
+                klass.any_instance.should_receive(:private_method).and_return(:something)
+                klass.new.private_method
+                space.verify_all
+              end
+
+              it "cleans up the backed up method" do
+                expect(klass.method_defined?(:__existing_method_without_any_instance__)).to be_false
+              end
+
+              it "restores a stubbed private method after the spec is run" do
+                expect(klass.private_method_defined?(:private_method)).to be_true
+              end
+
+              it "ensures that the restored method behaves as it originally did" do
+                expect(klass.new.send(:private_method)).to eq(:private_method_return_value)
+              end
+            end
+
+            context "ensures that the subsequent specs do not see expectations set in previous specs" do
+              context "when the instance created after the expectation is set" do
+                it "first spec" do
+                  klass.any_instance.should_receive(:existing_method).and_return(Object.new)
+                  klass.new.existing_method
+                end
+
+                it "second spec" do
+                  expect(klass.new.existing_method).to eq(existing_method_return_value)
+                end
+              end
+
+              context "when the instance created before the expectation is set" do
+                before :each do
+                  @instance = klass.new
+                end
+
+                it "first spec" do
+                  klass.any_instance.should_receive(:existing_method).and_return(Object.new)
+                  @instance.existing_method
+                end
+
+                it "second spec" do
+                  expect(@instance.existing_method).to eq(existing_method_return_value)
+                end
+              end
+            end
+
+            it "ensures that the next spec does not see that expectation" do
+              klass.any_instance.should_receive(:existing_method).and_return(Object.new)
+              klass.new.existing_method
+              space.verify_all
+
+              expect(klass.new.existing_method).to eq(existing_method_return_value)
+            end
+          end
+        end
+
+        context "with multiple calls to any_instance in the same example" do
+          it "does not prevent the change from being rolled back" do
+            klass.any_instance.stub(:existing_method).and_return(false)
+            klass.any_instance.stub(:existing_method).and_return(true)
+
+            RSpec::Mocks.space.verify_all
+            expect(klass.new).to respond_to(:existing_method)
+            expect(klass.new.existing_method).to eq(existing_method_return_value)
+          end
+        end
+
+        it "adds an class to the current space when #any_instance is invoked" do
+          expect {
+            klass.any_instance
+          }.to change { space.any_instance_recorders.size }.by(1)
+        end
+
+        it "adds an instance to the current space when stubbed method is invoked" do
+          klass.any_instance.stub(:foo)
+          instance = klass.new
+          instance.foo
+          expect(RSpec::Mocks.space.proxies.keys).to include(instance.object_id)
+        end
+      end
+
+      context 'when used in conjunction with a `dup`' do
+        it "doesn't cause an infinite loop" do
+          pending "This intermittently fails on JRuby" if RUBY_PLATFORM == 'java'
+
+          Object.any_instance.stub(:some_method)
+          o = Object.new
+          o.some_method
+          expect { o.dup.some_method }.to_not raise_error
+        end
+
+        it "doesn't bomb if the object doesn't support `dup`" do
+          klass = Class.new do
+            undef_method :dup
+          end
+          klass.any_instance
+        end
+
+        it "doesn't fail when dup accepts parameters" do
+          klass = Class.new do
+            def dup(funky_option)
+            end
+          end
+
+          klass.any_instance
+
+          expect { klass.new.dup('Dup dup dup') }.to_not raise_error
+        end
+      end
+
+      context "when directed at a method defined on a superclass" do
+        let(:sub_klass) { Class.new(klass) }
+
+        it "stubs the method correctly" do
+          klass.any_instance.stub(:existing_method).and_return("foo")
+          expect(sub_klass.new.existing_method).to eq "foo"
+        end
+
+        it "mocks the method correctly" do
+          instance_one = sub_klass.new
+          instance_two = sub_klass.new
+          expect do
+            klass.any_instance.should_receive(:existing_method)
+            instance_one.existing_method
+            instance_two.existing_method
+          end.to raise_error(RSpec::Mocks::MockExpectationError, "The message 'existing_method' was received by #{instance_two.inspect} but has already been received by #{instance_one.inspect}")
+        end
+      end
+
+      context "when a class overrides Object#method" do
+        let(:http_request_class) { Struct.new(:method, :uri) }
+
+        it "stubs the method correctly" do
+          http_request_class.any_instance.stub(:existing_method).and_return("foo")
+          expect(http_request_class.new.existing_method).to eq "foo"
+        end
+
+        it "mocks the method correctly" do
+          http_request_class.any_instance.should_receive(:existing_method).and_return("foo")
+          expect(http_request_class.new.existing_method).to eq "foo"
+        end
+      end
+
+      context "when used after the test has finished" do
+        it "restores the original behavior of a stubbed method" do
+          klass.any_instance.stub(:existing_method).and_return(:stubbed_return_value)
+
+          instance = klass.new
+          expect(instance.existing_method).to eq :stubbed_return_value
+
+          RSpec::Mocks.verify
+
+          expect(instance.existing_method).to eq :existing_method_return_value
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/any_number_of_times_spec.rb b/rspec-mocks/spec/rspec/mocks/any_number_of_times_spec.rb
new file mode 100644
index 0000000..5b0745f
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/any_number_of_times_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+describe "AnyNumberOfTimes" do
+  before(:each) do
+    @mock = RSpec::Mocks::Mock.new("test mock")
+    allow(RSpec).to receive(:deprecate)
+  end
+
+  it "is deprecated" do
+    expect(RSpec).to receive(:deprecate).with("any_number_of_times", :replacement => "stub")
+    expect(@mock).to receive(:random_call).any_number_of_times
+  end
+
+  it "passes if any number of times method is called many times" do
+    @mock.should_receive(:random_call).any_number_of_times
+    (1..10).each do
+      @mock.random_call
+    end
+  end
+
+  it "passes if any number of times method is called once" do
+    @mock.should_receive(:random_call).any_number_of_times
+    @mock.random_call
+  end
+
+  it "passes if any number of times method is not called" do
+    @mock.should_receive(:random_call).any_number_of_times
+  end
+
+  it "returns the mocked value when called after a similar stub" do
+    @mock.stub(:message).and_return :stub_value
+    @mock.should_receive(:message).any_number_of_times.and_return(:mock_value)
+    expect(@mock.message).to eq :mock_value
+    expect(@mock.message).to eq :mock_value
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/argument_expectation_spec.rb b/rspec-mocks/spec/rspec/mocks/argument_expectation_spec.rb
new file mode 100644
index 0000000..f1e5ff3
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/argument_expectation_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe ArgumentListMatcher do
+      let(:argument_expectation) { RSpec::Mocks::ArgumentListMatcher.new }
+      let(:obj) { double("matcher") }
+
+      it "considers an object that responds to #matches? and #failure_message_for_should to be a matcher" do
+        obj.stub(:matches?)
+        obj.stub(:failure_message_for_should)
+        expect(argument_expectation.send(:is_matcher?, obj)).to be_true
+      end
+
+      it "considers an object that responds to #matches? and #failure_message to be a matcher for backward compatibility" do
+        obj.stub(:matches?)
+        obj.stub(:failure_message)
+        expect(argument_expectation.send(:is_matcher?, obj)).to be_true
+      end
+
+      it "does NOT consider an object that only responds to #matches? to be a matcher" do
+        obj.stub(:matches?)
+        expect(argument_expectation.send(:is_matcher?, obj)).to be_false
+      end
+
+      it "does not consider a null object to be a matcher" do
+        obj.as_null_object
+        expect(argument_expectation.send(:is_matcher?, obj)).to be_false
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/at_least_spec.rb b/rspec-mocks/spec/rspec/mocks/at_least_spec.rb
new file mode 100644
index 0000000..706aa2c
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/at_least_spec.rb
@@ -0,0 +1,151 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "at_least" do
+      before(:each) { @double = double }
+
+      it "fails if method is never called" do
+        @double.should_receive(:do_something).at_least(4).times
+        expect {
+          verify @double
+        }.to raise_error(/expected: at least 4 times.*received: 0 times/m)
+      end
+
+      it "fails when called less than n times" do
+        @double.should_receive(:do_something).at_least(4).times
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        expect {
+          verify @double
+        }.to raise_error(/expected: at least 4 times.*received: 3 times/m)
+      end
+
+      it "fails when at least once method is never called" do
+        @double.should_receive(:do_something).at_least(:once)
+        expect {
+          verify @double
+        }.to raise_error(/expected: at least 1 time.*received: 0 times/m)
+      end
+
+      it "fails when at least twice method is called once" do
+        @double.should_receive(:do_something).at_least(:twice)
+        @double.do_something
+        expect {
+          verify @double
+        }.to raise_error(/expected: at least 2 times.*received: 1 time/m)
+      end
+
+      it "fails when at least twice method is never called" do
+        @double.should_receive(:do_something).at_least(:twice)
+        expect {
+          verify @double
+        }.to raise_error(/expected: at least 2 times.*received: 0 times/m)
+      end
+
+      it "passes when at least n times method is called exactly n times" do
+        @double.should_receive(:do_something).at_least(4).times
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at least n times method is called n plus 1 times" do
+        @double.should_receive(:do_something).at_least(4).times
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at least once method is called once" do
+        @double.should_receive(:do_something).at_least(:once)
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at least once method is called twice" do
+        @double.should_receive(:do_something).at_least(:once)
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at least twice method is called three times" do
+        @double.should_receive(:do_something).at_least(:twice)
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at least twice method is called twice" do
+        @double.should_receive(:do_something).at_least(:twice)
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "returns the value given by a block when the at least once method is called" do
+        @double.should_receive(:to_s).at_least(:once) { "testing" }
+        expect(@double.to_s).to eq "testing"
+        verify @double
+      end
+
+      context "when sent with 0" do
+        before { RSpec.stub(:deprecate) }
+
+        it "outputs a deprecation warning" do
+          expect(RSpec).to receive(:deprecate).with("at_least\(0\) with should_receive", :replacement => "stub")
+          expect(@double).to receive(:do_something).at_least(0).times
+        end
+
+        it "passes with no return if called once" do
+          @double.should_receive(:do_something).at_least(0).times
+          @double.do_something
+        end
+
+        it "passes with return block if called once" do
+          @double.should_receive(:do_something).at_least(0).times { true }
+          @double.do_something
+        end
+
+        it "passes with and_return if called once" do
+          @double.should_receive(:do_something).at_least(0).times.and_return true
+          @double.do_something
+        end
+
+        it "passes with no return if never called" do
+          @double.should_receive(:do_something).at_least(0).times
+        end
+
+        it "passes with return block if never called" do
+          @double.should_receive(:do_something).at_least(0).times { true }
+        end
+
+        it "passes with and_return if never called" do
+          @double.should_receive(:do_something).at_least(0).times.and_return true
+        end
+      end
+
+      it "uses a stub value if no value set" do
+        @double.stub(:do_something => 'foo')
+        @double.should_receive(:do_something).at_least(:once)
+        expect(@double.do_something).to eq 'foo'
+        expect(@double.do_something).to eq 'foo'
+      end
+
+      it "prefers its own return value over a stub" do
+        @double.stub(:do_something => 'foo')
+        @double.should_receive(:do_something).at_least(:once).and_return('bar')
+        expect(@double.do_something).to eq 'bar'
+        expect(@double.do_something).to eq 'bar'
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/at_most_spec.rb b/rspec-mocks/spec/rspec/mocks/at_most_spec.rb
new file mode 100644
index 0000000..5205d5f
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/at_most_spec.rb
@@ -0,0 +1,90 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "at_most" do
+      before(:each) do
+        @double = double
+      end
+
+      it "passes when at_most(n) is called exactly n times" do
+        @double.should_receive(:do_something).at_most(2).times
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at_most(n) is called less than n times" do
+        @double.should_receive(:do_something).at_most(2).times
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at_most(n) is never called" do
+        @double.should_receive(:do_something).at_most(2).times
+        verify @double
+      end
+
+      it "passes when at_most(:once) is called once" do
+        @double.should_receive(:do_something).at_most(:once)
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at_most(:once) is never called" do
+        @double.should_receive(:do_something).at_most(:once)
+        verify @double
+      end
+
+      it "passes when at_most(:twice) is called once" do
+        @double.should_receive(:do_something).at_most(:twice)
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at_most(:twice) is called twice" do
+        @double.should_receive(:do_something).at_most(:twice)
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when at_most(:twice) is never called" do
+        @double.should_receive(:do_something).at_most(:twice)
+        verify @double
+      end
+
+      it "returns the value given by a block when at_most(:once) method is called" do
+        @double.should_receive(:to_s).at_most(:once) { "testing" }
+        expect(@double.to_s).to eq "testing"
+        verify @double
+      end
+
+      it "fails fast when at_most(n) times method is called n plus 1 times" do
+        @double.should_receive(:do_something).at_most(2).times
+        @double.do_something
+        @double.do_something
+        expect {
+          @double.do_something
+        }.to raise_error(/expected: at most 2 times.*received: 3 times/m)
+      end
+
+      it "fails fast when at_most(:once) and is called twice" do
+        @double.should_receive(:do_something).at_most(:once)
+        @double.do_something
+        expect {
+          @double.do_something
+        }.to raise_error(/expected: at most 1 time.*received: 2 times/m)
+      end
+
+      it "fails fast when at_most(:twice) and is called three times" do
+        @double.should_receive(:do_something).at_most(:twice)
+        @double.do_something
+        @double.do_something
+        expect {
+          @double.do_something
+        }.to raise_error(/expected: at most 2 times.*received: 3 times/m)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/block_return_value_spec.rb b/rspec-mocks/spec/rspec/mocks/block_return_value_spec.rb
new file mode 100644
index 0000000..65a1ad2
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/block_return_value_spec.rb
@@ -0,0 +1,88 @@
+require "spec_helper"
+
+describe "a double declaration with a block handed to:" do
+  describe "should_receive" do
+    it "returns the value of executing the block" do
+      obj = Object.new
+      obj.should_receive(:foo) { 'bar' }
+      expect(obj.foo).to eq('bar')
+    end
+
+    it "works when a multi-return stub has already been set" do
+      obj = Object.new
+      return_value = Object.new
+      obj.stub(:foo).and_return(return_value, nil)
+      obj.should_receive(:foo) { return_value }
+      expect(obj.foo).to be(return_value)
+    end
+  end
+
+  describe "stub" do
+    it "returns the value of executing the block" do
+      obj = Object.new
+      obj.stub(:foo) { 'bar' }
+      expect(obj.foo).to eq('bar')
+    end
+
+    it "does not complain if a lambda block and mismatched arguments are passed" do
+      obj = Object.new
+      obj.stub(:foo, &lambda { 'bar' })
+      expect(obj.foo(1, 2)).to eq('bar')
+    end
+  end
+
+  describe "with" do
+    it "returns the value of executing the block" do
+      obj = Object.new
+      obj.stub(:foo).with('baz') { 'bar' }
+      expect(obj.foo('baz')).to eq('bar')
+    end
+
+    it "does not complain if a lambda block and mismatched arguments are passed" do
+      obj = Object.new
+      obj.stub(:foo).with(1, 2, &lambda { 'bar' })
+      expect(obj.foo(1, 2)).to eq('bar')
+    end
+  end
+
+  %w[once twice ordered and_return].each do |method|
+    describe method do
+      it "returns the value of executing the block" do
+        obj = Object.new
+        obj.stub(:foo).send(method) { 'bar' }
+        expect(obj.foo).to eq('bar')
+      end
+
+      it "does not complain if a lambda block and mismatched arguments are passed" do
+        obj = Object.new
+        obj.stub(:foo).send(method, &lambda { 'bar' })
+        expect(obj.foo(1, 2)).to eq('bar')
+      end
+    end
+  end
+
+  describe 'any_number_of_times' do
+    before do
+      RSpec.stub(:deprecate)
+    end
+
+    it "warns about deprecation" do
+      expect(RSpec).to receive(:deprecate).with("any_number_of_times", :replacement => "stub")
+      Object.new.stub(:foo).any_number_of_times { 'bar' }
+    end
+
+    it "returns the value of executing the block" do
+      obj = Object.new
+      obj.stub(:foo).any_number_of_times { 'bar' }
+      expect(obj.foo).to eq('bar')
+    end
+  end
+
+  describe "times" do
+    it "returns the value of executing the block" do
+      obj = Object.new
+      obj.stub(:foo).at_least(1).times { 'bar' }
+      expect(obj.foo('baz')).to eq('bar')
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_10260_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_10260_spec.rb
new file mode 100644
index 0000000..ab2fb77
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_10260_spec.rb
@@ -0,0 +1,8 @@
+require 'spec_helper'
+
+describe "An RSpec Mock" do
+  it "hides internals in its inspect representation" do
+    m = double('cup')
+    expect(m.inspect).to match(/#<RSpec::Mocks::Mock:0x[a-f0-9.]+ @name="cup">/)
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_10263_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_10263_spec.rb
new file mode 100644
index 0000000..6b58e6b
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_10263_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe "Double" do
+  let(:test_double) { double }
+
+  specify "when one example has an expectation inside the block passed to should_receive" do
+    test_double.should_receive(:msg) do |arg|
+      expect(arg).to be_true #this call exposes the problem
+    end
+    begin
+      test_double.msg(false)
+    rescue Exception
+    end
+  end
+
+  specify "then the next example should behave as expected instead of saying" do
+    test_double.should_receive(:foobar)
+    test_double.foobar
+    verify test_double
+    begin
+      test_double.foobar
+    rescue Exception => e
+      expect(e.message).to eq "Double received unexpected message :foobar with (no args)"
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_11545_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_11545_spec.rb
new file mode 100644
index 0000000..73ec05c
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_11545_spec.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+class LiarLiarPantsOnFire
+  def respond_to?(message, incl_private=false)
+    true
+  end
+
+  def self.respond_to?(message, incl_private=false)
+    true
+  end
+end
+
+describe 'should_receive' do
+  before(:each) do
+    @liar = LiarLiarPantsOnFire.new
+  end
+
+  it "works when object lies about responding to a method" do
+    @liar.should_receive(:something)
+    @liar.something
+  end
+
+  it 'works when class lies about responding to a method' do
+    LiarLiarPantsOnFire.should_receive(:something)
+    LiarLiarPantsOnFire.something
+  end
+
+  it 'cleans up after itself' do
+    expect((class << LiarLiarPantsOnFire; self; end).instance_methods).not_to include("something")
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_496_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_496_spec.rb
new file mode 100644
index 0000000..285929c
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_496_spec.rb
@@ -0,0 +1,17 @@
+require 'spec_helper'
+
+module BugReport496
+  describe "a message expectation on a base class object" do
+    class BaseClass
+    end
+
+    class SubClass < BaseClass
+    end
+
+    it "is received" do
+      BaseClass.should_receive(:new).once
+      SubClass.new
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_600_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_600_spec.rb
new file mode 100644
index 0000000..78e3b27
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_600_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+module BugReport600
+  describe "stubbing a class method" do
+    class ExampleClass
+      def self.method_that_uses_define_method
+        define_method "defined_method" do |attributes|
+          load_address(address, attributes)
+        end
+      end
+    end
+
+    it "works" do
+      ExampleClass.should_receive(:define_method).with("defined_method")
+      ExampleClass.method_that_uses_define_method
+    end
+
+    it "restores the original method" do
+      ExampleClass.method_that_uses_define_method
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_7611_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_7611_spec.rb
new file mode 100644
index 0000000..b4161a2
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_7611_spec.rb
@@ -0,0 +1,16 @@
+require 'spec_helper'
+
+module Bug7611
+  describe "A Partial Mock" do
+    class Foo; end
+    class Bar < Foo; end
+
+    it "respects subclasses" do
+      Foo.stub(:new).and_return(Object.new)
+    end
+
+    it "should" do
+      expect(Bar.new.class).to eq Bar
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_8165_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_8165_spec.rb
new file mode 100644
index 0000000..bf0de63
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_8165_spec.rb
@@ -0,0 +1,31 @@
+require 'spec_helper'
+
+describe "An object where respond_to? is true and does not have method" do
+  # When should_receive(message) is sent to any object, the Proxy sends
+  # respond_to?(message) to that object to see if the method should be proxied.
+  #
+  # If respond_to? itself is proxied, then when the Proxy sends respond_to?
+  # to the object, the proxy is invoked and responds yes (if so set in the spec).
+  # When the object does NOT actually respond to `message`, an exception is thrown
+  # when trying to proxy it.
+  #
+  # The fix was to keep track of whether `respond_to?` had been proxied and, if
+  # so, call the munged copy of `respond_to?` on the object.
+
+  it "does not raise an exception for Object" do
+    obj = Object.new
+    obj.should_receive(:respond_to?).with(:foobar).and_return(true)
+    obj.should_receive(:foobar).and_return(:baz)
+    expect(obj.respond_to?(:foobar)).to be_true
+    expect(obj.foobar).to eq :baz
+  end
+
+  it "does not raise an exception for mock" do
+    obj = double("obj")
+    obj.should_receive(:respond_to?).with(:foobar).and_return(true)
+    obj.should_receive(:foobar).and_return(:baz)
+    expect(obj.respond_to?(:foobar)).to be_true
+    expect(obj.foobar).to eq :baz
+  end
+
+end
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_830_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_830_spec.rb
new file mode 100644
index 0000000..7648201
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_830_spec.rb
@@ -0,0 +1,21 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe 'Calling a method that catches StandardError' do
+      class Foo
+        def self.foo
+          bar
+        rescue StandardError
+        end
+      end
+
+      it 'still reports mock failures' do
+        Foo.should_not_receive :bar
+        expect {
+          Foo.foo
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/bug_report_957_spec.rb b/rspec-mocks/spec/rspec/mocks/bug_report_957_spec.rb
new file mode 100644
index 0000000..c28838a
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/bug_report_957_spec.rb
@@ -0,0 +1,22 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "stubbing a base class class method" do
+      before do
+        @base_class     = Class.new
+        @concrete_class = Class.new(@base_class)
+
+        @base_class.stub(:find).and_return "stubbed_value"
+      end
+
+      it "returns the value for the stub on the base class" do
+        expect(@base_class.find).to eq "stubbed_value"
+      end
+
+      it "returns the value for the descendent class" do
+        expect(@concrete_class.find).to eq "stubbed_value"
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/combining_implementation_instructions_spec.rb b/rspec-mocks/spec/rspec/mocks/combining_implementation_instructions_spec.rb
new file mode 100644
index 0000000..64c3450
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/combining_implementation_instructions_spec.rb
@@ -0,0 +1,205 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "Combining implementation instructions" do
+      it 'can combine and_yield and and_return' do
+        dbl = double
+        dbl.stub(:foo).and_yield(5).and_return(3)
+
+        expect { |b|
+          expect(dbl.foo(&b)).to eq(3)
+        }.to yield_with_args(5)
+      end
+
+      describe "combining and_yield, a block implementation and and_return" do
+        def verify_combined_implementation
+          dbl = double
+          (yield dbl).and_yield(5).and_return(3)
+
+          expect { |b|
+            expect(dbl.foo(:arg, &b)).to eq(3)
+          }.to yield_with_args(5)
+
+          expect(@block_called).to be_true
+        end
+
+        it 'works when passing a block to `stub`' do
+          verify_combined_implementation do |dbl|
+            dbl.stub(:foo) { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `with`' do
+          verify_combined_implementation do |dbl|
+            dbl.stub(:foo).with(:arg) { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `exactly`' do
+          verify_combined_implementation do |dbl|
+            dbl.should_receive(:foo).exactly(:once) { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `at_least`' do
+          verify_combined_implementation do |dbl|
+            dbl.should_receive(:foo).at_least(:once) { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `at_most`' do
+          verify_combined_implementation do |dbl|
+            dbl.should_receive(:foo).at_most(:once) { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `times`' do
+          verify_combined_implementation do |dbl|
+            dbl.should_receive(:foo).exactly(1).times { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `any_number_of_times`' do
+          verify_combined_implementation do |dbl|
+            dbl.should_receive(:foo).any_number_of_times { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `once`' do
+          verify_combined_implementation do |dbl|
+            dbl.should_receive(:foo).once { @block_called = true }
+          end
+        end
+
+        it 'works when passing a block to `twice`' do
+          the_double = nil
+
+          verify_combined_implementation do |dbl|
+            the_double = dbl
+            dbl.should_receive(:foo).twice { @block_called = true }
+          end
+
+          the_double.foo { |a| } # to ensure it is called twice
+        end
+
+        it 'works when passing a block to `ordered`' do
+          verify_combined_implementation do |dbl|
+            dbl.should_receive(:foo).ordered { @block_called = true }
+          end
+        end
+      end
+
+      it 'can combine and_yield and and_return with a block' do
+        dbl = double
+        dbl.stub(:foo).and_yield(5).and_return { :return }
+
+        expect { |b|
+          expect(dbl.foo(&b)).to eq(:return)
+        }.to yield_with_args(5)
+      end
+
+      it 'can combine and_yield and and_raise' do
+        dbl = double
+        dbl.stub(:foo).and_yield(5).and_raise("boom")
+
+        expect { |b|
+          expect { dbl.foo(&b) }.to raise_error("boom")
+        }.to yield_with_args(5)
+      end
+
+      it 'can combine and_yield, a block implementation and and_raise' do
+        dbl = double
+        block_called = false
+        dbl.stub(:foo) { block_called = true }.and_yield(5).and_raise("boom")
+
+        expect { |b|
+          expect { dbl.foo(&b) }.to raise_error("boom")
+        }.to yield_with_args(5)
+
+        expect(block_called).to be_true
+      end
+
+      it 'can combine and_yield and and_throw' do
+        dbl = double
+        dbl.stub(:foo).and_yield(5).and_throw(:bar)
+
+        expect { |b|
+          expect { dbl.foo(&b) }.to throw_symbol(:bar)
+        }.to yield_with_args(5)
+      end
+
+      it 'can combine and_yield, a block implementation and and_throw' do
+        dbl = double
+        block_called = false
+        dbl.stub(:foo) { block_called = true }.and_yield(5).and_throw(:bar)
+
+        expect { |b|
+          expect { dbl.foo(&b) }.to throw_symbol(:bar)
+        }.to yield_with_args(5)
+
+        expect(block_called).to be_true
+      end
+
+      it 'returns `nil` from all terminal actions to discourage further configuration' do
+        expect(double.stub(:foo).and_return(1)).to be_nil
+        expect(double.stub(:foo).and_raise("boom")).to be_nil
+        expect(double.stub(:foo).and_throw(:foo)).to be_nil
+      end
+
+      it 'allows the terminal action to be overriden' do
+        dbl = double
+        stubbed_double = dbl.stub(:foo)
+
+        stubbed_double.and_return(1)
+        expect(dbl.foo).to eq(1)
+
+        stubbed_double.and_return(3)
+        expect(dbl.foo).to eq(3)
+
+        stubbed_double.and_raise("boom")
+        expect { dbl.foo }.to raise_error("boom")
+
+        stubbed_double.and_throw(:bar)
+        expect { dbl.foo }.to throw_symbol(:bar)
+      end
+
+      it 'allows the inner implementation block to be overriden' do
+        dbl = double
+        stubbed_double = dbl.stub(:foo)
+
+        stubbed_double.with(:arg) { :with_block }
+        expect(dbl.foo(:arg)).to eq(:with_block)
+
+        stubbed_double.at_least(:once) { :at_least_block }
+        expect(dbl.foo(:arg)).to eq(:at_least_block)
+      end
+
+      it 'can combine and_call_original, with, and_return' do
+        obj = Struct.new(:value).new('original')
+        obj.stub(:value).and_call_original
+        obj.stub(:value).with(:arg).and_return('value')
+        expect(obj.value).to eq 'original'
+        expect(obj.value(:arg)).to eq 'value'
+      end
+
+      it 'raises an error if `and_call_original` is followed by any other instructions' do
+        dbl = [1, 2, 3]
+        stubbed = dbl.stub(:size)
+        stubbed.and_call_original
+
+        msg_fragment = /cannot be modified further/
+
+        expect { stubbed.and_yield }.to raise_error(msg_fragment)
+        expect { stubbed.and_return(1) }.to raise_error(msg_fragment)
+        expect { stubbed.and_raise("a") }.to raise_error(msg_fragment)
+        expect { stubbed.and_throw(:bar) }.to raise_error(msg_fragment)
+
+        expect { stubbed.once { } }.to raise_error(msg_fragment)
+
+        expect(dbl.size).to eq(3)
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/configuration_spec.rb b/rspec-mocks/spec/rspec/mocks/configuration_spec.rb
new file mode 100644
index 0000000..93d9a6e
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/configuration_spec.rb
@@ -0,0 +1,150 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe Configuration do
+      let(:config) { Configuration.new }
+      let(:mod_1)  { Module.new }
+      let(:mod_2)  { Module.new }
+
+      def instance_methods_of(mod)
+        mod_1.instance_methods.map(&:to_sym)
+      end
+
+      it 'adds stub and should_receive to the given modules' do
+        expect(instance_methods_of(mod_1)).not_to include(:stub, :should_receive)
+        expect(instance_methods_of(mod_2)).not_to include(:stub, :should_receive)
+
+        config.add_stub_and_should_receive_to(mod_1, mod_2)
+
+        expect(instance_methods_of(mod_1)).to include(:stub, :should_receive)
+        expect(instance_methods_of(mod_2)).to include(:stub, :should_receive)
+      end
+
+      shared_examples_for "configuring the syntax" do
+        def sandboxed
+          orig_syntax = RSpec::Mocks.configuration.syntax
+          yield
+        ensure
+          configure_syntax(orig_syntax)
+        end
+
+        around(:each) { |ex| sandboxed(&ex) }
+        let(:dbl) { double }
+        let(:should_methods)       { [:should_receive, :stub, :should_not_receive] }
+        let(:should_class_methods) { [:any_instance] }
+        let(:expect_methods)      { [:receive, :allow, :expect_any_instance_of, :allow_any_instance_of] }
+
+        it 'defaults to enabling both the :should and :expect syntaxes' do
+          expect(dbl).to respond_to(*should_methods)
+          expect(self).to respond_to(*expect_methods)
+        end
+
+        context 'when configured to :expect' do
+          before { configure_syntax :expect }
+
+          it 'removes the should methods from every object' do
+            expect(dbl).not_to respond_to(*should_methods)
+          end
+
+          it 'removes `any_instance` from every class' do
+            expect(Class.new).not_to respond_to(*should_class_methods)
+          end
+
+          it 'adds the expect methods to the example group context' do
+            expect(self).to respond_to(*expect_methods)
+          end
+
+          it 'reports that the syntax is :expect' do
+            expect(configured_syntax).to eq([:expect])
+          end
+
+          it 'is a no-op when configured a second time' do
+            expect(Syntax.default_should_syntax_host).not_to receive(:method_undefined)
+            expect(::RSpec::Mocks::ExampleMethods).not_to receive(:method_added)
+            configure_syntax :expect
+          end
+        end
+
+        context 'when configured to :should' do
+          before { configure_syntax :should }
+
+          it 'adds the should methods to every object' do
+            expect(dbl).to respond_to(*should_methods)
+          end
+
+          it 'adds `any_instance` to every class' do
+            expect(Class.new).to respond_to(*should_class_methods)
+          end
+
+          it 'removes the expect methods from the example group context' do
+            expect(self).not_to respond_to(*expect_methods)
+          end
+
+          it 'reports that the syntax is :should' do
+            expect(configured_syntax).to eq([:should])
+          end
+
+          it 'is a no-op when configured a second time' do
+            Syntax.default_should_syntax_host.should_not_receive(:method_added)
+            ::RSpec::Mocks::ExampleMethods.should_not_receive(:method_undefined)
+            configure_syntax :should
+          end
+        end
+
+        context 'when configured to [:should, :expect]' do
+          before { configure_syntax [:should, :expect] }
+
+          it 'adds the should methods to every object' do
+            expect(dbl).to respond_to(*should_methods)
+          end
+
+          it 'adds `any_instance` to every class' do
+            expect(Class.new).to respond_to(*should_class_methods)
+          end
+
+          it 'adds the expect methods to the example group context' do
+            expect(self).to respond_to(*expect_methods)
+          end
+
+          it 'reports that both syntaxes are enabled' do
+            expect(configured_syntax).to eq([:should, :expect])
+          end
+        end
+      end
+
+      describe "configuring rspec-mocks directly" do
+        it_behaves_like "configuring the syntax" do
+          def configure_syntax(syntax)
+            RSpec::Mocks.configuration.syntax = syntax
+          end
+
+          def configured_syntax
+            RSpec::Mocks.configuration.syntax
+          end
+        end
+      end
+
+      describe "configuring using the rspec-core config API" do
+        it_behaves_like "configuring the syntax" do
+          def configure_syntax(syntax)
+            RSpec.configure do |rspec|
+              rspec.mock_with :rspec do |c|
+                c.syntax = syntax
+              end
+            end
+          end
+
+          def configured_syntax
+            RSpec.configure do |rspec|
+              rspec.mock_with :rspec do |c|
+                return c.syntax
+              end
+            end
+          end
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/double_spec.rb b/rspec-mocks/spec/rspec/mocks/double_spec.rb
new file mode 100644
index 0000000..749a033
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/double_spec.rb
@@ -0,0 +1,24 @@
+require "spec_helper"
+
+describe "double" do
+  it "is an alias for stub and mock" do
+    expect(double()).to be_a(RSpec::Mocks::Mock)
+  end
+
+  it "uses 'Double' in failure messages" do
+    double = double('name')
+    expect {double.foo}.to raise_error(/Double "name" received/)
+  end
+
+  describe "deprecated aliases" do
+    it "warns if #stub is used" do
+      expect(RSpec).to receive(:deprecate).with("stub", :replacement => "double")
+      stub("TestDouble")
+    end
+
+    it "warns if #mock is used" do
+      expect(RSpec).to receive(:deprecate).with("mock", :replacement => "double")
+      mock("TestDouble")
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/extensions/marshal_spec.rb b/rspec-mocks/spec/rspec/mocks/extensions/marshal_spec.rb
new file mode 100644
index 0000000..46f436b
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/extensions/marshal_spec.rb
@@ -0,0 +1,54 @@
+require 'spec_helper'
+
+describe Marshal, 'extensions' do
+  # An object that raises when code attempts to dup it.
+  #
+  # Because we manipulate the internals of RSpec::Mocks.space below, we need
+  # an object that simply blows up when #dup is called without using any
+  # partial mocking or stubbing from rspec-mocks itself.
+  class UndupableObject
+    def dup
+      raise NotImplementedError
+    end
+  end
+
+  describe '#dump' do
+    context 'when rspec-mocks has not been fully initialized' do
+      def without_space
+        stashed_space, RSpec::Mocks.space = RSpec::Mocks.space, nil
+        yield
+      ensure
+        RSpec::Mocks.space = stashed_space
+      end
+
+      it 'does not duplicate the object before serialization' do
+        obj = UndupableObject.new
+        without_space do
+          serialized = Marshal.dump(obj)
+          expect(Marshal.load(serialized)).to be_an(UndupableObject)
+        end
+      end
+    end
+
+    context 'when rspec-mocks has been fully initialized' do
+      it 'duplicates objects with stubbed or mocked implementations before serialization' do
+        obj = double(:foo => "bar")
+
+        serialized = Marshal.dump(obj)
+        expect(Marshal.load(serialized)).to be_an(obj.class)
+      end
+
+      it 'does not duplicate other objects before serialization' do
+        obj = UndupableObject.new
+
+        serialized = Marshal.dump(obj)
+        expect(Marshal.load(serialized)).to be_an(UndupableObject)
+      end
+
+      it 'does not duplicate nil before serialization' do
+        serialized = Marshal.dump(nil)
+        expect(Marshal.load(serialized)).to be_nil
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/failing_argument_matchers_spec.rb b/rspec-mocks/spec/rspec/mocks/failing_argument_matchers_spec.rb
new file mode 100644
index 0000000..c2ae428
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/failing_argument_matchers_spec.rb
@@ -0,0 +1,110 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "failing MockArgumentMatchers" do
+      before(:each) do
+        @double = double("double")
+        @reporter = double("reporter").as_null_object
+      end
+
+      after(:each) do
+        reset @double
+      end
+
+      it "rejects non boolean" do
+        @double.should_receive(:random_call).with(boolean())
+        expect do
+          @double.random_call("false")
+        end.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "rejects non numeric" do
+        @double.should_receive(:random_call).with(an_instance_of(Numeric))
+        expect do
+          @double.random_call("1")
+        end.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "rejects non string" do
+        @double.should_receive(:random_call).with(an_instance_of(String))
+        expect do
+          @double.random_call(123)
+        end.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "rejects goose when expecting a duck" do
+        @double.should_receive(:random_call).with(duck_type(:abs, :div))
+        expect { @double.random_call("I don't respond to :abs or :div") }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails if regexp does not match submitted string" do
+        @double.should_receive(:random_call).with(/bcd/)
+        expect { @double.random_call("abc") }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails if regexp does not match submitted regexp" do
+        @double.should_receive(:random_call).with(/bcd/)
+        expect { @double.random_call(/bcde/) }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails for a hash w/ wrong values" do
+        @double.should_receive(:random_call).with(:a => "b", :c => "d")
+        expect do
+          @double.random_call(:a => "b", :c => "e")
+        end.to raise_error(RSpec::Mocks::MockExpectationError, /Double "double" received :random_call with unexpected arguments\n  expected: \(\{(:a=>\"b\", :c=>\"d\"|:c=>\"d\", :a=>\"b\")\}\)\n       got: \(\{(:a=>\"b\", :c=>\"e\"|:c=>\"e\", :a=>\"b\")\}\)/)
+      end
+
+      it "fails for a hash w/ wrong keys" do
+        @double.should_receive(:random_call).with(:a => "b", :c => "d")
+        expect do
+          @double.random_call("a" => "b", "c" => "d")
+        end.to raise_error(RSpec::Mocks::MockExpectationError, /Double "double" received :random_call with unexpected arguments\n  expected: \(\{(:a=>\"b\", :c=>\"d\"|:c=>\"d\", :a=>\"b\")\}\)\n       got: \(\{(\"a\"=>\"b\", \"c\"=>\"d\"|\"c\"=>\"d\", \"a\"=>\"b\")\}\)/)
+      end
+
+      it "matches against a Matcher" do
+        expect do
+          @double.should_receive(:msg).with(equal(3))
+          @double.msg(37)
+        end.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"double\" received :msg with unexpected arguments\n  expected: (equal 3)\n       got: (37)")
+      end
+
+      it "fails no_args with one arg" do
+        expect do
+          @double.should_receive(:msg).with(no_args)
+          @double.msg(37)
+        end.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"double\" received :msg with unexpected arguments\n  expected: (no args)\n       got: (37)")
+      end
+
+      it "fails hash_including with missing key" do
+         expect do
+           @double.should_receive(:msg).with(hash_including(:a => 1))
+           @double.msg({})
+         end.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"double\" received :msg with unexpected arguments\n  expected: (hash_including(:a=>1))\n       got: ({})")
+      end
+
+      it "fails with block matchers" do
+        expect do
+          @double.should_receive(:msg).with {|arg| expect(arg).to eq :received }
+          @double.msg :no_msg_for_you
+        end.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected: :received.*\s*.*got: :no_msg_for_you/)
+      end
+
+      it "fails with sensible message when args respond to #description" do
+        arg = Class.new do
+          def description
+          end
+
+          def inspect
+            "my_thing"
+          end
+        end.new
+
+        expect do
+          @double.should_receive(:msg).with(3)
+          @double.msg arg
+        end.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"double\" received :msg with unexpected arguments\n  expected: (3)\n       got: (my_thing)")
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/hash_excluding_matcher_spec.rb b/rspec-mocks/spec/rspec/mocks/hash_excluding_matcher_spec.rb
new file mode 100644
index 0000000..c2a90d8
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/hash_excluding_matcher_spec.rb
@@ -0,0 +1,67 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    module ArgumentMatchers
+      describe HashExcludingMatcher do
+
+        it "describes itself properly" do
+          expect(HashExcludingMatcher.new(:a => 5).description).to eq "hash_not_including(:a=>5)"
+        end
+
+        describe "passing" do
+          it "matches a hash without the specified key" do
+            expect(hash_not_including(:c)).to eq({:a => 1, :b => 2})
+          end
+
+          it "matches a hash with the specified key, but different value" do
+            expect(hash_not_including(:b => 3)).to eq({:a => 1, :b => 2})
+          end
+
+          it "matches a hash without the specified key, given as anything()" do
+            expect(hash_not_including(:c => anything)).to eq({:a => 1, :b => 2})
+          end
+
+          it "matches an empty hash" do
+            expect(hash_not_including(:a)).to eq({})
+          end
+
+          it "matches a hash without any of the specified keys" do
+            expect(hash_not_including(:a, :b, :c)).to eq(:d => 7)
+          end
+
+        end
+
+        describe "failing" do
+          it "does not match a non-hash" do
+            expect(hash_not_including(:a => 1)).not_to eq 1
+          end
+
+          it "does not match a hash with a specified key" do
+            expect(hash_not_including(:b)).not_to eq(:b => 2)
+          end
+
+          it "does not match a hash with the specified key/value pair" do
+            expect(hash_not_including(:b => 2)).not_to eq(:a => 1, :b => 2)
+          end
+
+          it "does not match a hash with the specified key" do
+            expect(hash_not_including(:a, :b => 3)).not_to eq(:a => 1, :b => 2)
+          end
+
+          it "does not match a hash with one of the specified keys" do
+            expect(hash_not_including(:a, :b)).not_to eq(:b => 2)
+          end
+
+          it "does not match a hash with some of the specified keys" do
+            expect(hash_not_including(:a, :b, :c)).not_to eq(:a => 1, :b => 2)
+          end
+
+          it "does not match a hash with one key/value pair included" do
+            expect(hash_not_including(:a, :b, :c, :d => 7)).not_to eq(:d => 7)
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/hash_including_matcher_spec.rb b/rspec-mocks/spec/rspec/mocks/hash_including_matcher_spec.rb
new file mode 100644
index 0000000..999bcc8
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/hash_including_matcher_spec.rb
@@ -0,0 +1,90 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    module ArgumentMatchers
+      describe HashIncludingMatcher do
+
+        it "describes itself properly" do
+          expect(HashIncludingMatcher.new(:a => 1).description).to eq "hash_including(:a=>1)"
+        end
+
+        describe "passing" do
+          it "matches the same hash" do
+            expect(hash_including(:a => 1)).to eq({:a => 1})
+          end
+
+          it "matches a hash with extra stuff" do
+            expect(hash_including(:a => 1)).to eq({:a => 1, :b => 2})
+          end
+
+          describe "when matching against other matchers" do
+            it "matches an int against anything()" do
+              expect(hash_including(:a => anything, :b => 2)).to eq({:a => 1, :b => 2})
+            end
+
+            it "matches a string against anything()" do
+              expect(hash_including(:a => anything, :b => 2)).to eq({:a => "1", :b => 2})
+            end
+          end
+
+          describe "when passed only keys or keys mixed with key/value pairs" do
+            it "matches if the key is present" do
+              expect(hash_including(:a)).to eq({:a => 1, :b => 2})
+            end
+
+            it "matches if more keys are present" do
+              expect(hash_including(:a, :b)).to eq({:a => 1, :b => 2, :c => 3})
+            end
+
+            it "matches a string against a given key" do
+              expect(hash_including(:a)).to eq({:a => "1", :b => 2})
+            end
+
+            it "matches if passed one key and one key/value pair" do
+              expect(hash_including(:a, :b => 2)).to eq({:a => 1, :b => 2})
+            end
+
+            it "matches if passed many keys and one key/value pair" do
+              expect(hash_including(:a, :b, :c => 3)).to eq({:a => 1, :b => 2, :c => 3, :d => 4})
+            end
+
+            it "matches if passed many keys and many key/value pairs" do
+              expect(hash_including(:a, :b, :c => 3, :e => 5)).to eq({:a => 1, :b => 2, :c => 3, :d => 4, :e => 5})
+            end
+          end
+        end
+
+        describe "failing" do
+          it "does not match a non-hash" do
+            expect(hash_including(:a => 1)).not_to eq 1
+          end
+
+          it "does not match a hash with a missing key" do
+            expect(hash_including(:a => 1)).not_to eq(:b => 2)
+          end
+
+          it "does not match a hash with a missing key" do
+            expect(hash_including(:a)).not_to eq(:b => 2)
+          end
+
+          it "does not match an empty hash with a given key" do
+            expect(hash_including(:a)).not_to eq({})
+          end
+
+          it "does not match a hash with a missing key when one pair is matching" do
+            expect(hash_including(:a, :b => 2)).not_to eq(:b => 2)
+          end
+
+          it "does not match a hash with an incorrect value" do
+            expect(hash_including(:a => 1, :b => 2)).not_to eq(:a => 1, :b => 3)
+          end
+
+          it "does not match when values are nil but keys are different" do
+            expect(hash_including(:a => nil)).not_to eq(:b => nil)
+          end
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/instance_method_stasher_spec.rb b/rspec-mocks/spec/rspec/mocks/instance_method_stasher_spec.rb
new file mode 100644
index 0000000..30869f6
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/instance_method_stasher_spec.rb
@@ -0,0 +1,58 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe InstanceMethodStasher do
+      class ExampleClass
+        def hello
+          :hello_defined_on_class
+        end
+      end
+
+      def singleton_class_for(obj)
+        class << obj; self; end
+      end
+
+      it "stashes the current implementation of an instance method so it can be temporarily replaced" do
+        obj = Object.new
+        def obj.hello; :hello_defined_on_singleton_class; end;
+
+        stashed_method = InstanceMethodStasher.new(singleton_class_for(obj), :hello)
+        stashed_method.stash
+
+        def obj.hello; :overridden_hello; end
+        expect(obj.hello).to eql :overridden_hello
+
+        stashed_method.restore
+        expect(obj.hello).to eql :hello_defined_on_singleton_class
+      end
+
+      it "stashes private instance methods" do
+        obj = Object.new
+        def obj.hello; :hello_defined_on_singleton_class; end;
+        singleton_class_for(obj).__send__(:private, :hello)
+
+        stashed_method = InstanceMethodStasher.new(singleton_class_for(obj), :hello)
+        stashed_method.stash
+
+        def obj.hello; :overridden_hello; end
+        stashed_method.restore
+        expect(obj.send(:hello)).to eql :hello_defined_on_singleton_class
+      end
+
+      it "only stashes methods directly defined on the given class, not its ancestors" do
+        obj = ExampleClass.new
+
+        stashed_method = InstanceMethodStasher.new(singleton_class_for(obj), :hello)
+        stashed_method.stash
+
+        def obj.hello; :overridden_hello; end;
+        expect(obj.hello).to eql :overridden_hello
+
+        stashed_method.restore
+        expect(obj.hello).to eql :overridden_hello
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/matchers/have_received_spec.rb b/rspec-mocks/spec/rspec/mocks/matchers/have_received_spec.rb
new file mode 100644
index 0000000..9a35a1c
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/matchers/have_received_spec.rb
@@ -0,0 +1,266 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe Matchers::HaveReceived do
+      describe "expect(...).to have_received" do
+        it 'passes when the double has received the given message' do
+          dbl = double_with_met_expectation(:expected_method)
+          expect(dbl).to have_received(:expected_method)
+        end
+
+        it 'passes when a null object has received the given message' do
+          dbl = null_object_with_met_expectation(:expected_method)
+          expect(dbl).to have_received(:expected_method)
+        end
+
+        it 'fails when the double has not received the given message' do
+          dbl = double_with_unmet_expectation(:expected_method)
+
+          expect {
+            expect(dbl).to have_received(:expected_method)
+          }.to raise_error(/expected: 1 time/)
+        end
+
+        it 'fails when a null object has not received the given message' do
+          dbl = double.as_null_object
+
+          expect {
+            expect(dbl).to have_received(:expected_method)
+          }.to raise_error(/expected: 1 time/)
+        end
+
+        it 'fails when the method has not been previously stubbed' do
+          dbl = double
+
+          expect {
+            expect(dbl).to have_received(:expected_method)
+          }.to raise_error(/method has not been stubbed/)
+        end
+
+        it 'fails when the method has been mocked' do
+          dbl = double
+          dbl.should_receive(:expected_method)
+          dbl.expected_method
+
+          expect {
+            expect(dbl).to have_received(:expected_method)
+          }.to raise_error(/method has been mocked instead of stubbed/)
+        end
+
+        it 'resets expectations on class methods when mocks are reset' do
+          dbl = Object
+          dbl.stub(:expected_method)
+          dbl.expected_method
+          reset dbl
+          dbl.stub(:expected_method)
+
+          expect {
+            expect(dbl).to have_received(:expected_method)
+          }.to raise_error(/0 times/)
+        end
+
+        context "with" do
+          it 'passes when the given args match the args used with the message' do
+            dbl = double_with_met_expectation(:expected_method, :expected, :args)
+            expect(dbl).to have_received(:expected_method).with(:expected, :args)
+          end
+
+          it 'fails when the given args do not match the args used with the message' do
+            dbl = double_with_met_expectation(:expected_method, :expected, :args)
+
+            expect {
+              expect(dbl).to have_received(:expected_method).with(:unexpected, :args)
+            }.to raise_error(/with unexpected arguments/)
+          end
+        end
+
+        it 'generates a useful description' do
+          matcher = have_received(:expected_method).with(:expected_args).once
+          expect(matcher.description).to eq 'have received expected_method(:expected_args) 1 time'
+        end
+
+        context "counts" do
+          let(:dbl) { double(:expected_method => nil) }
+
+          before do
+            dbl.expected_method
+            dbl.expected_method
+            dbl.expected_method
+          end
+
+          context "exactly" do
+            it 'passes when the message was received the given number of times' do
+              expect(dbl).to have_received(:expected_method).exactly(3).times
+            end
+
+            it 'fails when the message was received more times' do
+              expect {
+                expect(dbl).to have_received(:expected_method).exactly(2).times
+              }.to raise_error(/expected: 2 times.*received: 3 times/m)
+            end
+
+            it 'fails when the message was received fewer times' do
+              expect {
+                expect(dbl).to have_received(:expected_method).exactly(4).times
+              }.to raise_error(/expected: 4 times.*received: 3 times/m)
+            end
+          end
+
+          context 'at_least' do
+            it 'passes when the message was received the given number of times' do
+              expect(dbl).to have_received(:expected_method).at_least(3).times
+            end
+
+            it 'passes when the message was received more times' do
+              expect(dbl).to have_received(:expected_method).at_least(2).times
+            end
+
+            it 'fails when the message was received fewer times' do
+              expect {
+                expect(dbl).to have_received(:expected_method).at_least(4).times
+              }.to raise_error(/expected: at least 4 times.*received: 3 times/m)
+            end
+          end
+
+          context 'at_most' do
+            it 'passes when the message was received the given number of times' do
+              expect(dbl).to have_received(:expected_method).at_most(3).times
+            end
+
+            it 'passes when the message was received fewer times' do
+              expect(dbl).to have_received(:expected_method).at_most(4).times
+            end
+
+            it 'fails when the message was received more times' do
+              expect {
+                expect(dbl).to have_received(:expected_method).at_most(2).times
+              }.to raise_error(/expected: at most 2 times.*received: 3 times/m)
+            end
+          end
+
+          context 'once' do
+            it 'passes when the message was received once' do
+              dbl = double(:expected_method => nil)
+              dbl.expected_method
+              expect(dbl).to have_received(:expected_method).once
+            end
+
+            it 'fails when the message was never received' do
+              dbl = double(:expected_method => nil)
+
+              expect {
+                expect(dbl).to have_received(:expected_method).once
+              }.to raise_error(/expected: 1 time.*received: 0 times/m)
+            end
+
+            it 'fails when the message was received twice' do
+              dbl = double(:expected_method => nil)
+              dbl.expected_method
+              dbl.expected_method
+
+              expect {
+                expect(dbl).to have_received(:expected_method).once
+              }.to raise_error(/expected: 1 time.*received: 2 times/m)
+            end
+          end
+
+          context 'twice' do
+            it 'passes when the message was received twice' do
+              dbl = double(:expected_method => nil)
+              dbl.expected_method
+              dbl.expected_method
+
+              expect(dbl).to have_received(:expected_method).twice
+            end
+
+            it 'fails when the message was received once' do
+              dbl = double(:expected_method => nil)
+              dbl.expected_method
+
+              expect {
+                expect(dbl).to have_received(:expected_method).twice
+              }.to raise_error(/expected: 2 times.*received: 1 time/m)
+            end
+
+            it 'fails when the message was received thrice' do
+              dbl = double(:expected_method => nil)
+              dbl.expected_method
+              dbl.expected_method
+              dbl.expected_method
+
+              expect {
+                expect(dbl).to have_received(:expected_method).twice
+              }.to raise_error(/expected: 2 times.*received: 3 times/m)
+            end
+          end
+        end
+      end
+
+      describe "expect(...).not_to have_received" do
+        it 'passes when the double has not received the given message' do
+          dbl = double_with_unmet_expectation(:expected_method)
+          expect(dbl).not_to have_received(:expected_method)
+        end
+
+        it 'fails when the double has received the given message' do
+          dbl = double_with_met_expectation(:expected_method)
+
+          expect {
+            expect(dbl).not_to have_received(:expected_method)
+          }.to raise_error(/expected: 0 times.*received: 1 time/m)
+        end
+
+        it 'fails when the method has not been previously stubbed' do
+          dbl = double
+
+          expect {
+            expect(dbl).not_to have_received(:expected_method)
+          }.to raise_error(/method has not been stubbed/)
+        end
+
+        context "with" do
+          it 'passes when the given args do not match the args used with the message' do
+            dbl = double_with_met_expectation(:expected_method, :expected, :args)
+            expect(dbl).not_to have_received(:expected_method).with(:unexpected, :args)
+          end
+
+          it 'fails when the given args match the args used with the message' do
+            dbl = double_with_met_expectation(:expected_method, :expected, :args)
+
+            expect {
+              expect(dbl).not_to have_received(:expected_method).with(:expected, :args)
+            }.to raise_error(/expected: 0 times.*received: 1 time/m) # TODO: better message
+          end
+        end
+
+        %w(exactly at_least at_most times once twice).each do |constraint|
+          it "does not allow #{constraint} to be used because it creates confusion" do
+            dbl = double_with_unmet_expectation(:expected_method)
+            expect {
+              expect(dbl).not_to have_received(:expected_method).send(constraint)
+            }.to raise_error(/can't use #{constraint} when negative/)
+          end
+        end
+      end
+
+      def double_with_met_expectation(method_name, *args)
+        double = double_with_unmet_expectation(method_name)
+        meet_expectation(double, method_name, *args)
+      end
+
+      def null_object_with_met_expectation(method_name, *args)
+        meet_expectation(double.as_null_object, method_name, *args)
+      end
+
+      def meet_expectation(double, method_name, *args)
+        double.send(method_name, *args)
+        double
+      end
+
+      def double_with_unmet_expectation(method_name)
+        double('double', method_name => true)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb b/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb
new file mode 100644
index 0000000..9e4a504
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/matchers/receive_spec.rb
@@ -0,0 +1,328 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe Matchers::Receive do
+      include_context "with syntax", :expect
+
+      def verify_all
+        ::RSpec::Mocks.space.verify_all
+      end
+
+      shared_examples_for "a receive matcher" do |*options|
+        it 'allows the caller to configure how the subject responds' do
+          wrapped.to receive(:foo).and_return(5)
+          expect(receiver.foo).to eq(5)
+        end
+
+        it 'allows the caller to constrain the received arguments' do
+          wrapped.to receive(:foo).with(:a)
+          receiver.foo(:a)
+
+          expect {
+            receiver.foo(:b)
+          }.to raise_error(/received :foo with unexpected arguments/)
+        end
+
+        it 'allows a `do...end` block implementation to be provided' do
+          wrapped.to receive(:foo) do
+            4
+          end
+
+          expect(receiver.foo).to eq(4)
+        end
+
+        it 'allows a `{ ... }` block implementation to be provided' do
+          wrapped.to receive(:foo) { 5 }
+          expect(receiver.foo).to eq(5)
+        end
+
+        it 'gives precedence to a `{ ... }` block when both forms are provided ' +
+           'since that form actually binds to `receive`' do
+          wrapped.to receive(:foo) { :curly } do
+            :do_end
+          end
+
+          expect(receiver.foo).to eq(:curly)
+        end
+
+        it 'does not support other matchers', :unless => options.include?(:allow_other_matchers) do
+          expect {
+            wrapped.to eq(3)
+          }.to raise_error(UnsupportedMatcherError)
+        end
+      end
+
+      shared_examples_for "an expect syntax allowance" do |*options|
+        include_examples "a receive matcher", *options
+
+        it 'does not expect the message to be received' do
+          wrapped.to receive(:foo)
+          expect { verify_all }.not_to raise_error
+        end
+      end
+
+      shared_examples_for "an expect syntax negative allowance" do
+        it 'is disabled since this expression is confusing' do
+          expect {
+            wrapped.not_to receive(:foo)
+          }.to raise_error(/not_to receive` is not supported/)
+
+          expect {
+            wrapped.to_not receive(:foo)
+          }.to raise_error(/to_not receive` is not supported/)
+        end
+      end
+
+      shared_examples_for "an expect syntax expectation" do |*options|
+        include_examples "a receive matcher", *options
+
+        it 'sets up a message expectation that passes if the message is received' do
+          wrapped.to receive(:foo)
+          receiver.foo
+          verify_all
+        end
+
+        it 'sets up a message expectation that fails if the message is not received' do
+          wrapped.to receive(:foo)
+
+          expect {
+            verify_all
+          }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+
+        it "reports the line number of expectation of unreceived message", :pending => options.include?(:does_not_report_line_num) do
+          expected_error_line = __LINE__; wrapped.to receive(:foo)
+
+          expect {
+            verify_all
+          }.to raise_error { |e|
+            expect(e.backtrace.first).to match(/#{File.basename(__FILE__)}:#{expected_error_line}/)
+          }
+        end
+      end
+
+      shared_examples_for "an expect syntax negative expectation" do
+        it 'sets up a negaive message expectation that passes if the message is not received' do
+          wrapped.not_to receive(:foo)
+          verify_all
+        end
+
+        it 'sets up a negative message expectation that fails if the message is received' do
+          wrapped.not_to receive(:foo)
+
+          expect {
+            receiver.foo
+          }.to raise_error(/expected: 0 times.*received: 1 time/m)
+        end
+
+        it 'supports `to_not` as an alias for `not_to`' do
+          wrapped.to_not receive(:foo)
+
+          expect {
+            receiver.foo
+          }.to raise_error(/expected: 0 times.*received: 1 time/m)
+        end
+
+        it 'allows the caller to constrain the received arguments' do
+          wrapped.not_to receive(:foo).with(:a)
+          def receiver.method_missing(*a); end # a poor man's stub...
+
+          expect {
+            receiver.foo(:b)
+          }.not_to raise_error
+
+          expect {
+            receiver.foo(:a)
+          }.to raise_error(/expected: 0 times.*received: 1 time/m)
+        end
+
+        it 'prevents confusing double-negative expressions involving `never`' do
+          expect {
+            wrapped.not_to receive(:foo).never
+          }.to raise_error(/trying to negate it again/)
+
+          expect {
+            wrapped.to_not receive(:foo).never
+          }.to raise_error(/trying to negate it again/)
+        end
+      end
+
+      describe "allow(...).to receive" do
+        include_examples "an expect syntax allowance" do
+          let(:receiver) { double }
+          let(:wrapped)  { allow(receiver) }
+        end
+      end
+
+      describe "allow(...).not_to receive" do
+        include_examples "an expect syntax negative allowance" do
+          let(:wrapped) { allow(double) }
+        end
+      end
+
+      describe "allow_any_instance_of(...).to receive" do
+        include_examples "an expect syntax allowance" do
+          let(:klass)    { Class.new }
+          let(:wrapped)  { allow_any_instance_of(klass) }
+          let(:receiver) { klass.new }
+        end
+      end
+
+      describe "allow_any_instance_of(...).not_to receive" do
+        include_examples "an expect syntax negative allowance" do
+          let(:wrapped) { allow_any_instance_of(Class.new) }
+        end
+      end
+
+      describe "expect(...).to receive" do
+        include_examples "an expect syntax expectation", :allow_other_matchers do
+          let(:receiver) { double }
+          let(:wrapped)  { expect(receiver) }
+        end
+      end
+
+      describe "expect_any_instance_of(...).to receive" do
+        include_examples "an expect syntax expectation", :does_not_report_line_num do
+          let(:klass)    { Class.new }
+          let(:wrapped)  { expect_any_instance_of(klass) }
+          let(:receiver) { klass.new }
+        end
+      end
+
+      describe "expect(...).not_to receive" do
+        include_examples "an expect syntax negative expectation" do
+          let(:receiver) { double }
+          let(:wrapped)  { expect(receiver) }
+        end
+      end
+
+      describe "expect_any_instance_of(...).not_to receive" do
+        include_examples "an expect syntax negative expectation" do
+          let(:klass)    { Class.new }
+          let(:wrapped)  { expect_any_instance_of(klass) }
+          let(:receiver) { klass.new }
+        end
+      end
+
+      shared_examples "using rspec-mocks in another test framework" do
+        it 'can use the `expect` syntax' do
+          dbl = double
+
+          framework.new.instance_eval do
+            expect(dbl).to receive(:foo).and_return(3)
+          end
+
+          expect(dbl.foo).to eq(3)
+        end
+
+        it 'expects the method to be called when `expect` is used' do
+          dbl = double
+
+          framework.new.instance_eval do
+            expect(dbl).to receive(:foo)
+          end
+
+          expect { verify dbl }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+
+        it 'supports `expect(...).not_to receive`' do
+          dbl = double
+
+          framework.new.instance_eval do
+            expect(dbl).not_to receive(:foo)
+          end
+
+          expect { dbl.foo }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+
+        it 'supports `expect(...).to_not receive`' do
+          dbl = double
+
+          framework.new.instance_eval do
+            expect(dbl).to_not receive(:foo)
+          end
+
+          expect { dbl.foo }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+      end
+
+      context "when used in a test framework without rspec-expectations" do
+        let(:framework) do
+          Class.new do
+            include RSpec::Mocks::ExampleMethods
+
+            def eq(value)
+              double("MyMatcher")
+            end
+          end
+        end
+
+        include_examples "using rspec-mocks in another test framework"
+
+        it 'cannot use `expect` with another matcher' do
+          expect {
+            framework.new.instance_eval do
+              expect(3).to eq(3)
+            end
+          }.to raise_error(/only the `receive` matcher is supported/)
+        end
+
+        it 'can toggle the available syntax' do
+          expect(framework.new).to respond_to(:expect)
+          RSpec::Mocks.configuration.syntax = :should
+          expect(framework.new).not_to respond_to(:expect)
+          RSpec::Mocks.configuration.syntax = :expect
+          expect(framework.new).to respond_to(:expect)
+        end
+
+        after { RSpec::Mocks.configuration.syntax = :expect }
+      end
+
+      context "when rspec-expectations is included in the test framework first" do
+        before do
+          # the examples here assume `expect` is define in RSpec::Matchers...
+          expect(RSpec::Matchers.method_defined?(:expect)).to be_true
+        end
+
+        let(:framework) do
+          Class.new do
+            include RSpec::Matchers
+            include RSpec::Mocks::ExampleMethods
+          end
+        end
+
+        include_examples "using rspec-mocks in another test framework"
+
+        it 'can use `expect` with any matcher' do
+          framework.new.instance_eval do
+            expect(3).to eq(3)
+          end
+        end
+      end
+
+      context "when rspec-expectations is included in the test framework last" do
+        before do
+          # the examples here assume `expect` is define in RSpec::Matchers...
+          expect(RSpec::Matchers.method_defined?(:expect)).to be_true
+        end
+
+        let(:framework) do
+          Class.new do
+            include RSpec::Mocks::ExampleMethods
+            include RSpec::Matchers
+          end
+        end
+
+        include_examples "using rspec-mocks in another test framework"
+
+        it 'can use `expect` with any matcher' do
+          framework.new.instance_eval do
+            expect(3).to eq(3)
+          end
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/methods_spec.rb b/rspec-mocks/spec/rspec/mocks/methods_spec.rb
new file mode 100644
index 0000000..0c9ce76
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/methods_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "Methods added to every object" do
+      include_context "with syntax", :expect
+
+      def added_methods
+        host = Class.new
+        orig_instance_methods = host.instance_methods
+        Syntax.enable_should(host)
+        (host.instance_methods - orig_instance_methods).map(&:to_sym)
+      end
+
+      it 'limits the number of methods that get added to all objects' do
+        # If really necessary, you can add to this list, but long term,
+        # we are hoping to cut down on the number of methods added to all objects
+        expect(added_methods).to match_array([
+          :as_null_object, :null_object?,
+          :received_message?, :should_not_receive, :should_receive,
+          :stub, :stub!, :stub_chain, :unstub, :unstub!
+        ])
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/mock_ordering_spec.rb b/rspec-mocks/spec/rspec/mocks/mock_ordering_spec.rb
new file mode 100644
index 0000000..f872189
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/mock_ordering_spec.rb
@@ -0,0 +1,103 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+
+    describe "ordering" do
+      before { @double = double("test double") }
+      after  { reset @double }
+
+      it "passes when messages are received in order" do
+        @double.should_receive(:one).ordered
+        @double.should_receive(:two).ordered
+        @double.should_receive(:three).ordered
+        @double.one
+        @double.two
+        @double.three
+      end
+
+      it "passes when messages are received in order across objects" do
+        a = double("a")
+        b = double("b")
+        a.should_receive(:one).ordered
+        b.should_receive(:two).ordered
+        a.should_receive(:three).ordered
+        a.one
+        b.two
+        a.three
+      end
+
+      it "fails when messages are received out of order (2nd message 1st)" do
+        @double.should_receive(:one).ordered
+        @double.should_receive(:two).ordered
+        expect {
+          @double.two
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :two out of order")
+      end
+
+      it "fails when messages are received out of order (3rd message 1st)" do
+        @double.should_receive(:one).ordered
+        @double.should_receive(:two).ordered
+        @double.should_receive(:three).ordered
+        @double.one
+        expect {
+          @double.three
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :three out of order")
+      end
+
+      it "fails when messages are received out of order (3rd message 2nd)" do
+        @double.should_receive(:one).ordered
+        @double.should_receive(:two).ordered
+        @double.should_receive(:three).ordered
+        @double.one
+        expect {
+          @double.three
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :three out of order")
+      end
+
+      it "fails when messages are out of order across objects" do
+        a = double("test double")
+        b = double("another test double")
+        a.should_receive(:one).ordered
+        b.should_receive(:two).ordered
+        a.should_receive(:three).ordered
+        a.one
+        expect {
+          a.three
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :three out of order")
+        reset a
+        reset b
+      end
+
+      it "ignores order of non ordered messages" do
+        @double.should_receive(:ignored_0)
+        @double.should_receive(:ordered_1).ordered
+        @double.should_receive(:ignored_1)
+        @double.should_receive(:ordered_2).ordered
+        @double.should_receive(:ignored_2)
+        @double.should_receive(:ignored_3)
+        @double.should_receive(:ordered_3).ordered
+        @double.should_receive(:ignored_4)
+        @double.ignored_3
+        @double.ordered_1
+        @double.ignored_0
+        @double.ordered_2
+        @double.ignored_4
+        @double.ignored_2
+        @double.ordered_3
+        @double.ignored_1
+        verify @double
+      end
+
+      it "supports duplicate messages" do
+        @double.should_receive(:a).ordered
+        @double.should_receive(:b).ordered
+        @double.should_receive(:a).ordered
+
+        @double.a
+        @double.b
+        @double.a
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/mock_space_spec.rb b/rspec-mocks/spec/rspec/mocks/mock_space_spec.rb
new file mode 100644
index 0000000..bd39ef9
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/mock_space_spec.rb
@@ -0,0 +1,113 @@
+require 'spec_helper'
+require 'rspec/mocks'
+
+module RSpec
+  module Mocks
+    describe Space do
+      let(:space) { RSpec::Mocks::Space.new }
+      let(:dbl_1) { Object.new }
+      let(:dbl_2) { Object.new }
+
+      before do
+        space.ensure_registered(dbl_1)
+        space.ensure_registered(dbl_2)
+      end
+
+      it "verifies all mocks within" do
+        verifies = []
+
+        space.proxy_for(dbl_1).stub(:verify) { verifies << :dbl_1 }
+        space.proxy_for(dbl_2).stub(:verify) { verifies << :dbl_2 }
+
+        space.verify_all
+
+        expect(verifies).to match_array([:dbl_1, :dbl_2])
+      end
+
+      def define_singleton_method_on_recorder_for(klass, name, &block)
+        recorder = space.any_instance_recorder_for(klass)
+        (class << recorder; self; end).send(:define_method, name, &block)
+      end
+
+      it 'verifies all any_instance recorders within' do
+        klass_1, klass_2 = Class.new, Class.new
+
+        verifies = []
+
+        # We can't `stub` a method on the recorder because it defines its own `stub`...
+        define_singleton_method_on_recorder_for(klass_1, :verify) { verifies << :klass_1 }
+        define_singleton_method_on_recorder_for(klass_2, :verify) { verifies << :klass_2 }
+
+        space.verify_all
+
+        expect(verifies).to match_array([:klass_1, :klass_2])
+      end
+
+      it "resets all mocks within" do
+        resets = []
+
+        space.proxy_for(dbl_1).stub(:reset) { resets << :dbl_1 }
+        space.proxy_for(dbl_2).stub(:reset) { resets << :dbl_2 }
+
+        space.reset_all
+
+        expect(resets).to match_array([:dbl_1, :dbl_2])
+      end
+
+      it "does not leak mock proxies between examples" do
+        expect {
+          space.reset_all
+        }.to change { space.proxies.size }.to(0)
+      end
+
+      it 'does not leak any instance recorders between examples' do
+        space.any_instance_recorder_for(Class.new)
+        expect {
+          space.reset_all
+        }.to change { space.any_instance_recorders.size }.to(0)
+      end
+
+      it "resets the ordering" do
+        space.expectation_ordering.register :some_expectation
+
+        expect {
+          space.reset_all
+        }.to change { space.expectation_ordering.empty? }.from(false).to(true)
+      end
+
+      it "only adds an instance once" do
+        m1 = double("mock1")
+
+        expect {
+          space.ensure_registered(m1)
+        }.to change { space.proxies }
+
+        expect {
+          space.ensure_registered(m1)
+        }.not_to change { space.proxies }
+      end
+
+      it 'returns a consistent any_instance_recorder for a given class' do
+        klass_1, klass_2 = Class.new, Class.new
+
+        r1 = space.any_instance_recorder_for(klass_1)
+        r2 = space.any_instance_recorder_for(klass_1)
+        r3 = space.any_instance_recorder_for(klass_2)
+
+        expect(r1).to be(r2)
+        expect(r1).not_to be(r3)
+      end
+
+      it 'removes an any_instance_recorder when requested' do
+        klass = Class.new
+
+        space.any_instance_recorder_for(klass)
+
+        expect {
+          space.remove_any_instance_recorder_for(klass)
+        }.to change { space.any_instance_recorders.size }.by(-1)
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/mock_spec.rb b/rspec-mocks/spec/rspec/mocks/mock_spec.rb
new file mode 100644
index 0000000..9bfbeda
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/mock_spec.rb
@@ -0,0 +1,798 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe Mock do
+      before(:each) { @double = double("test double") }
+      after(:each)  { reset @double }
+
+      it "has method_missing as private" do
+        expect(RSpec::Mocks::Mock.private_instance_methods).to include_method(:method_missing)
+      end
+
+      it "does not respond_to? method_missing (because it's private)" do
+        expect(RSpec::Mocks::Mock.new).not_to respond_to(:method_missing)
+      end
+
+      it "reports line number of expectation of unreceived message" do
+        expected_error_line = __LINE__; @double.should_receive(:wont_happen).with("x", 3)
+        begin
+          verify @double
+          violated
+        rescue RSpec::Mocks::MockExpectationError => e
+          # NOTE - this regexp ended w/ $, but jruby adds extra info at the end of the line
+          expect(e.backtrace[0]).to match(/#{File.basename(__FILE__)}:#{expected_error_line}/)
+        end
+      end
+
+      it "reports line number of expectation of unreceived message after #should_receive after similar stub" do
+        @double.stub(:wont_happen)
+        expected_error_line = __LINE__; @double.should_receive(:wont_happen).with("x", 3)
+        begin
+          verify @double
+          violated
+        rescue RSpec::Mocks::MockExpectationError => e
+          # NOTE - this regexp ended w/ $, but jruby adds extra info at the end of the line
+          expect(e.backtrace[0]).to match(/#{File.basename(__FILE__)}:#{expected_error_line}/)
+        end
+      end
+
+      it "passes when not receiving message specified as not to be received" do
+        @double.should_not_receive(:not_expected)
+        verify @double
+      end
+
+      it "prevents confusing double-negative expressions involving `never`" do
+        expect {
+          @double.should_not_receive(:not_expected).never
+        }.to raise_error(/trying to negate it again/)
+      end
+
+      def expect_and_return_warning
+        expect(RSpec).to receive(:deprecate).with(/`and_return` on a negative message expectation/)
+      end
+
+      it "warns when `should_not_receive().and_return` is used" do
+        expect_and_return_warning
+        @double.should_not_receive(:foo).and_return(1)
+      end
+
+      it "warns when `should_receive().never.and_return` is used" do
+        expect_and_return_warning
+        @double.should_receive(:foo).never.and_return(1)
+      end
+
+      it "warns when `expect().not_to receive().and_return` is used" do
+        expect_and_return_warning
+        expect(@double).not_to receive(:foo).and_return(1)
+      end
+
+      it "warns when `expect().to receive().never.and_return` is used" do
+        expect_and_return_warning
+        expect(@double).to receive(:foo).never.and_return(1)
+      end
+
+      it "passes when receiving message specified as not to be received with different args" do
+        @double.should_not_receive(:message).with("unwanted text")
+        @double.should_receive(:message).with("other text")
+        @double.message "other text"
+        verify @double
+      end
+
+      it "fails when receiving message specified as not to be received" do
+        @double.should_not_receive(:not_expected)
+        expect {
+          @double.not_expected
+          violated
+        }.to raise_error(
+          RSpec::Mocks::MockExpectationError,
+          %Q|(Double "test double").not_expected(no args)\n    expected: 0 times with any arguments\n    received: 1 time|
+        )
+      end
+
+      it "fails when receiving message specified as not to be received with args" do
+        @double.should_not_receive(:not_expected).with("unexpected text")
+        expect {
+          @double.not_expected("unexpected text")
+          violated
+        }.to raise_error(
+          RSpec::Mocks::MockExpectationError,
+          %Q|(Double "test double").not_expected("unexpected text")\n    expected: 0 times with arguments: ("unexpected text")\n    received: 1 time with arguments: ("unexpected text")|
+        )
+      end
+
+      it "fails when array arguments do not match" do
+        @double.should_not_receive(:not_expected).with(["do not want"])
+        expect {
+          @double.not_expected(["do not want"])
+          violated
+        }.to raise_error(
+          RSpec::Mocks::MockExpectationError,
+          %Q|(Double "test double").not_expected(["do not want"])\n    expected: 0 times with arguments: (["do not want"])\n    received: 1 time with arguments: (["do not want"])|
+        )
+      end
+
+      it "passes when receiving message specified as not to be received with wrong args" do
+        @double.should_not_receive(:not_expected).with("unexpected text")
+        @double.not_expected "really unexpected text"
+        verify @double
+
+        @double.should_receive(:not_expected).with("unexpected text").never
+        @double.not_expected "really unexpected text"
+        verify @double
+      end
+
+      it "allows block to calculate return values" do
+        @double.should_receive(:something).with("a","b","c").and_return { |a,b,c| c+b+a }
+        expect(@double.something("a","b","c")).to eq "cba"
+        verify @double
+      end
+
+      it "allows parameter as return value" do
+        @double.should_receive(:something).with("a","b","c").and_return("booh")
+        expect(@double.something("a","b","c")).to eq "booh"
+        verify @double
+      end
+
+      it "returns the previously stubbed value if no return value is set" do
+        @double.stub(:something).with("a","b","c").and_return(:stubbed_value)
+        @double.should_receive(:something).with("a","b","c")
+        expect(@double.something("a","b","c")).to eq :stubbed_value
+        verify @double
+      end
+
+      it "returns nil if no return value is set and there is no previously stubbed value" do
+        @double.should_receive(:something).with("a","b","c")
+        expect(@double.something("a","b","c")).to be_nil
+        verify @double
+      end
+
+      it "raises exception if args don't match when method called" do
+        @double.should_receive(:something).with("a","b","c").and_return("booh")
+        expect {
+          @double.something("a","d","c")
+          violated
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n  expected: (\"a\", \"b\", \"c\")\n       got: (\"a\", \"d\", \"c\")")
+      end
+
+      describe "even when a similar expectation with different arguments exist" do
+        it "raises exception if args don't match when method called, correctly reporting the offending arguments" do
+          @double.should_receive(:something).with("a","b","c").once
+          @double.should_receive(:something).with("z","x","c").once
+          expect {
+            @double.something("a","b","c")
+            @double.something("z","x","g")
+          }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n  expected: (\"z\", \"x\", \"c\")\n       got: (\"z\", \"x\", \"g\")")
+        end
+      end
+
+      it "raises exception if args don't match when method called even when the method is stubbed" do
+        @double.stub(:something)
+        @double.should_receive(:something).with("a","b","c")
+        expect {
+          @double.something("a","d","c")
+          verify @double
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n  expected: (\"a\", \"b\", \"c\")\n       got: (\"a\", \"d\", \"c\")")
+      end
+
+      it "raises exception if args don't match when method called even when using null_object" do
+        @double = double("test double").as_null_object
+        @double.should_receive(:something).with("a","b","c")
+        expect {
+          @double.something("a","d","c")
+          verify @double
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n  expected: (\"a\", \"b\", \"c\")\n       got: (\"a\", \"d\", \"c\")")
+      end
+
+      describe 'with a method that has a default argument' do
+        it "raises an exception if the arguments don't match when the method is called, correctly reporting the offending arguments" do
+          def @double.method_with_default_argument(arg={}); end
+          @double.should_receive(:method_with_default_argument).with({})
+
+          expect {
+            @double.method_with_default_argument(nil)
+            verify @double
+          }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :method_with_default_argument with unexpected arguments\n  expected: ({})\n       got: (nil)")
+        end
+      end
+
+      it "fails if unexpected method called" do
+        expect {
+          @double.something("a","b","c")
+          violated
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received unexpected message :something with (\"a\", \"b\", \"c\")")
+      end
+
+      it "uses block for expectation if provided" do
+        @double.should_receive(:something) do | a, b |
+          expect(a).to eq "a"
+          expect(b).to eq "b"
+          "booh"
+        end
+        expect(@double.something("a", "b")).to eq "booh"
+        verify @double
+      end
+
+      it "fails if expectation block fails" do
+        @double.should_receive(:something) do |bool|
+          expect(bool).to be_true
+        end
+
+        expect {
+          @double.something false
+        }.to raise_error(RSpec::Expectations::ExpectationNotMetError)
+      end
+
+      it "is wrappable in an array" do
+        expect( Array(@double) ).to eq([@double])
+      end
+
+      it "is wrappable in an array when a null object" do
+        expect( Array(@double.as_null_object) ).to eq [@double]
+      end
+
+      it "responds to to_ary as a null object" do
+        expect(@double.as_null_object.to_ary).to eq nil
+      end
+
+      it "responds to to_a as a null object" do
+        if RUBY_VERSION.to_f > 1.8
+          expect(@double.as_null_object.to_a).to eq nil
+        else
+          expect(@double.as_null_object.to_a).to eq [@double]
+        end
+      end
+
+      it "passes proc to expectation block without an argument" do
+        @double.should_receive(:foo) { |&block| expect(block.call).to eq(:bar) }
+        @double.foo { :bar }
+      end
+
+      context "with Ruby > 1.8.6", :unless => RUBY_VERSION.to_s == '1.8.6' do
+        it "passes proc to expectation block without an argument" do
+          # We eval this because Ruby 1.8.6's syntax parser barfs on { |&block| ... }
+          # and prevents the entire spec suite from running.
+          eval("@double.should_receive(:foo) {|&block| expect(block.call).to eq(:bar)}")
+          @double.foo { :bar }
+        end
+
+        it "passes proc to expectation block with an argument" do
+          eval("@double.should_receive(:foo) {|arg, &block| expect(block.call).to eq(:bar)}")
+          @double.foo(:arg) { :bar }
+        end
+
+        it "passes proc to stub block without an argurment" do
+          eval("@double.stub(:foo) {|&block| expect(block.call).to eq(:bar)}")
+          @double.foo { :bar }
+        end
+
+        it "passes proc to stub block with an argument" do
+          eval("@double.stub(:foo) {|arg, &block| expect(block.call).to eq(:bar)}")
+          @double.foo(:arg) { :bar }
+        end
+      end
+
+      it "fails right away when method defined as never is received" do
+        @double.should_receive(:not_expected).never
+        expect { @double.not_expected }.
+          to raise_error(RSpec::Mocks::MockExpectationError,
+                         %Q|(Double "test double").not_expected(no args)\n    expected: 0 times with any arguments\n    received: 1 time|
+        )
+      end
+
+      it "raises RuntimeError by default" do
+        @double.should_receive(:something).and_raise
+        expect { @double.something }.to raise_error(RuntimeError)
+      end
+
+      it "raises RuntimeError with a message by default" do
+        @double.should_receive(:something).and_raise("error message")
+        expect { @double.something }.to raise_error(RuntimeError, "error message")
+      end
+
+      it "raises an exception of a given type without an error message" do
+        @double.should_receive(:something).and_raise(StandardError)
+        expect { @double.something }.to raise_error(StandardError)
+      end
+
+      it "raises an exception of a given type with a message" do
+        @double.should_receive(:something).and_raise(RuntimeError, "error message")
+        expect { @double.something }.to raise_error(RuntimeError, "error message")
+      end
+
+      it "raises a given instance of an exception" do
+        @double.should_receive(:something).and_raise(RuntimeError.new("error message"))
+        expect { @double.something }.to raise_error(RuntimeError, "error message")
+      end
+
+      class OutOfGas < StandardError
+        attr_reader :amount, :units
+        def initialize(amount, units)
+          @amount = amount
+          @units  = units
+        end
+      end
+
+      it "raises a given instance of an exception with arguments other than the standard 'message'" do
+        @double.should_receive(:something).and_raise(OutOfGas.new(2, :oz))
+
+        begin
+          @double.something
+          fail "OutOfGas was not raised"
+        rescue OutOfGas => e
+          expect(e.amount).to eq 2
+          expect(e.units).to eq :oz
+        end
+      end
+
+      it "does not raise when told to if args dont match" do
+        @double.should_receive(:something).with(2).and_raise(RuntimeError)
+        expect {
+          @double.something 1
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "throws when told to" do
+        @double.should_receive(:something).and_throw(:blech)
+        expect {
+          @double.something
+        }.to throw_symbol(:blech)
+      end
+
+      it "ignores args on any args" do
+        @double.should_receive(:something).at_least(:once).with(any_args)
+        @double.something
+        @double.something 1
+        @double.something "a", 2
+        @double.something [], {}, "joe", 7
+        verify @double
+      end
+
+      it "fails on no args if any args received" do
+        @double.should_receive(:something).with(no_args())
+        expect {
+          @double.something 1
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n  expected: (no args)\n       got: (1)")
+      end
+
+      it "fails when args are expected but none are received" do
+        @double.should_receive(:something).with(1)
+        expect {
+          @double.something
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" received :something with unexpected arguments\n  expected: (1)\n       got: (no args)")
+      end
+
+      it "returns value from block by default" do
+        @double.stub(:method_that_yields).and_yield
+        value = @double.method_that_yields { :returned_obj }
+        expect(value).to eq :returned_obj
+        verify @double
+      end
+
+      it "yields 0 args to blocks that take a variable number of arguments" do
+        @double.should_receive(:yield_back).with(no_args()).once.and_yield
+        a = nil
+        @double.yield_back {|*x| a = x}
+        expect(a).to eq []
+        verify @double
+      end
+
+      it "yields 0 args multiple times to blocks that take a variable number of arguments" do
+        @double.should_receive(:yield_back).once.with(no_args()).once.and_yield.
+                                                                    and_yield
+        b = []
+        @double.yield_back {|*a| b << a}
+        expect(b).to eq [ [], [] ]
+        verify @double
+      end
+
+      it "yields one arg to blocks that take a variable number of arguments" do
+        @double.should_receive(:yield_back).with(no_args()).once.and_yield(99)
+        a = nil
+        @double.yield_back {|*x| a = x}
+        expect(a).to eq [99]
+        verify @double
+      end
+
+      it "yields one arg 3 times consecutively to blocks that take a variable number of arguments" do
+        @double.should_receive(:yield_back).once.with(no_args()).once.and_yield(99).
+                                                                    and_yield(43).
+                                                                    and_yield("something fruity")
+        b = []
+        @double.yield_back {|*a| b << a}
+        expect(b).to eq [[99], [43], ["something fruity"]]
+        verify @double
+      end
+
+      it "yields many args to blocks that take a variable number of arguments" do
+        @double.should_receive(:yield_back).with(no_args()).once.and_yield(99, 27, "go")
+        a = nil
+        @double.yield_back {|*x| a = x}
+        expect(a).to eq [99, 27, "go"]
+        verify @double
+      end
+
+      it "yields many args 3 times consecutively to blocks that take a variable number of arguments" do
+        @double.should_receive(:yield_back).once.with(no_args()).once.and_yield(99, :green, "go").
+                                                                    and_yield("wait", :amber).
+                                                                    and_yield("stop", 12, :red)
+        b = []
+        @double.yield_back {|*a| b << a}
+        expect(b).to eq [[99, :green, "go"], ["wait", :amber], ["stop", 12, :red]]
+        verify @double
+      end
+
+      it "yields single value" do
+        @double.should_receive(:yield_back).with(no_args()).once.and_yield(99)
+        a = nil
+        @double.yield_back {|x| a = x}
+        expect(a).to eq 99
+        verify @double
+      end
+
+      it "yields single value 3 times consecutively" do
+        @double.should_receive(:yield_back).once.with(no_args()).once.and_yield(99).
+                                                                    and_yield(43).
+                                                                    and_yield("something fruity")
+        b = []
+        @double.yield_back {|a| b << a}
+        expect(b).to eq [99, 43, "something fruity"]
+        verify @double
+      end
+
+      it "yields two values" do
+        @double.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
+        a, b = nil
+        @double.yield_back {|x,y| a=x; b=y}
+        expect(a).to eq 'wha'
+        expect(b).to eq 'zup'
+        verify @double
+      end
+
+      it "yields two values 3 times consecutively" do
+        @double.should_receive(:yield_back).once.with(no_args()).once.and_yield('wha', 'zup').
+                                                                    and_yield('not', 'down').
+                                                                    and_yield(14, 65)
+        c = []
+        @double.yield_back {|a,b| c << [a, b]}
+        expect(c).to eq [['wha', 'zup'], ['not', 'down'], [14, 65]]
+        verify @double
+      end
+
+      it "fails when calling yielding method with wrong arity" do
+        @double.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
+        expect {
+          @double.yield_back {|a|}
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" yielded |\"wha\", \"zup\"| to block with arity of 1")
+      end
+
+      it "fails when calling yielding method consecutively with wrong arity" do
+        @double.should_receive(:yield_back).once.with(no_args()).once.and_yield('wha', 'zup').
+                                                                    and_yield('down').
+                                                                    and_yield(14, 65)
+        expect {
+          c = []
+          @double.yield_back {|a,b| c << [a, b]}
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" yielded |\"down\"| to block with arity of 2")
+      end
+
+      it "fails when calling yielding method without block" do
+        @double.should_receive(:yield_back).with(no_args()).once.and_yield('wha', 'zup')
+        expect {
+          @double.yield_back
+        }.to raise_error(RSpec::Mocks::MockExpectationError, "Double \"test double\" asked to yield |[\"wha\", \"zup\"]| but no block was passed")
+      end
+
+      it "is able to double send" do
+        @double.should_receive(:send).with(any_args)
+        @double.send 'hi'
+        verify @double
+      end
+
+      it "is able to raise from method calling yielding double" do
+        @double.should_receive(:yield_me).and_yield 44
+
+        expect {
+          @double.yield_me do |x|
+            raise "Bang"
+          end
+        }.to raise_error(StandardError, "Bang")
+
+        verify @double
+      end
+
+      it "clears expectations after verify" do
+        @double.should_receive(:foobar)
+        @double.foobar
+        verify @double
+        expect {
+          @double.foobar
+        }.to raise_error(RSpec::Mocks::MockExpectationError, %q|Double "test double" received unexpected message :foobar with (no args)|)
+      end
+
+      it "restores objects to their original state on rspec_reset" do
+        double = double("this is a double")
+        double.should_receive(:blah)
+        reset double
+        verify double #should throw if reset didn't work
+      end
+
+      it "works even after method_missing starts raising NameErrors instead of NoMethodErrors" do
+        # Object#method_missing throws either NameErrors or NoMethodErrors.
+        #
+        # On a fresh ruby program Object#method_missing:
+        #  * raises a NoMethodError when called directly
+        #  * raises a NameError when called indirectly
+        #
+        # Once Object#method_missing has been called at least once (on any object)
+        # it starts behaving differently:
+        #  * raises a NameError when called directly
+        #  * raises a NameError when called indirectly
+        #
+        # There was a bug in Mock#method_missing that relied on the fact
+        # that calling Object#method_missing directly raises a NoMethodError.
+        # This example tests that the bug doesn't exist anymore.
+
+
+        # Ensures that method_missing always raises NameErrors.
+        a_method_that_doesnt_exist rescue
+
+
+        @double.should_receive(:foobar)
+        @double.foobar
+        verify @double
+
+        expect { @double.foobar }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "temporarily replaces a method stub on a double" do
+        @double.stub(:msg).and_return(:stub_value)
+        @double.should_receive(:msg).with(:arg).and_return(:double_value)
+        expect(@double.msg(:arg)).to equal(:double_value)
+        expect(@double.msg).to equal(:stub_value)
+        expect(@double.msg).to equal(:stub_value)
+        verify @double
+      end
+
+      it "does not require a different signature to replace a method stub" do
+        @double.stub(:msg).and_return(:stub_value)
+        @double.should_receive(:msg).and_return(:double_value)
+        expect(@double.msg(:arg)).to equal(:double_value)
+        expect(@double.msg).to equal(:stub_value)
+        expect(@double.msg).to equal(:stub_value)
+        verify @double
+      end
+
+      it "raises an error when a previously stubbed method has a negative expectation" do
+        @double.stub(:msg).and_return(:stub_value)
+        @double.should_not_receive(:msg)
+        expect { @double.msg(:arg) }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "temporarily replaces a method stub on a non-double" do
+        non_double = Object.new
+        non_double.stub(:msg).and_return(:stub_value)
+        non_double.should_receive(:msg).with(:arg).and_return(:double_value)
+        expect(non_double.msg(:arg)).to equal(:double_value)
+        expect(non_double.msg).to equal(:stub_value)
+        expect(non_double.msg).to equal(:stub_value)
+        verify non_double
+      end
+
+      it "returns the stubbed value when no new value specified" do
+        @double.stub(:msg).and_return(:stub_value)
+        @double.should_receive(:msg)
+        expect(@double.msg).to equal(:stub_value)
+        verify @double
+      end
+
+      it "returns the stubbed value when stubbed with args and no new value specified" do
+        @double.stub(:msg).with(:arg).and_return(:stub_value)
+        @double.should_receive(:msg).with(:arg)
+        expect(@double.msg(:arg)).to equal(:stub_value)
+        verify @double
+      end
+
+      it "does not mess with the stub's yielded values when also doubleed" do
+        @double.stub(:yield_back).and_yield(:stub_value)
+        @double.should_receive(:yield_back).and_yield(:double_value)
+        @double.yield_back{|v| expect(v).to eq :double_value }
+        @double.yield_back{|v| expect(v).to eq :stub_value }
+        verify @double
+      end
+
+      it "can yield multiple times when told to do so" do
+        @double.stub(:foo).and_yield(:stub_value)
+        @double.should_receive(:foo).and_yield(:first_yield).and_yield(:second_yield)
+
+        expect { |b| @double.foo(&b) }.to yield_successive_args(:first_yield, :second_yield)
+        expect { |b| @double.foo(&b) }.to yield_with_args(:stub_value)
+
+        verify @double
+      end
+
+      it "assigns stub return values" do
+        double = RSpec::Mocks::Mock.new('name', :message => :response)
+        expect(double.message).to eq :response
+      end
+
+    end
+
+    describe "a double message receiving a block" do
+      before(:each) do
+        @double = double("double")
+        @calls = 0
+      end
+
+      def add_call
+        @calls = @calls + 1
+      end
+
+      it "calls the block after #should_receive" do
+        @double.should_receive(:foo) { add_call }
+
+        @double.foo
+
+        expect(@calls).to eq 1
+      end
+
+      it "calls the block after #should_receive after a similar stub" do
+        @double.stub(:foo).and_return(:bar)
+        @double.should_receive(:foo) { add_call }
+
+        @double.foo
+
+        expect(@calls).to eq 1
+      end
+
+      it "calls the block after #once" do
+        @double.should_receive(:foo).once { add_call }
+
+        @double.foo
+
+        expect(@calls).to eq 1
+      end
+
+      it "calls the block after #twice" do
+        @double.should_receive(:foo).twice { add_call }
+
+        @double.foo
+        @double.foo
+
+        expect(@calls).to eq 2
+      end
+
+      it "calls the block after #times" do
+        @double.should_receive(:foo).exactly(10).times { add_call }
+
+        (1..10).each { @double.foo }
+
+        expect(@calls).to eq 10
+      end
+
+      it "calls the block after #any_number_of_times" do
+        expect(RSpec).to receive(:deprecate).with("any_number_of_times", :replacement => "stub")
+
+        @double.should_receive(:foo).any_number_of_times { add_call }
+
+        (1..7).each { @double.foo }
+
+        expect(@calls).to eq 7
+      end
+
+      it "calls the block after #ordered" do
+        @double.should_receive(:foo).ordered { add_call }
+        @double.should_receive(:bar).ordered { add_call }
+
+        @double.foo
+        @double.bar
+
+        expect(@calls).to eq 2
+      end
+    end
+
+    describe 'string representation generated by #to_s' do
+      it 'does not contain < because that might lead to invalid HTML in some situations' do
+        double = double("Dog")
+        valid_html_str = "#{double}"
+        expect(valid_html_str).not_to include('<')
+      end
+    end
+
+    describe "string representation generated by #to_str" do
+      it "looks the same as #to_s" do
+        double = double("Foo")
+        expect(double.to_str).to eq double.to_s
+      end
+    end
+
+    describe "double created with no name" do
+      it "does not use a name in a failure message" do
+        double = double()
+        expect {double.foo}.to raise_error(/Double received/)
+      end
+
+      it "does respond to initially stubbed methods" do
+        double = double(:foo => "woo", :bar => "car")
+        expect(double.foo).to eq "woo"
+        expect(double.bar).to eq "car"
+      end
+    end
+
+    describe "==" do
+      it "sends '== self' to the comparison object" do
+        first = double('first')
+        second = double('second')
+
+        first.should_receive(:==).with(second)
+        second == first
+      end
+    end
+
+    describe "with" do
+      before { @double = double('double') }
+      context "with args" do
+        context "with matching args" do
+          it "passes" do
+            @double.should_receive(:foo).with('bar')
+            @double.foo('bar')
+          end
+        end
+
+        context "with non-matching args" do
+          it "fails" do
+            @double.should_receive(:foo).with('bar')
+            expect do
+              @double.foo('baz')
+            end.to raise_error
+            reset @double
+          end
+        end
+
+        context "with non-matching doubles" do
+          it "fails" do
+            d1 = double('1')
+            d2 = double('2')
+            @double.should_receive(:foo).with(d1)
+            expect do
+              @double.foo(d2)
+            end.to raise_error
+            reset @double
+          end
+        end
+
+        context "with non-matching doubles as_null_object" do
+          it "fails" do
+            d1 = double('1').as_null_object
+            d2 = double('2').as_null_object
+            @double.should_receive(:foo).with(d1)
+            expect do
+              @double.foo(d2)
+            end.to raise_error
+            reset @double
+          end
+        end
+      end
+
+      context "with a block" do
+        context "with matching args" do
+          it "returns the result of the block" do
+            @double.should_receive(:foo).with('bar') { 'baz' }
+            expect(@double.foo('bar')).to eq('baz')
+          end
+        end
+
+        context "with non-matching args" do
+          it "fails" do
+            @double.should_receive(:foo).with('bar') { 'baz' }
+            expect do
+              expect(@double.foo('wrong')).to eq('baz')
+            end.to raise_error(/received :foo with unexpected arguments/)
+            reset @double
+          end
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/multiple_return_value_spec.rb b/rspec-mocks/spec/rspec/mocks/multiple_return_value_spec.rb
new file mode 100644
index 0000000..9c15fed
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/multiple_return_value_spec.rb
@@ -0,0 +1,132 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "a double stubbed with multiple return values" do
+      let(:a_double) { double }
+
+      before do
+        a_double.stub(:foo).and_return(:val_1, nil)
+      end
+
+      it 'can still set a message expectation with a single return value' do
+        a_double.should_receive(:foo).once.and_return(:val_1)
+        expect(a_double.foo).to eq(:val_1)
+      end
+    end
+
+    describe "a message expectation with multiple return values and no specified count" do
+      before(:each) do
+        @double = double
+        @return_values = [1,2,3]
+        @double.should_receive(:do_something).and_return(@return_values[0], at return_values[1], at return_values[2])
+      end
+
+      it "returns values in order" do
+        expect(@double.do_something).to eq @return_values[0]
+        expect(@double.do_something).to eq @return_values[1]
+        expect(@double.do_something).to eq @return_values[2]
+        verify @double
+      end
+
+      it "falls back to a previously stubbed value" do
+        @double.stub :do_something => :stub_result
+        expect(@double.do_something).to eq @return_values[0]
+        expect(@double.do_something).to eq @return_values[1]
+        expect(@double.do_something).to eq @return_values[2]
+        expect(@double.do_something).to eq :stub_result
+      end
+
+      it "fails when there are too few calls (if there is no stub)" do
+        @double.do_something
+        @double.do_something
+        expect { verify @double }.to raise_error
+      end
+
+      it "fails when there are too many calls (if there is no stub)" do
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        expect { verify @double }.to raise_error
+      end
+    end
+
+    describe "a message expectation with multiple return values with a specified count equal to the number of values" do
+      before(:each) do
+        @double = double
+        @return_values = [1,2,3]
+        @double.should_receive(:do_something).exactly(3).times.and_return(@return_values[0], at return_values[1], at return_values[2])
+      end
+
+      it "returns values in order to consecutive calls" do
+        expect(@double.do_something).to eq @return_values[0]
+        expect(@double.do_something).to eq @return_values[1]
+        expect(@double.do_something).to eq @return_values[2]
+        verify @double
+      end
+    end
+
+    describe "a message expectation with multiple return values specifying at_least less than the number of values" do
+      before(:each) do
+        @double = double
+        @double.should_receive(:do_something).at_least(:twice).with(no_args).and_return(11, 22)
+      end
+
+      it "uses the last return value for subsequent calls" do
+        expect(@double.do_something).to equal(11)
+        expect(@double.do_something).to equal(22)
+        expect(@double.do_something).to equal(22)
+        verify @double
+      end
+
+      it "fails when called less than the specified number" do
+        expect(@double.do_something).to equal(11)
+        expect { verify @double }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      context "when method is stubbed too" do
+        before { @double.stub(:do_something).and_return :stub_result }
+
+        it "uses the last value for subsequent calls" do
+          expect(@double.do_something).to equal(11)
+          expect(@double.do_something).to equal(22)
+          expect(@double.do_something).to equal(22)
+          verify @double
+        end
+
+        it "fails when called less than the specified number" do
+          expect(@double.do_something).to equal(11)
+          expect { verify @double }.to raise_error(RSpec::Mocks::MockExpectationError)
+        end
+      end
+    end
+
+    describe "a message expectation with multiple return values with a specified count larger than the number of values" do
+      before(:each) do
+        @double = RSpec::Mocks::Mock.new("double")
+        @double.should_receive(:do_something).exactly(3).times.and_return(11, 22)
+      end
+
+      it "uses the last return value for subsequent calls" do
+        expect(@double.do_something).to equal(11)
+        expect(@double.do_something).to equal(22)
+        expect(@double.do_something).to equal(22)
+        verify @double
+      end
+
+      it "fails when called less than the specified number" do
+        @double.do_something
+        @double.do_something
+        expect { verify @double }.to raise_error
+      end
+
+      it "fails fast when called greater than the specified number" do
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        expect { @double.do_something }.to raise_error
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/mutate_const_spec.rb b/rspec-mocks/spec/rspec/mocks/mutate_const_spec.rb
new file mode 100644
index 0000000..b2abe83
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/mutate_const_spec.rb
@@ -0,0 +1,501 @@
+require 'spec_helper'
+
+TOP_LEVEL_VALUE_CONST = 7
+
+class TestClass
+  M = :m
+  N = :n
+
+  class Nested
+    class NestedEvenMore
+    end
+  end
+end
+
+class TestClassThatDefinesSend
+  C = :c
+
+  def self.send
+  end
+end
+
+class TestSubClass < TestClass
+  P = :p
+end
+
+module RSpec
+  module Mocks
+    describe "Constant Mutating" do
+      include RSpec::Mocks::RecursiveConstMethods
+
+      def reset_rspec_mocks
+        ::RSpec::Mocks.space.reset_all
+      end
+
+      shared_context "constant example methods" do |const_name|
+        define_method :const do
+          recursive_const_get(const_name)
+        end
+
+        define_method :parent_const do
+          recursive_const_get("Object::" + const_name.sub(/(::)?[^:]+\z/, ''))
+        end
+
+        define_method :last_const_part do
+          const_name.split('::').last
+        end
+      end
+
+      shared_examples_for "loaded constant stubbing" do |const_name|
+        include_context "constant example methods", const_name
+
+        let!(:original_const_value) { const }
+        after { change_const_value_to(original_const_value) }
+
+        def change_const_value_to(value)
+          parent_const.__send__(:remove_const, last_const_part)
+          parent_const.const_set(last_const_part, value)
+        end
+
+        it 'allows it to be stubbed' do
+          expect(const).not_to eq(7)
+          stub_const(const_name, 7)
+          expect(const).to eq(7)
+        end
+
+        it 'resets it to its original value when rspec clears its mocks' do
+          original_value = const
+          expect(original_value).not_to eq(:a)
+          stub_const(const_name, :a)
+          reset_rspec_mocks
+          expect(const).to be(original_value)
+        end
+
+        it 'returns the stubbed value' do
+          expect(stub_const(const_name, 7)).to eq(7)
+        end
+      end
+
+      shared_examples_for "loaded constant hiding" do |const_name|
+        before do
+          expect(recursive_const_defined?(const_name)).to be_true
+        end
+
+        it 'allows it to be hidden' do
+          hide_const(const_name)
+          expect(recursive_const_defined?(const_name)).to be_false
+        end
+
+        it 'resets the constant when rspec clear its mocks' do
+          hide_const(const_name)
+          reset_rspec_mocks
+          expect(recursive_const_defined?(const_name)).to be_true
+        end
+
+        it 'returns nil' do
+          expect(hide_const(const_name)).to be_nil
+        end
+      end
+
+      shared_examples_for "unloaded constant stubbing" do |const_name|
+        include_context "constant example methods", const_name
+
+        before do
+          expect(recursive_const_defined?(const_name)).to be_false
+        end
+
+        it 'allows it to be stubbed' do
+          stub_const(const_name, 7)
+          expect(const).to eq(7)
+        end
+
+        it 'removes the constant when rspec clears its mocks' do
+          stub_const(const_name, 7)
+          reset_rspec_mocks
+          expect(recursive_const_defined?(const_name)).to be_false
+        end
+
+        it 'returns the stubbed value' do
+          expect(stub_const(const_name, 7)).to eq(7)
+        end
+
+        it 'ignores the :transfer_nested_constants option if passed' do
+          stub = Module.new
+          stub_const(const_name, stub, :transfer_nested_constants => true)
+          expect(stub.constants).to eq([])
+        end
+      end
+
+      shared_examples_for "unloaded constant hiding" do |const_name|
+        include_context "constant example methods", const_name
+
+        before do
+          expect(recursive_const_defined?(const_name)).to be_false
+        end
+
+        it 'allows it to be hidden, though the operation has no effect' do
+          hide_const(const_name)
+          expect(recursive_const_defined?(const_name)).to be_false
+        end
+
+        it 'remains undefined after rspec clears its mocks' do
+          hide_const(const_name)
+          reset_rspec_mocks
+          expect(recursive_const_defined?(const_name)).to be_false
+        end
+
+        it 'returns nil' do
+          expect(hide_const(const_name)).to be_nil
+        end
+      end
+
+      describe "#hide_const" do
+        context "for a loaded constant nested in a module that redefines `send`" do
+          it_behaves_like "loaded constant hiding", "TestClassThatDefinesSend::C"
+        end
+
+
+        context 'for a loaded nested constant' do
+          it_behaves_like "loaded constant hiding", "TestClass::Nested"
+        end
+
+        context 'for a loaded constant prefixed with ::' do
+          it_behaves_like 'loaded constant hiding', "::TestClass"
+        end
+
+        context 'for an unloaded constant with nested name that matches a top-level constant' do
+          it_behaves_like "unloaded constant hiding", "TestClass::Hash"
+
+          it 'does not hide the top-level constant' do
+            top_level_hash = ::Hash
+
+            hide_const("TestClass::Hash")
+            expect(::Hash).to equal(top_level_hash)
+          end
+
+          it 'does not affect the ability to access the top-level constant from nested contexts', :silence_warnings do
+            top_level_hash = ::Hash
+
+            hide_const("TestClass::Hash")
+            expect(TestClass::Hash).to equal(top_level_hash)
+          end
+        end
+
+        context 'for a loaded deeply nested constant' do
+          it_behaves_like "loaded constant hiding", "TestClass::Nested::NestedEvenMore"
+        end
+
+        context 'for an unloaded unnested constant' do
+          it_behaves_like "unloaded constant hiding", "X"
+        end
+
+        context 'for an unloaded nested constant' do
+          it_behaves_like "unloaded constant hiding", "X::Y"
+        end
+
+        it 'can be hidden multiple times but still restores the original value properly' do
+          orig_value = TestClass
+          hide_const("TestClass")
+          hide_const("TestClass")
+
+          reset_rspec_mocks
+          expect(TestClass).to be(orig_value)
+        end
+
+        it 'allows a constant to be hidden, then stubbed, restoring it to its original value properly' do
+          orig_value = TOP_LEVEL_VALUE_CONST
+
+          hide_const("TOP_LEVEL_VALUE_CONST")
+          expect(recursive_const_defined?("TOP_LEVEL_VALUE_CONST")).to be_false
+
+          stub_const("TOP_LEVEL_VALUE_CONST", 12345)
+          expect(TOP_LEVEL_VALUE_CONST).to eq 12345
+
+          reset_rspec_mocks
+          expect(TOP_LEVEL_VALUE_CONST).to eq orig_value
+        end
+      end
+
+      describe "#stub_const" do
+        context "for a loaded constant nested in a module that redefines `send`" do
+          it_behaves_like "loaded constant stubbing", "TestClassThatDefinesSend::C"
+        end
+
+        context 'for a loaded unnested constant' do
+          it_behaves_like "loaded constant stubbing", "TestClass"
+
+          it 'can be stubbed multiple times but still restores the original value properly' do
+            orig_value = TestClass
+            stub1, stub2 = Module.new, Module.new
+            stub_const("TestClass", stub1)
+            stub_const("TestClass", stub2)
+
+            reset_rspec_mocks
+            expect(TestClass).to be(orig_value)
+          end
+
+          it 'allows nested constants to be transferred to a stub module' do
+            tc_nested = TestClass::Nested
+            stub = Module.new
+            stub_const("TestClass", stub, :transfer_nested_constants => true)
+            expect(stub::M).to eq(:m)
+            expect(stub::N).to eq(:n)
+            expect(stub::Nested).to be(tc_nested)
+          end
+
+          it 'does not transfer nested constants that are inherited from a superclass' do
+            stub = Module.new
+            stub_const("TestSubClass", stub, :transfer_nested_constants => true)
+            expect(stub::P).to eq(:p)
+            expect(defined?(stub::M)).to be_false
+            expect(defined?(stub::N)).to be_false
+          end
+
+          it 'raises an error when asked to transfer a nested inherited constant' do
+            original_tsc = TestSubClass
+
+            expect {
+              stub_const("TestSubClass", Module.new, :transfer_nested_constants => [:M])
+            }.to raise_error(ArgumentError)
+
+            expect(TestSubClass).to be(original_tsc)
+          end
+
+          it 'allows nested constants to be selectively transferred to a stub module' do
+            stub = Module.new
+            stub_const("TestClass", stub, :transfer_nested_constants => [:M, :N])
+            expect(stub::M).to eq(:m)
+            expect(stub::N).to eq(:n)
+            expect(defined?(stub::Nested)).to be_false
+          end
+
+          it 'raises an error if asked to transfer nested constants but given an object that does not support them' do
+            original_tc = TestClass
+            stub = Object.new
+            expect {
+              stub_const("TestClass", stub, :transfer_nested_constants => true)
+            }.to raise_error(ArgumentError)
+
+            expect(TestClass).to be(original_tc)
+
+            expect {
+              stub_const("TestClass", stub, :transfer_nested_constants => [:M])
+            }.to raise_error(ArgumentError)
+
+            expect(TestClass).to be(original_tc)
+          end
+
+          it 'raises an error if asked to transfer nested constants on a constant that does not support nested constants' do
+            stub = Module.new
+            expect {
+              stub_const("TOP_LEVEL_VALUE_CONST", stub, :transfer_nested_constants => true)
+            }.to raise_error(ArgumentError)
+
+            expect(TOP_LEVEL_VALUE_CONST).to eq(7)
+
+            expect {
+              stub_const("TOP_LEVEL_VALUE_CONST", stub, :transfer_nested_constants => [:M])
+            }.to raise_error(ArgumentError)
+
+            expect(TOP_LEVEL_VALUE_CONST).to eq(7)
+          end
+
+          it 'raises an error if asked to transfer a nested constant that is not defined' do
+            original_tc = TestClass
+            expect(defined?(TestClass::V)).to be_false
+            stub = Module.new
+
+            expect {
+              stub_const("TestClass", stub, :transfer_nested_constants => [:V])
+            }.to raise_error(/cannot transfer nested constant.*V/i)
+
+            expect(TestClass).to be(original_tc)
+          end
+        end
+
+        context 'for a loaded nested constant' do
+          it_behaves_like "loaded constant stubbing", "TestClass::Nested"
+        end
+
+        context 'for a loaded constant prefixed with ::' do
+          it_behaves_like 'loaded constant stubbing', "::TestClass"
+        end
+
+        context 'for an unloaded constant prefixed with ::' do
+          it_behaves_like 'unloaded constant stubbing', "::SomeUndefinedConst"
+        end
+
+        context "for an unloaded constant nested in a module that redefines `send`" do
+          it_behaves_like 'unloaded constant stubbing', "TestClassThatDefinesSend::SomeUndefinedConst"
+        end
+
+        context 'for an unloaded constant with nested name that matches a top-level constant' do
+          it_behaves_like "unloaded constant stubbing", "TestClass::Hash"
+        end
+
+        context 'for a loaded deeply nested constant' do
+          it_behaves_like "loaded constant stubbing", "TestClass::Nested::NestedEvenMore"
+        end
+
+        context 'for an unloaded unnested constant' do
+          it_behaves_like "unloaded constant stubbing", "X"
+        end
+
+        context 'for an unloaded nested constant' do
+          it_behaves_like "unloaded constant stubbing", "X::Y"
+
+          it 'removes the root constant when rspec clears its mocks' do
+            expect(defined?(X)).to be_false
+            stub_const("X::Y", 7)
+            reset_rspec_mocks
+            expect(defined?(X)).to be_false
+          end
+        end
+
+        context 'for an unloaded deeply nested constant' do
+          it_behaves_like "unloaded constant stubbing", "X::Y::Z"
+
+          it 'removes the root constant when rspec clears its mocks' do
+            expect(defined?(X)).to be_false
+            stub_const("X::Y::Z", 7)
+            reset_rspec_mocks
+            expect(defined?(X)).to be_false
+          end
+        end
+
+        context 'for an unloaded constant nested within a loaded constant' do
+          it_behaves_like "unloaded constant stubbing", "TestClass::X"
+
+          it 'removes the unloaded constant but leaves the loaded constant when rspec resets its mocks' do
+            expect(defined?(TestClass)).to be_true
+            expect(defined?(TestClass::X)).to be_false
+            stub_const("TestClass::X", 7)
+            reset_rspec_mocks
+            expect(defined?(TestClass)).to be_true
+            expect(defined?(TestClass::X)).to be_false
+          end
+
+          it 'raises a helpful error if it cannot be stubbed due to an intermediary constant that is not a module' do
+            expect(TestClass::M).to be_a(Symbol)
+            expect { stub_const("TestClass::M::X", 5) }.to raise_error(/cannot stub/i)
+          end
+        end
+
+        context 'for an unloaded constant nested deeply within a deeply nested loaded constant' do
+          it_behaves_like "unloaded constant stubbing", "TestClass::Nested::NestedEvenMore::X::Y::Z"
+
+          it 'removes the first unloaded constant but leaves the loaded nested constant when rspec resets its mocks' do
+            expect(defined?(TestClass::Nested::NestedEvenMore)).to be_true
+            expect(defined?(TestClass::Nested::NestedEvenMore::X)).to be_false
+            stub_const("TestClass::Nested::NestedEvenMore::X::Y::Z", 7)
+            reset_rspec_mocks
+            expect(defined?(TestClass::Nested::NestedEvenMore)).to be_true
+            expect(defined?(TestClass::Nested::NestedEvenMore::X)).to be_false
+          end
+        end
+      end
+    end
+
+    describe Constant do
+      describe ".original" do
+        context 'for a previously defined unstubbed constant' do
+          let(:const) { Constant.original("TestClass::M") }
+
+          it("exposes its name")                    { expect(const.name).to eq("TestClass::M") }
+          it("indicates it was previously defined") { expect(const).to be_previously_defined }
+          it("indicates it has not been mutated")   { expect(const).not_to be_mutated }
+          it("indicates it has not been stubbed")   { expect(const).not_to be_stubbed }
+          it("indicates it has not been hidden")    { expect(const).not_to be_hidden }
+          it("exposes its original value")          { expect(const.original_value).to eq(:m) }
+        end
+
+        context 'for a previously defined stubbed constant' do
+          before { stub_const("TestClass::M", :other) }
+          let(:const) { Constant.original("TestClass::M") }
+
+          it("exposes its name")                    { expect(const.name).to eq("TestClass::M") }
+          it("indicates it was previously defined") { expect(const).to be_previously_defined }
+          it("indicates it has been mutated")       { expect(const).to be_mutated }
+          it("indicates it has been stubbed")       { expect(const).to be_stubbed }
+          it("indicates it has not been hidden")    { expect(const).not_to be_hidden }
+          it("exposes its original value")          { expect(const.original_value).to eq(:m) }
+        end
+
+        context 'for a previously undefined stubbed constant' do
+          before { stub_const("TestClass::Undefined", :other) }
+          let(:const) { Constant.original("TestClass::Undefined") }
+
+          it("exposes its name")                        { expect(const.name).to eq("TestClass::Undefined") }
+          it("indicates it was not previously defined") { expect(const).not_to be_previously_defined }
+          it("indicates it has been mutated")           { expect(const).to be_mutated }
+          it("indicates it has been stubbed")           { expect(const).to be_stubbed }
+          it("indicates it has not been hidden")        { expect(const).not_to be_hidden }
+          it("returns nil for the original value")      { expect(const.original_value).to be_nil }
+        end
+
+        context 'for a previously undefined unstubbed constant' do
+          let(:const) { Constant.original("TestClass::Undefined") }
+
+          it("exposes its name")                        { expect(const.name).to eq("TestClass::Undefined") }
+          it("indicates it was not previously defined") { expect(const).not_to be_previously_defined }
+          it("indicates it has not been mutated")       { expect(const).not_to be_mutated }
+          it("indicates it has not been stubbed")       { expect(const).not_to be_stubbed }
+          it("indicates it has not been hidden")        { expect(const).not_to be_hidden }
+          it("returns nil for the original value")      { expect(const.original_value).to be_nil }
+        end
+
+        context 'for a previously defined constant that has been stubbed twice' do
+          before { stub_const("TestClass::M", 1) }
+          before { stub_const("TestClass::M", 2) }
+          let(:const) { Constant.original("TestClass::M") }
+
+          it("exposes its name")                    { expect(const.name).to eq("TestClass::M") }
+          it("indicates it was previously defined") { expect(const).to be_previously_defined }
+          it("indicates it has been mutated")       { expect(const).to be_mutated }
+          it("indicates it has been stubbed")       { expect(const).to be_stubbed }
+          it("indicates it has not been hidden")    { expect(const).not_to be_hidden }
+          it("exposes its original value")          { expect(const.original_value).to eq(:m) }
+        end
+
+        context 'for a previously undefined constant that has been stubbed twice' do
+          before { stub_const("TestClass::Undefined", 1) }
+          before { stub_const("TestClass::Undefined", 2) }
+          let(:const) { Constant.original("TestClass::Undefined") }
+
+          it("exposes its name")                        { expect(const.name).to eq("TestClass::Undefined") }
+          it("indicates it was not previously defined") { expect(const).not_to be_previously_defined }
+          it("indicates it has been mutated")           { expect(const).to be_mutated }
+          it("indicates it has been stubbed")           { expect(const).to be_stubbed }
+          it("indicates it has not been hidden")        { expect(const).not_to be_hidden }
+          it("returns nil for the original value")      { expect(const.original_value).to be_nil }
+        end
+
+        context 'for a previously defined hidden constant' do
+          before { hide_const("TestClass::M") }
+          let(:const) { Constant.original("TestClass::M") }
+
+          it("exposes its name")                    { expect(const.name).to eq("TestClass::M") }
+          it("indicates it was previously defined") { expect(const).to be_previously_defined }
+          it("indicates it has been mutated")       { expect(const).to be_mutated }
+          it("indicates it has not been stubbed")   { expect(const).not_to be_stubbed }
+          it("indicates it has been hidden")        { expect(const).to be_hidden }
+          it("exposes its original value")          { expect(const.original_value).to eq(:m) }
+        end
+
+        context 'for a previously defined constant that has been hidden twice' do
+          before { hide_const("TestClass::M") }
+          before { hide_const("TestClass::M") }
+          let(:const) { Constant.original("TestClass::M") }
+
+          it("exposes its name")                    { expect(const.name).to eq("TestClass::M") }
+          it("indicates it was previously defined") { expect(const).to be_previously_defined }
+          it("indicates it has been mutated")       { expect(const).to be_mutated }
+          it("indicates it has not been stubbed")   { expect(const).not_to be_stubbed }
+          it("indicates it has been hidden")        { expect(const).to be_hidden }
+          it("exposes its original value")          { expect(const.original_value).to eq(:m) }
+        end
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/nil_expectation_warning_spec.rb b/rspec-mocks/spec/rspec/mocks/nil_expectation_warning_spec.rb
new file mode 100644
index 0000000..54c8f93
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/nil_expectation_warning_spec.rb
@@ -0,0 +1,68 @@
+require 'spec_helper'
+
+def remove_last_describe_from_world
+  RSpec::world.example_groups.pop
+end
+
+def empty_example_group
+  RSpec::Core::ExampleGroup.describe(Object, 'Empty Behaviour Group') { }
+  remove_last_describe_from_world
+end
+
+module RSpec
+  module Mocks
+    describe "an expectation set on nil" do
+      it "issues a warning with file and line number information" do
+        expected_warning = %r%An expectation of :foo was set on nil. Called from #{__FILE__}:#{__LINE__+3}(:in .+)?. Use allow_message_expectations_on_nil to disable warnings.%
+        Kernel.should_receive(:warn).with(expected_warning)
+
+        nil.should_receive(:foo)
+        nil.foo
+      end
+
+      it "issues a warning when the expectation is negative" do
+        Kernel.should_receive(:warn)
+
+        nil.should_not_receive(:foo)
+      end
+
+      it "does not issue a warning when expectations are set to be allowed" do
+        allow_message_expectations_on_nil
+        Kernel.should_not_receive(:warn)
+
+        nil.should_receive(:foo)
+        nil.should_not_receive(:bar)
+        nil.foo
+      end
+
+      it 'does not call #nil? on a double extra times' do
+        dbl = double
+        dbl.should_receive(:nil?).once.and_return(false)
+        dbl.nil?
+      end
+    end
+
+    describe "#allow_message_expectations_on_nil" do
+      it "does not affect subsequent examples" do
+        example_group = ::RSpec::Core::ExampleGroup.describe
+        reporter      = ::RSpec.configuration.reporter
+        example_group.it("when called in one example that doesn't end up setting an expectation on nil") do
+                        allow_message_expectations_on_nil
+                      end
+        example_group.it("should not effect the next example ran") do
+                        Kernel.should_receive(:warn)
+                        nil.should_receive(:foo)
+                        nil.foo
+                      end
+
+        expect(example_group.run reporter).to eq true
+      end
+
+      it 'doesnt error when marshalled' do
+        allow_message_expectations_on_nil
+        expect(Marshal.dump(nil)).to eq Marshal.dump_without_mocks(nil)
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/null_object_mock_spec.rb b/rspec-mocks/spec/rspec/mocks/null_object_mock_spec.rb
new file mode 100644
index 0000000..d115f73
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/null_object_mock_spec.rb
@@ -0,0 +1,123 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "a double _not_ acting as a null object" do
+      before(:each) do
+        @double = double('non-null object')
+      end
+
+      it "says it does not respond to messages it doesn't understand" do
+        expect(@double).not_to respond_to(:foo)
+      end
+
+      it "says it responds to messages it does understand" do
+        @double.stub(:foo)
+        expect(@double).to respond_to(:foo)
+      end
+
+      it "raises an error when interpolated in a string as an integer" do
+        # Not sure why, but 1.9.2 (but not JRuby --1.9) raises a different
+        # error than 1.8.7 and 1.9.3...
+        expected_error = (RUBY_VERSION == '1.9.2' && RUBY_PLATFORM !~ /java/) ?
+                         RSpec::Mocks::MockExpectationError :
+                         TypeError
+
+        expect { "%i" % @double }.to raise_error(expected_error)
+      end
+    end
+
+    describe "a double acting as a null object" do
+      before(:each) do
+        @double = double('null object').as_null_object
+      end
+
+      it "says it responds to everything" do
+        expect(@double).to respond_to(:any_message_it_gets)
+      end
+
+      it "allows explicit stubs" do
+        @double.stub(:foo) { "bar" }
+        expect(@double.foo).to eq("bar")
+      end
+
+      it "allows explicit expectation" do
+        @double.should_receive(:something)
+        @double.something
+      end
+
+      it 'continues to return self from an explicit expectation' do
+        @double.should_receive(:bar)
+        expect(@double.foo.bar).to be(@double)
+      end
+
+      it 'returns an explicitly stubbed value from an expectation with no implementation' do
+        @double.stub(:foo => "bar")
+        @double.should_receive(:foo)
+        expect(@double.foo).to eq("bar")
+      end
+
+      it "fails verification when explicit exception not met" do
+        expect {
+          @double.should_receive(:something)
+          verify @double
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "ignores unexpected methods" do
+        @double.random_call("a", "d", "c")
+        verify @double
+      end
+
+      it "allows expected message with different args first" do
+        @double.should_receive(:message).with(:expected_arg)
+        @double.message(:unexpected_arg)
+        @double.message(:expected_arg)
+      end
+
+      it "allows expected message with different args second" do
+        @double.should_receive(:message).with(:expected_arg)
+        @double.message(:expected_arg)
+        @double.message(:unexpected_arg)
+      end
+
+      it "can be interpolated in a string as an integer" do
+        # This form of string interpolation calls
+        # @double.to_int.to_int.to_int...etc until it gets an integer,
+        # and thus gets stuck in an infinite loop unless our double
+        # returns an int value from #to_int.
+        expect(("%i" % @double)).to eq("0")
+      end
+
+      it "preserves its nullness to subsequent examples to " +
+         "maintain compatibility with <= 2.13" do
+        RSpec::Mocks.teardown
+        expect(@double).to be_null_object
+        expect { @double.some.long.message.chain }.not_to raise_error
+      end
+    end
+
+    describe "#as_null_object" do
+      it "sets the object to null_object" do
+        obj = double('anything').as_null_object
+        expect(obj).to be_null_object
+      end
+    end
+
+    describe "#null_object?" do
+      it "defaults to false" do
+        obj = double('anything')
+        expect(obj).not_to be_null_object
+      end
+    end
+
+    describe "when using the :expect syntax" do
+      include_context "with syntax", :expect
+
+      it 'still supports null object doubles' do
+        obj = double("foo").as_null_object
+        expect(obj.foo.bar.bazz).to be(obj)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/once_counts_spec.rb b/rspec-mocks/spec/rspec/mocks/once_counts_spec.rb
new file mode 100644
index 0000000..f57109d
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/once_counts_spec.rb
@@ -0,0 +1,52 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "#once" do
+      before(:each) do
+        @double = double
+      end
+
+      it "passes when called once" do
+        @double.should_receive(:do_something).once
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when called once with specified args" do
+        @double.should_receive(:do_something).once.with("a", "b", "c")
+        @double.do_something("a", "b", "c")
+        verify @double
+      end
+
+      it "passes when called once with unspecified args" do
+        @double.should_receive(:do_something).once
+        @double.do_something("a", "b", "c")
+        verify @double
+      end
+
+      it "fails when called with wrong args" do
+        @double.should_receive(:do_something).once.with("a", "b", "c")
+        expect {
+          @double.do_something("d", "e", "f")
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+        reset @double
+      end
+
+      it "fails fast when called twice" do
+        @double.should_receive(:do_something).once
+        @double.do_something
+        expect {
+          @double.do_something
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails when not called" do
+        @double.should_receive(:do_something).once
+        expect {
+          verify @double
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/options_hash_spec.rb b/rspec-mocks/spec/rspec/mocks/options_hash_spec.rb
new file mode 100644
index 0000000..e15051a
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/options_hash_spec.rb
@@ -0,0 +1,35 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "calling :should_receive with an options hash" do
+      it "reports the file and line submitted with :expected_from" do
+        begin
+          mock = RSpec::Mocks::Mock.new("a mock")
+          mock.should_receive(:message, :expected_from => "/path/to/blah.ext:37")
+          verify mock
+        rescue Exception => e
+        ensure
+          expect(e.backtrace.to_s).to match(/\/path\/to\/blah.ext:37/m)
+        end
+      end
+
+      it "uses the message supplied with :message" do
+        expect {
+          m = RSpec::Mocks::Mock.new("a mock")
+          m.should_receive(:message, :message => "recebi nada")
+          verify m
+        }.to raise_error("recebi nada")
+      end
+
+      it "uses the message supplied with :message after a similar stub" do
+        expect {
+          m = RSpec::Mocks::Mock.new("a mock")
+          m.stub(:message)
+          m.should_receive(:message, :message => "from mock")
+          verify m
+        }.to raise_error("from mock")
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/partial_mock_spec.rb b/rspec-mocks/spec/rspec/mocks/partial_mock_spec.rb
new file mode 100644
index 0000000..e5bd34a
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/partial_mock_spec.rb
@@ -0,0 +1,205 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "using a Partial Mock," do
+      let(:object) { Object.new }
+
+      it "names the class in the failure message" do
+        object.should_receive(:foo)
+        expect do
+          verify object
+        end.to raise_error(RSpec::Mocks::MockExpectationError, /\(#<Object:.*>\).foo/)
+      end
+
+      it "names the class in the failure message when expectation is on class" do
+        Object.should_receive(:foo)
+        expect {
+          verify Object
+        }.to raise_error(RSpec::Mocks::MockExpectationError, /<Object \(class\)>/)
+      end
+
+      it "does not conflict with @options in the object" do
+        object.instance_eval { @options = Object.new }
+        object.should_receive(:blah)
+        object.blah
+      end
+
+      it "should_not_receive mocks out the method" do
+        object.should_not_receive(:fuhbar)
+        expect {
+          object.fuhbar
+        }.to raise_error(
+          RSpec::Mocks::MockExpectationError,
+          /expected\: 0 times with any arguments\n    received\: 1 time/
+        )
+      end
+
+      it "should_not_receive returns a negative message expectation" do
+        expect(object.should_not_receive(:foobar)).to be_negative
+      end
+
+      it "should_receive mocks out the method" do
+        object.should_receive(:foobar).with(:test_param).and_return(1)
+        expect(object.foobar(:test_param)).to equal(1)
+      end
+
+      it "should_receive handles a hash" do
+        object.should_receive(:foobar).with(:key => "value").and_return(1)
+        expect(object.foobar(:key => "value")).to equal(1)
+      end
+
+      it "should_receive handles an inner hash" do
+        hash = {:a => {:key => "value"}}
+        object.should_receive(:foobar).with(:key => "value").and_return(1)
+        expect(object.foobar(hash[:a])).to equal(1)
+      end
+
+      it "should_receive returns a positive message expectation" do
+        expect(object.should_receive(:foobar)).not_to be_negative
+        object.foobar
+      end
+
+      it "should_receive verifies method was called" do
+        object.should_receive(:foobar).with(:test_param).and_return(1)
+        expect {
+          verify object
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "should_receive also takes a String argument" do
+        object.should_receive('foobar')
+        object.foobar
+      end
+
+      it "should_not_receive also takes a String argument" do
+        object.should_not_receive('foobar')
+        expect {
+          object.foobar
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "uses reports nil in the error message" do
+        allow_message_expectations_on_nil
+
+        _nil = nil
+        _nil.should_receive(:foobar)
+        expect {
+          verify _nil
+        }.to raise_error(
+          RSpec::Mocks::MockExpectationError,
+          %Q|(nil).foobar(any args)\n    expected: 1 time with any arguments\n    received: 0 times with any arguments|
+        )
+      end
+
+      it "includes the class name in the error when mocking a class method that is called an extra time with the wrong args" do
+        klass = Class.new do
+          def self.inspect
+            "MyClass"
+          end
+        end
+
+        klass.should_receive(:bar).with(1)
+        klass.bar(1)
+
+        expect {
+          klass.bar(2)
+        }.to raise_error(RSpec::Mocks::MockExpectationError, /MyClass/)
+      end
+    end
+
+    describe "Using a partial mock on a proxy object", :if => defined?(::BasicObject) do
+      let(:proxy_class) do
+        Class.new(::BasicObject) do
+          def initialize(target)
+            @target = target
+          end
+
+          def proxied?
+            true
+          end
+
+          def method_missing(*a)
+            @target.send(*a)
+          end
+        end
+      end
+
+      let(:wrapped_object) { Object.new }
+      let(:proxy) { proxy_class.new(wrapped_object) }
+
+      it 'works properly' do
+        proxy.should_receive(:proxied?).and_return(false)
+        expect(proxy).not_to be_proxied
+      end
+
+      it 'does not confuse the proxy and the proxied object' do
+        proxy.stub(:foo).and_return(:proxy_foo)
+        wrapped_object.stub(:foo).and_return(:wrapped_foo)
+
+        expect(proxy.foo).to eq(:proxy_foo)
+        expect(wrapped_object.foo).to eq(:wrapped_foo)
+      end
+    end
+
+    describe "Partially mocking an object that defines ==, after another mock has been defined" do
+      before(:each) do
+        double("existing mock", :foo => :foo)
+      end
+
+      let(:klass) do
+        Class.new do
+          attr_reader :val
+          def initialize(val)
+            @val = val
+          end
+
+          def ==(other)
+            @val == other.val
+          end
+        end
+      end
+
+      it "does not raise an error when stubbing the object" do
+        o = klass.new :foo
+        expect { o.stub(:bar) }.not_to raise_error
+      end
+    end
+
+    describe "Method visibility when using partial mocks" do
+      let(:klass) do
+        Class.new do
+          def public_method
+            private_method
+            protected_method
+          end
+          protected
+          def protected_method; end
+          private
+          def private_method; end
+        end
+      end
+
+      let(:object) { klass.new }
+
+      it 'keeps public methods public' do
+        object.should_receive(:public_method)
+        expect(object.public_methods).to include_method(:public_method)
+        object.public_method
+      end
+
+      it 'keeps private methods private' do
+        object.should_receive(:private_method)
+        expect(object.private_methods).to include_method(:private_method)
+        object.public_method
+      end
+
+      it 'keeps protected methods protected' do
+        object.should_receive(:protected_method)
+        expect(object.protected_methods).to include_method(:protected_method)
+        object.public_method
+      end
+
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb b/rspec-mocks/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb
new file mode 100644
index 0000000..18da091
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/partial_mock_using_mocks_directly_spec.rb
@@ -0,0 +1,95 @@
+require 'spec_helper'
+
+module RSpec::Mocks
+  describe "PartialMockUsingMocksDirectly" do
+    let(:klass) do
+      Class.new do
+        module MethodMissing
+          remove_method :method_missing rescue nil
+          def method_missing(m, *a, &b)
+            if m == :captured_by_method_missing
+              "response generated by method missing"
+            else
+              super(m, *a, &b)
+            end
+          end
+        end
+
+        extend MethodMissing
+        include MethodMissing
+
+        def existing_method
+          :original_value
+        end
+
+      end
+    end
+
+    let(:obj) { klass.new }
+
+    # See http://rubyforge.org/tracker/index.php?func=detail&aid=10263&group_id=797&atid=3149
+    # specify "should clear expectations on verify" do
+    #     obj.should_receive(:msg)
+    #     obj.msg
+    #     verify obj
+    #     expect {
+    #       obj.msg
+    #     }.to raise_error(NoMethodError)
+    #
+    # end
+    it "fails when expected message is not received" do
+      obj.should_receive(:msg)
+      expect {
+        verify obj
+      }.to raise_error(RSpec::Mocks::MockExpectationError)
+    end
+
+    it "fails when message is received with incorrect args" do
+      obj.should_receive(:msg).with(:correct_arg)
+      expect {
+        obj.msg(:incorrect_arg)
+      }.to raise_error(RSpec::Mocks::MockExpectationError)
+      obj.msg(:correct_arg)
+    end
+
+    it "passes when expected message is received" do
+      obj.should_receive(:msg)
+      obj.msg
+      verify obj
+    end
+
+    it "passes when message is received with correct args" do
+      obj.should_receive(:msg).with(:correct_arg)
+      obj.msg(:correct_arg)
+      verify obj
+    end
+
+    it "restores the original method if it existed" do
+      expect(obj.existing_method).to equal(:original_value)
+      obj.should_receive(:existing_method).and_return(:mock_value)
+      expect(obj.existing_method).to equal(:mock_value)
+      verify obj
+      expect(obj.existing_method).to equal(:original_value)
+    end
+
+    context "with an instance method handled by method_missing" do
+      it "restores the original behavior" do
+        expect(obj.captured_by_method_missing).to eq("response generated by method missing")
+        obj.stub(:captured_by_method_missing) { "foo" }
+        expect(obj.captured_by_method_missing).to eq("foo")
+        reset obj
+        expect(obj.captured_by_method_missing).to eq("response generated by method missing")
+      end
+    end
+
+    context "with a class method handled by method_missing" do
+      it "restores the original behavior" do
+        expect(klass.captured_by_method_missing).to eq("response generated by method missing")
+        klass.stub(:captured_by_method_missing) { "foo" }
+        expect(klass.captured_by_method_missing).to eq("foo")
+        reset klass
+        expect(klass.captured_by_method_missing).to eq("response generated by method missing")
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/passing_argument_matchers_spec.rb b/rspec-mocks/spec/rspec/mocks/passing_argument_matchers_spec.rb
new file mode 100644
index 0000000..0b52de6
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/passing_argument_matchers_spec.rb
@@ -0,0 +1,142 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "Passing argument matchers" do
+      before(:each) do
+        @double = double('double')
+        Kernel.stub(:warn)
+      end
+
+      after(:each) do
+        verify @double
+      end
+
+      context "handling argument matchers" do
+        it "accepts true as boolean()" do
+          @double.should_receive(:random_call).with(boolean())
+          @double.random_call(true)
+        end
+
+        it "accepts false as boolean()" do
+          @double.should_receive(:random_call).with(boolean())
+          @double.random_call(false)
+        end
+
+        it "accepts fixnum as kind_of(Numeric)" do
+          @double.should_receive(:random_call).with(kind_of(Numeric))
+          @double.random_call(1)
+        end
+
+        it "accepts float as an_instance_of(Numeric)" do
+          @double.should_receive(:random_call).with(kind_of(Numeric))
+          @double.random_call(1.5)
+        end
+
+        it "accepts fixnum as instance_of(Fixnum)" do
+          @double.should_receive(:random_call).with(instance_of(Fixnum))
+          @double.random_call(1)
+        end
+
+        it "does NOT accept fixnum as instance_of(Numeric)" do
+          @double.should_not_receive(:random_call).with(instance_of(Numeric))
+          @double.random_call(1)
+        end
+
+        it "does NOT accept float as instance_of(Numeric)" do
+          @double.should_not_receive(:random_call).with(instance_of(Numeric))
+          @double.random_call(1.5)
+        end
+
+        it "accepts string as anything()" do
+          @double.should_receive(:random_call).with("a", anything(), "c")
+          @double.random_call("a", "whatever", "c")
+        end
+
+        it "matches duck type with one method" do
+          @double.should_receive(:random_call).with(duck_type(:length))
+          @double.random_call([])
+        end
+
+        it "matches duck type with two methods" do
+          @double.should_receive(:random_call).with(duck_type(:abs, :div))
+          @double.random_call(1)
+        end
+
+        it "matches no args against any_args()" do
+          @double.should_receive(:random_call).with(any_args)
+          @double.random_call()
+        end
+
+        it "matches one arg against any_args()" do
+          @double.should_receive(:random_call).with(any_args)
+          @double.random_call("a string")
+        end
+
+        it "matches no args against no_args()" do
+          @double.should_receive(:random_call).with(no_args)
+          @double.random_call()
+        end
+
+        it "matches hash with hash_including same hash" do
+          @double.should_receive(:random_call).with(hash_including(:a => 1))
+          @double.random_call(:a => 1)
+        end
+      end
+
+      context "handling block matchers" do
+        it "matches arguments against RSpec expectations" do
+          @double.should_receive(:random_call).with {|arg1, arg2, arr, *rest|
+            expect(arg1).to eq 5
+            expect(arg2).to have_at_least(3).characters
+            expect(arg2).to have_at_most(10).characters
+            expect(arr.map {|i| i * 2}).to eq [2,4,6]
+            expect(rest).to eq [:fee, "fi", 4]
+          }
+          @double.random_call 5, "hello", [1,2,3], :fee, "fi", 4
+        end
+
+        it "does not eval the block as the return value" do
+          eval_count = 0
+          @double.should_receive(:msg).with {|a| eval_count += 1}
+          @double.msg(:ignore)
+          expect(eval_count).to eq(1)
+        end
+      end
+
+      context "handling non-matcher arguments" do
+        it "matches non special symbol (can be removed when deprecated symbols are removed)" do
+          @double.should_receive(:random_call).with(:some_symbol)
+          @double.random_call(:some_symbol)
+        end
+
+        it "matches string against regexp" do
+          @double.should_receive(:random_call).with(/bcd/)
+          @double.random_call("abcde")
+        end
+
+        it "matches regexp against regexp" do
+          @double.should_receive(:random_call).with(/bcd/)
+          @double.random_call(/bcd/)
+        end
+
+        it "matches against a hash submitted and received by value" do
+          @double.should_receive(:random_call).with(:a => "a", :b => "b")
+          @double.random_call(:a => "a", :b => "b")
+        end
+
+        it "matches against a hash submitted by reference and received by value" do
+          opts = {:a => "a", :b => "b"}
+          @double.should_receive(:random_call).with(opts)
+          @double.random_call(:a => "a", :b => "b")
+        end
+
+        it "matches against a hash submitted by value and received by reference" do
+          opts = {:a => "a", :b => "b"}
+          @double.should_receive(:random_call).with(:a => "a", :b => "b")
+          @double.random_call(opts)
+        end
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/precise_counts_spec.rb b/rspec-mocks/spec/rspec/mocks/precise_counts_spec.rb
new file mode 100644
index 0000000..32feca6
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/precise_counts_spec.rb
@@ -0,0 +1,68 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "PreciseCounts" do
+      before(:each) do
+        @double = double("test double")
+      end
+
+      it "fails when exactly n times method is called less than n times" do
+        @double.should_receive(:do_something).exactly(3).times
+        @double.do_something
+        @double.do_something
+        expect {
+          verify @double
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails fast when exactly n times method is called more than n times" do
+        @double.should_receive(:do_something).exactly(3).times
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        expect {
+          @double.do_something
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails when exactly n times method is never called" do
+        @double.should_receive(:do_something).exactly(3).times
+        expect {
+          verify @double
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "passes if exactly n times method is called exactly n times" do
+        @double.should_receive(:do_something).exactly(3).times
+        @double.do_something
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "returns the value given by a block when the exactly once method is called" do
+        @double.should_receive(:to_s).exactly(:once) { "testing" }
+        expect(@double.to_s).to eq "testing"
+        verify @double
+      end
+
+      it "passes mutiple calls with different args" do
+        @double.should_receive(:do_something).once.with(1)
+        @double.should_receive(:do_something).once.with(2)
+        @double.do_something(1)
+        @double.do_something(2)
+        verify @double
+      end
+
+      it "passes multiple calls with different args and counts" do
+        @double.should_receive(:do_something).twice.with(1)
+        @double.should_receive(:do_something).once.with(2)
+        @double.do_something(1)
+        @double.do_something(2)
+        @double.do_something(1)
+        verify @double
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/record_messages_spec.rb b/rspec-mocks/spec/rspec/mocks/record_messages_spec.rb
new file mode 100644
index 0000000..a61ff07
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/record_messages_spec.rb
@@ -0,0 +1,26 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "a mock" do
+      before(:each) do
+        @mock = double("mock").as_null_object
+      end
+      it "answers false for received_message? when no messages received" do
+        expect(@mock.received_message?(:message)).to be_false
+      end
+      it "answers true for received_message? when message received" do
+        @mock.message
+        expect(@mock.received_message?(:message)).to be_true
+      end
+      it "answers true for received_message? when message received with correct args" do
+        @mock.message 1,2,3
+        expect(@mock.received_message?(:message, 1,2,3)).to be_true
+      end
+      it "answers false for received_message? when message received with incorrect args" do
+        @mock.message 1,2,3
+        expect(@mock.received_message?(:message, 1,2)).to be_false
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/serialization_spec.rb b/rspec-mocks/spec/rspec/mocks/serialization_spec.rb
new file mode 100644
index 0000000..530c683
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/serialization_spec.rb
@@ -0,0 +1,89 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "Serialization of mocked objects" do
+
+      class SerializableObject < Struct.new(:foo, :bar); end
+
+      def self.with_yaml_loaded(&block)
+        context 'with YAML loaded' do
+          module_eval(&block)
+        end
+      end
+
+      def self.without_yaml_loaded(&block)
+        context 'without YAML loaded' do
+          before do
+            # We can't really unload yaml, but we can fake it here...
+            hide_const("YAML")
+            Struct.class_eval do
+              alias __old_to_yaml to_yaml
+              undef to_yaml
+            end
+          end
+
+          module_eval(&block)
+
+          after do
+            Struct.class_eval do
+              alias to_yaml __old_to_yaml
+              undef __old_to_yaml
+            end
+          end
+        end
+      end
+
+      let(:serializable_object) { RSpec::Mocks::SerializableObject.new(7, "something") }
+
+      def set_stub
+        serializable_object.stub(:bazz => 5)
+      end
+
+      shared_examples_for 'normal YAML serialization' do
+        it 'serializes to yaml the same with and without stubbing, using #to_yaml' do
+          expect { set_stub }.to_not change { serializable_object.to_yaml }
+        end
+
+        it 'serializes to yaml the same with and without stubbing, using YAML.dump' do
+          expect { set_stub }.to_not change { ::YAML.dump(serializable_object) }
+        end
+      end
+
+      with_yaml_loaded do
+        compiled_with_psych = begin
+          require 'psych'
+          true
+        rescue LoadError
+          false
+        end
+
+        if compiled_with_psych
+          context 'using Syck as the YAML engine' do
+            before(:each) { ::YAML::ENGINE.yamler = 'syck' }
+            it_behaves_like 'normal YAML serialization'
+          end
+
+          context 'using Psych as the YAML engine' do
+            before(:each) { ::YAML::ENGINE.yamler = 'psych' }
+            it_behaves_like 'normal YAML serialization'
+          end
+        else
+          it_behaves_like 'normal YAML serialization'
+        end
+      end
+
+      without_yaml_loaded do
+        it 'does not add #to_yaml to the stubbed object' do
+          expect(serializable_object).not_to respond_to(:to_yaml)
+          set_stub
+          expect(serializable_object).not_to respond_to(:to_yaml)
+        end
+      end
+
+      it 'marshals the same with and without stubbing' do
+        expect { set_stub }.to_not change { Marshal.dump(serializable_object) }
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/stash_spec.rb b/rspec-mocks/spec/rspec/mocks/stash_spec.rb
new file mode 100644
index 0000000..f18e3cb
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/stash_spec.rb
@@ -0,0 +1,46 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+
+    describe "only stashing the original method" do
+      let(:klass) do
+        Class.new do
+          def self.foo(arg)
+            :original_value
+          end
+        end
+      end
+
+      it "keeps the original method intact after multiple expectations are added on the same method" do
+        klass.should_receive(:foo).with(:fizbaz).and_return(:wowwow)
+        klass.should_receive(:foo).with(:bazbar).and_return(:okay)
+
+        klass.foo(:fizbaz)
+        klass.foo(:bazbar)
+        verify klass
+
+        reset klass
+        expect(klass.foo(:yeah)).to equal(:original_value)
+      end
+    end
+
+    describe "when a class method is aliased on a subclass and the method is mocked" do
+      it "restores the original aliased public method" do
+        klass = Class.new do
+          class << self
+            alias alternate_new new
+          end
+        end
+
+        klass.should_receive(:alternate_new)
+        expect(klass.alternate_new).to be_nil
+
+        verify klass
+
+        reset klass
+        expect(klass.alternate_new).to be_an_instance_of(klass)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/stub_chain_spec.rb b/rspec-mocks/spec/rspec/mocks/stub_chain_spec.rb
new file mode 100644
index 0000000..4399fd7
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/stub_chain_spec.rb
@@ -0,0 +1,154 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "A chained method stub" do
+      let(:object) { Object.new }
+
+      context "with one method in chain" do
+        context "using and_return" do
+          it "returns expected value from chaining only one method call" do
+            object.stub_chain(:msg1).and_return(:return_value)
+            expect(object.msg1).to equal(:return_value)
+          end
+        end
+
+        context "using a block" do
+          it "returns the correct value" do
+            object.stub_chain(:msg1) { :return_value }
+            expect(object.msg1).to equal(:return_value)
+          end
+        end
+
+        context "using a hash" do
+          it "returns the value of the key/value pair" do
+            object.stub_chain(:msg1 => :return_value)
+            expect(object.msg1).to equal(:return_value)
+          end
+        end
+      end
+
+      context "with two methods in chain" do
+        context "using and_return" do
+          it "returns expected value from chaining two method calls" do
+            object.stub_chain(:msg1, :msg2).and_return(:return_value)
+            expect(object.msg1.msg2).to equal(:return_value)
+          end
+        end
+
+        context "using a block" do
+          it "returns the correct value" do
+            object.stub_chain(:msg1, :msg2) { :return_value }
+            expect(object.msg1.msg2).to equal(:return_value)
+          end
+        end
+
+        context "using a hash" do
+          it "returns the value of the key/value pair" do
+            object.stub_chain(:msg1, :msg2 => :return_value)
+            expect(object.msg1.msg2).to equal(:return_value)
+          end
+        end
+      end
+
+      context "with four methods in chain" do
+        context "using and_return" do
+          it "returns expected value from chaining two method calls" do
+            object.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:return_value)
+            expect(object.msg1.msg2.msg3.msg4).to equal(:return_value)
+          end
+        end
+
+        context "using a block" do
+          it "returns the correct value" do
+            object.stub_chain(:msg1, :msg2, :msg3, :msg4) { :return_value }
+            expect(object.msg1.msg2.msg3.msg4).to equal(:return_value)
+          end
+        end
+
+        context "using a hash" do
+          it "returns the value of the key/value pair" do
+            object.stub_chain(:msg1, :msg2, :msg3, :msg4 => :return_value)
+            expect(object.msg1.msg2.msg3.msg4).to equal(:return_value)
+          end
+        end
+
+        context "using a hash with a string key" do
+          it "returns the value of the key/value pair" do
+            object.stub_chain("msg1.msg2.msg3.msg4" => :return_value)
+            expect(object.msg1.msg2.msg3.msg4).to equal(:return_value)
+          end
+        end
+      end
+
+      it "returns expected value from chaining four method calls" do
+        object.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:return_value)
+        expect(object.msg1.msg2.msg3.msg4).to equal(:return_value)
+      end
+
+      context "with messages shared across multiple chains" do
+        context "using and_return" do
+          context "starting with the same message" do
+            it "returns expected value" do
+              object.stub_chain(:msg1, :msg2, :msg3).and_return(:first)
+              object.stub_chain(:msg1, :msg2, :msg4).and_return(:second)
+
+              expect(object.msg1.msg2.msg3).to equal(:first)
+              expect(object.msg1.msg2.msg4).to equal(:second)
+            end
+          end
+
+          context "starting with the different messages" do
+            it "returns expected value" do
+              object.stub_chain(:msg1, :msg2, :msg3).and_return(:first)
+              object.stub_chain(:msg4, :msg2, :msg3).and_return(:second)
+
+              expect(object.msg1.msg2.msg3).to equal(:first)
+              expect(object.msg4.msg2.msg3).to equal(:second)
+            end
+          end
+        end
+
+        context "using => value" do
+          context "starting with the same message" do
+            it "returns expected value" do
+              object.stub_chain(:msg1, :msg2, :msg3 => :first)
+              object.stub_chain(:msg1, :msg2, :msg4 => :second)
+
+              expect(object.msg1.msg2.msg3).to equal(:first)
+              expect(object.msg1.msg2.msg4).to equal(:second)
+            end
+          end
+
+          context "starting with different messages" do
+            it "returns expected value" do
+              object.stub_chain(:msg1, :msg2, :msg3 => :first)
+              object.stub_chain(:msg4, :msg2, :msg3 => :second)
+
+              expect(object.msg1.msg2.msg3).to equal(:first)
+              expect(object.msg4.msg2.msg3).to equal(:second)
+            end
+          end
+        end
+      end
+
+      it "returns expected value when chain is a dot separated string, like stub_chain('msg1.msg2.msg3')" do
+        object.stub_chain("msg1.msg2.msg3").and_return(:return_value)
+        expect(object.msg1.msg2.msg3).to equal(:return_value)
+      end
+
+      it "returns expected value from two chains with shared messages at the beginning" do
+        object.stub_chain(:msg1, :msg2, :msg3, :msg4).and_return(:first)
+        object.stub_chain(:msg1, :msg2, :msg3, :msg5).and_return(:second)
+
+        expect(object.msg1.msg2.msg3.msg4).to equal(:first)
+        expect(object.msg1.msg2.msg3.msg5).to equal(:second)
+      end
+
+      it "handles private instance methods (like Object#select) in the middle of a chain" do
+        object.stub_chain(:msg1, :select, :msg3 => 'answer')
+        expect(object.msg1.select.msg3).to eq 'answer'
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/stub_implementation_spec.rb b/rspec-mocks/spec/rspec/mocks/stub_implementation_spec.rb
new file mode 100644
index 0000000..5abda0d
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/stub_implementation_spec.rb
@@ -0,0 +1,81 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "stub implementation" do
+      describe "with no args" do
+        it "execs the block when called" do
+          obj = double()
+          obj.stub(:foo) { :bar }
+          expect(obj.foo).to eq :bar
+        end
+      end
+
+      describe "with one arg" do
+        it "execs the block with that arg when called" do
+          obj = double()
+          obj.stub(:foo) {|given| given}
+          expect(obj.foo(:bar)).to eq :bar
+        end
+      end
+
+      describe "with variable args" do
+        it "execs the block when called" do
+          obj = double()
+          obj.stub(:foo) {|*given| given.first}
+          expect(obj.foo(:bar)).to eq :bar
+        end
+      end
+    end
+
+
+    describe "unstub implementation" do
+      it "replaces the stubbed method with the original method" do
+        obj = Object.new
+        def obj.foo; :original; end
+        obj.stub(:foo)
+        obj.unstub(:foo)
+        expect(obj.foo).to eq :original
+      end
+
+      it "removes all stubs with the supplied method name" do
+        obj = Object.new
+        def obj.foo; :original; end
+        obj.stub(:foo).with(1)
+        obj.stub(:foo).with(2)
+        obj.unstub(:foo)
+        expect(obj.foo).to eq :original
+      end
+
+      it "does not remove any expectations with the same method name" do
+        obj = Object.new
+        def obj.foo; :original; end
+        obj.should_receive(:foo).with(3).and_return(:three)
+        obj.stub(:foo).with(1)
+        obj.stub(:foo).with(2)
+        obj.unstub(:foo)
+        expect(obj.foo(3)).to eq :three
+      end
+
+      it "restores the correct implementations when stubbed and unstubbed on a parent and child class" do
+        parent = Class.new
+        child  = Class.new(parent)
+
+        parent.stub(:new)
+        child.stub(:new)
+        parent.unstub(:new)
+        child.unstub(:new)
+
+        expect(parent.new).to be_an_instance_of parent
+        expect(child.new).to be_an_instance_of child
+      end
+
+      it "raises a MockExpectationError if the method has not been stubbed" do
+        obj = Object.new
+        expect {
+          obj.unstub(:foo)
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/stub_spec.rb b/rspec-mocks/spec/rspec/mocks/stub_spec.rb
new file mode 100644
index 0000000..b35d81f
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/stub_spec.rb
@@ -0,0 +1,353 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "A method stub" do
+      before(:each) do
+        @class = Class.new do
+          class << self
+            def existing_class_method
+              existing_private_class_method
+            end
+
+            private
+            def existing_private_class_method
+              :original_value
+            end
+          end
+
+          def existing_instance_method
+            existing_private_instance_method
+          end
+
+          private
+          def existing_private_instance_method
+            :original_value
+          end
+        end
+        @instance = @class.new
+        @stub = Object.new
+      end
+
+      describe "using stub" do
+        it "returns declared value when message is received" do
+          @instance.stub(:msg).and_return(:return_value)
+          expect(@instance.msg).to equal(:return_value)
+          verify @instance
+        end
+      end
+
+      describe "using stub!" do
+        before do
+          allow(RSpec).to receive(:deprecate)
+        end
+
+        it "warns of deprecation" do
+          expect(RSpec).to receive(:deprecate).with("stub!", :replacement => "stub")
+          @instance.stub!(:msg).and_return(:return_value)
+        end
+
+        it "returns the declared value when the message is received" do
+          @instance.stub!(:msg).and_return(:return_value)
+          expect(@instance.msg).to equal(:return_value)
+          verify @instance
+        end
+
+        it "can be used to stub the example context itself (since `stub` returns a test dobule instead)" do
+          stub!(:foo).and_return(5)
+          expect(foo).to eq(5)
+        end
+      end
+
+      describe 'using unstub' do
+        it 'removes the message stub' do
+          @instance.stub(:msg)
+          @instance.unstub(:msg)
+          expect { @instance.msg }.to raise_error NoMethodError
+        end
+      end
+
+      describe 'using unstub!' do
+        it 'removes the message stub but warns about deprecation' do
+          @instance.stub(:msg)
+          RSpec.should_receive(:deprecate).with("unstub!", :replacement => "unstub")
+          @instance.unstub!(:msg)
+          expect { @instance.msg }.to raise_error NoMethodError
+        end
+      end
+
+      it "instructs an instance to respond_to the message" do
+        @instance.stub(:msg)
+        expect(@instance).to respond_to(:msg)
+      end
+
+      it "instructs a class object to respond_to the message" do
+        @class.stub(:msg)
+        expect(@class).to respond_to(:msg)
+      end
+
+      it "ignores when expected message is received with no args" do
+        @instance.stub(:msg)
+        @instance.msg
+        expect do
+          verify @instance
+        end.not_to raise_error
+      end
+
+      it "ignores when message is received with args" do
+        @instance.stub(:msg)
+        @instance.msg(:an_arg)
+        expect do
+          verify @instance
+        end.not_to raise_error
+      end
+
+      it "ignores when expected message is not received" do
+        @instance.stub(:msg)
+        expect do
+          verify @instance
+        end.not_to raise_error
+      end
+
+      it "handles multiple stubbed methods" do
+        @instance.stub(:msg1 => 1, :msg2 => 2)
+        expect(@instance.msg1).to eq(1)
+        expect(@instance.msg2).to eq(2)
+      end
+
+      describe "#rspec_reset" do
+        it "removes stubbed methods that didn't exist" do
+          @instance.stub(:non_existent_method)
+          reset @instance
+          expect(@instance).not_to respond_to(:non_existent_method)
+        end
+
+        it "restores existing instance methods" do
+          # See bug reports 8302 adn 7805
+          @instance.stub(:existing_instance_method) { :stub_value }
+          reset @instance
+          expect(@instance.existing_instance_method).to eq(:original_value)
+        end
+
+        it "restores existing private instance methods" do
+          # See bug reports 8302 adn 7805
+          @instance.stub(:existing_private_instance_method) { :stub_value }
+          reset @instance
+          expect(@instance.send(:existing_private_instance_method)).to eq(:original_value)
+        end
+
+        it "restores existing class methods" do
+          # See bug reports 8302 adn 7805
+          @class.stub(:existing_class_method) { :stub_value }
+          reset @class
+          expect(@class.existing_class_method).to eq(:original_value)
+        end
+
+        it "restores existing private class methods" do
+          # See bug reports 8302 adn 7805
+          @class.stub(:existing_private_class_method) { :stub_value }
+          reset @class
+          expect(@class.send(:existing_private_class_method)).to eq(:original_value)
+        end
+
+        it "does not remove existing methods that have been stubbed twice" do
+          @instance.stub(:existing_instance_method)
+          @instance.stub(:existing_instance_method)
+
+          reset @instance
+
+          expect(@instance.existing_instance_method).to eq(:original_value)
+        end
+
+        it "correctly restores the visibility of methods whose visibility has been tweaked on the singleton class" do
+          # hello is a private method when mixed in, but public on the module
+          # itself
+          mod = Module.new {
+            extend self
+            def hello; :hello; end
+
+            private :hello
+            class << self; public :hello; end;
+          }
+
+          expect(mod.hello).to eq(:hello)
+
+          mod.stub(:hello) { :stub }
+          reset mod
+
+          expect(mod.hello).to eq(:hello)
+        end
+
+        if RUBY_VERSION >= '2.0.0'
+          context "with a prepended module (ruby 2.0.0+)" do
+            before do
+              mod = Module.new do
+                def existing_instance_method
+                  "#{super}_prepended".to_sym
+                end
+              end
+
+              @prepended_class = Class.new(@class) do
+                prepend mod
+
+                def non_prepended_method
+                  :not_prepended
+                end
+              end
+              @prepended_instance = @prepended_class.new
+            end
+
+            it "restores prepended instance methods" do
+              allow(@prepended_instance).to receive(:existing_instance_method) { :stubbed }
+              expect(@prepended_instance.existing_instance_method).to eq :stubbed
+
+              reset @prepended_instance
+              expect(@prepended_instance.existing_instance_method).to eq :original_value_prepended
+            end
+
+            it "restores non-prepended instance methods" do
+              allow(@prepended_instance).to receive(:non_prepended_method) { :stubbed }
+              expect(@prepended_instance.non_prepended_method).to eq :stubbed
+
+              reset @prepended_instance
+              expect(@prepended_instance.non_prepended_method).to eq :not_prepended
+            end
+          end
+        end
+      end
+
+      it "returns values in order to consecutive calls" do
+        @instance.stub(:msg).and_return("1",2,:three)
+        expect(@instance.msg).to eq("1")
+        expect(@instance.msg).to eq(2)
+        expect(@instance.msg).to eq(:three)
+      end
+
+      it "keeps returning last value in consecutive calls" do
+        @instance.stub(:msg).and_return("1",2,:three)
+        expect(@instance.msg).to eq("1")
+        expect(@instance.msg).to eq(2)
+        expect(@instance.msg).to eq(:three)
+        expect(@instance.msg).to eq(:three)
+        expect(@instance.msg).to eq(:three)
+      end
+
+      it "yields a specified object" do
+        @instance.stub(:method_that_yields).and_yield(:yielded_obj)
+        current_value = :value_before
+        @instance.method_that_yields {|val| current_value = val}
+        expect(current_value).to eq :yielded_obj
+        verify @instance
+      end
+
+      it "yields multiple times with multiple calls to and_yield" do
+        @instance.stub(:method_that_yields_multiple_times).and_yield(:yielded_value).
+                                                       and_yield(:another_value)
+        current_value = []
+        @instance.method_that_yields_multiple_times {|val| current_value << val}
+        expect(current_value).to eq [:yielded_value, :another_value]
+        verify @instance
+      end
+
+      it "yields a specified object and return another specified object" do
+        yielded_obj = double("my mock")
+        yielded_obj.should_receive(:foo).with(:bar)
+        @instance.stub(:method_that_yields_and_returns).and_yield(yielded_obj).and_return(:baz)
+        expect(@instance.method_that_yields_and_returns { |o| o.foo :bar }).to eq :baz
+      end
+
+      it "throws when told to" do
+        @stub.stub(:something).and_throw(:up)
+        expect { @stub.something }.to throw_symbol(:up)
+      end
+
+      it "throws with argument when told to" do
+        @stub.stub(:something).and_throw(:up, 'high')
+        expect { @stub.something }.to throw_symbol(:up, 'high')
+      end
+
+      it "overrides a pre-existing method" do
+        @stub.stub(:existing_instance_method).and_return(:updated_stub_value)
+        expect(@stub.existing_instance_method).to eq :updated_stub_value
+      end
+
+      it "overrides a pre-existing stub" do
+        @stub.stub(:foo) { 'bar' }
+        @stub.stub(:foo) { 'baz' }
+        expect(@stub.foo).to eq 'baz'
+      end
+
+      it "allows a stub and an expectation" do
+        @stub.stub(:foo).with("bar")
+        @stub.should_receive(:foo).with("baz")
+        @stub.foo("bar")
+        @stub.foo("baz")
+      end
+
+      it "calculates return value by executing block passed to #and_return" do
+        @stub.stub(:something).with("a","b","c").and_return { |a,b,c| c+b+a }
+        expect(@stub.something("a","b","c")).to eq "cba"
+        verify @stub
+      end
+    end
+
+    describe "A method stub with args" do
+      before(:each) do
+        @stub = Object.new
+        @stub.stub(:foo).with("bar")
+      end
+
+      it "does not complain if not called" do
+      end
+
+      it "does not complain if called with arg" do
+        @stub.foo("bar")
+      end
+
+      it "complains if called with no arg" do
+        expect {
+          @stub.foo
+        }.to raise_error(/received :foo with unexpected arguments/)
+      end
+
+      it "complains if called with other arg", :github_issue => [123,147] do
+        expect {
+          @stub.foo("other")
+        }.to raise_error(/received :foo with unexpected arguments.*Please stub a default value/m)
+      end
+
+      it "does not complain if also mocked w/ different args" do
+        @stub.should_receive(:foo).with("baz")
+        @stub.foo("bar")
+        @stub.foo("baz")
+      end
+
+      it "complains if also mocked w/ different args AND called w/ a 3rd set of args" do
+        @stub.should_receive(:foo).with("baz")
+        @stub.foo("bar")
+        @stub.foo("baz")
+        expect {
+          @stub.foo("other")
+        }.to raise_error
+      end
+
+      it "supports options" do
+        @stub.stub(:foo, :expected_from => "bar")
+      end
+
+      it 'uses the correct stubbed response when responding to a mock expectation' do
+        @stub.stub(:bar) { 15 }
+        @stub.stub(:bar).with(:eighteen) { 18 }
+        @stub.stub(:bar).with(:thirteen) { 13 }
+
+        @stub.should_receive(:bar).exactly(4).times
+
+        expect(@stub.bar(:blah)).to eq(15)
+        expect(@stub.bar(:thirteen)).to eq(13)
+        expect(@stub.bar(:eighteen)).to eq(18)
+        expect(@stub.bar).to eq(15)
+      end
+    end
+
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/stubbed_message_expectations_spec.rb b/rspec-mocks/spec/rspec/mocks/stubbed_message_expectations_spec.rb
new file mode 100644
index 0000000..445bc07
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/stubbed_message_expectations_spec.rb
@@ -0,0 +1,58 @@
+require 'spec_helper'
+
+describe "expection set on previously stubbed method" do
+  it "fails if message is not received after expectation is set" do
+    double = double(:msg => nil)
+    double.msg
+    double.should_receive(:msg)
+    expect { verify double }.to raise_error(RSpec::Mocks::MockExpectationError)
+  end
+
+  it "outputs arguments of similar calls" do
+    double = double('double', :foo => true)
+    double.should_receive(:foo).with('first')
+    double.foo('second')
+    double.foo('third')
+    expect {
+      verify double
+    }.to raise_error(%Q|Double "double" received :foo with unexpected arguments\n  expected: ("first")\n       got: ("second"), ("third")|)
+    reset double
+  end
+
+  context "with argument constraint on stub" do
+    it "matches any args if no arg constraint set on expectation" do
+      double = double("mock")
+      double.stub(:foo).with(3).and_return("stub")
+      double.should_receive(:foo).at_least(:once).and_return("expectation")
+      double.foo
+      verify double
+    end
+
+    it "matches specific args set on expectation" do
+      double = double("mock")
+      double.stub(:foo).with(3).and_return("stub")
+      double.should_receive(:foo).at_least(:once).with(4).and_return("expectation")
+      double.foo(4)
+      verify double
+    end
+
+    it "fails if expectation's arg constraint is not met" do
+      double = double("mock")
+      double.stub(:foo).with(3).and_return("stub")
+      double.should_receive(:foo).at_least(:once).with(4).and_return("expectation")
+      double.foo(3)
+      expect { verify double }.to raise_error(/expected: \(4\)\s+got: \(3\)/)
+    end
+
+    it 'distinguishes between individual values and arrays properly' do
+      dbl = double
+      dbl.stub(:foo).with('a', ['b'])
+
+      expect {
+        dbl.foo(['a'], 'b')
+      }.to raise_error { |e|
+        expect(e.message).to include('expected: ("a", ["b"])', 'got: (["a"], "b")')
+      }
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/syntax_agnostic_message_matchers_spec.rb b/rspec-mocks/spec/rspec/mocks/syntax_agnostic_message_matchers_spec.rb
new file mode 100644
index 0000000..33b4016
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/syntax_agnostic_message_matchers_spec.rb
@@ -0,0 +1,81 @@
+require "spec_helper"
+
+module RSpec
+  module Mocks
+
+    describe ".allow_message" do
+      let(:subject) { Object.new }
+
+      it "sets up basic message allowance" do
+        expect {
+          ::RSpec::Mocks.allow_message(subject, :basic)
+        }.to change {
+          subject.respond_to?(:basic)
+        }.to(true)
+
+        expect(subject.basic).to eq(nil)
+      end
+
+      it "sets up message allowance with params and return value" do
+        expect {
+          ::RSpec::Mocks.allow_message(subject, :x).with(:in).and_return(:out)
+        }.to change {
+          subject.respond_to?(:x)
+        }.to(true)
+
+        expect(subject.x(:in)).to eq(:out)
+      end
+
+      it "supports block implementations" do
+        ::RSpec::Mocks.allow_message(subject, :message) { :value }
+        expect(subject.message).to eq(:value)
+      end
+
+      it "does not set an expectation that the message will be received" do
+        ::RSpec::Mocks.allow_message(subject, :message)
+        expect { verify subject }.not_to raise_error
+      end
+    end
+
+    describe ".expect_message" do
+      let(:subject) { Object.new }
+
+      it "sets up basic message expectation, verifies as uncalled" do
+        expect {
+          ::RSpec::Mocks.expect_message(subject, :basic)
+        }.to change {
+          subject.respond_to?(:basic)
+        }.to(true)
+
+        expect { verify subject }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails if never is specified and the message is called" do
+        expect {
+          ::RSpec::Mocks.expect_message(subject, :foo).never
+          subject.foo
+        }.to raise_error(/expected.*0 times/)
+      end
+
+      it "sets up basic message expectation, verifies as called" do
+        ::RSpec::Mocks.expect_message(subject, :basic)
+        subject.basic
+        verify subject
+      end
+
+      it "sets up message expectation with params and return value" do
+        ::RSpec::Mocks.expect_message(subject, :msg).with(:in).and_return(:out)
+        expect(subject.msg(:in)).to eq(:out)
+        verify subject
+      end
+
+      it "accepts a block implementation for the expected message" do
+        ::RSpec::Mocks.expect_message(subject, :msg) { :value }
+        expect(subject.msg).to eq(:value)
+        verify subject
+      end
+
+    end
+
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/test_double_spec.rb b/rspec-mocks/spec/rspec/mocks/test_double_spec.rb
new file mode 100644
index 0000000..40d4ba4
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/test_double_spec.rb
@@ -0,0 +1,67 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe TestDouble do
+      before(:all) do
+        Module.class_eval do
+          private
+          def use; end
+        end
+      end
+
+      after(:all) do
+        Module.class_eval do
+          undef use
+        end
+      end
+
+      it 'can be extended onto a module to make it a pure test double that can mock private methods' do
+        double = Module.new
+        double.stub(:use)
+        expect { double.use }.to raise_error(/private method `use' called/)
+
+        double = Module.new { TestDouble.extend_onto(self) }
+        double.should_receive(:use).and_return(:ok)
+        expect(double.use).to be(:ok)
+      end
+
+      it 'sets the test double name when a name is passed' do
+        double = Module.new { TestDouble.extend_onto(self, "MyDouble") }
+        expect { double.foo }.to raise_error(/Mock "MyDouble" received/)
+      end
+
+      [[:should, :expect], [:expect], [:should]].each do |syntax|
+        context "with syntax #{syntax.inspect}" do
+          include_context "with syntax", syntax
+          it 'stubs the methods passed in the stubs hash' do
+            double = Module.new do
+              TestDouble.extend_onto(self, "MyDouble", :a => 5, :b => 10)
+            end
+
+            expect(double.a).to eq(5)
+            expect(double.b).to eq(10)
+          end
+        end
+      end
+
+      it 'indicates what type of test double it is in error messages' do
+        double = Module.new do
+          TestDouble.extend_onto(self, "A", :__declared_as => "ModuleMock")
+        end
+        expect { double.foo }.to raise_error(/ModuleMock "A"/)
+      end
+
+      it 'is declared as a mock by default' do
+        double = Module.new { TestDouble.extend_onto(self) }
+        expect { double.foo }.to raise_error(/Mock received/)
+      end
+
+      it 'warns of deprecation of :null_object => true' do
+        RSpec.should_receive :deprecate
+        double = Class.new { TestDouble.extend_onto self, 'name', :null_object => true }
+      end
+    end
+  end
+end
+
diff --git a/rspec-mocks/spec/rspec/mocks/to_ary_spec.rb b/rspec-mocks/spec/rspec/mocks/to_ary_spec.rb
new file mode 100644
index 0000000..c1d2810
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/to_ary_spec.rb
@@ -0,0 +1,54 @@
+require "spec_helper"
+
+describe "a double receiving to_ary" do
+  shared_examples "to_ary" do
+    it "can be overridden with a stub" do
+      obj.stub(:to_ary) { :non_nil_value }
+      expect(obj.to_ary).to be(:non_nil_value)
+    end
+
+    it "responds when overriden" do
+      obj.stub(:to_ary) { :non_nil_value }
+      expect(obj).to respond_to(:to_ary)
+    end
+
+    it "supports Array#flatten" do
+      obj = double('foo')
+      expect([obj].flatten).to eq([obj])
+    end
+  end
+
+  context "double as_null_object" do
+    let(:obj) { double('obj').as_null_object }
+    include_examples "to_ary"
+
+    it "does respond to to_ary" do
+      expect(obj).to respond_to(:to_ary)
+    end
+
+    it "does respond to to_a" do
+      expect(obj).to respond_to(:to_a)
+    end
+
+    it "returns nil" do
+      expect(obj.to_ary).to eq nil
+    end
+  end
+
+  context "double without as_null_object" do
+    let(:obj) { double('obj') }
+    include_examples "to_ary"
+
+    it "doesn't respond to to_ary" do
+      expect(obj).not_to respond_to(:to_ary)
+    end
+
+    it "doesn't respond to to_a", :if => ( RUBY_VERSION.to_f > 1.8 ) do
+      expect(obj).not_to respond_to(:to_a)
+    end
+
+    it "raises " do
+      expect { obj.to_ary }.to raise_error(NoMethodError)
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks/twice_counts_spec.rb b/rspec-mocks/spec/rspec/mocks/twice_counts_spec.rb
new file mode 100644
index 0000000..5f772fd
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks/twice_counts_spec.rb
@@ -0,0 +1,66 @@
+require 'spec_helper'
+
+module RSpec
+  module Mocks
+    describe "#twice" do
+      before(:each) do
+        @double = double("test double")
+      end
+
+      it "passes when called twice" do
+        @double.should_receive(:do_something).twice
+        @double.do_something
+        @double.do_something
+        verify @double
+      end
+
+      it "passes when called twice with specified args" do
+        @double.should_receive(:do_something).twice.with("1", 1)
+        @double.do_something("1", 1)
+        @double.do_something("1", 1)
+        verify @double
+      end
+
+      it "passes when called twice with unspecified args" do
+        @double.should_receive(:do_something).twice
+        @double.do_something("1")
+        @double.do_something(1)
+        verify @double
+      end
+
+      it "fails fast when call count is higher than expected" do
+        @double.should_receive(:do_something).twice
+        @double.do_something
+        @double.do_something
+        expect {
+          @double.do_something
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails when call count is lower than expected" do
+        @double.should_receive(:do_something).twice
+        @double.do_something
+        expect {
+          verify @double
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+      end
+
+      it "fails when called wrong args on the first call" do
+        @double.should_receive(:do_something).twice.with("1", 1)
+        expect {
+          @double.do_something(1, "1")
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+        reset @double
+      end
+
+      it "fails when called with wrong args on the second call" do
+        @double.should_receive(:do_something).twice.with("1", 1)
+        @double.do_something("1", 1)
+        expect {
+          @double.do_something(1, "1")
+        }.to raise_error(RSpec::Mocks::MockExpectationError)
+        reset @double
+      end
+    end
+  end
+end
diff --git a/rspec-mocks/spec/rspec/mocks_spec.rb b/rspec-mocks/spec/rspec/mocks_spec.rb
new file mode 100644
index 0000000..1b2f1de
--- /dev/null
+++ b/rspec-mocks/spec/rspec/mocks_spec.rb
@@ -0,0 +1,65 @@
+require "spec_helper"
+
+describe RSpec::Mocks do
+  describe "::setup" do
+    context "with an existing Mock::Space" do
+      before do
+        @orig_space = RSpec::Mocks::space
+      end
+
+      after do
+        RSpec::Mocks::space = @orig_space
+      end
+
+      it "memoizes the space" do
+        RSpec::Mocks::setup(Object.new)
+        space = RSpec::Mocks::space
+        RSpec::Mocks::setup(Object.new)
+        expect(RSpec::Mocks::space).to equal(space)
+      end
+    end
+
+    context "with no pre-existing Mock::Space" do
+      it "initializes a Mock::Space" do
+        RSpec::Mocks::space = nil
+        RSpec::Mocks::setup(Object.new)
+        expect(RSpec::Mocks::space).not_to be_nil
+      end
+    end
+  end
+
+  describe "::verify" do
+    it "delegates to the space" do
+      foo = double
+      foo.should_receive(:bar)
+      expect do
+        RSpec::Mocks::verify
+      end.to raise_error(RSpec::Mocks::MockExpectationError)
+    end
+  end
+
+  describe "::teardown" do
+    it "delegates to the space" do
+      foo = double
+      foo.should_receive(:bar)
+      RSpec::Mocks::teardown
+      expect do
+        foo.bar
+      end.to raise_error(/received unexpected message/)
+    end
+  end
+
+  describe ".configuration" do
+    it 'returns a memoized configuration instance' do
+      expect(RSpec::Mocks.configuration).to be_a(RSpec::Mocks::Configuration)
+      expect(RSpec::Mocks.configuration).to be(RSpec::Mocks.configuration)
+    end
+  end
+
+  context 'when requiring spec/mocks (as was valid for rspec 1)' do
+    it 'prints a deprecation warning' do
+      expect(::RSpec).to receive(:deprecate).with("require 'spec/mocks'", :replacement => "require 'rspec/mocks'")
+      load "spec/mocks.rb"
+    end
+  end
+end
diff --git a/rspec-mocks/spec/spec_helper.rb b/rspec-mocks/spec/spec_helper.rb
new file mode 100644
index 0000000..eb51f08
--- /dev/null
+++ b/rspec-mocks/spec/spec_helper.rb
@@ -0,0 +1,60 @@
+require 'yaml'
+begin
+  require 'psych'
+rescue LoadError
+end
+
+RSpec::Matchers.define :include_method do |expected|
+  match do |actual|
+    actual.map { |m| m.to_s }.include?(expected.to_s)
+  end
+end
+
+module VerifyAndResetHelpers
+  def verify(object)
+    RSpec::Mocks.proxy_for(object).verify
+  end
+
+  def reset(object)
+    RSpec::Mocks.proxy_for(object).reset
+  end
+end
+
+RSpec.configure do |config|
+  config.mock_with :rspec
+  config.color_enabled = true
+  config.order = :random
+  config.run_all_when_everything_filtered = true
+  config.treat_symbols_as_metadata_keys_with_true_values = true
+  config.filter_run_including :focus
+
+  config.expect_with :rspec do |expectations|
+    expectations.syntax = :expect
+  end
+
+  old_verbose = nil
+  config.before(:each, :silence_warnings) do
+    old_verbose = $VERBOSE
+    $VERBOSE = nil
+  end
+
+  config.after(:each, :silence_warnings) do
+    $VERBOSE = old_verbose
+  end
+
+  config.include VerifyAndResetHelpers
+end
+
+shared_context "with syntax" do |syntax|
+  orig_syntax = nil
+
+  before(:all) do
+    orig_syntax = RSpec::Mocks.configuration.syntax
+    RSpec::Mocks.configuration.syntax = syntax
+  end
+
+  after(:all) do
+    RSpec::Mocks.configuration.syntax = orig_syntax
+  end
+end
+
diff --git a/License.txt b/rspec/License.txt
similarity index 100%
rename from License.txt
rename to rspec/License.txt
diff --git a/README.md b/rspec/README.md
similarity index 100%
rename from README.md
rename to rspec/README.md
diff --git a/lib/rspec.rb b/rspec/lib/rspec.rb
similarity index 100%
rename from lib/rspec.rb
rename to rspec/lib/rspec.rb
diff --git a/lib/rspec/version.rb b/rspec/lib/rspec/version.rb
similarity index 100%
rename from lib/rspec/version.rb
rename to rspec/lib/rspec/version.rb
diff --git a/metadata.yml b/rspec/metadata.yml
similarity index 100%
rename from metadata.yml
rename to rspec/metadata.yml

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-rspec.git



More information about the Pkg-ruby-extras-commits mailing list