Sha256: eb2b057e7115096274d23af24c380c0d93141ebb07e4b2401ec711988fda5263

Contents?: true

Size: 679 Bytes

Versions: 3

Compression:

Stored size: 679 Bytes

Contents

require 'spec/helper'

Ramaze.contrib :route

class MainController < Ramaze::Controller
  def text(num)
    "text: #{num}"
  end

  def bar
    "bar"
  end
end

describe 'Route' do
  behaves_like 'http'
  ramaze
  @route = Ramaze::Contrib::Route

  it 'should provide backwards compat wrapper to Ramaze::Route' do
    @route[ %r!^/(\d+)\.te?xt$! ] = "/text/%d"
    @route[ 'foobar' ] = lambda{ |path, request|
      '/bar' if path == '/foo' and request[:bar] == '1'
    }
  end

  it 'should work' do
    r = get('/123.txt')
    r.status.should == 200
    r.body.should == 'text: 123'

    r = get('/foo', 'bar=1')
    r.status.should == 200
    r.body.should == 'bar'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ramaze-0.3.5 spec/contrib/route.rb
ramaze-0.3.9 spec/contrib/route.rb
ramaze-0.3.9.1 spec/contrib/route.rb