Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rspec/rspec-core
base: v2.10.0
...
head fork: rspec/rspec-core
compare: master
Checking mergeability… Don't worry, you can still create the pull request.
This comparison is big! We're only showing the most recent 250 commits
Commits on Jan 15, 2015
@myronmarston myronmarston Got things to work on 1.8.7. ab2b613
@myronmarston myronmarston Run `:context` hooks from shared contexts that apply to one example. 639db76
@myronmarston myronmarston Make :context hooks in config apply to individual matching examples. 3e1184c
@myronmarston myronmarston Skip specs failing due to a JRuby 1.7 bug when run in ruby 2.0 mode. 658e6e0
@myronmarston myronmarston Add benchmarks for treating an example’s group instance’s singleton c…
…lass as a group.
ec88ce7
@myronmarston myronmarston Add profiling support with stackprof. f054a61
@myronmarston myronmarston Update docs to explain how singleton example groups work. 8a09786
@myronmarston myronmarston Remove unnecessary module inclusion. c2f04ed
@myronmarston myronmarston Split FilterableItemRepository into two implementations.
They are optimized for different cases.
06c5d75
@myronmarston myronmarston Use optimized filterable item repository in the appropriate places.
- Config should use the QueryOptimized one because config
  usually sets up global hooks, inclusions, etc once at the
  start of the process (e.g. in `spec_helper`) and then is
  repeatedly queried as each example or group is defined.
- Examples and groups should use the UpdateOptimized one as
  they are not queried by other examples or groups the way
  config is; instead, they can be updated multiple times
  based on having multiple global config hooks to process.
  Cutting out the additional update processing done by
  the QueryOptimized implementation greatly improves
  the performance of the `with_config_hooks` benchmark.
580bc76
@myronmarston myronmarston Improve perf of metadata-based shared group inclusion.
The call to `RSpec::CallerFilter.first_non_rspec_line`
took most of the time. I originally planned to leverage
rspec/rspec-support#155 but realized we could avoid
calling that entirely by re-using the location from
the group’s metadata.

I re-ran all the benchmarks and updated them. They
look much, much better.
a1a3dc4
@e2 e2 docs: emphasize gem backtrace exclusion patterns
cd32c7c
@myronmarston myronmarston Merge pull request #1847 from e2/doc_multiple_backtrace_gem_filter
docs: emphasize gem backtrace exclusion patterns
198abcb
Commits on Jan 16, 2015
@myronmarston myronmarston Stop using aruba’s removed `regexp`.
See cucumber/aruba#227 for background.
70bb6b9
Commits on Jan 17, 2015
@JonRowe JonRowe Merge pull request #1850 from rspec/fix-for-aruba-0-6-2
Stop using aruba’s removed `regexp`.
e69194a
@agx agx Escape rspec path
otherwise things like

   bundle exec rake spec

break in repos containing spaces in directory names
3b944b5
Commits on Jan 18, 2015
@myronmarston myronmarston Merge pull request #1845 from agx/escape-rspec_path
Escape rspec path
246a45a
@myronmarston myronmarston Changelog for #1845.
[ci skip]
e5f20d2
Commits on Jan 20, 2015
@myronmarston myronmarston Merge pull request #1749 from rspec/more-powerful-include
Apply module/shared context inclusion to individual examples
229bbaa
Commits on Jan 22, 2015
@durran durran Allow Regexp class to be described
d7f5e3e
Commits on Jan 23, 2015
@myronmarston myronmarston It should be `flatten(1)`.
We changed it to `flatten(1)` in cd52601
but then accidentally changed it to `flatten(2)` in
940b7ab. Not sure how...
b1f52e4
@myronmarston myronmarston Merge pull request #1854 from rspec/flatten-1-not-2
It should be `flatten(1)`.
340a1f0
Commits on Jan 26, 2015
@mtsmfm mtsmfm accept semicolon separated -I
dcfb37b
@myronmarston myronmarston Merge pull request #1855 from mtsmfm/comma-separated-option
accept colon separated -I like ruby
d329a10
@myronmarston myronmarston Changelog for #1855.
Also, add a bit more detail to the spec doc string,
to mention this mirror’s Ruby’s -I behavior.
b829a80
Commits on Jan 27, 2015
@durran durran Move spec with described_class specs for Regexp failure
f9f4534
@myronmarston myronmarston Merge pull request #1853 from durran/regexp-testing
Allow Regexp class to be described
3fd4b93
@myronmarston myronmarston Add changelog entry for #1853.
[ci skip]
2ed060a
Commits on Jan 30, 2015
@maxlinc maxlinc Fixes #1856: make sure summary is last so it doesn't scroll off the s…
…creen
ca49430
@JonRowe JonRowe Merge pull request #1857 from maxlinc/summary_profile_order
Change the profile/dump_summary order
3519d9d
@JonRowe JonRowe changelog for #1857
[skip ci]
655a52b
Commits on Feb 03, 2015
@myronmarston myronmarston Update changelog.
[ci skip]
26a5cd9
@myronmarston myronmarston Update changelog for v3.2.0 [ci skip] 41abbac
@myronmarston myronmarston Release 3.2.0
c13d083
@myronmarston myronmarston Bump version to 3.3.0.pre
67f933c
Raymond Sanchez Skip Core.path_to_executable for Windows OS only
c6fef1a
Commits on Feb 04, 2015
@rsanchez79 rsanchez79 Update spec for Core.path_to_executable
This is to handle issue with File.executable? on Windows.
da20dd3
@myronmarston myronmarston Remove unnecessary temporary mocks scope.
a640e98
@myronmarston myronmarston Merge pull request #1860 from rsanchez79/master
Update Core.path_to_executable spec for Windows
dda91af
@myronmarston myronmarston Cleanup whitespace.
8fa14ae
@JonRowe JonRowe Merge pull request #1862 from rspec/remove-unnecessary-mock-scope
Remove unnecessary temporary mocks scope.
be5c7a6
Raymond Sanchez Update spec for format_backtrace
In Windows, we can use '/' for file separator. Let's keep one spec for
both Windows and non-windows systems.
dcbc98e
Commits on Feb 05, 2015
@JonRowe JonRowe Merge pull request #1865 from rsanchez79/specForWindows
Update spec for format_backtrace
703e742
@JonRowe JonRowe expose the reporter from a running example 038a183
Commits on Feb 06, 2015
@JonRowe JonRowe make Reporter#message a public api 44b36c7
@JonRowe JonRowe changelog for #1866
[skip ci]
41e8447
@JonRowe JonRowe switch NullReporter to not be an instance
2633182
@JonRowe JonRowe Merge pull request #1866 from rspec/expose_reporter_and_allow_message
Expose reporter to running examples
9d12a30
Commits on Feb 08, 2015
@JonRowe JonRowe allow the reporter to send custom events to registered formatters a7b1037
@JonRowe JonRowe enforce notify only sending internal notifications
4e906eb
@JonRowe JonRowe Merge pull request #1869 from rspec/allow_publishing_custom_events_vi…
…a_reporter

