diff options
Diffstat (limited to 'spec/ruby/core/enumerator/lazy/reject_spec.rb')
-rw-r--r-- | spec/ruby/core/enumerator/lazy/reject_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/ruby/core/enumerator/lazy/reject_spec.rb b/spec/ruby/core/enumerator/lazy/reject_spec.rb index 2661907b39..03444b471f 100644 --- a/spec/ruby/core/enumerator/lazy/reject_spec.rb +++ b/spec/ruby/core/enumerator/lazy/reject_spec.rb @@ -33,6 +33,18 @@ describe "Enumerator::Lazy#reject" do end end + it "lets exceptions raised in the block go through" do + lazy = 10.times.lazy.map do |i| + raise "foo" + end + + lazy = lazy.reject(&:nil?) + + -> { + lazy.first + }.should raise_error(RuntimeError, "foo") + end + it "calls the block with a gathered array when yield with multiple arguments" do yields = [] @yieldsmixed.reject { |v| yields << v }.force @@ -57,4 +69,10 @@ describe "Enumerator::Lazy#reject" do end end end + + it "works with an infinite enumerable" do + s = 0..Float::INFINITY + s.lazy.reject { |n| false }.first(100).should == + s.first(100).reject { |n| false } + end end |