rspec-expectations 2.99.2 → 3.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +14 -6
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +2 -0
  4. data/Changelog.md +63 -104
  5. data/License.txt +1 -0
  6. data/README.md +14 -8
  7. data/features/README.md +1 -2
  8. data/features/built_in_matchers/README.md +3 -0
  9. data/features/built_in_matchers/be.feature +44 -44
  10. data/features/built_in_matchers/be_within.feature +1 -1
  11. data/features/built_in_matchers/comparisons.feature +97 -0
  12. data/features/built_in_matchers/cover.feature +3 -3
  13. data/features/built_in_matchers/end_with.feature +3 -3
  14. data/features/built_in_matchers/equality.feature +20 -23
  15. data/features/built_in_matchers/exist.feature +5 -5
  16. data/features/built_in_matchers/expect_error.feature +14 -14
  17. data/features/built_in_matchers/include.feature +15 -15
  18. data/features/built_in_matchers/match.feature +4 -5
  19. data/features/built_in_matchers/match_array.feature +37 -0
  20. data/features/built_in_matchers/predicates.feature +30 -6
  21. data/features/built_in_matchers/respond_to.feature +4 -4
  22. data/features/built_in_matchers/satisfy.feature +2 -2
  23. data/features/built_in_matchers/start_with.feature +3 -3
  24. data/features/built_in_matchers/types.feature +6 -6
  25. data/features/custom_matchers/access_running_example.feature +3 -3
  26. data/features/custom_matchers/define_matcher.feature +6 -34
  27. data/features/custom_matchers/define_matcher_outside_rspec.feature +2 -2
  28. data/features/custom_matchers/define_matcher_with_fluent_interface.feature +1 -1
  29. data/features/customized_message.feature +18 -1
  30. data/features/diffing.feature +3 -3
  31. data/features/implicit_docstrings.feature +9 -9
  32. data/features/step_definitions/additional_cli_steps.rb +0 -10
  33. data/features/support/env.rb +10 -3
  34. data/features/test_frameworks/test_unit.feature +0 -40
  35. data/lib/rspec-expectations.rb +0 -5
  36. data/lib/rspec/expectations.rb +4 -18
  37. data/lib/rspec/expectations/expectation_target.rb +10 -77
  38. data/lib/rspec/expectations/extensions.rb +0 -1
  39. data/lib/rspec/expectations/handler.rb +1 -5
  40. data/lib/rspec/expectations/syntax.rb +25 -5
  41. data/lib/rspec/expectations/version.rb +1 -1
  42. data/lib/rspec/matchers.rb +7 -102
  43. data/lib/rspec/matchers/built_in/base_matcher.rb +10 -17
  44. data/lib/rspec/matchers/built_in/be.rb +5 -18
  45. data/lib/rspec/matchers/built_in/be_within.rb +2 -8
  46. data/lib/rspec/matchers/built_in/change.rb +1 -39
  47. data/lib/rspec/matchers/built_in/has.rb +7 -40
  48. data/lib/rspec/matchers/built_in/include.rb +1 -1
  49. data/lib/rspec/matchers/built_in/match_array.rb +1 -1
  50. data/lib/rspec/matchers/built_in/raise_error.rb +44 -23
  51. data/lib/rspec/matchers/built_in/respond_to.rb +1 -7
  52. data/lib/rspec/matchers/built_in/satisfy.rb +1 -7
  53. data/lib/rspec/matchers/built_in/throw_symbol.rb +2 -10
  54. data/lib/rspec/matchers/built_in/yield.rb +4 -25
  55. data/lib/rspec/matchers/compatibility.rb +2 -2
  56. data/lib/rspec/{expectations → matchers}/configuration.rb +9 -6
  57. data/lib/rspec/matchers/dsl.rb +2 -4
  58. data/lib/rspec/matchers/matcher.rb +163 -283
  59. data/lib/rspec/matchers/operator_matcher.rb +57 -71
  60. data/lib/rspec/matchers/pretty.rb +0 -4
  61. data/lib/rspec/matchers/test_unit_integration.rb +5 -22
  62. data/spec/rspec/expectations/expectation_target_spec.rb +0 -62
  63. data/spec/rspec/expectations/extensions/kernel_spec.rb +0 -4
  64. data/spec/rspec/expectations_spec.rb +2 -43
  65. data/spec/rspec/matchers/base_matcher_spec.rb +12 -27
  66. data/spec/rspec/matchers/be_spec.rb +2 -71
  67. data/spec/rspec/matchers/change_spec.rb +1 -76
  68. data/spec/rspec/{expectations → matchers}/configuration_spec.rb +41 -21
  69. data/spec/rspec/matchers/description_generation_spec.rb +2 -21
  70. data/spec/rspec/matchers/equal_spec.rb +0 -26
  71. data/spec/rspec/matchers/has_spec.rb +0 -24
  72. data/spec/rspec/matchers/match_array_spec.rb +0 -13
  73. data/spec/rspec/matchers/matcher_spec.rb +325 -279
  74. data/spec/rspec/matchers/matchers_spec.rb +36 -0
  75. data/spec/rspec/matchers/operator_matcher_spec.rb +8 -27
  76. data/spec/rspec/matchers/raise_error_spec.rb +65 -209
  77. data/spec/rspec/matchers/yield_spec.rb +32 -9
  78. data/spec/spec_helper.rb +21 -6
  79. data/spec/support/classes.rb +7 -7
  80. data/spec/support/in_sub_process.rb +7 -8
  81. data/spec/support/shared_examples.rb +0 -42
  82. metadata +113 -84
  83. metadata.gz.sig +4 -0
  84. data/features/built_in_matchers/have.feature +0 -109
  85. data/features/built_in_matchers/operators.feature +0 -227
  86. data/lib/rspec/expectations/caller_filter.rb +0 -60
  87. data/lib/rspec/expectations/deprecation.rb +0 -27
  88. data/lib/rspec/expectations/extensions/array.rb +0 -9
  89. data/lib/rspec/matchers/be_close.rb +0 -12
  90. data/lib/rspec/matchers/built_in/have.rb +0 -273
  91. data/lib/rspec/matchers/differentiate_block_method_types.rb +0 -55
  92. data/lib/rspec/matchers/extensions/instance_eval_with_args.rb +0 -39
  93. data/lib/rspec/matchers/match_aliases.rb +0 -22
  94. data/spec/rspec/matchers/be_close_spec.rb +0 -25
  95. data/spec/rspec/matchers/differentiate_block_method_types_spec.rb +0 -39
  96. data/spec/rspec/matchers/have_spec.rb +0 -853
  97. data/spec/rspec/matchers/pretty_spec.rb +0 -23
  98. data/spec/support/helper_methods.rb +0 -42
