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)

rspec-rails-2.4.1 is released!

| Comments

This is a bug fix release recommended for all users who have upgraded to rspec-rails-2.4.

rspec-rails-2.4.1 / 2011-01-03

full changelog

  • Bug fixes
    • fixed bug caused by including some Rails modules before RSpec’s RailsExampleGroup

rspec-2.4.0 is released!

| Comments

Changes in rspec-core and rspec-rails are listed below. There are no changes to rspec-mocks and rspec-expectations for this release.

rspec-core-2.4.0 / 2011-01-02

full changelog

  • Enhancements

    • start the debugger on -d so the stack trace is visible when it stops (Clifford Heath)
    • apply hook filtering to examples as well as groups (Myron Marston)
    • support multiple formatters, each with their own output
    • show exception classes in failure messages unless they come from RSpec matchers or message expectations
    • before(:all) { pending } sets all examples to pending
  • Bug fixes

    • fix bug due to change in behavior of reject in Ruby 1.9.3-dev (Shota Fukumori)
    • fix bug when running in jruby: be explicit about passing block to super (John Firebaugh)
    • rake task doesn’t choke on paths with quotes (Janmejay Singh)
    • restore —options option from rspec-1
    • require ‘ostruct’ to fix bug with its([key]) (Kim Burgestrand)
    • —configure option generates .rspec file instead of autotest/discover.rb

rspec-rails-2.4.0 / 2011-01-02

full changelog

  • Enhancements

    • include ApplicationHelper in helper object in helper specs
    • include request spec extensions in files in spec/integration
    • include controller spec extensions in groups that use :type => :controller
      • same for :model, :view, :helper, :mailer, :request, :routing
  • Bug fixes

    • restore global config.render_views so you only need to say it once
    • support overriding render_views in nested groups
    • matchers that delegate to Rails’ assertions capture ActiveSupport::TestCase::Assertion (so they work properly now with should_not in Ruby 1.8.7 and 1.9.1)
  • Deprecations

    • include_self_when_dir_matches

RSpec 2 Documentation

| Comments

RSpec-2 was released with, admittedly, less than complete documentation. The new docs are a work in progress that need your help. It’s all open source, and anybody who can write Markdown or Cucumber can contribute to it. Here’s how:


Fork the git repo you of the rspec project to which you want to contribute docs, make additions/edits to appropriate files in the features directory, and submit pull requests.


I review, tweak, and organize the contributions, merge them in, and then push them to http://relishapp.com.

Source repositories

With the exception of the front page, all of the docs are stored in the features directories of rspec repositories on github:






Relish is an application developed by Justin Ko and Matt Wynne to display Cucumber features for open and closed source projects. It is still fairly new and under regular development, so presentation, navigation, etc, are all improving as we go.

Cucumber and Markdown docs live in the features directory (and its subdirectories) in each project. There is a .nav file that sorts the navigation links. It’s pretty self-explanatory, and you probably won’t need to touch it. But now you know what it is.


If you know what you’re doing with Cucumber, feel free to submit executable scenarios. Please make sure you run them and they pass against ruby-1.8.6, 1.8.7, 1.9.1, and 1.9.2. Bonus points for jruby and rbx.

Even if you don’t know what you’re doing with Cucumber, all of the Cucumber features have a narrative section at the top, which is plain text and not executed. Relish processes this section through Markdown, so it can be as expressive as you know how to make Markdown “speak.” Patches that add to this narrative are great, but so are patches that simply re-format them to make them more readable.


In addition to the Cucumber features, Relish supports pages using Markdown. Each project has a README file in the features directory which is displayed as the front page for that project. Each subdirectory below features can also have a README (optional), which would be displayed as the front page of that directory.

In addition to the README files, we can add arbitrary pages using Markdown as well.


If you want to help and you’re not sure where to start, feel free to contact me via email to the rspec-users list or a github issue in the project you’re interested in contributing to.

Thanks in advance for your help!

rspec-core-2.3.1 is released!

| Comments

full changelog

  • Bug fixes
    • send debugger warning message to $stdout if RSpec.configuration.error_stream has not been defined yet.
    • HTML Formatter finally properly displays nested groups (Jarmo Pertman)
    • eliminate some warnings when running RSpec’s own suite (Jarmo Pertman)

rspec-2.3.0 is released!

| Comments

rspec-core-2.3.0 / 2010-12-12

full changelog

  • Enhancements

    • tell autotest to use “rspec2” if it sees a .rspec file in the project’s root directory
      • replaces the need for ./autotest/discover.rb, which will not work with all versions of ZenTest and/or autotest
    • config.expect_with
      • :rspec # => rspec/expectations
      • :stdlib # => test/unit/assertions
      • :rspec, :stdlib # => both
  • Bug fixes

    • fix dev Gemfile to work on non-mac-os machines (Lake Denman)
    • ensure explicit subject is only eval’d once (Laszlo Bacsi)

rspec-expectations-2.3.0 / 2010-12-12

full changelog

  • Enhancements
    • diff strings when include matcher fails (Mike Sassak)

rspec-mocks-2.3.0 / 2010-12-12

full changelog

  • Bug fixes
    • Fix our Marshal extension so that it does not interfere with objects that have their own @mock_proxy instance variable. (Myron Marston)

rspec-rails-2.3.0 / 2010-12-12

full changelog

  • Changes
    • Generator no longer generates autotest/autodiscover.rb, as it is no longer needed (as of rspec-core-2.3.0)

rspec-rails-2.2.1 is released

| Comments

rspec-rails-2.2.1 / 2010-12-01

full changelog

  • Bug fixes

    • Depend on railties, activesupport, and actionpack instead of rails (Piotr Solnica)
    • Got webrat integration working properly across different types of specs
  • Deprecations

    • —webrat-matchers flag for generators is deprecated. use —webrat instead.

rspec-core-2.2.1 is released!

| Comments

2.2.1 / 2010-11-28

full changelog

  • Bug fixes
    • alias_method instead of override Kernel#method_missing (John Wilger)
    • changed —autotest to —tty in generated command (MIKAMI Yoshiyuki)
    • revert change to debugger (had introduced conflict with Rails)
      • also restored —debugger/-debug option

rspec-2.2 is released!

| Comments


full changelog

  • Deprecations/changes

    • —debug/-d on command line is deprecated and now has no effect
    • win32console is now ignored; Windows users must use ANSICON for color support (Bosko Ivanisevic)
  • Enhancements

    • Raise exception with helpful message when rspec-1 is loaded alongside rspec-2 (Justin Ko)
    • debugger statements just work as long as ruby-debug is installed
      • otherwise you get warned, but not fired
    • Expose example.metadata in around hooks
    • Performance improvments (see Upgrade.markdown)
  • Bug fixes

    • Make sure —fail-fast makes it across drb
    • Pass -Ilib:spec to rcov


full changelog

  • Enhancements

    • Added “rspec/mocks/standalone” for exploring the rspec-mocks in irb.
  • Bug fix

    • Eliminate warning on splat args without parens (Gioele Barabucci)
    • Fix bug where obj.should_receive(:foo).with(stub.as_null_object) would
      pass with a false positive.


full changelog

  • Enhancements

    • Added stub_template in view specs
  • Bug fixes

    • Properly include helpers in views (Jonathan del Strother)
    • Fix bug in which method missing led to a stack overflow
    • Fix stack overflow in request specs with open_session
    • Fix stack overflow in any spec when method_missing was invoked
    • Add gem dependency on rails ~> 3.0.0 (ensures bundler won’t install rspec-rails-2 with rails-2 apps).