File: Upgrade.md

package info (click to toggle)
ruby-rspec-expectations 2.14.2-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 920 kB
  • sloc: ruby: 8,202; makefile: 4
file content (53 lines) | stat: -rw-r--r-- 1,157 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Upgrade to rspec-expectations-2.0

## What's new

### New `eq` matcher.

`RSpec::Matchers` now offers you two approaches to differentiating between
object identity. You can use the rspec-1 approach:

    actual.should == expected     # object equality
    actual.should equal(expected) # object identity

... or, if you prefer:

    actual.should eq(expected) # object equality
    actual.should be(expected) # object identity

## What's been removed

### simple_matcher

Use RSpec::Matchers.define instead. For example, if you had:

    def eat_cheese
      simple_matcher("eat cheese") do |actual|
        actual.eat?(:cheese)
      end
    end

Change it to:

    RSpec::Matchers.define :eat_cheese do
      match do |actual|
        actual.eat?(:cheese)
      end
    end

### wrap_expectation

Use RSpec::Matchers.define instead.

    RSpec::Matchers.define :eat_cheese do
      match do |actual|
        actual.should eat?(:cheese)
      end
    end

    RSpec::Matchers.define :eat_cheese do
      include MyCheesyAssertions
      match_unless_raises Test::Unit::AssertionFailedError do |actual|
        assert_eats_chesse actual
      end
    end