Skip to content

Add initial draft of 3.8 blog post. #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 4, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions source/blog/2018-08-03-rspec-3-8-has-been-released.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
title: RSpec 3.8 has been released!
author: Myron Marston
---

RSpec 3.8 has just been released! Given our commitment to
[semantic versioning](http://semver.org/), this should be an easy
upgrade for anyone already using RSpec 3, but if we did introduce
any regressions, please let us know, and we'll get a patch release
out with a fix ASAP.

We're also happy to announce that [Benoit Tigeot](https://github.com/benoittgt)
has joined the RSpec team since the last release. Welcome to the team, Benoit!
We know you'll do great things :).

RSpec continues to be a community-driven project with contributors
from all over the world. This release includes over xxx commits and yyy
merged pull requests from zzz different contributors!

Thank you to everyone who helped make this release happen!

## Notable Changes

### Core: Performance of --bisect has been significantly improved

RSpec has supported a `--bisect` feature since
[RSpec 3.3](/blog/2015/06/rspec-3-3-has-been-released/#core-bisect).
This feature is useful when your test suite has an ordering
dependency--that is, the suite only fails when the tests are run
in a specific order. `--bisect` will repeatedly run smaller and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double spacing typo here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

smaller subsets of your suite in order to narrow it down to the
minimal set of specs needed to reproduce the failures.

Since 3.3, this feature has been implemented by shelling out to
the `rspec` command to run each subset. While simple and effective,
we realized this approach was also quite inefficient. Each time the
`rspec` command runs, it must boot RSpec and your application
environment (which may include Rails and many other gems) from scratch.
The cost of this can vary considerably from a couple hundred milliseconds
to 30+ seconds on a large Rails app. In extreme cases, the runtime of
`--bisect` can be dominated by the time it takes to boot your application
environment over and over and over.

In RSpec 3.8, we've improved bisect's performance by using forking
on platforms that support it rather than shelling out. That way, we
can boot your application environment _once_, and then fork a subprocess
in which to run each subset of the test suite, avoiding the need to boot
your application many times.

The actual improvement you'll see in practice will vary widely, but
in our [limited testing](https://github.com/rspec/rspec-core/pull/2511)
it improved the runtime of `--bisect` by 33% in one case and an
order-of-magnitude (108.9 seconds down to 11.7 seconds) in another.

If you're looking to maximize the benefit of this change, you may
want to pass some additional `--require` options when running a
bisection in order to pre-load as much of your application environment
as possible.

### Core: Support the XDG base directory spec for configuration

RSpec, like many command line tools, supports the use of options
files, which can live at `.rspec` (for team project options)
`~/.rspec` (for global personal options) or at `.rspec-local`
(for personal project options -- this file should not be under
source control). In RSpec 3.8, we've expanded this feature to
support the [XDG Base Directory
Specification](https://specifications.freedesktop.org/basedir-spec/latest/),
which defines a standard way for tools to locate the global personal
options file. This gives users complete control over where this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double spacing typo here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old habit of mine. Fixed.

file is located rather than forcing it to live in their home directory.

To use this feature, simply set the `$XDG_CONFIG_HOME` environment
variable and put your RSpec options at `$XDG_CONFIG_HOME/rspec/options`.

For more info, [read the spec](https://specifications.freedesktop.org/basedir-spec/latest/)
or [check out the pull
request](https://github.com/rspec/rspec-core/pull/2538).

Thanks to Magnus Bergmark for implementing this feature!

### Expectations: Formatted output length is now configurable

TODO (Sam/Benoit): write this up since you authored this feature
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

When dealing with larger objects their string representations can become rather unwieldy and can clutter the console output. In RSpec 3.6 we started truncating these objects to prevent this issue but due to an oversight this was never made easily configurable. In 3.7 RSpec Expectations has a new configuration option allowing changing this value and also allows turning it off (by setting the limit to nil).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've adapted this.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

### Expectations: Failure message improvements

A big thank you to Tomohiro Hashidate and Nicktime who have improved our output
for a couple of failure cases, see the full change log for details.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That doesn't seem all that notable, to be honest. If it's not important enough to describe, we shouldn't mention it, I don't think. It's in the changelog.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to highlight this as I feel documentation / usability tweaks are important, it was more of a "shout out" than "notable".

### Rails: ?

TODO (Sam/Benoit/Jon): figure out what is notable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

### Rails:  `have_http_status` matcher upgraded to support Rails 5.2
Since Rails 5.2 the `have_http_status` matcher has issued deprecation warnings due to a change in the name
of the various states. In RSpec 3.8 these warnings are removed.

### Rails: View specs `stub_template` performance improved.

Thanks to Simon Coffey for implementing caching for `stub_template` that prevents unnecessary recreation of
templates. This improves performance by reducing the amount of allocation and setup performed.

### Rails: `rails_helper.rb`

Thank you to Koichi ITO and Alessandro Rodi for improving our generated `rails_helper.rb` with improved messages when migrations are pending, and bringing us in line with Rails standards.

### Rails: Scafold generator

Thanks to Laura Paakkinen, our scaffold generator now correctly respects longer namespaces for generating controllers / routes, e.g. `api/v1/posts` now generates `Api::V1::Posts`.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I've added these, except for the last one. It's not clear what qualifies as a "longer namespace." Is it one over 10 characters? 20? 30? And also it doesn't seem that notable--it's just a bug fix, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its any multi part namespace over 2, I'm on the fence about it but similar to the other questionable one, it was more about highlighting contributor effort.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contributor effort has never been the basis on whether or not we highlight something as notable in our release blog post. It's about the effect the change has for users of RSpec.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, how do you feel, given that our contributor count is quite low at the moment, about simply listing everyone who helped on this release at the end of the blog post? A "And thanks to who helped with this release".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All contributors will be listed in "Stats" section (example). And they're also listed in the changelog for their individual contributions. We don't need to list all the contributors 3 times in the same blog post.


## Stats:

TODO: generate

## Docs

### API Docs

* [rspec-core](/documentation/3.8/rspec-core/)
* [rspec-expectations](/documentation/3.8/rspec-expectations/)
* [rspec-mocks](/documentation/3.8/rspec-mocks/)
* [rspec-rails](/documentation/3.8/rspec-rails/)

### Cucumber Features

* [rspec-core](http://relishapp.com/rspec/rspec-core)
* [rspec-expectations](http://relishapp.com/rspec/rspec-expectations)
* [rspec-mocks](http://relishapp.com/rspec/rspec-mocks)
* [rspec-rails](http://relishapp.com/rspec/rspec-rails)

## Release notes:

TODO: generate