@@ -23,7 +23,7 @@ Note: You can also use `expect(..).to_not` instead of `expect(..).not_to`.
23
23
 
24
24
  ## What is a matcher?
25
25
 
26
- A matcher is any object that responds to the following methods:
26
+ A Matcher is any object that responds to the following methods:
27
27
 
28
28
  matches?(actual)
29
29
  failure_message_for_should
@@ -33,7 +33,6 @@ These methods are also part of the matcher protocol, but are optional:
33
33
  does_not_match?(actual)
34
34
  failure_message_for_should_not
35
35
  description
36
- supports_block_expectations?
37
36
 
38
37
  RSpec ships with a number of built-in matchers and a DSL for writing custom
39
38
  matchers.
@@ -77,6 +77,7 @@ e.g.
77
77
  ## Collection membership
78
78
 
79
79
  expect(actual).to include(expected)
80
+ expect(array).to match_array(expected)
80
81
 
81
82
  ### Examples
82
83
 
@@ -84,6 +85,8 @@ e.g.
84
85
  expect([1,2,3]).to include(1, 2)
85
86
  expect(:a => 'b').to include(:a => 'b')
86
87
  expect("this string").to include("is str")
88
+ expect([1,2,3]).to match_array([1,2,3])
89
+ expect([1,2,3]).to match_array([3,2,1])
87
90
 
88
91
  ## Ranges (1.9 only)
89
92
 
@@ -3,28 +3,28 @@ Feature: "be" matchers
3
3
  There are several related "be" matchers:
4
4
 
5
5
  ```ruby
6
- obj.should be_truthy # passes if obj is truthy (not nil or false)
7
- obj.should be_falsey # passes if obj is falsy (nil or false)
8
- obj.should be_nil # passes if obj is nil
9
- obj.should be # passes if obj is truthy (not nil or false)
6
+ expect(obj).to be_truthy # passes if obj is truthy (not nil or false)
7
+ expect(obj).to be_falsey # passes if obj is falsy (nil or false)
8
+ expect(obj).to be_nil # passes if obj is nil
9
+ expect(obj).to be # passes if obj is truthy (not nil or false)
10
10
  ```