Allow the reporter to send custom events to registered formatters
9d49bcb
Commits on Feb 09, 2015
@bf4 bf4 Skip specs with non-mri-compatible backtrace.
a52fc45
@JonRowe JonRowe Merge pull request #1871 from bf4/only_test_backtrace_on_mri
Skip specs with non-mri-compatible backtrace.
0b3a9be
@myronmarston myronmarston Add changelog entry for #1869.
[ci skip]
f00b298
@JonRowe JonRowe ammend changelog for #1869
[skip ci]
c096053
Commits on Feb 11, 2015
@myronmarston myronmarston Remove unnecessary shift/unshift.
f251894
@JonRowe JonRowe Merge pull request #1875 from rspec/cleanup-args-shifting
Remove unnecessary shift/unshift.
6580db2
Commits on Feb 14, 2015
@myronmarston myronmarston Beef up tests for when rspec-expectations is not available.
Specifically, in #1826, we changed the conditional for
whether or not to assign a generated description from
RSpec::Matchers for examples with no doc string. Before
#1826, the conditional was: 

  assign_generated_description if RSpec.configuration.expecting_with_rspec?

In #1826 it changed to:

  assign_generated_description if defined?(::RSpec::Matchers)

We didn’t update the spec meant for that case to match, but it continued
to pass (as a false positive) due to rspec/rspec-mocks#874. @samphippen’s
fix in rspec/rspec-mocks#884 surfaced the issue (as the spec now failed)
so I decided to improve the tests.

- The spec now simulates the `RSpec::Matchers` constant being undefined
  to simulate the correct condition. We also have to prevent it from
  being autoloaded.
- The cukes for minitest/test-unit did not sufficiently cover this case,
  because the aforementioned autoload would autoload RSpec::Matchers,
  so we have to simulate rspec-expectations being completely uninstalled.
  Then the cukes properly fail if we break the `if defined?(::RSpec::Matchers)`
  conditional.
6525139
Commits on Feb 15, 2015
@JonRowe JonRowe Merge pull request #1879 from rspec/better-avoid-generated-descriptio…
…ns-tests

Beef up tests for when rspec-expectations is not available.
0ec31db
Commits on Feb 16, 2015
@JonRowe JonRowe Fix inconsistency in spec
@cbliard pointed out on ca3d7fe via
https://github.com/rspec/rspec-core/pull/1703/files#r24651173
that these specs don't actually assert what they are meant to
so corrected
07b4bea
@esposito esposito notify seed before notifying start
7a3a4fd
Commits on Feb 17, 2015
@myronmarston myronmarston Cleanup whitespace. 2808ab1
@myronmarston myronmarston Remove unneeded require. ca3f0d0
@myronmarston myronmarston Update to new library-wide rspec-support checks.
3f8a079
@myronmarston myronmarston Update what we skip to account for recent changes.
08c4c7b
@JonRowe JonRowe Merge pull request #1880 from rspec/allowed-stdlibs
Allowed stdlibs
850b904
Commits on Feb 18, 2015
@bf4 bf4 Address String#split failures by using EncodedString
Add spec for exception when failure_lines has a bad encoding
529f83b
@bf4 bf4 Remove unnecessary conditional
"".split("\n")       # => []
nil.to_s.split("\n") # => []

If exception.message is nil, the inner block will
not be reached. If it is non-nil, then there's no need
to check for nil inside the block.
62204c8
@esposito esposito test order of notifications
4bed44a
@mswinson mswinson add type and version information to json formatter
- add type to allow clients to detect file format
- add version to determine which version of rspec-core generated the
  file
