David Chelimsky

random thoughtlessness

rspec-2.5.0 is released!

| Comments

rspec-2.5 is a minor upgrade, and is fully backward compatible with rspec-2.4. It includes several bug fixes, enhancements, and one deprecation. See the changelog below for details.

We had a little glitch publishing the docs to http://relishapp.com/rspec, so the 2.5 docs won’t be up for another day or two, so I’ll detail the noticable differences here.

Autotest/Bundler integration

UPDATE: the —skip-bundler option does not work, and is removed from rspec-core-2.5.1. See the post on the 2.5.1 release for more information.


RSpec’s Autotest integration assumes that you want bundle exec in the shell command generated by Autotest if you have a Gemfile. This works fine for some situations, but not all, so we added an opt-out for rspec-2.5:

autotest -- --skip-bundler

Autotest ignores everything after the initial --, so RSpec’s Autotest extension handles the --skip-bundler option.

Autotest’s bundler plugin

Autotest ships with a plugin for bundler. Just add the following to a .autotest file in the project’s root directory, or your home directory:

require 'autotest/bundler'

This prefixes the generated shell command with ‘bundle exec’.

UPDATE: The implicit detection of Gemfile is removed from rspec-core-2.5.1. See the post on the 2.5.1 release for more information.

Implicit detection of Gemfile is deprecated

Given that Autotest has its own way of dealing with Bundler (see above), we deprecated the implicit assumption that Gemfile means “use bundler”. You’ll see a deprecation notice if you are relying on that, but it still works. It’s just a deprecation warning. To silence the warning, either use the --skip-bundler option or Autotest’s bundler plugin, described above.

HTML Formatter

The HTML formatter now has a set of checkboxes in the header that allow you to filter what you’re looking at:

to not, or not to not

Are you the sort of person for whom “expect this block of code to not raise an error” is like nails on chalkboard? If so, relief has arrived. You may now type either of the following, and RSpec will happily service you:

expect { ... }.to_not raise_error
expect { ... }.not_to raise_error



full changelog

  • 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)


full changelog

  • 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)


full changelog

  • 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)


full changelog

  • Enhancements

    • use index_helper instead of table_name when generating specs (Reza Primardiansyah)
  • Bug fixes

    • fixed bug in which render_views in a nested group set the value in its parent group.
    • only include MailerExampleGroup when it is defiend (Steve Sloan)
    • mock_model.as_null_object.attribute.blank? returns false (Randy Schmidt)
    • fix typo in request specs (Paco Guzman)