3.8.6 / 2019-10-07
Bug Fixes:
-
Revert #1125 due to the change being incompatible with our semantic versioning policy.
3.8.5 / 2019-10-02
Bug Fixes:
-
Prevent unsupported implicit block expectation syntax from being used. (Phil Pirozhkov, #1125)
3.8.4 / 2019-06-10
Bug Fixes:
-
Prevent false negatives when checking objects for the methods required to run the the
be_an_instance_ofandbe_kind_ofmatchers. (Nazar Matus, #1112)
3.8.3 / 2019-04-20
Bug Fixes:
-
Prevent composed
allmatchers from leaking into their siblings leading to duplicate failures. (Jamie English, #1086) -
Prevent objects which change their hash on comparison from failing change checks. (Phil Pirozhkov, #1110)
-
Issue an
ArgumentErrorrather than aNoMethodErrorwhenbe_an_instance_ofandbe_kind_ofmatchers encounter objects not supporting those methods. (Taichi Ishitani, #1107)
3.8.2 / 2018-10-09
Bug Fixes:
-
Change
includematcher to rely on arespond_to?(:include?)check rather than a direct Hash comparison before callingto_hashto convert to a hash. (Jordan Owens, #1073) -
Prevent unexpected call stack jumps from causing an obscure error (
IndexError), and replace that error with a proper informative message. (Jon Rowe, #1076)
3.8.1 / 2018-08-06
Bug Fixes:
-
Fix regression in
includematcher so stoppedexpect(hash.with_indifferent_access).to include(:symbol_key)from working. (Eito Katagiri, #1069)
3.8.0 / 2018-08-04
Enhancements:
-
Improve failure message of
change(receiver, :message)by including the receiver asSomeClass#some_message. (Tomohiro Hashidate, #1005) -
Improve
changematcher so that it can correctly detect changes in deeply nested mutable objects (such as arrays-of-hashes-of-arrays). The improved logic uses the before/afterhashvalue to see if the object has been mutated, rather than shallow duping the object. (Myron Marston, #1034) -
Improve
includematcher so that pseudo-hash objects (e.g. objects that decorate a hash using aSimpleDelegatoror similar) are treated as a hash, as long as they implementto_hash. (Pablo Brasero, #1012) -
Add
max_formatted_output_length=to configuration, allowing changing the length at which we truncate large output strings. (Sam Phippen #951, Benoit Tigeot #1056) -
Improve error message when passing a matcher that doesn't support block expectations to a block based
expect. (@nicktime, #1066)
3.7.0 / 2017-10-17
Enhancements:
-
Improve compatibility with
--enable-frozen-string-literaloption on Ruby 2.3+. (Pat Allan, #997)
3.6.0 / 2017-05-04
Enhancements:
-
Treat NoMethodError as a failure for comparison matchers. (Jon Rowe, #972)
-
Allow for scoped aliased and negated matchers–just call
alias_matcherordefine_negated_matcherfrom within an example group. (Markus Reiter, #974) -
Improve failure message of
changematcher with block andsatisfymatcher by including the block snippet instead of just describing it asresultorblockwhen Ripper is available. (Yuji Nakayama, #987)
Bug Fixes:
-
Fix
yield_with_argsandyield_successive_argsmatchers so that they compare expected to actual args at the time the args are yielded instead of at the end, in case the method that is yielding mutates the arguments after yielding. (Alyssa Ross, #965)
3.6.0.beta2 / 2016-12-12
Bug Fixes:
-
Using the exist matcher on
Fileno longer produces a deprecation warning. (Jon Rowe, #954)
3.6.0.beta1 / 2016-10-09
Bug Fixes:
-
Fix
contain_exactlyto work correctly with ranges. (Myron Marston, #940) -
Fix
changeto work correctly with sets. (Marcin Gajewski, #939)
3.5.0 / 2016-07-01
Enhancements:
-
Add support for keyword arguments to the
respond_tomatcher. (Rob Smith, #915).
3.5.0.beta4 / 2016-06-05
Bug Fixes:
-
Fix
includematcher so that it provides a valid diff for hashes. (Yuji Nakayama, #916)
3.5.0.beta3 / 2016-04-02
Enhancements:
-
Make
rspec/expectations/minitest_integrationwork on Minitest::Spec 5.6+. (Myron Marston, #904) -
Add an alias
having_attributesforhave_attributesmatcher. (Yuji Nakayama, #905) -
Improve
changematcher error message when block is mis-used. (Alex Altair, #908)
3.5.0.beta2 / 2016-03-10
Enhancements:
-
Add the ability to raise an error on encountering false positives via
RSpec::Configuration#on_potential_false_positives = :raise. (Jon Rowe, #900) -
When using the custom matcher DSL, support new
notify_expectation_failures: trueoption for thematchmethod to allow expectation failures to be raised as normal instead of being converted into afalsereturn value formatches?. (Jon Rowe, #892)
Bug Fixes:
-
Allow
shoulddeprecation check to work onBasicObjects. (James Coleman, #898)
3.5.0.beta1 / 2016-02-06
Enhancements:
-
Make
match_when_negatedin custom matcher DSL support use of expectations within the match logic. (Chris Arcand, #789)
Bug Fixes:
-
Return
trueas expected from passing negated expectations (such asexpect("foo").not_to eq "bar"), so they work properly when used within amatchormatch_when_negatedblock. (Chris Arcand, #789)
3.4.0 / 2015-11-11
Enhancements:
-
Warn when
RSpec::Matchersis included in a superclass after it has already been included in a subclass on MRI 1.9, since that situation can cause uses ofsuperto trigger infinite recursion. (Myron Marston, #816) -
Stop rescuing
NoMemoryError,SignalExcepetion,InterruptandSystemExit. It is dangerous to interfere with these. (Myron Marston, #845) -
Add
#with_capturesto the match matcher which allows a user to specify expected captures when matching a regex against a string. (Sam Phippen, #848) -
Always print compound failure messages in the multi-line form. Trying to print it all on a single line didn't read very well. (Myron Marston, #859)
Bug Fixes:
-
Fix failure message from dynamic predicate matchers when the object does not respond to the predicate so that it is inspected rather than relying upon its
to_s– that way fornil,"nil"is printed rather than an empty string. (Myron Marston, #841) -
Fix SystemStackError raised when diffing an Enumerable object whose
#eachincludes the object itself. (Yuji Nakayama, #857)
3.3.1 / 2015-07-15
Bug Fixes:
-
Fix
be >,be <, etc so that it fails rather than allowing an argument error to be raised when compared against an object of the wrong type. This allows it to be used in composed matcher expressions against heterogeneous objects. (Dennis Günnewig, #809) -
Fix
respond_toto work properly on target objects that redefine themethodmethod. (unmanbearpig, #821)
3.3.0 / 2015-06-12
Enhancements:
-
Expose
RSpec::Matchers::EnglishPhrasingto make it easier to write nice failure messages in custom matchers. (Jared Beck, #736) -
Add
RSpec::Matchers::FailMatchers, a mixin which providesfail,fail_withandfail_includingmatchers for use in specifying that an expectation fails for use by extension/plugin authors. (Charlie Rudolph, #729) -
Avoid loading
tempfile(and its dependencies) unless it is absolutely needed. (Myron Marston, #735) -
Improve failure output when attempting to use
be_trueorbe_false. (Tim Wade, #744) -
Define
RSpec::Matchers#respond_to_missing?so thatRSpec::Matchers#respond_to?andRSpec::Matchers#methodhandle dynamic predicate matchers. (Andrei Botalov, #751) -
Use custom Time/DateTime/BigDecimal formatting for all matchers so they are consistently represented in failure messages. (Gavin Miller, #740)
-
Add configuration to turn off warnings about matcher combinations that may cause false positives. (Jon Rowe, #768)
-
Warn when using a bare
raise_errormatcher that you may be subject to false positives. (Jon Rowe, #768) -
Warn rather than raise when using the
raise_errormatcher in negative expectations that may be subject to false positives. (Jon Rowe, #775) -
Improve failure message for
include(a, b, c)so that ifaandbare included the failure message only mentionsc. (Chris Arcand, #780) -
Allow
satisfymatcher to take an optional description argument that will be used in thedescription,failure_messageandfailure_message_when_negatedin place of the undescriptive “sastify block”. (Chris Arcand, #783) -
Add new
aggregate_failuresAPI that allows multiple independent expectations to all fail and be listed in the failure output, rather than the example aborting on the first failure. (Myron Marston, #776) -
Improve
raise_errormatcher so that it can accept a matcher as a single argument that matches the message. (Time Wade, #782)
Bug Fixes:
-
Make
contain_exactly/match_arraywork with strict test doubles that have not defined<=>. (Myron Marston, #758) -
Fix
includematcher so that it omits the diff when it would confusingly highlight items that are actually included but are not an exact match in a line-by-line diff. (Tim Wade, #763) -
Fix
matchmatcher so that it does not blow up when matching a string or regex against another matcher (rather than a string or regex). (Myron Marston, #772) -
Silence whitespace-only diffs. (Myron Marston, #801)
3.2.1 / 2015-04-06
Bug Fixes:
-
Prevent
Ranges from being enumerated when generating matcher descriptions. (Jon Rowe, #755) -
Ensure exception messages are compared as strings in the
raise_errormatcher. (Jon Rowe, #755)
3.2.0 / 2015-02-03
Enhancements:
-
Add
block_argmethod to custom matcher API, which allows you to access the block passed to a custom matcher, if there is one. (Mike Dalton, #645) -
Provide more detail in failure message of
yield_controlmatcher. (Jon Rowe, #650) -
Add a shorthand syntax for
chainin the matcher DSL which assigns values for use elsewhere, for examplechain :and_smaller_than, :small_valuecreates anattr_readerforsmall_value(Tom Stuart, #644) -
Provide a more helpful deprecation message when using the
shouldsyntax. (Elia Schito, #663) -
Provide more detail in the
have_attributesmatcher failure message. (Jon Rowe, #668) -
Make the
have_attributesmatcher diffable. (Jon Rowe, Alexey Fedorov, #668) -
Add
output(...).to_std(out|err)_from_any_processas alternatives tooutput(...).to_std(out|err). The latter doesn't work when a sub process writes to the named stream but is much faster. (Alex Genco, #700) -
Improve compound matchers (created by
andandor) so that diffs are included in failures when one or more of their matchers are diffable. (Alexey Fedorov, #713)
Bug Fixes:
-
Avoid calling
private_methodsfrom thebepredicate matcher on the target object if the object publicly responds to the predicate method. This avoids a possible error that can occur if the object raises errors fromprivate_methods(which can happen with celluloid objects). (@chapmajs, #670) -
Make
yield_control(with no modifier) default toat_least(:once)rather than raising a confusing error when multiple yields are encountered. (Myron Marston, #675) -
Fix “instance variable @color not initialized” warning when using rspec-expectations outside of an rspec-core context. (Myron Marston, #689)
-
Fix
start_withandend_withto work properly when checking a string against an array of strings. (Myron Marston, #690) -
Don't use internally delegated matchers when generating descriptions for examples without doc strings. (Myron Marston, #692)
3.1.2 / 2014-09-26
Bug Fixes:
-
Fix
define_negated_matcherso that matchers that support fluent interfaces continue to be negated after you use the chained method. (Myron Marston, #656) -
Fix
define_negated_matcherso that the matchers fail with an appropriate failure message. (Myron Marston, #659)
3.1.1 / 2014-09-15
Bug Fixes:
-
Fix regression in
allmatcher in 3.1.0 that prevented it from working on objects that are notEnumerablebut do implementeach_with_index(such as an ActiveRecord proxy). (Jori Hardman, #647)
3.1.0 / 2014-09-04
Enhancements:
-
Add
have_attributesmatcher, that passes if actual's attribute values match the expected attributes hash:Person = Struct.new(:name, :age)person = Person.new("Bob", 32)expect(person).to have_attributes(:name => "Bob", :age => 32). (Adam Farhi, #571) -
Extended compound matcher support to block matchers, for cases like:
expect { ... }.to change { x }.to(3).and change { y }.to(4). (Myron Marston, #567) -
Include chained methods in custom matcher description and failure message when new
include_chain_clauses_in_custom_matcher_descriptionsconfig option is enabled. (Dan Oved, #600) -
Add
thricemodifier toyield_controlmatcher as a synonym forexactly(3).times. (Dennis Taylor, #615) -
Add
RSpec::Matchers.define_negated_matcher, which defines a negated version of the named matcher. (Adam Farhi, Myron Marston, #618) -
Document and support negation of
contain_exactly/match_array. (Jon Rowe, #626).
Bug Fixes:
-
Rename private
LegacyMacherAdapterconstant toLegacyMatcherAdapterto fix typo. (Abdelkader Boudih, #563) -
Fix
allmatcher so that it fails properly (rather than raising aNoMethodError) when matched against a non-enumerable. (Hao Su, #622)
3.0.4 / 2014-08-14
Bug Fixes:
-
Fix
start_withandend_withso that they work properly with structs. (Myron Marston, #620) -
Fix failure message generation so that structs are printed properly in failures. Previously failure messages would represent them as an array. (Myron Marston, #620)
-
Fix composable matcher support so that it does not wrongly treat structs as arrays. (Myron Marston, #620)
3.0.3 / 2014-07-21
Bug Fixes:
-
Fix issue with detection of generic operator matchers so they work correctly when undefined. (Myron Marston, #597)
-
Don't inadvertently define
BasicObjectin 1.8.7. (Chris Griego, #603) -
Fix
includematcher so that it fails gracefully when matched against an object that does not respond toinclude?. (Myron Marston, #607)
3.0.2 / 2014-06-19
Bug Fixes:
-
Fix regression in
contain_exactly(AKAmatch_array) that caused it to wrongly pass when the expected array was empty. (Myron Marston, #581) -
Provide a better error message when you use the
change(obj, :msg)form of the change matcher but forget the message argument. (Alex Sunderland, #585) -
Make the
contain_exactlymatcher work with arrays that contain hashes in arbitrary ordering. (Sam Phippen, #578)
3.0.1 / 2014-06-12
Bug Fixes:
-
Add a missing
requirethat would cause therespond_tomatcher to fail when used in a project where the rest of RSpec (e.g. core and expecatations) weren't being used. (Myron Marston, #566) -
Structs are no longer treated as arrays when diffed. (Jon Rowe, #576)
3.0.0 / 2014-06-01
No code changes. Just taking it out of pre-release.
3.0.0.rc1 / 2014-05-18
Breaking Changes for 3.0.0:
-
Remove
matcher_execution_contextattribute from DSL-defined custom matchers. (Myron Marston) -
Remove
RSpec::Matchers::Pretty#_pretty_print. (Myron Marston) -
Remove
RSpec::Matchers::Pretty#expected_to_sentence. (Myron Marston) -
Rename
RSpec::Matchers::Configurationconstant toRSpec::Expectations::Configuration. (Myron Marston) -
Prevent
have_xyzpredicate matchers using private methods. (Adrian Gonzalez) -
Block matchers must now implement
supports_block_expectations?. (Myron Marston) -
Stop supporting
require 'rspec-expectations'. Userequire 'rspec/expectations'instead. (Myron Marston)
Bug Fixes:
-
Fix
NoMethodErrortriggered by beta2 whenYARDwas loaded in the test environment. (Myron Marston) -
Fix
be_xyzmatcher to accept ado...endblock. (Myron Marston) -
Fix composable matcher failure message generation logic so that it does not blow up when given
$stdoutor$stderr. (Myron Marston) -
Fix
changematcher to work properly withIOobjects. (Myron Marston) -
Fix
existmatcher so that it can be used in composed matcher expressions involving objects that do not implementexist?orexists?. (Daniel Fone) -
Fix composable matcher match logic so that it clones matchers before using them in order to work properly with matchers that use internal memoization based on a given
actualvalue. (Myron Marston) -
Fix
be_xyzandhas_xyzpredicate matchers so that they can be used in composed matcher expressions involving objects that do not implement the predicate method. (Daniel Fone)
Enhancements:
-
Document the remaining public APIs. rspec-expectations now has 100% of the public API documented and will remain that way (as new undocumented methods will fail the build). (Myron Marston)
-
Improve the formatting of BigDecimal objects in
eqmatcher failure messages. (Daniel Fone) -
Improve the failure message for
be_xyzpredicate matchers so that it includes theinspectoutput of the receiver. (Erik Michaels-Ober, Sam Phippen) -
Add
allmatcher, to allow you to specify that a given matcher matches all elements in a collection:expect([1, 3, 5]).to all( be_odd ). (Adam Farhi) -
Add boolean aliases (
&/|) for compound operators (and/or). (Adam Farhi) -
Give users a clear error when they wrongly use a value matcher in a block expectation expression (e.g.
expect { 3 }.to eq(3)) or vice versa. (Myron Marston)
3.0.0.beta2 / 2014-02-17
Breaking Changes for 3.0.0:
-
Remove deprecated support for accessing the
RSpecconstant usingRspecorSpec. (Myron Marston) -
Remove deprecated
RSpec::Expectations.differ=. (Myron Marston) -
Remove support for deprecated
expect(...).should. (Myron Marston) -
Explicitly disallow
expect { }.not_to change { }withby,by_at_least,by_at_mostorto. These have never been supported but did not raise explicit errors. (Myron Marston) -
Provide
===rather than==as an alias ofmatches?for all matchers. The semantics of===are closer to an RSpec matcher than==. (Myron Marston) -
Remove deprecated
RSpec::Matchers::OperatorMatcherconstant. (Myron Marston) -
Make
RSpec::Expectations::ExpectationNotMetErrorsubclassExceptionrather thanStandardErrorso they can bypass a barerescuein end-user code (e.g. when an expectation is set from within a rspec-mocks stub implementation). (Myron Marston) -
Remove Test::Unit and Minitest 4.x integration. (Myron Marston)
Enhancements:
-
Simplify the failure message of the
bematcher when matching against:true,falseandnil. (Sam Phippen) -
Update matcher protocol and custom matcher DSL to better align with the newer
expectsyntax. If you want your matchers to maintain compatibility with multiple versions of RSpec, you can alias the new names to the old. (Myron Marston)-
failure_message_for_should=>failure_message -
failure_message_for_should_not=>failure_message_when_negated -
match_for_should=>match -
match_for_should_not=>match_when_negated
-
-
Improve generated descriptions from
changematcher. (Myron Marston) -
Add support for compound matcher expressions using
andandor. Simply chain them off of any existing matcher to create an expression likeexpect(alphabet).to start_with("a").and end_with("z"). (Eloy Espinaco) -
Add
contain_exactlyas a less ambiguous version ofmatch_array. Note that it expects the expected array to be splatted as individual args:expect(array).to contain_exactly(1, 2)is the same asexpect(array).to match_array([1, 2]). (Myron Marston) -
Update
contain_exactly/match_arrayso that it can match against other non-array collections (such as aSet). (Myron Marston) -
Update built-in matchers so that they can accept matchers as arguments to allow you to compose matchers in arbitrary ways. (Myron Marston)
-
Add
RSpec::Matchers::Composablemixin that can be used to make a custom matcher composable as well. Note that custom matchers defined viaRSpec::Matchers.definealready have this. (Myron Marston) -
Define noun-phrase aliases for built-in matchers, which can be used when creating composed matcher expressions that read better and provide better failure messages. (Myron Marston)
-
Add
RSpec::Matchers.alias_matcherso users can define their own matcher aliases. Thedescriptionof the matcher will reflect the alternate matcher name. (Myron Marston) -
Add explicit
be_betweenmatcher.be_betweenhas worked for a long time as a dynamic predicate matcher, but the failure message was suboptimal. The new matcher provides a much better failure message. (Erik Michaels-Ober) -
Enhance the
be_betweenmatcher to allow forinclusiveorexclusivecomparison (e.g. inclusive of min/max or exclusive of min/max). (Pedro Gimenez) -
Make failure message for
not_to be #{operator}less confusing by only saying it's confusing when comparison operators are used. (Prathamesh Sonpatki) -
Improve failure message of
eqmatcher whenTimeorDateTimeobjects are used so that the full sub-second precision is included. (Thomas Holmes, Jeff Wallace) -
Add
outputmatcher for expecting that a block outputsto_stdoutorto_stderr. (Luca Pette, Matthias Günther) -
Forward a provided block on to the
has_xyz?method call when thehave_xyzmatcher is used. (Damian Galarza) -
Provide integration with Minitest 5.x. Require
rspec/expectations/minitest_integrationafter loading minitest to use rspec-expectations with minitest. (Myron Marston)
Bug Fixes:
-
Fix wrong matcher descriptions with falsey expected value (yujinakayama)
-
Fix
expect { }.not_to change { }.from(x)so that the matcher only passes if the starting value isx. (Tyler Rick, Myron Marston) -
Fix hash diffing, so that it colorizes properly and doesn't consider trailing commas when performing the diff. (Jared Norman)
-
Fix built-in matchers to fail normally rather than raising
ArgumentErrorwhen given an object of the wrong type to match against, so that they work well in composite matcher expressions likeexpect([1.51, "foo"]).to include(a_string_matching(/foo/), a_value_within(0.1).of(1.5)). (Myron Marston)
Deprecations:
-
Retain support for RSpec 2 matcher protocol (e.g. for matchers in 3rd party extension gems like
shoulda), but it will print a deprecation warning. (Myron Marston)
3.0.0.beta1 / 2013-11-07
Breaking Changes for 3.0.0:
-
Remove explicit support for 1.8.6. (Jon Rowe)
-
Remove the deprecated
be_closematcher, preferringbe_withininstead. (Sam Phippen) -
Remove the deprecated
have,have_at_leastandhave_at_mostmatchers. You can continue using those matchers through github.com/rspec/rspec-collection_matchers, or you can rewrite your expectations with something likeexpect(your_object.size).to eq(num). (Hugo Baraúna) -
Rename
be_trueandbe_falsetobe_truthyandbe_falsey. (Sam Phippen) -
Make
expect { }.to_not raise_error(SomeSpecificClass, message),expect { }.to_not raise_error(SomeSpecificClass)andexpect { }.to_not raise_error(message)invalid, since they are prone to hiding failures. Instead, useexpect { }.to_not raise_error(with no args). (Sam Phippen) -
Within
RSpec::Matchers.defineblocks, helper methods made available either viadef self.helperorextend HelperModuleare no longer available to thematchblock (or any of the others). Insteadincludeyour helper module and define the helper method as an instance method. (Myron Marston) -
Force upgrading Diff::LCS for encoding compatability with diffs. (Jon Rowe)
Enhancements:
-
Support
do..endstyle block withraise_errormatcher. (Yuji Nakayama) -
Rewrote custom matcher DSL to simplify its implementation and solve a few issues. (Myron Marston)
-
Allow early
returnfrom within custom matcher DSL blocks. (Myron Marston) -
The custom matcher DSL's
chaincan now accept a block. (Myron Marston) -
Support setting an expectation on a
raise_errormatcher via a chainedwith_messagemethod call. (Sam Phippen)
Bug Fixes:
-
Allow
includeandmatchmatchers to be used from within a DSL-defined custom matcher'smatchblock. (Myron Marston) -
Correct encoding error message on diff failure (Jon Rowe)
Deprecations:
-
Using the old
:shouldsyntax without explicitly configuring it is deprecated. It will continue to work but will emit a deprecation warning in RSpec 3 if you do not explicitly enable it. (Sam Phippen)
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 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.last_emailed_at }.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_control -
expect {...}.to yield_with_args(1, 2, 3) -
expect {...}.to yield_with_no_args -
expect {...}.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 match_for_should_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