rspec-2.6.0 is released

May 12th, 2011

rspec-core-2.6.0

full changelog

  • Enhancements

    • shared_context (Damian Nurzynski)
      • extend groups matching specific metadata with:
        • method definitions
        • subject declarations
        • let/let! declarations
        • etc (anything you can do in a group)
    • its([:key]) works for any subject with #[]. (Peter Jaros)
    • treat_symbols_as_metadata_keys_with_true_values (Myron Marston)
    • Print a deprecation warning when you configure RSpec after defining an example. All configuration should happen before any examples are defined. (Myron Marston)
    • Pass the exit status of a DRb run to the invoking process. This causes specs run via DRb to not just return true or false. (Ilkka Laukkanen)
    • Refactoring of ConfigurationOptions#parse_options (Rodrigo Rosenfeld Rosas)
    • Report excluded filters in runner output (tip from andyl)
    • Clean up messages for filters/tags.
    • Restore –pattern/-P command line option from rspec-1
    • Support false as well as true in config.full_backtrace= (Andreas Tolf Tolfsen)
  • Bug fixes

    • Don’t stumble over an exception without a message (Hans Hasselberg)
    • Remove non-ascii characters from comments that were choking rcov (Geoffrey Byers)
    • Fixed backtrace so it doesn’t include lines from before the autorun at_exit hook (Myron Marston)
    • Include RSpec::Matchers when first example group is defined, rather than just before running the examples. This works around an obscure bug in ruby 1.9 that can cause infinite recursion. (Myron Marston)
    • Don’t send example_group_[started|finished] to formatters for empty groups.
    • Get specs passing on jruby (Sidu Ponnappa)
    • Fix bug where mixing nested groups and outer-level examples gave unpredictable :line_number behavior (Artur Małecki)
    • Regexp.escape the argument to –example (tip from Elliot Winkler)
    • Correctly pass/fail pending block with message expectations
    • CommandLine returns exit status (0/1) instead of true/false
    • Create path to formatter output file if it doesn’t exist (marekj).

rspec-expectations-2.6.0

full changelog

  • Enhancments

    • change matcher accepts Regexps (Robert Davis)
    • better descriptions for have_xxx matchers (Magnus Bergmark)
    • range.should cover(*values) (Anders Furseth)
  • Bug fixes

    • Removed non-ascii characters that were choking rcov (Geoffrey Byers)
    • change matcher dups arrays and hashes so their before/after states can be compared correctly.
    • Fix the order of inclusion of RSpec::Matchers in Test::Unit::TestCase and MiniTest::Unit::TestCase to prevent a SystemStackError (Myron Marston)

rspec-mocks-2.6.0

full changelog

  • Enhancements

    • Add support for any_instance.stub and any_instance.should_receive (Sidu Ponnappa and Andy Lindeman)
  • Bug fixes

    • fix bug in which multiple chains with shared messages ending in hashes failed to return the correct value

rspec-rails-2.6.0

full changelog

  • Enhancements

    • rails 3 shortcuts for routing specs (Joe Fiorini)
    • support nested resources in generators (Tim McEwan)
    • require ‘rspec/rails/mocks’ to use mock_model without requiring the whole rails framework
    • Update the controller spec generated by the rails scaffold generator:
    • Add documentation to the generated spec
    • Use any_instance to avoid stubbing finders
    • Use real objects instead of mock_model
    • Update capybara integration to work with capy 0.4 and 1.0.0.beta
    • Decorate paths passed to [append|prepend]_view_paths with empty templates unless rendering views. (Mark Turner)
  • Bug fixes

    • fix typo in “rake spec:statsetup” (Curtis Schofield)
    • expose named routes in anonymous controller specs (Andy Lindeman)
    • error when generating namespaced scaffold resources (Andy Lindeman)
    • Fix load order issue w/ Capybara (oleg dashevskii)
    • Fix monkey patches that broke due to internal changes in rails-3.1.0.beta1

We’re doing one more release candidate to update rspec-rails to work with rails-3.1.0.beta1. This will hopefully be the last release candidate, with a final release coming in just a few days.

rspec-rails-2.6.0.rc6

full changelog

  • Bug fixes
    • Fix load order issue w/ Capybara (oleg dashevskii)
    • Relax the dependencies on rails gems to >= 3.0 (Joel Moss)
    • Fix monkey patches that broke due to internal changes in rails-3.1.0.beta1

rspec-core-2.6.0.rc6

full changelog

  • Enhancements
    • Restore –pattern/-P command line option from rspec-1
    • Support false as well as true in config.full_backtrace= (Andreas Tolf Tolfsen)

This release addresses issues that were raised in the rspec-core-2.6.0.rc2 release.

NOTE: this was originally released as rc3, but there was a problem related to rubygems that made it uninstallable.

rspec-core-2.6.0.rc4

full changelog

Enhancements

  • Clean up messages for filters/tags.

rspec-mocks-2.6.0.rc4

full changelog

Bug fixes

  • Support multiple calls to any_instance in the same example (Sidu Ponnappa)

rspec-rails-2.6.0.rc4

full changelog

Enhancements

  • Update the controller spec generated by the rails scaffold generator:
    • Add documentation to the generated spec
    • Use any_instance to avoid stubbing finders
    • Use real objects instead of mock_model
  • Update capybara integration to work with capy 0.4 and 1.0.0.beta
  • Decorate paths passed to [append|prepend]_view_paths with empty templates unless rendering views. (Mark Turner)

rspec-1.3.2 and rspec-rails-1.3.4 have been released!

