rspec-expectations 3.1.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 55fe7e69aa2f95c64cc33b1805bbd01569c0c269
4
- data.tar.gz: 1315e9e9bb890c7088a2ba123fe0ad8af077f2a8
3
+ metadata.gz: a17c12beef7f8a1e2fa131987dbd3f487b9df046
4
+ data.tar.gz: 0854aa31f5d41a21d11f7cb33feccb38f19f76f6
5
5
  SHA512:
6
- metadata.gz: 20496ddf5da00c886e02c27353860d953803fe33d76603955c8398758a8f86d05e3a3245e460fca389dd82ba012ee609f8d7b2cf92166b4568e17ab98f4d769e
7
- data.tar.gz: 75767f0423ca2911f4161091aac4bc5b66e8b9deb01eb9490e00da0277ee036ab06be3d1f9f63930394fc46c426818227852f2f90a04c98288e7d69ca2ecad95
6
+ metadata.gz: 7952e648e91578f32c772b5f1d4679e06bbec42483a84b15c9e96828f4246a43f7e96a63d4bb7a50c0f809c6aa03a6df3a7439cc0815130518165b4e18cd2193
7
+ data.tar.gz: 50ca10401b8ead80b338c126b132381fd70df460c52a6d7df426f19020ac2fc5e423d7636456855099122be84df1e396a0a024e27849f8ac959becf7e82c29ba
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,48 @@
1
+ ### 3.2.0 / 2015-02-03
2
+ [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.2...v3.2.0)
3
+
4
+ Enhancements:
5
+
6
+ * Add `block_arg` method to custom matcher API, which allows you to
7
+ access the block passed to a custom matcher, if there is one.
8
+ (Mike Dalton, #645)
9
+ * Provide more detail in failure message of `yield_control` matcher.
10
+ (Jon Rowe, #650)
11
+ * Add a shorthand syntax for `chain` in the matcher DSL which assigns values
12
+ for use elsewhere, for example `chain :and_smaller_than, :small_value`
13
+ creates an `attr_reader` for `small_value` (Tom Stuart, #644)
14
+ * Provide a more helpful deprecation message when using the `should` syntax.
15
+ (Elia Schito, #663)
16
+ * Provide more detail in the `have_attributes` matcher failure message.
17
+ (Jon Rowe, #668)
18
+ * Make the `have_attributes` matcher diffable.
19
+ (Jon Rowe, Alexey Fedorov, #668)
20
+ * Add `output(...).to_std(out|err)_from_any_process` as alternatives
21
+ to `output(...).to_std(out|err)`. The latter doesn't work when a sub
22
+ process writes to the named stream but is much faster.
23
+ (Alex Genco, #700)
24
+ * Improve compound matchers (created by `and` and `or`) so that diffs
25
+ are included in failures when one or more of their matchers
26
+ are diffable. (Alexey Fedorov, #713)
27
+
28
+ Bug Fixes:
29
+
30
+ * Avoid calling `private_methods` from the `be` predicate matcher on
31
+ the target object if the object publicly responds to the predicate
32
+ method. This avoids a possible error that can occur if the object
33
+ raises errors from `private_methods` (which can happen with celluloid
34
+ objects). (@chapmajs, #670)
35
+ * Make `yield_control` (with no modifier) default to
36
+ `at_least(:once)` rather than raising a confusing error
37
+ when multiple yields are encountered.
38
+ (Myron Marston, #675)
39
+ * Fix "instance variable @color not initialized" warning when using
40
+ rspec-expectations outside of an rspec-core context. (Myron Marston, #689)
41
+ * Fix `start_with` and `end_with` to work properly when checking a
42
+ string against an array of strings. (Myron Marston, #690)
43
+ * Don't use internally delegated matchers when generating descriptions
44
+ for examples without doc strings. (Myron Marston, #692)
45
+
1
46
  ### 3.1.2 / 2014-09-26
2
47
  [Full Changelog](http://github.com/rspec/rspec-expectations/compare/v3.1.1...v3.1.2)
3
48
 
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RSpec Expectations [![Build Status](https://secure.travis-ci.org/rspec/rspec-expectations.png?branch=master)](http://travis-ci.org/rspec/rspec-expectations) [![Code Climate](https://codeclimate.com/github/rspec/rspec-expectations.png)](https://codeclimate.com/github/rspec/rspec-expectations)
1
+ # RSpec Expectations [![Build Status](https://secure.travis-ci.org/rspec/rspec-expectations.svg?branch=master)](http://travis-ci.org/rspec/rspec-expectations) [![Code Climate](https://codeclimate.com/github/rspec/rspec-expectations.svg)](https://codeclimate.com/github/rspec/rspec-expectations)
2
2
 
3
3
  RSpec::Expectations lets you express expected outcomes on an object in an
4
4
  example.
@@ -13,6 +13,15 @@ rspec-core and rspec-mocks):
13
13
 
14
14
  gem install rspec
15
15
 
16
+ Want to run against the `master` branch? You'll need to include the dependent
17
+ RSpec repos as well. Add the following to your `Gemfile`:
18
+
19
+ ```ruby
20
+ %w[rspec-core rspec-expectations rspec-mocks rspec-support].each do |lib|
21
+ gem lib, :git => "git://github.com/rspec/#{lib}.git", :branch => 'master'
22
+ end
23
+ ```
24
+
16
25
  If you want to use rspec-expectations with another tool, like Test::Unit,
17
26
  Minitest, or Cucumber, you can install it directly:
18
27
 
@@ -52,6 +61,7 @@ the example passes. If not, it fails with a message like:
52
61
  ```ruby
53
62
  expect(actual).to eq(expected) # passes if actual == expected
54
63
  expect(actual).to eql(expected) # passes if actual.eql?(expected)
64
+ expect(actual).not_to eql(not_expected) # passes if not(actual.eql?(expected))
55
65
  ```
56
66
 
57
67
  Note: The new `expect` syntax no longer supports the `==` matcher.
@@ -93,11 +103,12 @@ expect(actual).to be_a_kind_of(expected) # another alias
93
103
  ### Truthiness
94
104
 
95
105
  ```ruby
96
- expect(actual).to be_truthy # passes if actual is truthy (not nil or false)
97
- expect(actual).to be true # passes if actual == true
98
- expect(actual).to be_falsy # passes if actual is falsy (nil or false)
99
- expect(actual).to be false # passes if actual == false
100
- expect(actual).to be_nil # passes if actual is nil
106
+ expect(actual).to be_truthy # passes if actual is truthy (not nil or false)
107
+ expect(actual).to be true # passes if actual == true
108
+ expect(actual).to be_falsy # passes if actual is falsy (nil or false)
109
+ expect(actual).to be false # passes if actual == false
110
+ expect(actual).to be_nil # passes if actual is nil
111
+ expect(actual).to_not be_nil # passes if actual is not nil
101
112
  ```
102
113
 
103
114
  ### Expecting errors
@@ -63,6 +63,7 @@ module RSpec
63
63
  # the user sets an expectation, it can't be caught in their
64
64
  # code by a bare `rescue`.
65
65
  # @api public
66
- ExpectationNotMetError = Class.new(::Exception)
66
+ class ExpectationNotMetError < ::Exception
67
+ end
67
68
  end
68
69
  end
@@ -71,7 +71,7 @@ module RSpec
71
71
  # Delegates to rspec-core's color option if rspec-core
72
72
  # is loaded; otherwise you can set it here.
73
73
  def color?
74
- @color
74
+ defined?(@color) && @color
75
75
  end
76
76
  end
77
77
 
@@ -24,8 +24,7 @@ module RSpec
24
24
  "appropriate failure_message[_when_negated] method to return a string?"
25
25
  end
26
26
 
27
- diff = differ.diff(actual, expected)
28
- message = "#{message}\nDiff:#{diff}" unless diff.empty?
27
+ message = ::RSpec::Matchers::ExpectedsForMultipleDiffs.from(expected).message_with_diff(message, differ, actual)
29
28
 
30
29
  raise RSpec::Expectations::ExpectationNotMetError, message
31
30
  end
@@ -21,10 +21,13 @@ module RSpec
21
21
  LegacyMatcherAdapter::RSpec1.wrap(matcher) || matcher
22
22
  end
23
23
 
24
- def self.setup(handler, matcher, message)
24
+ def self.with_matcher(handler, matcher, message)
25
25
  check_message(message)
26
+ matcher = modern_matcher_from(matcher)
27
+ yield matcher
28
+ ensure
26
29
  ::RSpec::Matchers.last_expectation_handler = handler
27
- ::RSpec::Matchers.last_matcher = modern_matcher_from(matcher)
30
+ ::RSpec::Matchers.last_matcher = matcher
28
31
  end
29
32
 
30
33
  def self.handle_failure(matcher, message, failure_message_method)
@@ -42,10 +45,10 @@ module RSpec
42
45
  # @private
43
46
  class PositiveExpectationHandler
44
47
  def self.handle_matcher(actual, initial_matcher, message=nil, &block)
45
- matcher = ExpectationHelper.setup(self, initial_matcher, message)
46
-
47
- return ::RSpec::Matchers::BuiltIn::PositiveOperatorMatcher.new(actual) unless initial_matcher
48
- matcher.matches?(actual, &block) || ExpectationHelper.handle_failure(matcher, message, :failure_message)
48
+ ExpectationHelper.with_matcher(self, initial_matcher, message) do |matcher|
49
+ return ::RSpec::Matchers::BuiltIn::PositiveOperatorMatcher.new(actual) unless initial_matcher
50
+ matcher.matches?(actual, &block) || ExpectationHelper.handle_failure(matcher, message, :failure_message)
51
+ end
49
52
  end
50
53
 
51
54
  def self.verb
@@ -64,10 +67,10 @@ module RSpec
64
67
  # @private
65
68
  class NegativeExpectationHandler
66
69
  def self.handle_matcher(actual, initial_matcher, message=nil, &block)
67
- matcher = ExpectationHelper.setup(self, initial_matcher, message)
68
-
69
- return ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(actual) unless initial_matcher
70
- !(does_not_match?(matcher, actual, &block) || ExpectationHelper.handle_failure(matcher, message, :failure_message_when_negated))
70
+ ExpectationHelper.with_matcher(self, initial_matcher, message) do |matcher|
71
+ return ::RSpec::Matchers::BuiltIn::NegativeOperatorMatcher.new(actual) unless initial_matcher
72
+ !(does_not_match?(matcher, actual, &block) || ExpectationHelper.handle_failure(matcher, message, :failure_message_when_negated))
73
+ end
71
74
  end
72
75
 
73
76
  def self.does_not_match?(matcher, actual, &block)
@@ -12,6 +12,7 @@ end
12
12
  module RSpec
13
13
  module Expectations
14
14
  remove_const :ExpectationNotMetError
15
+ # Exception raised when an expectation fails.
15
16
  ExpectationNotMetError = ::Minitest::Assertion
16
17
  end
17
18
  end
@@ -27,7 +27,7 @@ module RSpec
27
27
 
28
28
  RSpec.deprecate(
29
29
  "Using `#{method_name}` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax",
30
- :replacement => "the new `:expect` syntax or explicitly enable `:should`"
30
+ :replacement => "the new `:expect` syntax or explicitly enable `:should` with `config.expect_with(:rspec) { |c| c.syntax = :should }`"
31
31
  )
32
32
 
33
33
  @warn_about_should = false
@@ -2,7 +2,7 @@ module RSpec
2
2
  module Expectations
3
3
  # @private
4
4
  module Version
5
- STRING = '3.1.2'
5
+ STRING = '3.2.0'
6
6
  end
7
7
  end
8
8
  end
@@ -10,6 +10,7 @@ RSpec::Support.define_optimized_require_for_rspec(:matchers) { |f| require_relat
10
10
  dsl
11
11
  matcher_delegator
12
12
  aliased_matcher
13
+ expecteds_for_multiple_diffs
13
14
  ].each { |file| RSpec::Support.require_rspec_matchers(file) }
14
15
 
15
16
  # RSpec's top level namespace. All of rspec-expectations is contained
@@ -220,19 +221,16 @@ module RSpec
220
221
  # @param old_name [Symbol] the original name for the matcher
221
222
  # @param options [Hash] options for the aliased matcher
222
223
  # @option options [Class] :klass the ruby class to use as the decorator. (Not normally used).
223
- # @yield [String] optional block that, when given is used to define the overriden
224
- # description. The yielded arg is the original description. If no block is
225
- # provided, a default description override is used based on the old and
226
- # new names.
224
+ # @yield [String] optional block that, when given, is used to define the overriden
225
+ # logic. The yielded arg is the original description or failure message. If no
226
+ # block is provided, a default override is used based on the old and new names.
227
227
  #
228
228
  # @example
229
- #
230
229
  # RSpec::Matchers.alias_matcher :a_list_that_sums_to, :sum_to
231
230
  # sum_to(3).description # => "sum to 3"
232
231
  # a_list_that_sums_to(3).description # => "a list that sums to 3"
233
232
  #
234
233
  # @example
235
- #
236
234
  # RSpec::Matchers.alias_matcher :a_list_sorted_by, :be_sorted_by do |description|
237
235
  # description.sub("be sorted by", "a list sorted by")
238
236
  # end
@@ -261,16 +259,20 @@ module RSpec
261
259
  #
262
260
  # @param negated_name [Symbol] the name for the negated matcher
263
261
  # @param base_name [Symbol] the name of the original matcher that will be negated
264
- # @yield [String] optional block that, when given is used to define the overriden
265
- # description. The yielded arg is the original description. If no block is
266
- # provided, a default description override is used based on the old and
267
- # new names.
262
+ # @yield [String] optional block that, when given, is used to define the overriden
263
+ # logic. The yielded arg is the original description or failure message. If no
264
+ # block is provided, a default override is used based on the old and new names.
268
265
  #
269
266
  # @example
267
+ # RSpec::Matchers.define_negated_matcher :exclude, :include
268
+ # include(1, 2).description # => "include 1 and 2"
269
+ # exclude(1, 2).description # => "exclude 1 and 2"
270
270
  #
271
- # RSpec::Matchers.define_negated_matcher :a_value_not_between, :a_value_between
272
- # a_value_between(3, 5).description # => "a value between 3 and 5"
273
- # a_value_not_between(3, 5).description # => "a value not between 3 and 5"
271
+ # @note While the most obvious negated form may be to add a `not_` prefix,
272
+ # the failure messages you get with that form can be confusing (e.g.
273
+ # "expected [actual] to not [verb], but did not"). We've found it works
274
+ # best to find a more positive name for the negated form, such as
275
+ # `avoid_changing` rather than `not_change`.
274
276
  def self.define_negated_matcher(negated_name, base_name, &description_override)
275
277
  alias_matcher(negated_name, base_name, :klass => AliasedNegatedMatcher, &description_override)
276
278
  end
@@ -329,7 +331,6 @@ module RSpec
329
331
  # Passes if actual.instance_of?(expected)
330
332
  #
331
333
  # @example
332
- #
333
334
  # expect(5).to be_an_instance_of(Fixnum)
334
335
  # expect(5).not_to be_an_instance_of(Numeric)
335
336
  # expect(5).not_to be_an_instance_of(Float)
@@ -342,7 +343,6 @@ module RSpec
342
343
  # Passes if actual.kind_of?(expected)
343
344
  #
344
345
  # @example
345
- #
346
346
  # expect(5).to be_a_kind_of(Fixnum)
347
347
  # expect(5).to be_a_kind_of(Numeric)
348
348
  # expect(5).not_to be_a_kind_of(Float)
@@ -360,7 +360,6 @@ module RSpec
360
360
  # but you can make it `exclusive` by chaining that off the matcher.
361
361
  #
362
362
  # @example
363
- #
364
363
  # expect(5).to be_between(1, 10)
365
364
  # expect(11).not_to be_between(1, 10)
366
365
  # expect(10).not_to be_between(1, 10).exclusive
@@ -372,7 +371,6 @@ module RSpec
372
371
  # Passes if actual == expected +/- delta
373
372
  #
374
373
  # @example
375
- #
376
374
  # expect(result).to be_within(0.5).of(3.0)
377
375
  # expect(result).not_to be_within(0.5).of(3.0)
378
376
  def be_within(delta)
@@ -407,7 +405,6 @@ module RSpec
407
405
  # * `by_at_most`
408
406
  #
409
407
  # @example
410
- #
411
408
  # expect {
412
409
  # team.add_player(player)
413
410
  # }.to change(roster, :count)
@@ -474,7 +471,6 @@ module RSpec
474
471
  # but `=~` is not supported with `expect`.
475
472
  #
476
473
  # @example
477
- #
478
474
  # expect([1, 2, 3]).to contain_exactly(1, 2, 3)
479
475
  # expect([1, 2, 3]).to contain_exactly(1, 3, 2)
480
476
  #
@@ -509,7 +505,6 @@ module RSpec
509
505
  # `expected.length` elements of the actual array.
510
506
  #
511
507
  # @example
512
- #
513
508
  # expect("this string").to end_with "string"
514
509
  # expect([0, 1, 2, 3, 4]).to end_with 4
515
510
  # expect([0, 2, 3, 4, 4]).to end_with 3, 4
@@ -526,7 +521,6 @@ module RSpec
526
521
  # information about equality in Ruby.
527
522
  #
528
523
  # @example
529
- #
530
524
  # expect(5).to eq(5)
531
525
  # expect(5).not_to eq(3)
532
526
  def eq(expected)
@@ -541,7 +535,6 @@ module RSpec
541
535
  # information about equality in Ruby.
542
536
  #
543
537
  # @example
544
- #
545
538
  # expect(5).to eql(5)
546
539
  # expect(5).not_to eql(3)
547
540
  def eql(expected)
@@ -556,7 +549,6 @@ module RSpec
556
549
  # information about equality in Ruby.
557
550
  #
558
551
  # @example
559
- #
560
552
  # expect(5).to equal(5) # Fixnums are equal
561
553
  # expect("5").not_to equal("5") # Strings that look the same are not the same object
562
554
  def equal(expected)
@@ -579,7 +571,6 @@ module RSpec
579
571
  # This works no matter how you define your attribute readers.
580
572
  #
581
573
  # @example
582
- #
583
574
  # Person = Struct.new(:name, :age)
584
575
  # person = Person.new("Bob", 32)
585
576
  #
@@ -589,7 +580,6 @@ module RSpec
589
580
  # @note It will fail if actual doesn't respond to any of the expected attributes.
590
581
  #
591
582
  # @example
592
- #
593
583
  # expect(person).to have_attributes(:color => "red")
594
584
  def have_attributes(expected)
595
585
  BuiltIn::HaveAttributes.new(expected)
@@ -601,13 +591,18 @@ module RSpec
601
591
  # and it will only pass if all args are found in collection.
602
592
  #
603
593
  # @example
604
- #
605
594
  # expect([1,2,3]).to include(3)
606
595
  # expect([1,2,3]).to include(2,3)
607
596
  # expect([1,2,3]).to include(2,3,4) # fails
608
597
  # expect([1,2,3]).not_to include(4)
609
598
  # expect("spread").to include("read")
610
599
  # expect("spread").not_to include("red")
600
+ # expect(:a => 1, :b => 2).to include(:a)
601
+ # expect(:a => 1, :b => 2).to include(:a, :b)
602
+ # expect(:a => 1, :b => 2).to include(:a => 1)
603
+ # expect(:a => 1, :b => 2).to include(:b => 2, :a => 1)
604
+ # expect(:a => 1, :b => 2).to include(:c) # fails
605
+ # expect(:a => 1, :b => 2).not_to include(:a => 2)
611
606
  def include(*expected)
612
607
  BuiltIn::Include.new(*expected)
613
608
  end
@@ -616,11 +611,10 @@ module RSpec
616
611
  alias_matcher :a_hash_including, :include
617
612
  alias_matcher :including, :include
618
613
 
619
- # Passes if actual all expected objects pass. This works for
620
- # any enumerable object.
614
+ # Passes if the provided matcher passes when checked against all
615
+ # elements of the collection.
621
616
  #
622
617
  # @example
623
- #
624
618
  # expect([1, 3, 5]).to all be_odd
625
619
  # expect([1, 3, 6]).to all be_odd # fails
626
620
  #
@@ -642,12 +636,10 @@ module RSpec
642
636
  # pair of elements.
643
637
  #
644
638
  # @example
645
- #
646
639
  # expect(email).to match(/^([^\s]+)((?:[-a-z0-9]+\.)+[a-z]{2,})$/i)
647
640
  # expect(email).to match("@example.com")
648
641
  #
649
642
  # @example
650
- #
651
643
  # hash = {
652
644
  # :a => {
653
645
  # :b => ["foo", 5],
@@ -682,7 +674,6 @@ module RSpec
682
674
  # that splatted out as individual items.
683
675
  #
684
676
  # @example
685
- #
686
677
  # expect(results).to contain_exactly(1, 2)
687
678
  # # is identical to:
688
679
  # expect(results).to match_array([1, 2])
@@ -693,11 +684,14 @@ module RSpec
693
684
  end
694
685
 
695
686
  # With no arg, passes if the block outputs `to_stdout` or `to_stderr`.
696
- # With a string, passes if the blocks outputs that specific string `to_stdout` or `to_stderr`.
697
- # With a regexp or matcher, passes if the blocks outputs a string `to_stdout` or `to_stderr` that matches.
687
+ # With a string, passes if the block outputs that specific string `to_stdout` or `to_stderr`.
688
+ # With a regexp or matcher, passes if the block outputs a string `to_stdout` or `to_stderr` that matches.
698
689
  #
699
- # @example
690
+ # To capture output from any spawned subprocess as well, use `to_stdout_from_any_process` or
691
+ # `to_stderr_from_any_process`. Output from any process that inherits the main process's corresponding
692
+ # standard stream will be captured.
700
693
  #
694
+ # @example
701
695
  # expect { print 'foo' }.to output.to_stdout
702
696
  # expect { print 'foo' }.to output('foo').to_stdout
703
697
  # expect { print 'foo' }.to output(/foo/).to_stdout
@@ -710,10 +704,15 @@ module RSpec
710
704
  #
711
705
  # expect { do_something }.to_not output.to_stderr
712
706
  #
713
- # @note This matcher works by temporarily replacing `$stdout` or `$stderr`,
714
- # so it's not able to intercept stream output that explicitly uses `STDOUT`/`STDERR`
707
+ # expect { system('echo foo') }.to output("foo\n").to_stdout_from_any_process
708
+ # expect { system('echo foo', out: :err) }.to output("foo\n").to_stderr_from_any_process
709
+ #
710
+ # @note `to_stdout` and `to_stderr` work by temporarily replacing `$stdout` or `$stderr`,
711
+ # so they're not able to intercept stream output that explicitly uses `STDOUT`/`STDERR`
715
712
  # or that uses a reference to `$stdout`/`$stderr` that was stored before the
716
- # matcher is used.
713
+ # matcher was used.
714
+ # @note `to_stdout_from_any_process` and `to_stderr_from_any_process` use Tempfiles, and
715
+ # are thus significantly (~30x) slower than `to_stdout` and `to_stderr`.
717
716
  def output(expected=nil)
718
717
  BuiltIn::Output.new(expected)
719
718
  end
@@ -726,7 +725,6 @@ module RSpec
726
725
  # Pass an optional block to perform extra verifications on the exception matched
727
726
  #
728
727
  # @example
729
- #
730
728
  # expect { do_something_risky }.to raise_error
731
729
  # expect { do_something_risky }.to raise_error(PoorRiskDecisionError)
732
730
  # expect { do_something_risky }.to raise_error(PoorRiskDecisionError) { |error| expect(error.data).to eq 42 }
@@ -751,7 +749,6 @@ module RSpec
751
749
  # provided. Names can be Strings or Symbols.
752
750
  #
753
751
  # @example
754
- #
755
752
  # expect("string").to respond_to(:length)
756
753
  #
757
754
  def respond_to(*names)
@@ -771,7 +768,6 @@ module RSpec
771
768
  # a custom matcher, which would likely make your specs more expressive.
772
769
  #
773
770
  # @example
774
- #
775
771
  # expect(5).to satisfy { |n| n > 3 }
776
772
  def satisfy(&block)
777
773
  BuiltIn::Satisfy.new(&block)
@@ -785,7 +781,6 @@ module RSpec
785
781
  # `expected.length` elements of the actual array.
786
782
  #
787
783
  # @example
788
- #
789
784
  # expect("this string").to start_with "this s"
790
785
  # expect([0, 1, 2, 3, 4]).to start_with 0
791
786
  # expect([0, 2, 3, 4, 4]).to start_with 0, 1
@@ -804,7 +799,6 @@ module RSpec
804
799
  # specified Symbol with the specified arg.
805
800
  #
806
801
  # @example
807
- #
808
802
  # expect { do_something_risky }.to throw_symbol
809
803
  # expect { do_something_risky }.to throw_symbol(:that_was_risky)
810
804
  # expect { do_something_risky }.to throw_symbol(:that_was_risky, 'culprit')
@@ -828,14 +822,11 @@ module RSpec
828
822
  # of whether or not arguments are yielded.
829
823
  #
830
824
  # @example
831
- #
832
825
  # expect { |b| 5.tap(&b) }.to yield_control
833
826
  # expect { |b| "a".to_sym(&b) }.not_to yield_control
834
827
  #
835
828
  # @note Your expect block must accept a parameter and pass it on to
836
829
  # the method-under-test as a block.
837
- # @note This matcher is not designed for use with methods that yield
838
- # multiple times.
839
830
  def yield_control
840
831
  BuiltIn::YieldControl.new
841
832
  end
@@ -846,7 +837,6 @@ module RSpec
846
837
  # no arguments. Fails if it does not yield, or yields with arguments.
847
838
  #
848
839
  # @example
849
- #
850
840
  # expect { |b| User.transaction(&b) }.to yield_with_no_args
851
841
  # expect { |b| 5.tap(&b) }.not_to yield_with_no_args # because it yields with `5`
852
842
  # expect { |b| "a".to_sym(&b) }.not_to yield_with_no_args # because it does not yield
@@ -873,7 +863,6 @@ module RSpec
873
863
  # operator, the matcher will pass.
874
864
  #
875
865
  # @example
876
- #
877
866
  # expect { |b| 5.tap(&b) }.to yield_with_args # because #tap yields an arg
878
867
  # expect { |b| 5.tap(&b) }.to yield_with_args(5) # because 5 == 5
879
868
  # expect { |b| 5.tap(&b) }.to yield_with_args(Fixnum) # because Fixnum === 5
@@ -901,7 +890,6 @@ module RSpec
901
890
  # operator, the matcher will pass.
902
891
  #
903
892
  # @example
904
- #
905
893
  # expect { |b| [1, 2, 3].each(&b) }.to yield_successive_args(1, 2, 3)
906
894
  # expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
907
895
  # expect { |b| [1, 2, 3].each(&b) }.not_to yield_successive_args(1, 2)