11
11
 
12
12
  Scenario: be_truthy matcher
13
13
  Given a file named "be_truthy_spec.rb" with:
14
14
  """ruby
15
15
  describe "be_truthy matcher" do
16
- specify { true.should be_truthy }
17
- specify { 7.should be_truthy }
18
- specify { "foo".should be_truthy }
19
- specify { nil.should_not be_truthy }
20
- specify { false.should_not be_truthy }
16
+ specify { expect(true).to be_truthy }
17
+ specify { expect(7).to be_truthy }
18
+ specify { expect("foo").to be_truthy }
19
+ specify { expect(nil).not_to be_truthy }
20
+ specify { expect(false).not_to be_truthy }
21
21
 
22
22
  # deliberate failures
23
- specify { true.should_not be_truthy }
24
- specify { 7.should_not be_truthy }
25
- specify { "foo".should_not be_truthy }
26
- specify { nil.should be_truthy }
27
- specify { false.should be_truthy }
23
+ specify { expect(true).not_to be_truthy }
24
+ specify { expect(7).not_to be_truthy }
25
+ specify { expect("foo").not_to be_truthy }
26
+ specify { expect(nil).to be_truthy }
27
+ specify { expect(false).to be_truthy }
28
28
  end
29
29
  """
30
30
  When I run `rspec be_truthy_spec.rb`
@@ -59,18 +59,18 @@ Feature: "be" matchers
59
59
  Given a file named "be_falsey_spec.rb" with:
60
60
  """ruby
61
61
  describe "be_falsey matcher" do
62
- specify { nil.should be_falsey }
63
- specify { false.should be_falsey }
64
- specify { true.should_not be_falsey }
65
- specify { 7.should_not be_falsey }
66
- specify { "foo".should_not be_falsey }
62
+ specify { expect(nil).to be_falsey }
63
+ specify { expect(false).to be_falsey }
64
+ specify { expect(true).not_to be_falsey }
65
+ specify { expect(7).not_to be_falsey }
66
+ specify { expect("foo").not_to be_falsey }
67
67
 
68
68
  # deliberate failures
69
- specify { nil.should_not be_falsey }
70
- specify { false.should_not be_falsey }
71
- specify { true.should be_falsey }
72
- specify { 7.should be_falsey }
73
- specify { "foo".should be_falsey }
69
+ specify { expect(nil).not_to be_falsey }
70
+ specify { expect(false).not_to be_falsey }
71
+ specify { expect(true).to be_falsey }
72
+ specify { expect(7).to be_falsey }
73
+ specify { expect("foo").to be_falsey }
74
74
  end
75
75
  """
76
76
  When I run `rspec be_falsey_spec.rb`
@@ -105,18 +105,18 @@ Feature: "be" matchers
105
105
  Given a file named "be_nil_spec.rb" with:
106
106
  """ruby
107
107
  describe "be_nil matcher" do
108
- specify { nil.should be_nil }
109
- specify { false.should_not be_nil }
110
- specify { true.should_not be_nil }
111
- specify { 7.should_not be_nil }
112
- specify { "foo".should_not be_nil }
108
+ specify { expect(nil).to be_nil }
109
+ specify { expect(false).not_to be_nil }
110
+ specify { expect(true).not_to be_nil }
111
+ specify { expect(7).not_to be_nil }
112
+ specify { expect("foo").not_to be_nil }
113
113
 
114
114
  # deliberate failures
115
- specify { nil.should_not be_nil }
116
- specify { false.should be_nil }
117
- specify { true.should be_nil }
118
- specify { 7.should be_nil }
119
- specify { "foo".should be_nil }
115
+ specify { expect(nil).not_to be_nil }
116
+ specify { expect(false).to be_nil }
117
+ specify { expect(true).to be_nil }
118
+ specify { expect(7).to be_nil }
119
+ specify { expect("foo").to be_nil }
120
120
  end
121
121
  """
122
122
  When I run `rspec be_nil_spec.rb`
@@ -151,18 +151,18 @@ Feature: "be" matchers
151
151
  Given a file named "be_spec.rb" with:
152
152
  """ruby
153
153
  describe "be_matcher" do
154
- specify { true.should be }
155
- specify { 7.should be }
156
- specify { "foo".should be }
157
- specify { nil.should_not be }
158
- specify { false.should_not be }
154
+ specify { expect(true).to be }
155
+ specify { expect(7).to be }
156
+ specify { expect("foo").to be }
157
+ specify { expect(nil).not_to be }
158
+ specify { expect(false).not_to be }
159
159
 
160
160
  # deliberate failures
161
- specify { true.should_not be }
162
- specify { 7.should_not be }
163
- specify { "foo".should_not be }
164
- specify { nil.should be }
165
- specify { false.should be }
161
+ specify { expect(true).not_to be }
162
+ specify { expect(7).not_to be }
163
+ specify { expect("foo").not_to be }
164
+ specify { expect(nil).to be }
165
+ specify { expect(false).to be }
166
166
  end
167
167
  """
168
168
  When I run `rspec be_spec.rb`
@@ -14,7 +14,7 @@ Feature: be_within matcher
14
14
  is within a delta of your expected value:
15
15
 
16
16
  ```ruby
17
- area_of_circle.should be_within(0.1).of(28.3)
17
+ expect(area_of_circle).to be_within(0.1).of(28.3)
18
18
  ```
19
19
 
20
20
  Note that the difference between the actual and expected values must be
@@ -0,0 +1,97 @@
1
+ Feature: comparsion matchers
2
+
3
+ RSpec provides a number of matchers that are based on Ruby's built-in
4
+ operators. These can be used for generalized comparsion of values. E.g.
5
+
6
+ ```ruby
7
+ expect(9).to be > 6
8
+ expect(3).to be <= 3
9
+ expect(1).to be < 6
10
+ ```
11
+
12
+
13
+ Scenario: numeric operator matchers
14
+ Given a file named "numeric_operator_matchers_spec.rb" with:
15
+ """ruby
16
+ describe do
17
+ example { expect(18).to be < 20 }
18
+ example { expect(18).to be > 15 }
19
+ example { expect(18).to be <= 19 }
20
+ example { expect(18).to be >= 17 }
21
+
22
+ # deliberate failures
23
+ example { expect(18).to be < 15 }
24
+ example { expect(18).to be > 20 }
25
+ example { expect(18).to be <= 17 }
26
+ example { expect(18).to be >= 19 }
27
+ end
28
+ """
29
+ When I run `rspec numeric_operator_matchers_spec.rb`
30
+ Then the output should contain "8 examples, 4 failures"
31
+ And the output should contain:
32
+ """
33
+ Failure/Error: example { expect(18).to be < 15 }
34
+ expected: < 15
35
+ got: 18
36
+ """
37
+ And the output should contain:
38
+ """
39
+ Failure/Error: example { expect(18).to be > 20 }
40
+ expected: > 20
41
+ got: 18
42
+ """
43
+ And the output should contain:
44
+ """
45
+ Failure/Error: example { expect(18).to be <= 17 }
46
+ expected: <= 17
47
+ got: 18
48
+ """
49
+ And the output should contain:
50
+ """
51
+ Failure/Error: example { expect(18).to be >= 19 }
52
+ expected: >= 19
53
+ got: 18
54
+ """
55
+
56
+ Scenario: string operator matchers
57
+ Given a file named "string_operator_matchers_spec.rb" with:
58
+ """ruby
59
+ describe do
60
+ example { expect("Strawberry").to be < "Tomato" }
61
+ example { expect("Strawberry").to be > "Apple" }
62
+ example { expect("Strawberry").to be <= "Turnip" }
63
+ example { expect("Strawberry").to be >= "Banana" }
64
+
65
+ # deliberate failures
66
+ example { expect("Strawberry").to be < "Cranberry" }
67
+ example { expect("Strawberry").to be > "Zuchini" }
68
+ example { expect("Strawberry").to be <= "Potato" }
69
+ example { expect("Strawberry").to be >= "Tomato" }
70
+ end
71
+ """
72
+ When I run `rspec string_operator_matchers_spec.rb`
73
+ Then the output should contain "8 examples, 4 failures"
74
+ And the output should contain:
75
+ """
76
+ Failure/Error: example { expect("Strawberry").to be < "Cranberry" }
77
+ expected: < "Cranberry"
78
+ got: "Strawberry"
79
+ """
80
+ And the output should contain:
81
+ """
82
+ Failure/Error: example { expect("Strawberry").to be > "Zuchini" }
83
+ expected: > "Zuchini"
84
+ got: "Strawberry"
85
+ """
86
+ And the output should contain:
87
+ """
88
+ Failure/Error: example { expect("Strawberry").to be <= "Potato" }
89
+ expected: <= "Potato"
90
+ got: "Strawberry"
91
+ """
92
+ And the output should contain:
93
+ """
94
+ Failure/Error: example { expect("Strawberry").to be >= "Tomato" }
95
+ expected: >= "Tomato"
96
+ got: "Strawberry"
97
+ """
@@ -6,9 +6,9 @@ Feature: cover matcher
6
6
  as a Range):
