Sha256: 0233660844a8df0a7de8fdd49b8c7cd91069044f29e2af9683d753873a46a945

Contents?: true

Size: 797 Bytes

Versions: 11

Compression:

Stored size: 797 Bytes

Contents

require File.expand_path('../../../spec/helper', __FILE__)
require 'ramaze/contrib/rest'

class Posts < Ramaze::Controller
  map '/'

  def show; 'Showing' end
  def create; 'Creating' end
  def update; 'Updating' end
  def destroy; 'Destroying' end

  def show_other; 'Showing other' end
end

describe 'Contrib REST rewrite' do
  behaves_like :rack_test

  it('rewrites GET to show'){          get('/').body.should == 'Showing' }
  it('rewrites POST to create'){      post('/').body.should == 'Creating' }
  it('rewrites PUT to update'){        put('/').body.should == 'Updating' }
  it('rewrites DELETE to destroy'){ delete('/').body.should == 'Destroying' }

  it 'is configurable' do
    Ramaze.options.rest_rewrite['GET'] = 'show_other'

    get('/').body.should == 'Showing other'
  end
end

Version data entries

11 entries across 11 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.06.12 spec/contrib/rest.rb
manveru-ramaze-2009.07 spec/contrib/rest.rb
ramaze-2011.01.30 spec/contrib/rest.rb
ramaze-2011.01 spec/contrib/rest.rb
ramaze-2010.06.18 spec/contrib/rest.rb
ramaze-2010.04.04 spec/contrib/rest.rb
ramaze-2010.04 spec/contrib/rest.rb
ramaze-2010.03 spec/contrib/rest.rb
ramaze-2010.01 spec/contrib/rest.rb
ramaze-2009.10 spec/contrib/rest.rb
ramaze-2009.07 spec/contrib/rest.rb