Sha256: bf27ba17c39fedbc823a20e47f51aaf196179351714c66085de4b47833d3071e

Contents?: true

Size: 945 Bytes

Versions: 20

Compression:

Stored size: 945 Bytes

Contents

require 'spec/helper'

describe 'Ramaze::Request' do
  def request(env = {})
    Ramaze::Request.new(env)
  end

  should 'provide #request_uri' do
    request('REQUEST_URI' => '/?a=b').request_uri.should == '/?a=b'
    request(  'PATH_INFO' => '/'    ).request_uri.should == '/'
  end

  should 'provide #local_net?' do
    request.local_net?('192.168.0.1').to_s.should == '192.168.0.0'
    request.local_net?('252.168.0.1').should == nil
    request.local_net?('unknown').should == nil
    request('REMOTE_ADDR' => '211.3.129.47, 66.249.85.131').local_net?.should == nil
    request('REMOTE_ADDR' => '211.3.129.47').local_net?.should == nil
  end

  should 'provide #subset' do
    params = {'a' => 'b', 'c' => 'd', 'e' => 'f'}
    env = { 'rack.request.form_hash' => params }
    req = request(env)

    req.params.should == params
    req.subset(:a).should == {'a' => 'b'}
    req.subset(:a, :c).should == {'a' => 'b', 'c' => 'd'}
  end
end

Version data entries

20 entries across 20 versions & 5 rubygems

Version Path
Pistos-ramaze-2008.09 spec/ramaze/current/request.rb
Pistos-ramaze-2008.12 spec/ramaze/current/request.rb
Pistos-ramaze-2009.01 spec/ramaze/current/request.rb
Pistos-ramaze-2009.02 spec/ramaze/current/request.rb
clivecrous-ramaze-0.3.9.5 spec/ramaze/current/request.rb
manveru-ramaze-2008.07 spec/ramaze/current/request.rb
manveru-ramaze-2008.08 spec/ramaze/current/request.rb
manveru-ramaze-2008.09 spec/ramaze/current/request.rb
manveru-ramaze-2008.10 spec/ramaze/current/request.rb
manveru-ramaze-2008.12 spec/ramaze/current/request.rb
manveru-ramaze-2009.01 spec/ramaze/current/request.rb
ptomato-ramaze-2009.02.1 spec/ramaze/current/request.rb
ptomato-ramaze-2009.02 spec/ramaze/current/request.rb
ramaze-0.3.9.1 spec/ramaze/current/request.rb
ramaze-0.3.9 spec/ramaze/current/request.rb
ramaze-2008.06 spec/ramaze/current/request.rb
ramaze-2008.11 spec/ramaze/current/request.rb
ramaze-2009.01 spec/ramaze/current/request.rb
ramaze-2009.02 spec/ramaze/current/request.rb
ramaze-2009.03 spec/ramaze/current/request.rb