26d0cb0
@JonRowe JonRowe Merge pull request #1760 from bf4/handle_non_utf8_exception_messages
Handle exception message with invalid UTF-8; For rbx
4152945
@JonRowe JonRowe changelog for #1760
[skip ci]
a14f95c
Commits on Feb 19, 2015
@JonRowe JonRowe remove usage of set from rspec-core and replace with an internal look…
…upset which uses a hash
72b66b0
@JonRowe JonRowe rename LookupSet to Set 44beede
@JonRowe JonRowe benchmark demonstrating that `#keys.each` performs marginally better …
…than `#each_key`
d31ca7e
Commits on Feb 20, 2015
@JonRowe JonRowe Merge pull request #1870 from rspec/remove_set
Remove Set
6aedf15
@JonRowe JonRowe Changelog for #1870
[skip ci]
60332a4
Commits on Feb 21, 2015
@esposito esposito cleanup specs
37a29f4
Commits on Feb 22, 2015
@myronmarston myronmarston Merge pull request #1881 from rspec/correct_spec
Fix inconsistency in spec
b7bd470
@myronmarston myronmarston Merge pull request #1882 from esposito/master
Notify seed before notifying start
f025003
@myronmarston myronmarston Changelog for #1882.
[ci skip]
2abde01
@myronmarston myronmarston Remove excess period.
[ci skip]
835b7a9
Commits on Feb 23, 2015
@myronmarston myronmarston Remove duplicate spec.
This exact spec is duplicated on line 775.
I suspect this was written for the old `--line-number` CLI flag
and got updated to the `file_path:line_num` form when
we dropped support for `--line-number`, creating the duplication.
67d1534
@myronmarston myronmarston Add ids to examples and groups.
This allows us to uniquely identify any example or group.
057e729
@myronmarston myronmarston Add support to filter based on example/group ids. 911601d
@myronmarston myronmarston Use id in rerun command when the location identifies multiple examples. ea3d536
@myronmarston myronmarston Add some missing keys to RESERVED_KEYS.
…and add a spec enforcing that it is always up-to-date.
b77d5bd
@myronmarston myronmarston Name the regexp to make it more clear what it’s for.
..as per @samphipppen’s request.
8b71ab9
@myronmarston myronmarston Standardize on setting `line` before rather than after.
..as per @samphippen’s review request.
0f7c90b
Commits on Feb 24, 2015
@myronmarston myronmarston Quote example ids in rerun command unless we know it’s unneeded. 3177337
@myronmarston myronmarston Update `rspec --help` to include more detail about filtering.
- Clarify location filtering.
- Add info about id filtering.
e226831
@myronmarston myronmarston Add changelog entries.
16bb9a7
@myronmarston myronmarston Forwardport 3.2.1 release notes.
[ci skip]
43b464b
@myronmarston myronmarston Add fish to the list of shells that allow unquoted ids.
…according to @joshcheek’s comment:

#1884 (comment)
dcbb853
@myronmarston myronmarston Updated travis build scripts (from rspec-dev)
a34c84d
Commits on Feb 25, 2015
@myronmarston myronmarston Lower JRuby coverage threshold.
30d3e0b
@myronmarston myronmarston Merge pull request #1886 from rspec/update-travis-build-scripts-2015-…
…02-24-for-master

Updates from rspec-dev (2015-02-24)
f96845f
@JonRowe JonRowe Merge pull request #1884 from rspec/example-ids
Example ids
faeeba1
Commits on Feb 26, 2015
@myronmarston myronmarston Fix rake task arg quoting on Windows.
4a57af8
@myronmarston myronmarston Merge pull request #1887 from rspec/fix-rake-task-windows-escaping
Fix rake task arg quoting on Windows.
094c3d2
@myronmarston myronmarston Add missing paren.
[ci skip]
9560970
Commits on Mar 03, 2015
@myronmarston myronmarston Fix example in README to be accurate.
[ci skip]
f06892d
@JonRowe JonRowe simple readme fix
[skip ci]
b610d83
@JonRowe JonRowe Merge pull request #1890 from rspec/fixup_readme
Simple readme fix
ae69d80
Commits on Mar 05, 2015
@myronmarston myronmarston Make diff coloring work properly in integration specs. 4ac3b66
@myronmarston myronmarston Triple quotes aren’t really a thing.
Ruby concatenates strings that are next to each
other, though, so it’s a blank string concatenated
with a longer multi-line string concatenated with
another blank string.
e4a2897
Commits on Mar 06, 2015
@myronmarston myronmarston Prefer capitalized section headings. 4dd013d
@myronmarston myronmarston Remove mention of removed feature.
README space is limited so why waste it mentioning
a feature we no longer support?
dcc5e92
@myronmarston myronmarston Add rspec gem to list as well.
While it’s not normally needed (it has no code!),
some RSpec extensions depend directly on `rspec` and
in such situations you’ll need it to have the newer
version as well.
7e18d70
@myronmarston myronmarston Add spacing. 38b1601
@myronmarston myronmarston Add note explaining that nested groups are subclasses. de156c1
@myronmarston myronmarston Improve “Get Started” section of README.
It’s important that you see the expectation fail
(it’s how you “test the test”, so to speak, and
you can confirm it gives you a good failure message),
so let’s not skip that step.
2c4ae5c
@myronmarston myronmarston Add section describing scope.
After reading http://therealadam.com/2015/03/01/its-not-your-fault-if-your-tools-confuse-you/,
I realized we do a poor job documenting the way the scopes work so this will hopefully help.
8112643
@myronmarston myronmarston Clarify what an example is.
[ci skip]
302bfba
@myronmarston myronmarston Remove use of helper method override w/o `super`.
241f697
@myronmarston myronmarston Add snippet showing how the examples would get run.
82bd95e
@myronmarston myronmarston Apply tag filters only to files not having an id or location filter.
Fixes #1889.
0a4937b
Commits on Mar 08, 2015
@JonRowe JonRowe Merge pull request #1897 from rspec/fix-filtering-regression
Fix filtering regression
4d19d2e
@JonRowe JonRowe Merge pull request #1898 from rspec/add-scope-docs
README improvements
896291a
Commits on Mar 10, 2015
@myronmarston myronmarston Rename argument to reflect what it actually is.
In my first pass I passed in the index but later
changed to passing in an index provider and forgot
to update the argument name.
c62fcde
@myronmarston myronmarston Cleanup formatter support a bit.
- Stop memoizing `example`. It made it difficult to
  construct multiple different examples.
