Skip to content

Commit be8ee33

Browse files
authored
Merge pull request #115 from rspec/myron/3-8-release-post
Add initial draft of 3.8 blog post.
2 parents f2d8a0e + 7ca8d55 commit be8ee33

File tree

1 file changed

+297
-0
lines changed

1 file changed

+297
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,297 @@
1+
---
2+
title: RSpec 3.8 has been released!
3+
author: Myron Marston and Jon Rowe
4+
---
5+
6+
RSpec 3.8 has just been released! Given our commitment to
7+
[semantic versioning](http://semver.org/), this should be an easy
8+
upgrade for anyone already using RSpec 3, but if we did introduce
9+
any regressions, please let us know, and we'll get a patch release
10+
out with a fix ASAP.
11+
12+
We're also happy to announce that [Benoit Tigeot](https://github.com/benoittgt)
13+
has joined the RSpec team since the last release. Welcome to the team, Benoit!
14+
We know you'll do great things :).
15+
16+
RSpec continues to be a community-driven project with contributors
17+
from all over the world. This release includes 369 commits and 98
18+
merged pull requests from 52 different contributors!
19+
20+
Thank you to everyone who helped make this release happen!
21+
22+
## Notable Changes
23+
24+
### Core: Performance of --bisect has been significantly improved
25+
26+
RSpec has supported a `--bisect` feature since
27+
[RSpec 3.3](/blog/2015/06/rspec-3-3-has-been-released/#core-bisect).
28+
This feature is useful when your test suite has an ordering
29+
dependency--that is, the suite only fails when the tests are run
30+
in a specific order. `--bisect` will repeatedly run smaller and
31+
smaller subsets of your suite in order to narrow it down to the
32+
minimal set of specs needed to reproduce the failures.
33+
34+
Since 3.3, this feature has been implemented by shelling out to
35+
the `rspec` command to run each subset. While simple and effective,
36+
we realized this approach was also quite inefficient. Each time the
37+
`rspec` command runs, it must boot RSpec and your application
38+
environment (which may include Rails and many other gems) from scratch.
39+
The cost of this can vary considerably from a couple hundred milliseconds
40+
to 30+ seconds on a large Rails app. In extreme cases, the runtime of
41+
`--bisect` can be dominated by the time it takes to boot your application
42+
environment over and over and over.
43+
44+
In RSpec 3.8, we've improved bisect's performance by using forking
45+
on platforms that support it rather than shelling out. That way, we
46+
can boot your application environment _once_, and then fork a subprocess
47+
in which to run each subset of the test suite, avoiding the need to boot
48+
your application many times.
49+
50+
The actual improvement you'll see in practice will vary widely, but
51+
in our [limited testing](https://github.com/rspec/rspec-core/pull/2511)
52+
it improved the runtime of `--bisect` by 33% in one case and an
53+
order-of-magnitude (108.9 seconds down to 11.7 seconds) in another.
54+
55+
If you're looking to maximize the benefit of this change, you may
56+
want to pass some additional `--require` options when running a
57+
bisection in order to pre-load as much of your application environment
58+
as possible.
59+
60+
### Core: Support the XDG base directory spec for configuration
61+
62+
RSpec, like many command line tools, supports the use of options
63+
files, which can live at `.rspec` (for team project options)
64+
`~/.rspec` (for global personal options) or at `.rspec-local`
65+
(for personal project options -- this file should not be under
66+
source control). In RSpec 3.8, we've expanded this feature to
67+
support the [XDG Base Directory
68+
Specification](https://specifications.freedesktop.org/basedir-spec/latest/),
69+
which defines a standard way for tools to locate the global personal
70+
options file. This gives users complete control over where this
71+
file is located rather than forcing it to live in their home directory.
72+
73+
To use this feature, simply set the `$XDG_CONFIG_HOME` environment
74+
variable and put your RSpec options at `$XDG_CONFIG_HOME/rspec/options`.
75+
76+
For more info, [read the spec](https://specifications.freedesktop.org/basedir-spec/latest/)
77+
or [check out the pull
78+
request](https://github.com/rspec/rspec-core/pull/2538).
79+
80+
Thanks to Magnus Bergmark for implementing this feature!
81+
82+
### Expectations: Formatted output length is now configurable
83+
84+
When setting expectations on large objects their string representations can become
85+
rather unwieldy and can clutter the console output. In RSpec 3.6, we started
86+
truncating these objects to address this issue, but did not make it easily configurable.
87+
88+
In RSpec 3.8, you can now configure it:
89+
90+
~~~ ruby
91+
RSpec.configure do |config|
92+
config.expect_with :rspec do |expectations|
93+
expectations.max_formatted_output_length = 200
94+
end
95+
end
96+
~~~
97+
98+
You can also disable the truncation entirely by setting the config option to `nil`.
99+
100+
### Rails: `have_http_status` matcher upgraded to support Rails 5.2
101+
102+
A change in Rails 5.2 caused RSpec's `have_http_status` matcher to issue deprecation
103+
warnings. In RSpec 3.8, these warnings have been removed.
104+
105+
### Rails: View specs `stub_template` performance improved.
106+
107+
Thanks to Simon Coffey for implementing caching for `stub_template`
108+
that prevents unnecessary recreation of templates. This improves performance
109+
by reducing the amount of allocation and setup performed.
110+
111+
### Rails: `rails_helper.rb` improvements
112+
113+
Thank you to Koichi ITO and Alessandro Rodi for improving our generated
114+
`rails_helper.rb` with improved messages when migrations are pending,
115+
and bringing us in line with Rails standards.
116+
117+
## Stats:
118+
119+
### Combined:
120+
121+
* **Total Commits**: 369
122+
* **Merged pull requests**: 98
123+
* **52 contributors**: Ace Dimasuhid, Alessandro Rodi, Alexander
124+
Panasyuk, Alyssa Ross, Andrew, Andrew Vit, Benoit Tigeot, Brad Charna,
125+
Brian Kephart, Christophe Bliard, Craig J. Bass, Daniel Colson, Douglas
126+
Lovell, Eric Hayes, Garett Arrowood, Gary Bernhardt, Gustav Munkby,
127+
James Crisp, Joel Taylor, Jon Rowe, Kenichi Kamiya, Koichi ITO, Lairan,
128+
Laura Paakkinen, Laurent Cobos, Magnus Bergmark, Matt Brictson, Maxim
129+
Krizhanovsky, Myron Marston, Nikola Đuza, Oleg Pudeyev, Olivier Lacan,
130+
Olle Jonsson, Pablo Brasero, Paul McMahon, Regan Chan, Sam Phippen,
131+
Sergiy Yarinovskiy, Shane Cavanaugh, Shia, Simon Coffey, Sorah Fukumori,
132+
Systho, Szijjártó-Nagy Misu, Tom Chen, Xavier Shay, Yuji Nakayama,
133+
arjan0307, joker1007, lsarni, n.epifanov, pavel
134+
135+
### rspec-core:
136+
137+
* **Total Commits**: 94
138+
* **Merged pull requests**: 24
139+
* **17 contributors**: Alyssa Ross, Andrew Vit, Benoit Tigeot, Garett
140+
Arrowood, Gary Bernhardt, Jon Rowe, Kenichi Kamiya, Koichi ITO, Magnus
141+
Bergmark, Myron Marston, Oleg Pudeyev, Olle Jonsson, Sam Phippen, Sorah
142+
Fukumori, Systho, Xavier Shay, arjan0307
143+
144+
### rspec-expectations:
145+
146+
* **Total Commits**: 52
147+
* **Merged pull requests**: 15
148+
* **13 contributors**: Ace Dimasuhid, Alyssa Ross, Benoit Tigeot, James
149+
Crisp, Jon Rowe, Kenichi Kamiya, Myron Marston, Pablo Brasero, Sam
150+
Phippen, Xavier Shay, Yuji Nakayama, joker1007, n.epifanov
151+
152+
### rspec-mocks:
153+
154+
* **Total Commits**: 47
155+
* **Merged pull requests**: 16
156+
* **13 contributors**: Alexander Panasyuk, Alyssa Ross, Andrew, Benoit
157+
Tigeot, James Crisp, Jon Rowe, Kenichi Kamiya, Maxim Krizhanovsky, Myron
158+
Marston, Olle Jonsson, Sam Phippen, Sergiy Yarinovskiy, Xavier Shay
159+
160+
### rspec-rails:
161+
162+
* **Total Commits**: 132
163+
* **Merged pull requests**: 27
164+
* **29 contributors**: Alessandro Rodi, Benoit Tigeot, Brad Charna,
165+
Brian Kephart, Christophe Bliard, Daniel Colson, Douglas Lovell, Eric
166+
Hayes, Joel Taylor, Jon Rowe, Kenichi Kamiya, Koichi ITO, Lairan, Laura
167+
Paakkinen, Laurent Cobos, Matt Brictson, Myron Marston, Nikola Đuza,
168+
Olivier Lacan, Paul McMahon, Regan Chan, Sam Phippen, Shane Cavanaugh,
169+
Shia, Simon Coffey, Szijjártó-Nagy Misu, Tom Chen, lsarni, pavel
170+
171+
### rspec-support:
172+
173+
* **Total Commits**: 44
174+
* **Merged pull requests**: 16
175+
* **10 contributors**: Alyssa Ross, Benoit Tigeot, Craig J. Bass, Gustav
176+
Munkby, James Crisp, Jon Rowe, Kenichi Kamiya, Myron Marston, Sam
177+
Phippen, Xavier Shay
178+
179+
## Docs
180+
181+
### API Docs
182+
183+
* [rspec-core](/documentation/3.8/rspec-core/)
184+
* [rspec-expectations](/documentation/3.8/rspec-expectations/)
185+
* [rspec-mocks](/documentation/3.8/rspec-mocks/)
186+
* [rspec-rails](/documentation/3.8/rspec-rails/)
187+
188+
### Cucumber Features
189+
190+
* [rspec-core](http://relishapp.com/rspec/rspec-core)
191+
* [rspec-expectations](http://relishapp.com/rspec/rspec-expectations)
192+
* [rspec-mocks](http://relishapp.com/rspec/rspec-mocks)
193+
* [rspec-rails](http://relishapp.com/rspec/rspec-rails)
194+
195+
## Release Notes
196+
197+
### rspec-core-3.8.0
198+
[Full Changelog](http://github.com/rspec/rspec-core/compare/v3.7.1...v3.8.0)
199+
200+
Enhancements:
201+
202+
* Improve shell escaping used by `RSpec::Core::RakeTask` and `--bisect` so
203+
that it works on `Pathname` objects. (Andrew Vit, #2479)
204+
* Nicely format errors encountered while loading files specified
205+
by `--require` option. (Myron Marston, #2504)
206+
* Significantly improve the performance of `--bisect` on platforms that
207+
support forking by replacing the shell-based runner with one that uses
208+
forking so that RSpec and the application environment can be booted only
209+
once, instead of once per spec run. (Myron Marston, #2511)
210+
* Provide a configuration API to pick which bisect runner is used for
211+
`--bisect`. Pick a runner via `config.bisect_runner = :shell` or
212+
`config.bisect_runner = :fork` in a file loaded by a `--require`
213+
option passed at the command line or set in `.rspec`. (Myron Marston, #2511)
214+
* Support the [XDG Base Directory
215+
Specification](https://specifications.freedesktop.org/basedir-spec/latest/)
216+
for the global options file. `~/.rspec` is still supported when no
217+
options file is found in `$XDG_CONFIG_HOME/rspec/options` (Magnus Bergmark, #2538)
218+
* Extract `RSpec.world.prepare_example_filtering` that sets up the
219+
example filtering for custom RSpec runners. (Oleg Pudeyev, #2552)
220+
221+
Bug Fixes:
222+
223+
* Prevent an `ArgumentError` when truncating backtraces with two identical
224+
backtraces. (Systho, #2515, Benoit Tigeot, #2539)
225+
226+
227+
### rspec-expectations-3.8.0
228+
[Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.7.0...v3.8.0)
229+
230+
Enhancements:
231+
232+
* Improve failure message of `change(receiver, :message)` by including the
233+
receiver as `SomeClass#some_message`. (Tomohiro Hashidate, #1005)
234+
* Improve `change` matcher so that it can correctly detect changes in
235+
deeply nested mutable objects (such as arrays-of-hashes-of-arrays).
236+
The improved logic uses the before/after `hash` value to see if the
237+
object has been mutated, rather than shallow duping the object.
238+
(Myron Marston, #1034)
239+
* Improve `include` matcher so that pseudo-hash objects (e.g. objects
240+
that decorate a hash using a `SimpleDelegator` or similar) are treated
241+
as a hash, as long as they implement `to_hash`. (Pablo Brasero, #1012)
242+
* Add `max_formatted_output_length=` to configuration, allowing changing
243+
the length at which we truncate large output strings.
244+
(Sam Phippen #951, Benoit Tigeot #1056)
245+
* Improve error message when passing a matcher that doesn't support block
246+
expectations to a block based `expect`. (@nicktime, #1066)
247+
248+
249+
### rspec-mocks-3.8.0
250+
[Full Changelog](http://github.com/rspec/rspec-mocks/compare/v3.7.0...v3.8.0)
251+
252+
Bug Fixes:
253+
254+
* Issue error when encountering invalid "counted" negative message expectations.
255+
(Sergiy Yarinovskiy, #1212)
256+
* Ensure `allow_any_instance_of` and `expect_any_instance_of` can be temporarily
257+
supressed. (Jon Rowe, #1228)
258+
* Ensure `expect_any_instance_of(double).to_not have_received(:some_method)`
259+
fails gracefully (as its not supported) rather than issuing a `NoMethodError`.
260+
(Maxim Krizhanovsky, #1231)
261+
262+
263+
### rspec-rails-3.8.0
264+
[Full Changelog](http://github.com/rspec/rspec-rails/compare/v3.7.2...v3.8.0)
265+
266+
Enhancements:
267+
268+
* Improved message when migrations are pending in the default `rails_helper.rb`
269+
(Koichi ITO, #1924)
270+
* `have_http_status` matcher now supports Rails 5.2 style response symbols
271+
(Douglas Lovell, #1951)
272+
* Change generated Rails helper to match Rails standards for Rails.root
273+
(Alessandro Rodi, #1960)
274+
* At support for asserting enqueued jobs have no wait period attached.
275+
(Brad Charna, #1977)
276+
* Cache instances of `ActionView::Template` used in `stub_template` resulting
277+
in increased performance due to less allocations and setup. (Simon Coffey, #1979)
278+
* Rails scaffold generator now respects longer namespaces (e.g. api/v1/\<thing\>).
279+
(Laura Paakkinen, #1958)
280+
281+
Bug Fixes:
282+
283+
* Escape quotation characters when producing method names for system spec
284+
screenshots. (Shane Cavanaugh, #1955)
285+
* Use relative path for resolving fixtures when `fixture_path` is not set.
286+
(Laurent Cobos, #1943)
287+
* Allow custom template resolvers in view specs. (@ahorek, #1941)
288+
289+
290+
### rspec-support-3.8.0
291+
[Full Changelog](http://github.com/rspec/rspec-support/compare/v3.7.1...v3.8.0)
292+
293+
Bug Fixes:
294+
295+
* Order hash keys before diffing to improve diff accuracy when using mocked calls.
296+
(James Crisp, #334)
297+

0 commit comments

Comments
 (0)