Sha256: c897041dd0c8810595573744846040d5a81e5eefc2fb1af12c468542a6b227e6

Contents?: true

Size: 393 Bytes

Versions: 12

Compression:

Stored size: 393 Bytes

Contents

require "spec_helper"

module Nasty
  describe LambdaBehaviours do
    include LambdaBehaviours

    it "memoizes the lambda" do
      calculation = memoize(lambda { |x| x + rand(100) })
      first_result = calculation.call(1)
      calculation.call(1).should == first_result
      calculation.call(1).should == first_result
      calculation.call(1).should == first_result
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
nasty-0.0.1395464273 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388168019 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388167257 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388166944 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388166636 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388165564 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388164945 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388164765 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388163823 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388163382 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388163140 spec/unit/lambda_behaviours_spec.rb
nasty-0.0.1388162472 spec/unit/lambda_behaviours_spec.rb