- Explicitly create the examples where they are needed.
96c7590
@myronmarston myronmarston Use a real result object instead of a double.
The result object is really just a value object,
so why fake it out?
bd774ef
@myronmarston myronmarston Implement dumper/parser for example statuses. 0529b6e
@myronmarston myronmarston Implement merging algorithm. ec07ce8
@myronmarston myronmarston Implement ExampleStatusPersister. 6c9d438
@myronmarston myronmarston Fix parser to handle blank values properly. 597b9fd
@myronmarston myronmarston Add config option for example status persistence file path. ee490cc
@myronmarston myronmarston Add `:last_run_status` metadata to examples. 6215a7a
@myronmarston myronmarston Add `--only-failures` and `--next-failure` options. 951e083
@myronmarston myronmarston Combine `--fail-fast` and `--no-fail-fast` in help output. 67c48b3
@myronmarston myronmarston Add changelog entries for new features from this PR.
52d4f7c
Commits on Mar 12, 2015
@myronmarston myronmarston Forward port 3.2.2 release notes.
[ci skip]
1e483f6
@myronmarston myronmarston Load only files with failures when using `rspec --only-failures`.
Loading ALL spec files when only a handful have failures is inefficient
and could make the run take significantly longer. Note that we only do
this if no file or directory arg is passed to `rspec`. If the user
passes anything, we load what they tell us to load.
ab1e895
@myronmarston myronmarston Move `only_failures` config specs into their own file.
`configuration_spec.rb` is too huge. The API needs to
remain large to support the configurability of RSpec,
but we don’t need to keep all the specs in one file.
I want to start breaking off different chunks into their
own files. This is a first step towards that.
f56aba5
@myronmarston myronmarston Ensure derived values are updated when the config setting updates.
It’s easier to make this work by moving the
`spec_files_with_failures` and the
`last_run_statuses` methods off of `world`
and over to `configuration.
cc34181
@myronmarston myronmarston Stop stubbing the object under test.
It made more sense when these methods were on `world`
as they were before but now they are on config so we
want to avoid that.
3ad1aeb
@myronmarston myronmarston Use spec/examples.txt instead of examples.txt.
It’s more appropriate there.
f8a5cd6
Commits on Mar 15, 2015
@myronmarston myronmarston Always limit loaded files when `--only-failures` is used.
Before, we only did so when no file or directory arg was passed
to `rspec`, but it's better to take the intersection of files
matching the provided args and files with failures.
500ff37
@myronmarston myronmarston Use "unknown" for :last_run_status when we don't have a value.
This ensures that the value is consistent — before for an unknown
case it could either be `nil` or `"unknown"`.

We've also moved the constant into configuration, so that we can
avoid the cost of loading `example_status_persister` (via constant
access since it is setup to be autoloaded) if the user hasn't
configured the feature.
94b4099
@myronmarston myronmarston Fail fast when we can't support `--only-failures` due to lack of config. 43da674
@myronmarston myronmarston Provide friendly warnings when we can’t access status file. 3258466
@myronmarston myronmarston Add `example_status_persistence_file_path` generated spec_helper.rb 8ced287
@myronmarston myronmarston Add backtrace to appveyor build (will later port to rspec-dev).
af8628f
Commits on Mar 16, 2015
@myronmarston myronmarston Merge pull request #1888 from rspec/rerun-failures
Add new --only-failures CLI option
4a7e748
@myronmarston myronmarston Updated travis build scripts (from rspec-dev)
6fc8cf1
@JonRowe JonRowe Merge pull request #1904 from rspec/update-travis-build-scripts-2015-…
…03-15-for-master

Updates from rspec-dev (2015-03-15)
1225032
@fabn fabn Warn users when overriding methods (via let, def or define_method) in…
… the same example group.
e072e53
@myronmarston myronmarston Merge pull request #1903 from fabn/warn-on-multiple-let
Emit a warning when let override a method defined in the same context
1c8c881
@myronmarston myronmarston Add changelog for #1903.
[ci skip]
f98223d
Commits on Mar 18, 2015
@myronmarston myronmarston Rename `safely` to make it more clear what it’s for. 4a61665
@myronmarston myronmarston Fix `RSpec::Core::RakeTask#failure_message`.
`system` returns a boolean value to indicate success/failure,
but the use of `failure_message` was in a `rescue` block that
never got executed.  It appears this has been broken since
ea70e4e. Before that commit,
we used `Rake::FileUtilsExt#ruby`, which does indicate failure
by raising an error (and thus the `rescue` was correct). In
ea70e4e, we switched to using
`system` and the rescue was left in place but never got hit
anymore.