This is primarily a bug-fix release of the rspec-1.x series, and is recommended for all users who have not yet upgraded to rspec-2.

rspec-rails-1.3 users will need to upgrade to rspec-rails-1.3.4, which depends on rspec ~> 1.3.2 (meaning 1.3.2 and up, but not 2.0).

rspec 1.3.2

  • Enhancements

    • Raise a meaningful error when an argument-scoped stub is called with the wrong args (Alexey)
    • Dev: ignore .rbc files (Myron Marston)
  • Bug fixes

    • Fix regression in which an expectation should return the value from a previously defined stub of the same method (Tom Stuart)
    • Support heckling class methods (Dan Kubb)
    • Only try to pass messages to the superclass if the superclass responds to the method (Andrew Selder)

rspec-rails-1.3.4 is released!

rspec-rails 1.3.4

  • No new code
  • Depends on rspec ~> 1.3.2
    • rspec-rails 1.3.3 depended on rspec-1.3.1 explicitly, so this release allows you to upgrade to rspec-1.3.2 with rspec-rails.

rspec-rails-2.4.1 is released!

January 3rd, 2011

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 Documentation

December 23rd, 2010

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:

You

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.

Me

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:

rspec-core
rspec-expectations
rspec-mocks
rspec-rails

Relish

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.

Cukes

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.

Pages

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](http://relishapp.com/rspec/rspec-core/v/2-3/file/upgrade](http://relishapp.com/rspec/rspec-core/v/2-3/file/upgrade).

Questions?

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-rails-2.3.1 is released!

December 16th, 2010

full changelog

  • Bug fixes
    • respond_to? correctly handles 2 args
    • scaffold generator no longer fails on autotest directory

RubyConf 2010 Presentations

November 13th, 2010

Slides from my RubyConf 2010 talks in São Paulo, Montevideo, and New Orleans:

Maintaining balance while reducing duplication

I just released rspec-1.3.1 and rspec-rails-1.3.3.

These are mostly bug fixes that have been sitting around for all to long as I focused on rspec-2 (coming very soon).

Report issues for rspec[-rails]-1.x to https://rspec.lighthouseapp.com/projects/5645.

Docs:

http://rspec.info/
http://rdoc.info/gems/rspec/1.3.1/frames
http://rdoc.info/gems/rspec-rails/1.3.3/frames

Cheers, David

rspec-1.3.1 / 2010-10-09

  • enhancements

    • Array =~ matcher works with subclasses of Array (Matthew Peychich & Pat Maddox)
    • config.suppress_deprecation_warnings!
  • bug fixes

    • QuitBacktraceTweaker no longer eats all paths with ‘lib’ (Tim Harper - #912)
    • Fix delegation of stubbed values on superclass class-level methods. (Scott Taylor - #496 - #957)
    • Fix pending to work with ruby-1.9
  • deprecations

    • share_as (will be removed from rspec-core-2.0)
    • simple_matcher (will be removed from rspec-core-2.0)

rspec-rails-1.3.3 / 2010-10-09

  • enhancements

    • replace use of ‘returning’ with ‘tap’
  • bug fixes

    • support message expectation on template.render with locals (Sergey Nebolsin). Closes #941.
    • helper instance variable no longer persists across examples (alex rothenberg). Closes #627.
    • mock_model stubs marked_for_destruction? (returns false).

Some questions have come up since I posted about rspec-rails-2 generators and rake tasks requiring that rspec-rails be declared in the :development group in a Gemfile. Here are a few of them, paraphrased, with answers:

Why the change?

rspec-rails now uses a Railtie to expose the rake tasks and generators. Railties allow Rails extensions to register themselves with Rails without having to copy files into your app. This makes installation and, especially, upgrades much easier to manage for both maintainers and users.

Do I need rspec-rails in both :development and :test groups?

:development

We need rspec-rails in the :development group in order to expose the rake tasks and generators without having to type RAILS_ENV=test when we want to use them.

:test

Quite ironically, it turns out that we don’t need it in the :test group at all. That may change in the future, and I don’t see any harm in keeping it in the :test group as well, so I’ll probably keep it there in my apps.

Doesn’t that mean I’m loading rspec-rails and all of its dependencies in the :development environment?

No, and herein lies the benefit of using a Railtie for this.

When you declare a gem in a Gemfile, Bundler loads up a file with the same name as the gem, in our case rspec-rails.rb.

The generator configs are only invoked when running rails generate, which is when you want them. The require statement is only invoked when running rake, which is when you want it. If you’re not running rake or rails generate, then no other files from rspec-rails or any of its dependencies are loaded, unless you load them explicitly from elsewhere in your app.

Does this actually work? When I add rspec-rails to the :development group and run rails generate, I don’t see most of the rspec generators.

The only RSpec generator that is intended to be invoked directly is rspec:install, which you’ll still see. The others are invoked implicitly by Rails when you run the various Rails generators. e.g., if you run script/rails generate controller Widgets, the controller generator implicitly calls out to the rspec:controller generator to generate a WidgetsController spec.

Because these are intended to be implicit, Rails hides them from you in order to reduce the noise level.

OK, but now I see all of the test_unit generators. What’s up with those?

Because RSpec is the test framework of record, Rails doesn’t know to hide the test_unit generators. If you want to hide them, just add this to one of your config files:

Rails::Generators.hide_namespace("test_unit")

[Updated on 7//14]

Turns out that hide_namespaces doesn’t work for this use case. I’ve got an open ticket in the Rails tracker to address this, and I’ll updated this post again once it’s addressed.