Sha256: 06e523b9042b0abd6d10082fcee5eb88cad43953bf0436ea14d9746b40dfd7df

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

require File.expand_path('../../../spec/helper', __FILE__)
require 'ramaze/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

1 entries across 1 versions & 1 rubygems

Version Path
ramaze-2011.07.25 spec/ramaze/rest.rb