The lack of test coverage here is why we never noticed, so I
addressed that as well.
ad53e7f
@myronmarston myronmarston Remove unreachable code.
`RSpec::CallerFilter.first_non_rspec_line` either
returns the line or raises an error, so the branch
for when `line` is nil could never be reached.
2ecdecc
@myronmarston myronmarston Exclude version/platform-specific code from simplecov. 76e6976
@myronmarston myronmarston Remove dead code. 74a286d
@myronmarston myronmarston Add specs covering uncovered code. 4dede48
@myronmarston myronmarston Enforce 100% coverage on ruby >= 2.1.0.
4cbc8c5
@myronmarston myronmarston Merge pull request #1905 from rspec/update-coverage
Update coverage
b6d9a8e
Commits on Mar 19, 2015
@myronmarston myronmarston Make `—order random` more deterministic.
When you’re troubleshooting an order dependent
failure, you want to get the repro case down to
a minimal run that loads and runs as few specs
as possible. With the old random ordering implementation,
that was hard to achieve because while rerunning with
a given seed produced the same order when the exact
same set of examples were loaded, the ordering would
be completely different when a subset was loaded.

By ordering by `hash(seed + example_id)` it ensures
that the ordering of any two examples should stay
consistently regardless of how many other examples are
loaded.

Jenkins or MD5 is significantly slower than `shuffle`,
but I think the tradeoff is worth it here. This isn’t
a hot spot.
b03aa28
@myronmarston myronmarston Add changelog for #1908.
e1fe8b3
Alex Kwiatkowski and Ryan Ong Check if method belongs to singleton_class before removing it
Fixes #1906
3932d82
@leoarnold leoarnold Corrected a typo in documentation
dcfec9c
@myronmarston myronmarston Merge pull request #1907 from SchoolKeep/ak-ro-fix-idempotently_defin…
…e_singleton_method

Check if method belongs to singleton_class before removing it
99bf337
@myronmarston myronmarston Add changelog for #1907.
[ci skip]
a56084a
@myronmarston myronmarston Correct author list for #1907.
[ci skip]
8830f4a
@myronmarston myronmarston Merge pull request #1909 from leoarnold/master
Corrected a typo in documentation
01cb4a8
@myronmarston myronmarston Use parens to clarify order of operations.
(This doesn’t actually change the order).
f0f5fff
Commits on Mar 20, 2015
@myronmarston myronmarston Assign example group constant earlier.
This ensures it is set as soon as possible, before
shared contexts included via metadata are evaluated,
so that if there’s an error, the example group class
name will be included in it.
5dc5088
@myronmarston myronmarston Merge pull request #1908 from rspec/stable-random-ordering
Make `—order random` more deterministic.
5e20d18
@myronmarston myronmarston Add changelog entry for #1749.
Somehow I forgot to add this before...

[ci skip]
3597451
@myronmarston myronmarston Make `let` work properly when shared context is applied to a single e…
…xample.
69b5b24
Commits on Mar 21, 2015
@myronmarston myronmarston Revert "Warn users when overriding methods (via let, def or define_me…
…thod) in the same example group."

This reverts the lib and spec pieces of e072e53.

The warning is overzealous. After upgrading a project to RSpec HEAD, I
got spammed with tons of warnings of situations that weren't actually
problematic.  For example, it's common to define a `let` in a shared
context that provides a default value, and than to purposefully override
that in a host group where the shared context is included. We should'nt
warn in such a situation, but this did warn.

See #1903 for the original code this reverts.
b663028
@myronmarston myronmarston Merge pull request #1915 from rspec/revert-method-override-warning
Revert "Warn users when overriding methods (via let, def or define_method) in the same example group."
1a22dfa
@JonRowe JonRowe Merge pull request #1911 from rspec/assign-group-name-sooner
Assign example group constant earlier.
e353d3c
@JonRowe JonRowe Merge pull request #1912 from rspec/fix-let-no-superclass-method-problem
Make `let` work properly when shared context is applied to a single example.
daf37a9
Commits on Mar 22, 2015
@myronmarston myronmarston Don't purge example groups when a `--fail-fast` failure is hit.
Doing so prevents us from persisting updates to example statuses,
interfering with `--next-failure` from working properly.

The purging was introduced in 6946d2d but has actually done nothing
since fde5955, when the runner switched
from doing `@world.example_groups.map { |g| g.run }` to
`order(@world.example_groups).map { |g| g.run }`. With the ordering
applied, purging the example group no longer had the intended "abort
the loop early" effect, since we were now mapping over a derived ordered
array. The purging isn't really needed anyway; each example group aborts
early if `wants_to_quit` is set, so we still don't run any more examples
or groups.

It might be nice to bring back the "abort the loop early" effect but
I can't think of an elegant way to do it and it doesn't seem worth
the complexity at this point.

Fixes #1914.
e747c7f
@myronmarston myronmarston Don't stomp the order the user has already specified.
Fixes #1910.
bae781a
@JonRowe JonRowe changelog for #1911
[skip ci]
e93a627
Commits on Mar 23, 2015
@JonRowe JonRowe Merge pull request #1916 from rspec/fix-next-failure
Fix next failure
c4dbf1b
Commits on Apr 03, 2015
@JoshCheek JoshCheek Make memoized helpers threadsafe
See #1858 for discussion.

The unsquashed version can be seen at
https://github.com/JoshCheek/rspec-core/tree/threadsafe-let-block-unsquashed
in case the intermediate state and thoughts have value.

Motivation
----------

When working in a truly threaded environment (e.g. Rbx and JRuby),
you can write a test like the one below, which should pass.
But, it will fail sometimes, because two threads request the uninitialized counter
concurrently. The first one to receive the value will then be
incrementing a counter, that is later overwritten when the second
thread's let block returns.

