Sha256: 40a1861ebaef8557434f06a0dcee04d4a9926b0d742bf3f7d1fc248f87613016

Contents?: true

Size: 475 Bytes

Versions: 3

Compression:

Stored size: 475 Bytes

Contents

require 'spec/helper'

require 'examples/caching.rb'

describe 'Caching' do
  ramaze

  it '/' do
    n1 = 10_000
    n2 = 10_000
    result = n1 ** n2
    url = "/#{n1}/#{n2}"
    result_string = "Hello, i'm a little method with this calculation:\n#{n1} ** #{n2} = #{result}"

    intense_time = Benchmark.realtime{ get(url).body.should == result_string }
    cached_already = Benchmark.realtime{ 10.times{ get(url) } }
    intense_time.should be > cached_already
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.1.1 spec/examples/caching.rb
ramaze-0.1.2 spec/examples/caching.rb
ramaze-0.1.3 spec/examples/caching.rb