main
1require "spec_helper"
2
3module Nasty
4 describe LambdaBehaviours do
5 include LambdaBehaviours
6
7 it "memoizes the lambda" do
8 calculation = memoize(lambda { |x| x + rand(100) })
9 first_result = calculation.call(1)
10 calculation.call(1).should == first_result
11 calculation.call(1).should == first_result
12 calculation.call(1).should == first_result
13 end
14 end
15end