7
7
 
8
8
  ```ruby
9
- (1..10).should cover(5)
10
- (1..10).should cover(4, 6)
11
- (1..10).should_not cover(11)
9
+ expect(1..10).to cover(5)
10
+ expect(1..10).to cover(4, 6)
11
+ expect(1..10).not_to cover(11)
12
12
  ```
13
13
 
14
14
  Scenario: range usage
@@ -4,9 +4,9 @@ Feature: end_with matcher
4
4
  expected characters or elements.
5
5
 
6
6
  ```ruby
7
- "this string".should end_with "string"
8
- "this string".should_not end_with "stringy"
9
- [0, 1, 2].should end_with 1, 2
7
+ expect("this string").to end_with "string"
8
+ expect("this string").not_to end_with "stringy"
9
+ expect([0, 1, 2]).to end_with 1, 2
10
10
  ```
11
11
 
12
12
  Scenario: string usage
@@ -13,37 +13,34 @@ Feature: equality matchers
13
13
  rspec-expectations ships with matchers that align with each of these methods:
14
14
 
15
15
  ```ruby
16
- a.should equal(b) # passes if a.equal?(b)
17
- a.should eql(b) # passes if a.eql?(b)
18
- a.should == b # passes if a == b
16
+ expect(a).to equal(b) # passes if a.equal?(b)
17
+ expect(a).to eql(b) # passes if a.eql?(b)
18
+ expect(a).to be == b # passes if a == b
19
19
  ```
20
20
 
21
21
  It also ships with two matchers that have more of a DSL feel to them:
22
22
 
23
23
  ```ruby
24
- a.should be(b) # passes if a.equal?(b)
25
- a.should eq(b) # passes if a == b
24
+ expect(a).to be(b) # passes if a.equal?(b)
25
+ expect(a).to eq(b) # passes if a == b
26
26
  ```
27
27
 
28
- These are a useful pair if you wish to avoid the warning that Ruby emits on
29
- `a.should == b`
30
-
31
28
  Scenario: compare using eq (==)
32
29
  Given a file named "compare_using_eq.rb" with:
33
30
  """ruby
34
31
  describe "a string" do
35
32
  it "is equal to another string of the same value" do
36
- "this string".should eq("this string")
33
+ expect("this string").to eq("this string")
37
34
  end
38
35
 
39
36
  it "is not equal to another string of a different value" do
40
- "this string".should_not eq("a different string")
37
+ expect("this string").not_to eq("a different string")
41
38
  end
42
39
  end
43
40
 
44
41
  describe "an integer" do
45
42
  it "is equal to a float of the same value" do
46
- 5.should eq(5.0)
43
+ expect(5).to eq(5.0)
47
44
  end
48
45
  end
49
46
  """
@@ -55,17 +52,17 @@ Feature: equality matchers
55
52
  """ruby
56
53
  describe "a string" do
57
54
  it "is equal to another string of the same value" do
58
- "this string".should == "this string"
55
+ expect("this string").to be == "this string"
59
56
  end
60
57
 
61
58
  it "is not equal to another string of a different value" do
62
- "this string".should_not == "a different string"
59
+ expect("this string").not_to be == "a different string"
63
60
  end
64
61
  end
65
62
 
66
63
  describe "an integer" do
67
64
  it "is equal to a float of the same value" do
68
- 5.should == 5.0
65
+ expect(5).to be == 5.0
69
66
  end
70
67
  end
71
68
  """
