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
@@ -5,26 +5,26 @@ Feature: include matcher
5
5
  as a string or array):
6
6
 
7
7
  ```ruby
8
- "a string".should include("a")
9
- "a string".should include("str")
10
- "a string".should include("str", "g")
11
- "a string".should_not include("foo")
12
-
13
- [1, 2].should include(1)
14
- [1, 2].should include(1, 2)
15
- [1, 2].should_not include(17)
8
+ expect("a string").to include("a")
9
+ expect("a string").to include("str")
10
+ expect("a string").to include("str", "g")
11
+ expect("a string").not_to include("foo")
12
+
13
+ expect([1, 2]).to include(1)
14
+ expect([1, 2]).to include(1, 2)
15
+ expect([1, 2]).not_to include(17)
16
16
  ```
17
17
 
18
18
  The matcher also provides flexible handling for hashes:
19
19
 
20
20
  ```ruby
21
- {:a => 1, :b => 2}.should include(:a)
22
- {:a => 1, :b => 2}.should include(:a, :b)
23
- {:a => 1, :b => 2}.should include(:a => 1)
24
- {:a => 1, :b => 2}.should include(:b => 2, :a => 1)
25
- {:a => 1, :b => 2}.should_not include(:c)
26
- {:a => 1, :b => 2}.should_not include(:a => 2)
27
- {:a => 1, :b => 2}.should_not include(:c => 3)
21
+ expect(:a => 1, :b => 2).to include(:a)
22
+ expect(:a => 1, :b => 2).to include(:a, :b)
23
+ expect(:a => 1, :b => 2).to include(:a => 1)
24
+ expect(:a => 1, :b => 2).to include(:b => 2, :a => 1)
25
+ expect(:a => 1, :b => 2).not_to include(:c)
26
+ expect(:a => 1, :b => 2).not_to include(:a => 2)
27
+ expect(:a => 1, :b => 2).not_to include(:c => 3)
28
28
  ```
29
29
 
30
30
  Scenario: array usage
@@ -5,10 +5,10 @@ Feature: match matcher
5
5
  method.
6
6
 
7
7
  ```ruby
8
- "a string".should match(/str/) # passes
9
- "a string".should match(/foo/) # fails
10
- /foo/.should match("food") # passes
11
- /foo/.should match("drinks") # fails
8
+ expect("a string").to match(/str/) # passes
9
+ expect("a string").to match(/foo/) # fails
10
+ expect(/foo/).to match("food") # passes
11
+ expect(/foo/).to match("drinks") # fails
12
12
  ```
13
13
 
