spec/lib/shamu/services/lazy_transform_spec.rb in shamu-0.0.11 vs spec/lib/shamu/services/lazy_transform_spec.rb in shamu-0.0.13
- old
+ new
@@ -2,16 +2,16 @@
describe Shamu::Services::LazyTransform do
let( :source ) { [ 1, 2, 3 ] }
def transformer( &block )
- ->( records ) {
+ ->( records ) do
records.map do |r|
yield
r
end
- }
+ end
end
it "short-circuits count" do
expect do |block|
transformed = Shamu::Services::LazyTransform.new( source, &transformer( &block ) )
@@ -67,10 +67,10 @@
transformed.to_a
end.to yield_control.exactly( 3 )
end
it "yields transformed values" do
- transformed = Shamu::Services::LazyTransform.new( source ) { |vs| vs.map { |v| v * v } }
+ transformed = Shamu::Services::LazyTransform.new( source ) { |vs| vs.map { |v| v * v } }
expect( transformed.to_a ).to eq [ 1, 4, 9 ]
end
it "short-circuits drop" do
expect do |block|