2.99.2 / 2014-07-21
Bug Fixes:
- Fix regression in
Expectations#method_handle_forwhere proxy objects with method delegated would wrongly not return a method handle. (Jon Rowe, #594) - Fix issue with detection of generic operator matchers so they work correctly when undefined. (Myron Marston, #597)
2.99.1 / 2014-06-19
Bug Fixes:
- Fix typo in custom matcher
expecteddeprecation warning -- it'sexpected_as_array, notexpected_array. (Frederick Cheung, #562)
2.99.0 / 2014-06-01
Enhancements:
- Special case deprecation message for
errors_onwithrspec-railsto be more useful. (Aaron Kromer)
2.99.0.rc1 / 2014-05-18
Deprecations:
- Deprecate
matcher_execution_contextattribute on DSL-defined custom matchers. (Myron Marston) - Deprecate
RSpec::Matchers::Pretty#_pretty_print. (Myron Marston) - Deprecate
RSpec::Matchers::Pretty#expected_to_sentence. (Myron Marston) - Deprecate
RSpec::Matchers::Configurationin favor ofRSpec::Expectations::Configuration. (Myron Marston) - Deprecate
be_xyzpredicate matcher on an object that doesn't respond toxyz?orxyzs?. (Daniel Fone) - Deprecate
have_xyzmatcher on an object that doesn't respond tohas_xyz?. (Daniel Fone) - Deprecate
have_xyzmatcher on an object that has a private methodhas_xyz?. (Jon Rowe) - Issue a deprecation warning when a block expectation expression is
used with a matcher that doesn't explicitly support block expectations
via
supports_block_expectations?. (Myron Marston) - Deprecate
require 'rspec-expectations'. Userequire 'rspec/expectations'instead. (Myron Marston)
2.99.0.beta2 / 2014-02-17
Deprecations:
- Deprecate chaining
by,by_at_least,by_at_mostortooff ofexpect { }.not_to change { }. The docs have always said these are not supported for the negative form but now they explicitly raise errors in RSpec 3. (Myron Marston) - Change the semantics of
expect { }.not_to change { x }.from(y). In RSpec 2.x, this expectation would only fail ifxstarted with the value ofyand changed. If it started with a different value and changed, it would pass. In RSpec 3, it will pass only if the value starts atyand it does not change. (Myron Marston) - Deprecate
matcher == valueas an alias formatcher.matches?(value), in favor ofmatcher === value. (Myron Marston) - Deprecate
RSpec::Matchers::OperatorMatcherin favor ofRSpec::Matchers::BuiltIn::OperatorMatcher. (Myron Marston) - Deprecate auto-integration with Test::Unit and minitest.
Instead, include
RSpec::Matchersin the appropriate test case base class yourself. (Myron Marston) - Deprecate treating
#expectedon a DSL-generated custom matcher as an array when only 1 argument is passed to the matcher method. In RSpec 3 it will be the single value in order to make diffs work properly. (Jon Rowe)
2.99.0.beta1 / 2013-11-07
Deprecations:
- Deprecate
have,have_at_leastandhave_at_most. You can continue using those matchers through https://github.com/rspec/rspec-collection_matchers, or you can rewrite your expectations with something likeexpect(your_object.size).to eq(num). (Hugo Baraúna) - Deprecate
be_xyzpredicate matcher whenxyz?is a private method. (Jon Rowe) - Deprecate
be_true/be_falsein favour ofbe_truthy/be_falsey(for Ruby's conditional semantics) orbe true/be false(for exact equality). (Sam Phippen) - Deprecate calling helper methods from a custom matcher with the wrong
scope. (Myron Marston)
def self.foo/extend Helpercan be used to add macro methods (e.g. methods that call the custom matcher DSL methods), but should not be used to define helper methods called from within the DSL blocks.def foo/include Helperis the opposite: it's for helper methods callable from within a DSL block, but not for defining macros.- RSpec 2.x allowed helper methods defined either way to be used for either purpose, but RSpec 3.0 will not.
2.14.5 / 2014-02-01
Bug fixes
- Fix wrong matcher descriptions with falsey expected value (yujinakayama)
2.14.4 / 2013-11-06
Bug fixes
- Make the
matchmatcher produce a diff output. (Jon Rowe, Ben Moss) - Choose encoding for diff's more intelligently, and when all else fails fall back to default internal encoding with replacing characters. (Jon Rowe)
2.14.3 / 2013-09-22
Bug fixes
- Fix operator matchers (
shouldsyntax) whenmethodis redefined on target. (Brandon Turner) - Fix diffing of hashes with object based keys. (Jon Rowe)
- Fix operator matchers (
shouldsyntax) when operator is defined viamethod_missing(Jon Rowe)
2.14.2 / 2013-08-14
Bug fixes
- Fix
be_<predicate>matcher to not support operator chaining like thebematcher does (e.g.be == 5). This led to some odd behaviors sincebe_<predicate> == anythingreturned aBeComparedTomatcher and was thus always truthy. This was a consequence of the implementation (e.g. subclassing the basicBematcher) and was not intended behavior. (Myron Marston). - Fix
changematcher to compare using==in addition to===. This is important for an expression like:expect {}.to change { a.class }.from(ClassA).to(ClassB)becauseSomeClass === SomeClassreturns false. (Myron Marston)
2.14.1 / 2013-08-08
Bug fixes
- Ensure diff output uses the same encoding as the encoding of
the string being diff'd to prevent
Encoding::UndefinedConversionErrorerrors (Jon Rowe).
2.14.0 / 2013-07-06
Bug fixes
- Values that are not matchers use
#inspect, rather than#descriptionfor documentation output (Andy Lindeman, Sam Phippen). - Make
expect(a).to be_within(x).percent_of(y)work with negative y (Katsuhiko Nishimra). - Make the
be_predicatematcher work as expected used withexpect{...}.to change...(Sam Phippen).
2.14.0.rc1 / 2013-05-27
Enhancements
- Enhance
yield_controlso that you can specify an exact or relative number of times:expect { }.to yield_control.exactly(3).times,expect { }.to yield_control.at_least(2).times, etc (Bartek Borkowski). - Make the differ that is used when an expectation fails better handle arrays by splitting each element of the array onto its own line. (Sam Phippen)
- Accept duck-typed strings that respond to
:to_stras expectation messages. (Toby Ovod-Everett)
Bug fixes
- Fix differ to not raise errors when dealing with differently-encoded strings (Jon Rowe).
- Fix
expect(something).to be_within(x).percent_of(y)where x and y are both integers (Sam Phippen). - Fix
havematcher to handle the fact that on ruby 2.0,Enumerator#sizemay return nil (Kenta Murata). - Fix
expect { raise s }.to raise_error(s)where s is an error instance on ruby 2.0 (Sam Phippen). - Fix
expect(object).to raise_errorpassing. This now warns the user and fails the spec (tomykaira).
Deprecations
- Deprecate
expect { }.not_to raise_error(SpecificErrorClass)orexpect { }.not_to raise_error("some specific message"). Using these was prone to hiding failures as they would allow any other error to pass. (Sam Phippen and David Chelimsky)
2.13.0 / 2013-02-23
Enhancements
- Add support for percent deltas to
be_withinmatcher:expect(value).to be_within(10).percent_of(expected)(Myron Marston). - Add support to
includematcher to allow it to be given a list of matchers as the expecteds to match against (Luke Redpath).
Bug fixes
- Fix
changematcher so that it dups strings in order to handle mutated strings (Myron Marston). - Fix
should be =~ /some regex//expect(...).to be =~ /some regex/. Previously, these either failed with a confusingundefined method matches?' for false:FalseClasserror or were no-ops that didn't actually verify anything (Myron Marston). - Add compatibility for diff-lcs 1.2 and relax the version constraint (Peter Goldstein).
- Fix DSL-generated matchers to allow multiple instances of the same matcher in the same example to have different description and failure messages based on the expected value (Myron Marston).
- Prevent
undefined method #split for Arrayerror when dumping the diff of an array of multiline strings (Myron Marston). - Don't blow up when comparing strings that are in an encoding that is not ASCII compatible (Myron Marston).
- Remove confusing "Check the implementation of #==" message printed for empty diffs (Myron Marston).
2.12.1 / 2012-12-15
Bug fixes
- Improve the failure message for an expression like
{}.should =~ {}. (Myron Marston and Andy Lindeman) - Provide a
match_regexalias so that custom matchers built using the matcher DSL can use it (sincematchis a different method in that context). (Steven Harman)
2.12.0 / 2012-11-12
Enhancements
- Colorize diffs if the
--coloroption is configured. (Alex Coplan) - Include backtraces in unexpected errors handled by
raise_errormatcher (Myron Marston) - Print a warning when users accidentally pass a non-string argument as an expectation message (Sam Phippen)
=~andmatch_arraymatchers output a more useful error message when the actual value is not an array (or an object that responds to#to_ary) (Sam Phippen)
Bug fixes
- Fix
includematcher so thatexpect({}).to include(:a => nil)fails as it should (Sam Phippen). - Fix
be_an_instance_ofmatcher so thatClass#to_sis used in the description rather thanClass#inspect, since some classes (likeActiveRecord::Base) define a long, verbose#inspect. (Tom Stuart)
2.11.3 / 2012-09-04
Bug fixes
- Fix (and deprecate)
expect { }.shouldsyntax so that it works even though it was never a documented or intended syntax. It worked as a consequence of the implementation ofexpectin RSpec 2.10 and earlier. (Myron Marston) Ensure #== is defined on built in matchers so that they can be composed. For example:
expect { user.emailed! }.to change { user.lastemailedat }.to be_within(1.second).of(Time.zone.now)
2.11.2 / 2012-07-25
Bug fixes
- Define
shouldandshould_notonObjectrather thanBasicObjecton MacRuby. On MacRuby,BasicObjectis defined but is not the root of the object hierarchy. (Gabriel Gilder)
2.11.1 / 2012-07-08
Bug fixes
- Constrain
actualinbe_withinmatcher to values that respond to-instead of requiring a specific type.Time, for example, is a legit alternative.
2.11.0 / 2012-07-07
Enhancements
- Expand
expectsyntax 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
Numericvalues to be the "actual" in thebe_withinmatcher. This prevents confusing error messages. (Su Zhang @zhangsu) - Define
shouldandshould_notonBasicObjectrather thanKernelon 1.9. This makesshouldandshould_notwork properly withBasicObject-subclassed proxy objects likeDelegator. (Myron Marston)
2.10.0 / 2012-05-03
Enhancements
- Add new
start_withandend_withmatchers (Jeremy Wadsack) - Add new matchers for specifying yields (Myron Marston):
expect {...}.to yield_controlexpect {...}.to yield_with_args(1, 2, 3)expect {...}.to yield_with_no_argsexpect {...}.to yield_successive_args(1, 2, 3)
match_unless_raisestakes multiple exception args
Bug fixes
- Fix
be_withinmatcher to be inclusive of delta. - Fix message-specific specs to pass on Rubinius (John Firebaugh)
2.9.1 / 2012-04-03
Bug fixes
- Provide a helpful message if the diff between two objects is empty.
- Fix bug diffing single strings with multiline strings.
- Fix for error with using custom matchers inside other custom matchers (mirasrael)
- Fix using execution context methods in nested DSL matchers (mirasrael)
2.9.0 / 2012-03-17
Enhancements
- Move built-in matcher classes to RSpec::Matchers::BuiltIn to reduce pollution of RSpec::Matchers (which is included in every example).
- Autoload files with matcher classes to improve load time.
Bug fixes
- Align
respond_to?andmethod_missingin DSL-defined matchers. - Clear out user-defined instance variables between invocations of DSL-defined matchers.
- Dup the instance of a DSL generated matcher so its state is not changed by subsequent invocations.
- Treat expected args consistently across positive and negative expectations (thanks to Ralf Kistner for the heads up)
2.8.0 / 2012-01-04
Enhancements
- Better diff output for Hash (Philippe Creux)
- Eliminate Ruby warnings (Olek Janiszewski)
2.8.0.rc2 / 2011-12-19
No changes for this release. Just releasing with the other rspec gems.
2.8.0.rc1 / 2011-11-06
Enhancements
- Use classes for the built-in matchers (they're faster).
- Eliminate Ruby warnings (Matijs van Zuijlen)
2.7.0 / 2011-10-16
Enhancements
HaveMatcherconverts argument usingto_i(Alex Bepple & Pat Maddox)- Improved failure message for the
have_xxxmatcher (Myron Marston) HaveMatchersupportscount(Matthew Bellantoni)- Change matcher dups
Enumerablebefore the action, supporting customEnumerabletypes likeCollectionProxyin Rails (David Chelimsky)
Bug fixes
- Fix typo in
have(n).xyzdocumentation (Jean Boussier) - fix
safe_sortfor ruby 1.9.2 (Kernelnow defines<=>for Object) (Peter van Hardenberg)
2.6.0 / 2011-05-12
Enhancements
changematcher accepts regexps (Robert Davis)- better descriptions for
have_xxxmatchers (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)
2.5.0 / 2011-02-05
Enhancements
should existworks withexist?orexists?(Myron Marston)expect { ... }.not_to do_something(in addition toto_not)
Documentation
- improved docs for raise_error matcher (James Almond)
2.4.0 / 2011-01-02
No functional changes in this release, which was made to align with the rspec-core-2.4.0 release.
Enhancements
- improved RDoc for change matcher (Jo Liss)
2.3.0 / 2010-12-12
Enhancements
- diff strings when include matcher fails (Mike Sassak)
2.2.0 / 2010-11-28
2.1.0 / 2010-11-07
Enhancements
be_within(delta).of(expected)matcher (Myron Marston)- Lots of new Cucumber features (Myron Marston)
- Raise error if you try
should != expectedon Ruby-1.9 (Myron Marston) - Improved failure messages from
throw_symbol(Myron Marston)
Bug fixes
- Eliminate hard dependency on
RSpec::Core(Myron Marston) have_matcher- use pluralize only when ActiveSupport inflections are indeed defined (Josep M Bach)- throw_symbol matcher no longer swallows exceptions (Myron Marston)
- fix matcher chaining to avoid name collisions (Myron Marston)
2.0.0 / 2010-10-10
Enhancements
- Add matchforshould_not method to matcher DSL (Myron Marston)
Bug fixes
respond_tomatcher works correctly withshould_notwith multiple methods (Myron Marston)includematcher works correctly withshould_notwith multiple values (Myron Marston)
2.0.0.rc / 2010-10-05
Enhancements
require 'rspec/expectations'in a T::U or MiniUnit suite (Josep M. Bach)
Bug fixes
- change by 0 passes/fails correctly (Len Smith)
- Add description to satisfy matcher
2.0.0.beta.22 / 2010-09-12
Enhancements
- diffing improvements
- diff multiline strings
- don't diff single line strings
- don't diff numbers (silly)
- diff regexp + multiline string
Bug fixes
* should[_not] change now handles boolean values correctly