-
-
Notifications
You must be signed in to change notification settings - Fork 41
3.6.0 release post #105
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
3.6.0 release post #105
Changes from 2 commits
baf323a
7140a7e
f8a103f
14eb7ad
791878a
f2b421f
b45aa1d
b859c7c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
--- | ||
title: RSpec 3.6 has been released! | ||
author: Sam Phippen, TODO: other editors | ||
--- | ||
|
||
RSpec 3.6 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. | ||
|
||
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 over 50 different contributors! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's funny that you have the contributor count filled in but not the commits and PRs! Usually I fill this in after generating the stats as it is based on that. |
||
|
||
Thank you to everyone who helped make this release happen! | ||
|
||
## Notable Changes | ||
|
||
### Core: Errors outside examples now handled and formatted well | ||
|
||
In previous versions of RSpec, we allowed errors encountered while loading spec | ||
files or running `:suite` hooks to crash the ruby interpreter, giving you its | ||
default full-stacktrace output. In RSpec 3.6, we now handle all errors that | ||
occur outside examples, and format them nicely including a filtered backtrace | ||
and a code snippet for the site of the error. For example, an error in a | ||
`before(:suite)` hook is now formatted like this: | ||
|
||
<img width="479" alt="screen shot 2017-04-27 at 9 59 12 pm" | ||
src="https://cloud.githubusercontent.com/assets/49391/25514870/cb9db6c8-2b94-11e7-952f-f26fd783512b.png"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to add the image to this repository instead of hotlinking to github's CDN? Ultimately, the site is hosted on github, of course, but there's something nice about keeping the image under source control, too... |
||
|
||
Thanks to Jon Rowe for assisting with this feature. | ||
|
||
### Core: `config.fail_if_no_examples` | ||
|
||
As it currently stands RSpec will exit with code `0` indicating success if no | ||
examples are defined. This configuration option makes it possible to cause RSpec | ||
to exit with code `1` indicating failure. This is useful in CI environments, it | ||
helps detect when you've misconfigured RSpec to look for specs in the wrong | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "it helps detect" reads like it's the start of a new sentence. If you want to keep it as one sentence, I think it helps to add a connecting word like "as":
|
||
place or with the wrong pattern. When this occurs we consider finding no specs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
What is the "this" here? Do you mean when RSpec is misconfigured to look for example in the wrong place? Or when the user has configured it with |
||
to being an error, as opposed to always passing. | ||
|
||
~~~ ruby | ||
RSpec.configure do |config| | ||
config.fail_if_no_examples = true | ||
end | ||
~~~ | ||
|
||
A special thanks to Ewa Czechowska for getting this in to core. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before moving on to the expectations changes, there's one more notable core changes, IMO: color is automatically enabled if RSpec is outputting to a TTY, so there's no longer a need to set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
### Core: Output coloring is set automatically if RSpec is outputting to a tty. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for spelling "color" the American way :). |
||
|
||
In past versions of RSpec, you were required to specify `--color` if you wanted | ||
output coloring, regardless of whether you were outputting to a terminal, a | ||
file, a CI system, or some other output location. Now, RSpec will automatically | ||
color output if it detects it is running in a TTY. You can still force coloring | ||
with `--color`, or if you are running in a TTY and explicitly do not want color, | ||
you can specify `--no-color` to disable this behavior. | ||
|
||
For existing RSpec projects, that were initialized with either `bundle exec | ||
rspec --init` or `bundle exec rails g rspec:install` you can find this setting | ||
in your `.rspec` file if you'd like to change it. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need this paragraph. The existing setting ( |
||
|
||
We thank Josh Justice for adding this behavior to RSpec. | ||
|
||
### Expectations: Scoped aliased and negative matchers | ||
|
||
TODO: is anyone more familiar with this feature who could full this out? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically, the idea is that you can now call |
||
|
||
### Mocks: `without_partial_double_verification` | ||
|
||
When we released RSpec 3.0 we added [verifying doubles](http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#verifying-doubles). | ||
Verifying doubles allow you to ensure that stubs and mocks that you create with | ||
RSpec correctly emulate the interfaces on the objects in your tests. | ||
`without_partial_double_verification` allows you to turn off the verifying | ||
double behaviour for the duration of the execution of a block. For example: | ||
|
||
~~~ ruby | ||
class Widget | ||
def call(takes_an_arg) | ||
end | ||
end | ||
|
||
RSpec.describe Widget do | ||
it 'can be stub with a mismatched arg count' do | ||
without_partial_double_verification { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why curlies here instead of |
||
w = Widget.new | ||
allow(w).to receive(:call).with(1, 2).and_return(3) | ||
w.call(1, 2) | ||
} | ||
end | ||
end | ||
~~~ | ||
|
||
Here, this test would fail if the `without_partial_double_verification` call was | ||
not made, because we are stubbing the `call` method on the `Widget` object with | ||
an argument count that is different to the implementation. This can be useful in | ||
situations where methods aren't already defined on the object, like in Rails, | ||
when methods on `ActiveRecord` objects are defined after database interactions. | ||
With this feature, we can test interfaces to those objects while retaining | ||
database isolation. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed for AR objects? I didn't think it helped then. (And in fact, I thought @JonRowe implemented some stuff for ActiveRecord models to make their dynamic nature cause no problems for verified doubles). Isn't the situation where this is needed helper specs or view specs or something? @JonRowe can you help here so we can accurately explain when this API is useful? |
||
|
||
A special thanks to Jon Rowe for adding this feature. | ||
|
||
### Rails: Support for Rails 5.1: | ||
|
||
RSpec 3.6.0 comes with full support for Rails 5.1. There are no major changes to | ||
the rails 5.1 API and so this upgrade should be fully smooth. Simply bumping to | ||
the latest version of RSpec will bring the support to your app with no other | ||
changes required on your part. | ||
|
||
Rails [system tests](http://weblog.rubyonrails.org/2017/4/27/Rails-5-1-final/) are not yet supported, | ||
but we plan to add support for them in the near future. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are system tests any different from feature specs w/ capybara? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only in that they're "blessed" and use a specific non-forked process server (run with puma) that allows for transactional testing. |
||
|
||
|
||
## Stats: | ||
|
||
TODO when ready to release | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To generate this, run Also, we usually include a For the release notes, we have an rspec-dev task ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to update the date in the filename!