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
|
Description: Fix failing spec/rspec/matchers/yield_spec with Ruby1.8
The test on line 294 was relying on the order of a Hash, which is not granted
with Ruby1.8.
This patch makes the test use an array of tuples instead.
Author: Myron Marston <myron.marston@gmail.com>
Origin: commit:https://github.com/rspec/rspec-expectations/commit/3cf9110be5e4b0682a074b7dbfc35fd0bae4c639
Bug: https://github.com/rspec/rspec-expectations/issues/144
Last-Update: 2012-05-10
---
spec/rspec/matchers/yield_spec.rb | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--- a/spec/rspec/matchers/yield_spec.rb
+++ b/spec/rspec/matchers/yield_spec.rb
@@ -291,18 +291,18 @@
describe "expect {...}.to yield_successive_args([:a, 1], [:b, 2])" do
it 'passes when the block successively yields the given args' do
- expect { |b| { :a => 1, :b => 2 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+ expect { |b| [ [:a, 1], [:b, 2] ].each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
end
it 'fails when the block does not yield that many times' do
expect {
- expect { |b| { :a => 1 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+ expect { |b| [[:a, 1]].each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
}.to fail_with(/but yielded with unexpected arguments/)
end
it 'fails when the block yields the right number of times but with different arguments' do
expect {
- expect { |b| { :a => 1, :b => 3 }.each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
+ expect { |b| [ [:a, 1], [:b, 3] ].each(&b) }.to yield_successive_args([:a, 1], [:b, 2])
}.to fail_with(/but yielded with unexpected arguments/)
end
end
|