Sha256: f02424d0cb4873619d9299fc24795f34731ac1a40049e341144c9efad869a9bd

Contents?: true

Size: 1.14 KB

Versions: 16

Compression:

Stored size: 1.14 KB

Contents

#          Copyright (c) 2006 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

require 'spec/helper'

class TCAdapterController < Ramaze::Controller
  map '/'

  def index
    "The index"
  end
end

$output = StringIO.new
Ramaze::Log.loggers << Ramaze::Logger::Informer.new($output)

describe "Adapter" do
  ramaze ramaze_options ||= {}
  behaves_like "http"

  it 'should do a simple request' do
    get('/').body.should == 'The index'
  end

  it 'should measure request processing time' do
    Ramaze::Global.benchmarking = true
    $output.string = ""
    get('/')
    $output.string.should =~ /request took/
    Ramaze::Global.benchmarking = false
  end

  it 'should not measure request processing time' do
    Ramaze::Global.benchmarking = false
    $output.string = ""
    get('/')
    $output.string.should.not =~ /request took/
  end

  it 'should allow using an Adapter.before block' do
    Ramaze::Adapter.before do |env|
      [ 200, {'Content-Type'=>'text/plain'}, 'i am before' ]
    end

    ret = get('/')
    ret.status.should == 200
    ret.body.should == 'i am before'
  end
end

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
Pistos-ramaze-2008.09 spec/ramaze/adapter.rb
Pistos-ramaze-2008.12 spec/ramaze/adapter.rb
Pistos-ramaze-2009.01 spec/ramaze/adapter.rb
Pistos-ramaze-2009.02 spec/ramaze/adapter.rb
manveru-ramaze-2008.07 spec/ramaze/adapter.rb
manveru-ramaze-2008.08 spec/ramaze/adapter.rb
manveru-ramaze-2008.09 spec/ramaze/adapter.rb
manveru-ramaze-2008.10 spec/ramaze/adapter.rb
manveru-ramaze-2008.12 spec/ramaze/adapter.rb
manveru-ramaze-2009.01 spec/ramaze/adapter.rb
ptomato-ramaze-2009.02.1 spec/ramaze/adapter.rb
ptomato-ramaze-2009.02 spec/ramaze/adapter.rb
ramaze-2008.11 spec/ramaze/adapter.rb
ramaze-2009.01 spec/ramaze/adapter.rb
ramaze-2009.03 spec/ramaze/adapter.rb
ramaze-2009.02 spec/ramaze/adapter.rb