You can verify this by running the code sample below in Rubinius.
After some number of attempts, the value will be less than 10k.
If you then make the `let` block a `let!` block, it will memoize
before the threads are created, and the values will be correct again.
While this is a reasonable solution, it is incredibly confusing
when it arises (I spent a lot of hours trying to find the bug in my code),
and requires that the user understand it's something they need to
be aware of and guard against.

```ruby
class Counter
  def initialize
    @mutex = Mutex.new
    @count = 0
  end

  attr_reader :count

  def increment
    @mutex.synchronize { @count += 1 }
  end
end

RSpec.describe Counter do
  let(:counter) { Counter.new }

  it 'increments the count in a threadsafe manner' do
    threads = 10.times.map do
      Thread.new { 1000.times { counter.increment } }
    end
    threads.each &:join
    expect(counter.count).to eq 10_000
  end
end
```

Relevant Changes
----------------

* Adds `--[no]-threadsafe` command-line option
* `RSpec::Core::Configuration#threadsafe{?,=}`
  (notation there is from bash expansion)
  setting, defaults to `true`
* Mamoized is a threadsafe object instead of a hash,
  so rename `RSpec::Core::MemoizedHelpers::ContextHookMemoizedHash`
  to        `RSpec::Core::MemoizedHelpers::ContextHookMemoized`

  Create an object because only #fetch was being called on the hash,
  and to make that threadsafe required adding a new method.
  At that point, there is no value in having it subclass Hash,
  having to support an entire API that nothing else uses.
  So just make it an object which wraps a hash and presents a memoized
  getter/setter. Also named the method in such a way as to make it
  very clear that it's not a hash, so a dev won't mistakenly think
  they are working with one when they aren't.
* Adds private class `RSpec::Core::ReentrantMutex`,
  which is basically just `Monitor` from the stdlib.
* `RSpec::Core::ExampleGroup#initialize` now calls super so that
  `RSpec::Core::MemoizedHelpers` can initialize the memoized helper
  when the example is instantiated, rather than when it is accessed,
  as this is not threadsafe.

Context and daydreams
---------------------

* PR can be seen unsquashed at:
  https://github.com/JoshCheek/rspec-core/tree/threadsafe-let-block-unsquashed
  This is my first "real" squash, and it wasn't super smooth. I think I
  got it right, in the end, but if you're looking at it going "wtf?", and
  want some more context into the squash itself, I documented it at:
  https://gist.github.com/JoshCheek/017c399641a44286428b
  Also, while I'm pretty sold against anything that changes history,
  there's probably a way to do this that's better than what I did,
  so if you read that and have insights, shoot em my wya, I'd love to get better!
* This does not add any stedlib dependencies as they affect the test
  environment of all users.
* The threads need to be reentrant, which will allow a let block in a thread to
  access its parent let block. This can be achieved with Monitor from
  the stdlib. However, to avoid the dependency, the code was copied from
  https://github.com/ruby/ruby/blob/eb7ddaa3a47bf48045d26c72eb0f263a53524ebc/lib/monitor.rb#L9
  and pasted/edited into `lib/rspec/core/reentrant_mutex.rb`
  This way the user's test environment is preserved, but we still get
  reentrant mutexes.
* Reentrant mutexes are built on top of normal mutexes. These are in
  core now, but for 1.8.7, were defined in the stdlib's thread.rb
  So, similarly, copy that code into `RSpec::Core::ReentrantMutex::MUTEX`
  (capitalization due to Rubocop rules),
  with a note stating that it should be deleted once 1.8 support is dropped.
  If there is a Mutex available already, though, as on 1.9.x+, it will use that.
* Adds a development dependency on a gem, thread_order, which I extracted out of this work.
  Its purpose was to ease the difficulty and opacity of specifying what should
  happen and when, with regards to getting the threads into situations to illustrate
  expected behaviour. It similarly works on 1.8.7 - 2.2, and on JRuby and Rbx,
  without dependencies on the stdlib.
* Add benchmark for threadsafe let block, here is a summary:

  ```
  MRI 2.2

  1 call to let -- each sets the value
    non-threadsafe (original):   830988.5 i/s
    non-threadsafe (config)  :   665661.9 i/s - 1.25x slower
    threadsafe               :   323574.9 i/s - 2.57x slower
  10 calls to let -- 9 will find memoized value
    non-threadsafe (original):   346302.0 i/s
    non-threadsafe (config)  :   309970.2 i/s - 1.12x slower
    threadsafe               :   208946.3 i/s - 1.66x slower
  1 call to let which invokes super
    non-threadsafe (original):   591906.3 i/s
    non-threadsafe (config)  :   511295.0 i/s - 1.16x slower
    threadsafe               :   246079.6 i/s - 2.41x slower
  10 calls to let which invokes super
    non-threadsafe (original):   297422.6 i/s
    non-threadsafe (config)  :   264045.8 i/s - 1.13x slower
    threadsafe               :   170853.1 i/s - 1.74x slower
  ```

  The threasafe let is 1.5 to 2.5 times slower than the original hash
  implementation. The hash alternative is 1.1 to 1.25 times slower.
  If this matters for you, you can configure which one you want to use.

  Either way, you can call the method defined by a let block hundreds of
  thousands of times a second.
ffe00a1
@myronmarston myronmarston Merge pull request #1858 from JoshCheek/threadsafe-let-block
Make memoized helpers threadsafe
76c0259
@myronmarston myronmarston Tweak a few things about the threadsafe let solution from #1858.
1). Remove `--threadsafe` CLI option.