@@ -77,15 +74,15 @@ Feature: equality matchers
77
74
  """ruby
78
75
  describe "an integer" do
79
76
  it "is equal to another integer of the same value" do
80
- 5.should eql(5)
77
+ expect(5).to eql(5)
81
78
  end
82
79
 
83
80
  it "is not equal to another integer of a different value" do
84
- 5.should_not eql(6)
81
+ expect(5).not_to eql(6)
85
82
  end
86
83
 
87
84
  it "is not equal to a float of the same value" do
88
- 5.should_not eql(5.0)
85
+ expect(5).not_to eql(5.0)
89
86
  end
90
87
 
91
88
  end
@@ -99,15 +96,15 @@ Feature: equality matchers
99
96
  describe "a string" do
100
97
  it "is equal to itself" do
101
98
  string = "this string"
102
- string.should equal(string)
99
+ expect(string).to equal(string)
103
100
  end
104
101
 
105
102
  it "is not equal to another string of the same value" do
106
- "this string".should_not equal("this string")
103
+ expect("this string").not_to equal("this string")
107
104
  end
108
105
 
109
106
  it "is not equal to another string of a different value" do
110
- "this string".should_not equal("a different string")
107
+ expect("this string").not_to equal("a different string")
111
108
  end
112
109
 
113
110
  end
@@ -121,15 +118,15 @@ Feature: equality matchers
121
118
  describe "a string" do
122
119
  it "is equal to itself" do
123
120
  string = "this string"
124
- string.should be(string)
121
+ expect(string).to be(string)
125
122
  end
126
123
 
127
124
  it "is not equal to another string of the same value" do
128
- "this string".should_not be("this string")
125
+ expect("this string").not_to be("this string")
129
126
  end
130
127
 
131
128
  it "is not equal to another string of a different value" do
132
- "this string".should_not be("a different string")
129
+ expect("this string").not_to be("a different string")
133
130
  end
134
131
 
135
132
  end
@@ -4,7 +4,7 @@ Feature: exist matcher
4
4
  (as indicated by #exist? or #exists?):
5
5
 
6
6
  ```ruby
7
- obj.should exist # passes if obj.exist? or obj.exists?
7
+ expect(obj).to exist # passes if obj.exist? or obj.exists?
8
8
  ```
9
9
 
10
10
  Scenario: basic usage
@@ -28,14 +28,14 @@ Feature: exist matcher
28
28
 
29
29
  describe "Earth" do
30
30
  let(:earth) { Planet.new("Earth") }
31
- specify { earth.should exist }
32
- specify { earth.should_not exist } # deliberate failure
31
+ specify { expect(earth).to exist }
32
+ specify { expect(earth).not_to exist } # deliberate failure
33
33
  end
34
34
 
35
35
  describe "Tatooine" do
36
36
  let(:tatooine) { Planet.new("Tatooine") }
37
- it { tatooine.should exist } # deliberate failure
38
- it { tatooine.should_not exist }
37
+ specify { expect(tatooine).to exist } # deliberate failure
38
+ specify { expect(tatooine).not_to exist }
39
39
  end
40
40
  """
41
41
  When I run `rspec exist_matcher_spec.rb`
@@ -78,6 +78,19 @@ Feature: raise_error matcher
78
78
  When I run `rspec example_spec.rb`
79
79
  Then the example should pass
80
80
 
81
+ Scenario: matching message with `with_message`
82
+ Given a file named "example_spec.rb" with:
83
+ """ruby
84
+ describe "matching error message with regex" do
85
+ it "matches the error message" do
86
+ expect { raise StandardError, "my message" }.
87
+ to raise_error.with_message(/my mess/)
88
+ end
89
+ end
90
+ """
91
+ When I run `rspec example_spec.rb`
92
+ Then the example should pass
93
+
81
94
  Scenario: match type + message with string
82
95
  Given a file named "example_spec.rb" with:
83
96
  """ruby
@@ -110,7 +123,7 @@ Feature: raise_error matcher
110
123
  describe "#foo" do
111
124
  it "raises NameError" do
112
125
  expect { Object.new.foo }.to raise_error { |error|
113
- error.should be_a(NameError)
126
+ expect(error).to be_a(NameError)
114
127
  }
115
128
  end
116
129
  end
@@ -118,19 +131,6 @@ Feature: raise_error matcher
118
131
  When I run `rspec example_spec`
119
132
  Then the example should pass
120
133
 
121
- Scenario: expect no occurence of a specific error
122
- Given a file named "example_spec" with:
123
- """
124
- describe Object, "#public_instance_methods" do
125
- it "does not raise" do
126
- expect { Object.public_instance_methods }.
127
- not_to raise_error(NameError)
128
- end
129
- end
130
- """
131
- When I run `rspec example_spec`
132
- Then the example should pass
133
-
134
134
  Scenario: expect no error at all
135
135
  Given a file named "example_spec" with:
136
136
  """