Recent Releases of https://github.com/rspec/rspec-expectations
https://github.com/rspec/rspec-expectations - 3.0.0.beta2
3.0.0.beta2 / 2014-02-17
Breaking Changes for 3.0.0:
- Remove deprecated support for accessing the
RSpecconstant using
RspecorSpec. (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::ExpectationNotMetErrorsubclass
Exceptionrather 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 newerexpectsyntax. 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_messagefailure_message_for_should_not=>failure_message_when_negatedmatch_for_should=>matchmatch_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::Machers.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 forinclusiveorexclusive
comparison (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 whenTimeorDateTime
objects are used so that the full sub-second precision is included.
(Thomas Holmes, Jeff Wallace) - Add
outputmatcher for expecting that a block outputsto_stdout
orto_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 like
expect([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 likeshoulda), but it will print
a deprecation warning. (Myron Marston)
- Ruby
Published by myronmarston about 12 years ago
https://github.com/rspec/rspec-expectations - 2.99.0.beta2
2.99.0.beta2 / 2014-02-17
Deprecations:
- Deprecate chaining
by,by_at_least,by_at_mostortooff of
expect { }.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 of
RSpec::Matchers::BuiltIn::OperatorMatcher. (Myron Marston) - Deprecate auto-integration with Test::Unit and minitest.
Instead, includeRSpec::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)
- Ruby
Published by myronmarston about 12 years ago
https://github.com/rspec/rspec-expectations - 2.14.5
2.14.5 / 2014-02-01
Bug fixes
- Fix wrong matcher descriptions with falsey expected value (yujinakayama)
- Ruby
Published by myronmarston about 12 years ago
https://github.com/rspec/rspec-expectations - 2.99.0.beta1
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 like
expect(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.
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-expectations - 3.0.0.beta1
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) - Rename
be_trueandbe_falsetobe_truthyandbe_falsey. (Sam Phippen) - Make
expect { }.to_not raise_error(SomeSpecificClass, message),
expect { }.to_not raise_error(SomeSpecificClass)and
expect { }.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). Instead
includeyour helper module and define the helper method as an
instance method. (Myron Marston)
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 chained
with_messagemethod call. (Sam Phippen)
Bug Fixes:
- Allow
includeandmatchmatchers to be used from within a
DSL-defined custom matcher'smatchblock. (Myron Marston)
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)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-expectations - 2.14.4
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)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-expectations - 2.14.3
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 via
method_missing(Jon Rowe)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-expectations - 2.14.2
2.14.2 / 2013-08-14
Bug fixes
- Fix
be_<predicate>matcher to not support operator chaining like the
bematcher 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)because
SomeClass === SomeClassreturns false. (Myron Marston)
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-expectations - 2.14.1
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 preventEncoding::UndefinedConversionError
errors (Jon Rowe).
- Ruby
Published by myronmarston over 12 years ago
https://github.com/rspec/rspec-expectations - 2.14.0
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)or
expect { }.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)
- Ruby
Published by myronmarston over 12 years ago