In general, we don't expose every config option via the CLI.
We want to make it easy for users to run `rspec --help` and
find the options that they are commonly going to want to customize
for a particular CLI run. I don't think `--threadsafe` is one of
those -- it's more something that'll be turned off globally for the
project or not touched at all, and as such, it adds noise to
the `--help` output to include it.

2). Extract Mutex class into its own file.

- Remove need for use of `MUTEX` over `Mutex`.
- No reason to force Ruby to parse the code
  for 1.8.7 Mutex implementation on other Rubies.

3). Remove threadsafe scenario.

A note about threadsafey is sufficient for the docs. Having
a full threadsafety example spec in the scenario is more
detail than users are likely to want to read.
3de3c43
@myronmarston myronmarston Merge pull request #1919 from rspec/threadsafe-let-followups
Tweak a few things about the threadsafe let solution from #1858.
80fc79e
Commits on Apr 04, 2015
@myronmarston myronmarston Remove unnecessary `uniq!` call.
No code is faster than no code.

It appears that the `uniq!` comes from micronaut:

afca728#diff-117c39fd53498f0c3f5a53efb3c24f05R52

However, it’s clear that it’s not actually needed. It didn’t do
anything for 2 years due to being a `uniq` (not `uniq!`)
call with an ignored return value, beginning in this commit:

ad92816#diff-3831ad1cf9ec21d559640a066a9d3bc8R40

…until this one, 2 years later:

67923ba

I don’t think there’s any way for there to be any duplicates to begin with, so it’s safe to remove.
57ccf13
@myronmarston myronmarston Remove unnecessary `dup`.
`filter_manager.prune` avoids mutating the input array,
like a good citizen, so there’s no need to dup it.
3b71463
@myronmarston myronmarston Abort filtering early if the input array is empty.
1dd82dd
Commits on Apr 05, 2015
@myronmarston myronmarston Make `describe_successfully` available for all specs. 68b634e
@myronmarston myronmarston Groups with `before(:all) { skip }` should pass.
Fixes #1925.
8e69df1
@myronmarston myronmarston Explicitly indicate that the example group failed.
Before we were relying upon the return value of
`for_filtered_examples`, which is a bad idea.
795c22d
@myronmarston myronmarston Use `describe_successfully` in a few more places.
This helper makes the additional helpful assertion
about the return value of `group.run`.
f1f4908
@myronmarston myronmarston Add changelog entry.
e2b0555
@JonRowe JonRowe Merge pull request #1923 from rspec/filtering-improvements
Filtering improvements
b17d611
@JonRowe JonRowe Merge pull request #1926 from rspec/fix-skip-before-all
Fix skip before all
cce1bac
@JonRowe JonRowe Merge pull request #1883 from mswinson/develop
add type and version information to json formatter
c4a6ed2
@JonRowe JonRowe remove extraneous information 86a68b4
Commits on Apr 06, 2015
@JonRowe JonRowe changelog post #1883
0312e5b
@myronmarston myronmarston Merge pull request #1927 from rspec/cleanup_post_1883
Cleanup post #1883
2a07aa9
@myronmarston myronmarston Remove unused instance variable. d48d07f
@myronmarston myronmarston Extract ShellEscape module. 65c341e
@myronmarston myronmarston Make option parsing simpler and more consistent.
- Do not mutate the provided args.
- Include `:files_or_directories_to_run` in the
  returned options hash. After all, it’s part of
  the parsed options.

This will help support the new `--bisect` option
by making it easy for us to split CLI args into options
(which get re-used throughout the bisect process) and
files_or_directories_to_run (which get replaced during
bisect).
f63add0
@myronmarston myronmarston Store original args as an attribute of the Parser.
This will make it easier to implement `--bisect`, where we
need access to the original CLI options.
a3a929c
@myronmarston myronmarston Add bisect formatter and server. ebc8615
@myronmarston myronmarston Add bisect runner. bdb75db
@myronmarston myronmarston Add a SubsetEnumerator for bisect. d1eafe4
@myronmarston myronmarston Add ExampleMinimizer. 670fd13
@myronmarston myronmarston Get `--bisect` to work end-to-end. 5981247
@myronmarston myronmarston Rename attribute.
The “in execution order” part isn’t actually important
for how we are using it, and makes the name unnecessarily
long.
c002258
@myronmarston myronmarston When bisecting, exit each run as soon as possible.
- When an expected failure passes (or is pending)
  we don’t care about any other results.
- When the last expected failure finishes, we don’t
  care about any later examples.
