Sha256: 383e51e498207298836931c6621845120121214a107a89235424f46e380c7af2

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

require "#{File.dirname(__FILE__)}/../helpers.rb"

describe "An instance of Waves::Response" do
  
  before do
    @request = Waves::Request.new(env( '/', :method => 'GET' ))
    @response = Waves::Response.new(@request)
  end
  
  it "has a Rack::Response" do
    @response.rack_response.class.should == Rack::Response
  end
  
  it "has a Waves::Request" do
    @response.request.class.should == Waves::Request
  end
  
  it "can access the session for the current request" do
    @response.session.class.should == Waves::Session
  end
  
  it "provides setter methods for commonly used headers" do
    @response.rack_response.should.receive(:[]=).with('Content-Type', 'text/javascript')
    @response.content_type = 'text/javascript'
    
    @response.rack_response.should.receive(:[]=).with('Content-Length', '42')
    @response.content_length = '42'
    
    @response.rack_response.should.receive(:[]=).with('Location', '/here/')
    @response.location = '/here/'
    
    @response.rack_response.should.receive(:[]=).with('Expires', 'Thu, 09 Aug 2007 05:22:55 GMT')
    @response.expires = 'Thu, 09 Aug 2007 05:22:55 GMT'
  end
  
  it "delegates unknown methods to the Rack response" do
    @response.rack_response.should.receive(:mclintock!)
    @response.mclintock!
  end
  
end

describe "Waves::Response#finish" do
  
  before do
    @request = Waves::Request.new(env( '/', :method => 'GET' ))
    @response = Waves::Response.new(@request)
  end
  
  it "saves the request session and calls Rack::Response#finish" do
    @response.rack_response.should.receive(:finish)
    @response.finish
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waves-edge-2009.03.10.13.14 test/runtime/response.rb