Sha256: 76290008e5366a32e742ad00025ea29bb7daf2454c8202ff949e25f8a032d402

Contents?: true

Size: 875 Bytes

Versions: 2

Compression:

Stored size: 875 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nitro-0.41.0 lib/nitro/test/context.rb
nitro-0.40.0 lib/nitro/test/context.rb