14
14
  This is equivalent to using the =~ matcher (see the operator matchers
@@ -49,4 +49,3 @@ Feature: match matcher
49
49
  | 4 examples, 2 failures |
50
50
  | expected /foo/ not to match "food" |
51
51
  | expected /foo/ to match "drinks" |
52
-
@@ -0,0 +1,37 @@
1
+ Feature: match_array matcher
2
+
3
+ The `match_array` matcher provides a way to test arrays against each other
4
+ in a way that disregards differences in the ordering between the actual
5
+ and expected array. For example:
6
+
7
+ ```ruby
8
+ expect([1, 2, 3]).to match_array [2, 3, 1] # pass
9
+ expect([:a, :c, :b]).to match_array [:a, :c] # fail
10
+ ```
11
+
12
+ Scenario: array operator matchers
13
+ Given a file named "array_operator_matchers_spec.rb" with:
14
+ """ruby
15
+ describe do
16
+ example { expect([1, 2, 3]).to match_array [1, 2, 3] }
17
+ example { expect([1, 2, 3]).to match_array [1, 3, 2] }
18
+ example { expect([1, 2, 3]).to match_array [2, 1, 3] }
19
+ example { expect([1, 2, 3]).to match_array [2, 3, 1] }
20
+ example { expect([1, 2, 3]).to match_array [3, 1, 2] }
21
+ example { expect([1, 2, 3]).to match_array [3, 2, 1] }
22
+
23
+ # deliberate failures
24
+ example { expect([1, 2, 3]).to match_array [1, 2, 1] }
25
+ end
26
+ """
27
+ When I run `rspec array_operator_matchers_spec.rb`
28
+ Then the output should contain "7 examples, 1 failure"
29
+ And the output should contain:
30
+ """
31
+ Failure/Error: example { expect([1, 2, 3]).to match_array [1, 2, 1] }
32
+ expected collection contained: [1, 1, 2]
33
+ actual collection contained: [1, 2, 3]
34
+ the missing elements were: [1]
35
+ the extra elements were: [3]
36
+ """
37
+
@@ -14,7 +14,7 @@ Feature: predicate matchers
14
14
  You could use a basic equality matcher to set expectations on these:
15
15
 
16
16
  ```ruby
17
- 7.zero?.should == true # fails with "expected true, got false (using ==)"
17
+ expect(7.zero?).to eq true # fails with "expected true, got false (using ==)"
18
18
  ```
19
19
 
20
20
  ...but RSpec provides dynamic predicate matchers that are more readable and
@@ -24,9 +24,9 @@ Feature: predicate matchers
24
24
  prefix the method with `be_` and remove the question mark. Examples:
25
25
 
26
26
  ```ruby
27
- 7.should_not be_zero # calls 7.zero?
28
- [].should be_empty # calls [].empty?
29
- x.should be_multiple_of(3) # calls x.multiple_of?(3)
27
+ expect(7).not_to be_zero # calls 7.zero?
28
+ expect([]).to be_empty # calls [].empty?
29
+ expect(x).to be_multiple_of(3) # calls x.multiple_of?(3)
30
30
  ```
31
31
 
32
32
  Alternately, for a predicate method that begins with `has_` like
@@ -34,14 +34,18 @@ Feature: predicate matchers
34
34
  makes no sense.
35
35
 
36
36
  ```ruby
37
- hash.should have_key(:foo) # calls hash.has_key?(:foo)
38
- array.should_not have_odd_values # calls array.has_odd_values?
37
+ expect(hash).to have_key(:foo) # calls hash.has_key?(:foo)
38
+ expect(array).not_to have_odd_values # calls array.has_odd_values?
39
39
  ```
40
40
 
41
41
  In either case, RSpec provides nice, clear error messages, such as:
42
42
 
43
43
  `expected zero? to return true, got false`
44
44
 
45
+ Calling private methods will also fail:
46
+
47
+ `expected private_method? to return true but it's a private method`
48
+
45
49
  Any arguments passed to the matcher will be passed on to the predicate method.
46
50
 
47
51
  Scenario: should be_zero (based on Fixnum#zero?)
@@ -135,3 +139,23 @@ Feature: predicate matchers
135
139
  And the output should contain "expected multiple_of?(4) to return false, got true"
136
140
  And the output should contain "expected multiple_of?(5) to return true, got false"
137
141
 
142
+ Scenario: calling private method causes error
143
+ Given a file named "attempting_to_match_private_method_spec.rb" with:
144
+ """ruby
145
+ class WithPrivateMethods
146
+ def secret?
147
+ true
148
+ end
149
+ private :secret?
150
+ end
151
+
152
+ describe 'private methods' do
153
+ subject { WithPrivateMethods.new }
154
+
155
+ # deliberate failure
156
+ it { should be_secret }
157
+ end
158
+ """
159
+ When I run `rspec attempting_to_match_private_method_spec.rb`
160
+ Then the output should contain "1 example, 1 failure"
161
+ And the output should contain "expectation set on private method `secret?`"
@@ -4,22 +4,22 @@ Feature: respond_to matcher
4
4
  its most basic form:
5
5
 
6
6
  ```ruby
7
- obj.should respond_to(:foo) # pass if obj.respond_to?(:foo)
7
+ expect(obj).to respond_to(:foo) # pass if obj.respond_to?(:foo)
8
8
  ```
9
9
 
10
10
  You can specify that an object responds to multiple messages in a single
11
11
  statement with multiple arguments passed to the matcher:
12
12
 
13
13
  ```ruby
14
- obj.should respond_to(:foo, :bar) # passes if obj.respond_to?(:foo) && obj.respond_to?(:bar)
14
+ expect(obj).to respond_to(:foo, :bar) # passes if obj.respond_to?(:foo) && obj.respond_to?(:bar)
15
15
  ```
16
16
 
17
17
  If the number of arguments accepted by the method is important to you,
18
18
  you can specify that as well:
19
19
 
20
20
  ```ruby
21
- obj.should respond_to(:foo).with(1).argument
22
- obj.should respond_to(:bar).with(2).arguments
21
+ expect(obj).to respond_to(:foo).with(1).argument
22
+ expect(obj).to respond_to(:bar).with(2).arguments
23
23
  ```
24
24
 
25
25
  Note that this matcher relies entirely upon #respond_to?. If an object
@@ -4,8 +4,8 @@ Feature: satisfy matcher
4
4
  you want to specify. It passes if the block you provide returns true:
5
5
 
6
6
  ```ruby
7
- 10.should satisfy { |v| v % 5 == 0 }
8
- 7.should_not satisfy { |v| v % 5 == 0 }
7
+ expect(10).to satisfy { |v| v % 5 == 0 }
8
+ expect(7).not_to satisfy { |v| v % 5 == 0 }
9
9
  ```
10
10
 
11
11
  This flexibility comes at a cost, however: the failure message
@@ -4,9 +4,9 @@ Feature: start_with matcher
4
4
  the expected characters or elements.
5
5
 
6
6
  ```ruby
7
- "this string".should start_with("this")
8
- "this string".should_not start_with("that")
9
- [0,1,2].should start_with(0, 1)
7
+ expect("this string").to start_with("this")
8
+ expect("this string").not_to start_with("that")
9
+ expect([0,1,2]).to start_with(0, 1)
10
10
  ```
11
11
 
12
12
  Scenario: with a string
@@ -2,19 +2,19 @@ Feature: specify types of objects
2
2
 
3
3
  rspec-expectations includes two matchers to specify types of objects:
4
4
 
5
- * `obj.should be_kind_of(type)`: calls `obj.kind_of?(type)`, which returns
5
+ * `expect(obj).to be_kind_of(type)`: calls `obj.kind_of?(type)`, which returns
6
6
  true if type is in obj's class hierarchy or is a module and is
7
7
  included in a class in obj's class hierarchy.
8
- * `obj.should be_instance_of(type)`: calls `obj.instance_of?(type)`, which
8
+ * `expect(obj).to be_instance_of(type)`: calls `obj.instance_of?(type)`, which
9
9
  returns true if and only if type if obj's class.
10
10
 
11
11
  Both of these matchers have aliases:
12
12
 
13
13
  ```ruby
14
- obj.should be_a_kind_of(type) # same as obj.should be_kind_of(type)
15
- obj.should be_a(type) # same as obj.should be_kind_of(type)
16
- obj.should be_an(type) # same as obj.should be_kind_of(type)
17
- obj.should be_an_instance_of(type) # same as obj.should be_instance_of(type)
14
+ expect(obj).to be_a_kind_of(type) # same as expect(obj).to be_kind_of(type)
15
+ expect(obj).to be_a(type) # same as expect(obj).to be_kind_of(type)
16
+ expect(obj).to be_an(type) # same as expect(obj).to be_kind_of(type)
17
+ expect(obj).to be_an_instance_of(type) # same as expect(obj).to be_instance_of(type)
18
18
  ```
19
19
 
20
20
  Scenario: be_(a_)kind_of matcher
@@ -24,7 +24,7 @@ Feature: access running example
24
24
  end
25
25
 
26
26
  it "does something" do
27
- "foo".should bar
27
+ expect("foo").to bar
28
28
  end
29
29
  end
30
30
  """
@@ -42,12 +42,12 @@ Feature: access running example
42
42
 
43
43
  describe "something" do
44
44
  it "does something" do
45
- "foo".should bar
45
+ expect("foo").to bar
46
46
  end
47
47
  end
48
48
  """
49
49
  When I run `rspec ./example_spec.rb`
50
50
  Then the output should contain "1 example, 1 failure"
51
51
  And the output should match /undefined.*method/
52
- And the output should contain "RSpec::Matchers::DSL::Matcher"
52
+ And the output should contain "RSpec::Matchers::DSL::Matcher bar"
53
53
  And the output should not contain "ExampleGroup"
@@ -183,7 +183,7 @@ Feature: define matcher
183
183
 
184
184
  describe "these two arrays" do
185
185
  specify "should be similar" do
186
- [1,2,3].should have_same_elements_as([2,3,1])
186
+ expect([1,2,3]).to have_same_elements_as([2,3,1])
187
187
  end
188
188
  end
189
189
  """
@@ -207,14 +207,14 @@ Feature: define matcher
207
207
  describe "group with MyHelpers" do
208
208
  include MyHelpers
209
209
  it "has access to the defined matcher" do
210
- 5.should be_just_like(5)
210
+ expect(5).to be_just_like(5)
211
211
  end
212
212
  end
213
213
 
214
214
  describe "group without MyHelpers" do
215
215
  it "does not have access to the defined matcher" do
216
216
  expect do
217
- 5.should be_just_like(5)
217
+ expect(5).to be_just_like(5)
218
218
  end.to raise_exception
219
219
  end
220
220
  end
@@ -234,12 +234,12 @@ Feature: define matcher
234
234
  end
235
235
 
236
236
  it "has access to the defined matcher" do
237
- 5.should be_just_like(5)
237
+ expect(5).to be_just_like(5)
238
238
  end
239
239
 
240
240
  describe "nested group" do
241
241
  it "has access to the defined matcher" do
242
- 5.should be_just_like(5)
242
+ expect(5).to be_just_like(5)
243
243
  end
244
244
  end
245
245
 
@@ -248,7 +248,7 @@ Feature: define matcher
248
248
  describe "group without matcher" do
249
249
  it "does not have access to the defined matcher" do
250
250
  expect do
251
- 5.should be_just_like(5)
251
+ expect(5).to be_just_like(5)
252
252
  end.to raise_exception
253
253
  end
254
254
  end
@@ -338,31 +338,3 @@ Feature: define matcher
338
338
  | 4 examples, 2 failures |
339
339
  | expected 9 to be a multiple of 2 |
340
340
  | expected 9 not to be a multiple of 3 |
341
-
342
- Scenario: matching against a regular expression
343
- Given a file named "regular_expression_matcher_spec.rb" with:
344
- """ruby
345
- # Due to Ruby's method dispatch mechanism, use the `#match_regex` alias
346
- # rather than the `#match` matcher when defining custom matchers via the
347
- # DSL.
348
-
349
- RSpec::Matchers.define :be_valid_us_zipcode do
350
- match do |actual|
351
- expect(actual).to match_regex(/\A\d{5}(-\d{4})?\z/)
352
- end
353
- end
354
-
355
- describe "30316" do
356
- it { should be_valid_us_zipcode }
357
- end
358
-
359
- describe "30316-0001" do
360
- it { should be_valid_us_zipcode }
361
- end
362
-
363
- describe "1000-61303" do
364
- it { should_not be_valid_us_zipcode }
365
- end
366
- """
367
- When I run `rspec regular_expression_matcher_spec.rb`
368
- Then the stdout should contain "3 examples, 0 failures"
@@ -23,11 +23,11 @@ Feature: define matcher outside rspec
23
23
  class TestMultiples < Test::Unit::TestCase
24
24
 
25
25
  def test_9_should_be_a_multiple_of_3
26
- 9.should be_a_multiple_of(3)
26
+ expect(9).to be_a_multiple_of(3)
27
27
  end
28
28
 
29
29
  def test_9_should_be_a_multiple_of_4
30
- 9.should be_a_multiple_of(4)
30
+ expect(9).to be_a_multiple_of(4)
31
31
  end
32
32
 
33
33
  end
@@ -2,7 +2,7 @@ Feature: define matcher with fluent interface
2
2
 
3
3
  Use the chain() method to define matchers with a fluent interface.
4
4
 
5
- Scenario: chained method with argumetn
5
+ Scenario: chained method with argument
6
6
  Given a file named "between_spec.rb" with:
7
7
  """ruby
8
8
  RSpec::Matchers.define :be_bigger_than do |first|
@@ -12,7 +12,24 @@ Feature: customized message
12
12
  it "is empty" do
13
13
  array = Array.new
14
14
  array << 1 # trigger a failure to demonstrate the message
15
- array.should be_empty, "expected empty array, got #{array.inspect}"
15
+ expect(array).to be_empty, "expected empty array, got #{array.inspect}"
16
+ end
17
+ end
18
+ end
19
+
20
+ """
21
+ When I run `rspec example_spec.rb --format documentation`
22
+ Then the output should contain "expected empty array, got [1]"
23
+
24
+ Scenario: customize failure message with a proc
25
+ Given a file named "example_spec.rb" with:
26
+ """ruby
27
+ describe Array do
28
+ context "when created with `new`" do
29
+ it "is empty" do
30
+ array = Array.new
31
+ array << 1 # trigger a failure to demonstrate the message
32
+ expect(array).to be_empty, lambda { "expected empty array, got #{array.inspect}" }
16
33
  end
17
34
  end
18
35
  end
@@ -17,7 +17,7 @@ Feature: diffing
17
17
  actual
18
18
  string
19
19
  ACTUAL
20
- actual.should eq(expected)
20
+ expect(actual).to eq(expected)
21
21
  end
22
22
  end
23
23
  """
@@ -65,7 +65,7 @@ Feature: diffing
65
65
  it "is like another string" do
66
66
  expected = "this string"
67
67
  actual = "that string"
68
- actual.should eq(expected)
68
+ expect(actual).to eq(expected)
69
69
  end
70
70
  end
71
71
  """
@@ -77,7 +77,7 @@ Feature: diffing
77
77
  """ruby
78
78
  describe "a number" do
79
79
  it "is like another number" do
80
- 1.should eq(2)
80
+ expect(1).to eq(2)
81
81
  end
82
82
  end
83
83
  """
@@ -9,11 +9,11 @@ Feature: implicit docstrings
9
9
  """ruby
10
10
  describe "Examples with no docstrings generate their own:" do
11
11
 
12
- specify { 3.should be < 5 }
12
+ specify { expect(3).to be < 5 }
13
13
 
14
- specify { [1,2,3].should include(2) }
14
+ specify { expect([1,2,3]).to include(2) }
15
15
 
16
- specify { [1,2,3].should respond_to(:size) }
16
+ specify { expect([1,2,3]).to respond_to(:size) }
17
17
 
18
18
  end
19
19
  """
@@ -29,17 +29,17 @@ Feature: implicit docstrings
29
29
  """ruby
30
30
  describe "Failing examples with no descriptions" do
31
31
 
32
- # description is auto-generated as "should equal(5)" based on the last #should
32
+ # description is auto-generated as "to equal(5)" based on the last #expect
33
33
  it do
34
- 3.should equal(2)
35
- 5.should equal(5)
34
+ expect(3).to equal(2)
35
+ expect(5).to equal(5)
36
36
  end
37
37
 
38
- it { 3.should be > 5 }
38
+ it { expect(3).to be > 5 }
39
39
 
40
- it { [1,2,3].should include(4) }
40
+ it { expect([1,2,3]).to include(4) }
41
41
 
42
- it { [1,2,3].should_not respond_to(:size) }
42
+ it { expect([1,2,3]).not_to respond_to(:size) }
43
43
 
44
44
  end
45
45
  """