David Chelimsky

random thoughtlessness

rspec-2.11 is released!

| Comments

rspec-2.11.0 is out and filled with a bunch of new features. Big thanks to all who contributed, especially Justin Ko, Andy Lindeman (the newest addition to the RSpec core team) and Myron Marston for their great job addressing issues and shepherding pull requests.

Thanks also to Myron for all his work on two great new features: the new expectation syntax and support for stubbing constants.

rspec-core-2.11.0

full changelog

Enhancements

  • Support multiple --example options. (Daniel Doubrovkine @dblock)
  • Named subject e.g. subject(:article) { Article.new }
  • config.mock_with and config.expect_with yield custom config object to a block if given
    • aids decoupling from rspec-core’s configuation
  • include_context and include_examples support a block, which gets eval’d in the current context (vs the nested context generated by it_behaves_like).
  • Add config.order = 'random' to the spec_helper.rb generated by rspec --init.
  • Delay the loading of DRb (Myron Marston).
  • Limit monkey patching of describe onto just the objects that need it rather than every object in the system (Myron Marston).

Bug fixes

  • Support alternative path separators. For example, on Windows, you can now do this: rspec spec\subdir. (Jarmo Pertman @jarmo)
  • When an example raises an error and an after or around hook does as well, print out the hook error. Previously, the error was silenced and the user got no feedback about what happened. (Myron Marston)
  • --require and -I are merged among different configuration sources (Andy Lindeman)
  • Delegate to mocha methods instead of aliasing them in mocha adapter.

rspec-expectations-2.11.0

full changelog

Enhancements

  • Expand expect syntax so that it supports expections on bare values in addition to blocks (Myron Marston).
  • Add configuration options to control available expectation syntaxes (Myron Marston):
    • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :expect }
    • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = :should }
    • RSpec.configuration.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
    • RSpec.configuration.add_should_and_should_not_to Delegator

Bug fixes

  • Allow only Numeric values to be the “actual” in the be_within matcher. This prevents confusing error messages. (Su Zhang @zhangsu)
  • Define should and should_not on BasicObject rather than Kernel on 1.9. This makes should and should_not work properly with BasicObject-subclassed proxy objects like Delegator. (Myron Marston)

rspec-mocks-2.11.0

full changelog

Enhancements

  • expose ArgumentListMatcher as a formal API
    • supports use by 3rd party mock frameworks like Surrogate
  • Add stub_const API to stub constants for the duration of an example (Myron Marston).

Bug fixes

  • Fix regression of edge case behavior. double.should_receive(:foo) { a } was causing a NoMethodError when double.stub(:foo).and_return(a, b) had been setup before (Myron Marston).
  • Infinite loop generated by using any_instance and dup. (Sidu Ponnappa @kaiwren)
  • double.should_receive(:foo).at_least(:once).and_return(a) always returns a even if :foo is already stubbed.
  • Prevent infinite loop when interpolating a null double into a string as an integer ("%i" % double.as_null_object). (Myron Marston)
  • Fix should_receive so that null object behavior (e.g. returning self) is preserved if no implementation is given (Myron Marston).
  • Fix and_raise so that it raises RuntimeError rather than Exception by default, just like ruby does. (Andrew Marshall)

rspec-rails-2.11.0

full changelog

Enhancements

  • The generated spec/spec_helper.rb sets config.order = "random" so that specs run in random order by default.
  • rename render_template to have_rendered (and alias to render_template for backward compatibility)

Bug fixes

  • “uninitialized constant” errors are avoided when using using gems like rspec-rails-uncommitted that define Rspec::Rails before rspec-rails loads (Andy Lindeman)

Comments