32045fd
@myronmarston myronmarston Rename `output` to `formatter_output`.
`output` conflicts with the `output` formatter.
5c14942
@myronmarston myronmarston While bisecting, silence stdout/stderr when shelling out. 911458b
@myronmarston myronmarston Surface spec suite load-time problems during bisect. 5a8f7d5
@myronmarston myronmarston Get bisect runner to work properly on JRuby.
Unfortunately, on JRuby, `Open3.popen3` doesn’t
handle shell escaped args properly :(.
4a5c299
@myronmarston myronmarston Abort bisect if the ordering is inconsistent. 4ce24f0
@myronmarston myronmarston Indicate if the bisection was successful via the exit code. 0b6acf3
@myronmarston myronmarston Extract helper methods for options that do something and exit.
This addresses a rubocop cyclomatic complexity failure.
269dddc
@myronmarston myronmarston Limit DRb access to only localhost for security reasons.
It would be nice to have a test for this but I’m not
sure how to simulate a request from a different host :(.
e4076f6
@myronmarston myronmarston Standardize bisect notifications on `bisect_` prefix. 4c74a6f
@myronmarston myronmarston Refactor bisect debug output.
- Move formatting logic into a formatter.
- Improve the formatting.
- Leverage notification events.
d208b70
@myronmarston myronmarston Add spec demonstrating that ENV vars are propagated properly. 45ed50c
@myronmarston myronmarston Fix duration normalization.
- Handle "second" vs "seconds".
- Handle minutes, too.
27920b4
@myronmarston myronmarston Gracefully handle SIGINT during bisect. e38fab7
@myronmarston myronmarston Abort early if there are no failures. d7c3125
@myronmarston myronmarston Fix bisect runner to handle `-fd` in addition to `-f d`. 04d3f5e
@myronmarston myronmarston Standardize bisect progress output on "failing" over "failed". cf48b93
@myronmarston myronmarston Ignore flapping examples that did not fail on original run.
We only care that all the failures from the original
run are still failing; additional failures can be
ignored.
eb5c5fe
@myronmarston myronmarston Fix help text grammar. fc95978
@myronmarston myronmarston Add changelog entry. 0e916fb
@myronmarston myronmarston Skip specs that are failing on AppVeyor on Ruby 2.1.
I have no idea why these pass on 1.9.3 but not on 2.1 on
AppVeyor.  It would be nice to get them to pass but
I don’t have access to a windows box and lack to the time
fix it now.
361b6d5
@myronmarston myronmarston Forwardport 3.2.3 release notes.
ee718e0
Commits on Apr 07, 2015
@myronmarston myronmarston Fix oddly worded sentences.
9e90efe
@myronmarston myronmarston Prefer localhost over 127.0.0.1.
127.0.0.1 is ipv4, whereas localhost should work
for ipv4 and ipv6.
20c9709
@myronmarston myronmarston Change how we whitelist open3.
This allows it to be loaded by the bisect runner but if
it’s loaded by other things it’ll notify by causing the
“minimizes stdlibs” spec to fail.
f5483c4
Commits on Apr 08, 2015
@myronmarston myronmarston Remove slow spec that's not needed.
I wasn't sure that ENV vars would be propagated to spawned
process properly, but no logic was required to make that work.
I tried backticks and `system` as well and those also do
the right thing.

Given that, there's no need to keep this slow spec around.

Revert "Add spec demonstrating that ENV vars are propagated properly."

This reverts commit 45ed50c.
01e567f
Commits on Apr 09, 2015
@myronmarston myronmarston Move bisect integration tests into cucumber scenarios.
- This surfaces the output to the user so they know what
  to expect based on reading the relish docs.
- This greatly reduces the runtime of our spec suite, from
  ~11.8 seconds to ~6.9 seconds.
dc07521
@myronmarston myronmarston Update test to ensure bisect coordinator closes stream. 1f11351
@myronmarston myronmarston Use the `--bisect` flag value rather than ENV var for verbose mode.
2666401
@myronmarston myronmarston Merge pull request #1917 from rspec/bisect
Bisect
978f0b7
@myronmarston myronmarston Fix help text for bisect to make it clear it's `--bisect=verbose`
cca061e
Commits on Apr 10, 2015
@JonRowe JonRowe Fix scenario demonstrating the default behaviour of expose_dsl_globally
47761bf
@myronmarston myronmarston Merge pull request #1932 from rspec/fix-bisect-help-text
Fix help text for bisect to make it clear it's `--bisect=verbose`
bd6f7fd
Commits on Apr 12, 2015
@JonRowe JonRowe ensure the default configuration is loaded in rspec/autorun 33e41fc
@JonRowe JonRowe changelog for #1933
0935042
@JonRowe JonRowe Merge pull request #1933 from rspec/fix_enable_global_dsl
Fixing the default behaviour of `expose_dsl_globally`
42e4ceb
Commits on Apr 13, 2015
@eugeneius eugeneius Apply helper modules to existing groups when added
When a helper module is configured, it is now applied to all existing
matching example groups. This means that the order in which example
groups are defined and helper modules are configured no longer matters.
b261081
Commits on Apr 14, 2015
@JonRowe JonRowe Merge pull request #1935 from eugeneius/configure_existing_example_gr…
…oups

Apply helper modules to existing groups when added
2e6c8d6
@JonRowe JonRowe changelog for #1935
4b7d39a
@myronmarston myronmarston Make specs from #1935 more robust.
- Ensure the specified behavior applies to nested
  groups and not simply top-level groups. The existing
  specs would have passed if the implementation of
  `configure_existing_groups` wrongly used
  `RSpec.world.example_groups` instead of
  `RSpec.world.all_example_groups`. This guards against that.
- Ensure metadata-based `include`/`extend`/`prepend` applies
  only to matching example groups. The existing specs would pass
  even if the metadata check was removed from the implementation
  of `configure_existing_groups`.
f2b70c9
@myronmarston myronmarston Update changelog for #1935.
That PR fixed a bug (already added to the Changelog
by @JonRowe) but it also is notable for this enhancement.
86d6b88
@JonRowe JonRowe Merge pull request #1938 from rspec/pr-1935-followups
Pr 1935 followups
455b2eb
Commits on Apr 18, 2015
@myronmarston myronmarston Tell users where the invalid options came from.
Addresses the confusion reported in rspec/rspec-rails#1356.
0f04f40
Commits on Apr 19, 2015
@JonRowe JonRowe Merge pull request #1940 from rspec/tell-users-where-invalid-option-c…
…ame-from

Tell users where the invalid options came from.
35106b3