Sha256: 8ba3b313d2b04981f1ab175de298bd26e4e0e9d291463e81821234efb4a3c78c

Contents?: true

Size: 1.77 KB

Versions: 1

Compression:

Stored size: 1.77 KB

Contents

require 'test/helpers.rb'
require 'foundations/compact'

describe "Application Context" do
  before do 
    Test = Module.new { include Waves::Foundations::Compact }
    Waves << Test
  end
  
  after do
    Waves.applications.clear
    Object.instance_eval { remove_const( :Test ) if const_defined?( :Test ) }
  end
  
  feature "Provide acccess to request, response, and session objects" do
    Test::Resources::Map.new( Waves::Request.new( env('/', :method => 'GET' ) ) ).
      instance_eval do
        { :request => Waves::Request, :response => Waves::Response, 
          :session => Waves::Session, :query => Waves::Request::Query }.
          each { |k,v| send( k ).class.should == v }
      end
  end
  
  feature "Shortcuts to the path, url, domain, and session" do
    Test::Resources::Map.new( Waves::Request.new( 
      env('http://localhost/foo/bar.js', :method => 'GET' ) ) ).
      instance_eval do
        { :url => request.url, :path => request.path, 
          :domain => request.domain, :session => request.session }.
          each { |k,v| send( k ).should == v }    
      end
  end

  feature "Access to path and associated helpers" do
    Test::Resources::Map.new( Waves::Request.new( 
      env('http://localhost/foo/bar.js', :method => 'GET' ) ) ).
      instance_eval do
        { :url => 'http://localhost/foo/bar.js', :path => '/foo/bar.js', 
          :basename => '/foo/bar', :extension => 'js' }.
          each { |k,v| send( k ).should == v }
      end
  end

  feature "Access to the application object and name" do
    Test::Resources::Map.new( Waves::Request.new( 
      env('http://localhost/foo/bar.js', :method => 'GET' ) ) ).
      instance_eval do
        { :app => Test, :app_name => :test }.
          each { |k,v| send( k ).should == v }    
      end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
waves-edge-2009.03.10.13.14 test/process/resource.rb