Sha256: 463d781e44cb5a5d5f134f45c384eedd5cfdebda8c416f3e415e6aa4671cbb0e

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 Bytes

Contents

require 'test/unit'
require 'test/unit/assertions'
require 'rexml/document'

require 'nitro/context'

module Nitro

# Override the default Request implementation
# to include methods useful for testing.

module Request
end

# Override the default Response implementation
# to include methods useful for testing.

module Response

  def status_ok?
    @status == 200
  end

  def redirect?
    (300..399).include?(@status)
  end

  def redirect_url
    @response_headers['location']
  end

  def response_cookie(name)
    return nil unless @response_cookies
    @response_cookies.find { |c| c.name == name }
  end

end

# Override the default Context implementation
# to include methods useful for testing.

class Context
  attr_writer :session, :cookies
  
  def session
    @session || @session = {}
  end
  
  def cookies
    @cookies || @cookies = {}
  end
     
end

end
# * George Moschovitis  <gm@navel.gr>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nitro-0.29.0 lib/nitro/test/context.rb
nitro-0.30.0 lib/nitro/test/context.rb
nitro-0.31.0 lib/nitro/test/context.rb