gems rspec-expectations 3.0.0.beta2

latest releases: 3.13.3, 3.13.2, 3.13.1...
11 years ago

3.0.0.beta2 / 2014-02-17

full changelog

Breaking Changes for 3.0.0:

  • Remove deprecated support for accessing the RSpec constant using
    Rspec or Spec. (Myron Marston)
  • Remove deprecated RSpec::Expectations.differ=. (Myron Marston)
  • Remove support for deprecated expect(...).should. (Myron Marston)
  • Explicitly disallow expect { }.not_to change { } with by,
    by_at_least, by_at_most or to. These have never been supported
    but did not raise explicit errors. (Myron Marston)
  • Provide === rather than == as an alias of matches? for
    all matchers. The semantics of === are closer to an RSpec
    matcher than ==. (Myron Marston)
  • Remove deprecated RSpec::Matchers::OperatorMatcher constant.
    (Myron Marston)
  • Make RSpec::Expectations::ExpectationNotMetError subclass
    Exception rather than StandardError so they can bypass
    a bare rescue in 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 be matcher when matching against:
    true, false and nil. (Sam Phippen)
  • Update matcher protocol and custom matcher DSL to better align
    with the newer expect syntax. 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 change matcher. (Myron Marston)
  • Add support for compound matcher expressions using and and or.
    Simply chain them off of any existing matcher to create an expression
    like expect(alphabet).to start_with("a").and end_with("z").
    (Eloy Espinaco)
  • Add contain_exactly as a less ambiguous version of match_array.
    Note that it expects the expected array to be splatted as
    individual args: expect(array).to contain_exactly(1, 2) is
    the same as expect(array).to match_array([1, 2]). (Myron Marston)
  • Update contain_exactly/match_array so that it can match against
    other non-array collections (such as a Set). (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::Composable mixin that can be used to make
    a custom matcher composable as well. Note that custom matchers
    defined via RSpec::Matchers.define already 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_matcher so users can define their own
    matcher aliases. The description of the matcher will reflect the
    alternate matcher name. (Myron Marston)
  • Add explicit be_between matcher. be_between has 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_between matcher to allow for inclusive or exclusive
    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 eq matcher when Time or DateTime
    objects are used so that the full sub-second precision is included.
    (Thomas Holmes, Jeff Wallace)
  • Add output matcher for expecting that a block outputs to_stdout
    or to_stderr. (Luca Pette, Matthias Günther)
  • Forward a provided block on to the has_xyz? method call when
    the have_xyz matcher is used. (Damian Galarza)
  • Provide integration with Minitest 5.x. Require
    rspec/expectations/minitest_integration after 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 is x. (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
    ArgumentError when 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 like shoulda), but it will print
    a deprecation warning. (Myron Marston)

Don't miss a new rspec-expectations release

NewReleases is sending notifications on new releases.