Sha256: 10259ac5bcc5bcf840a42b5d2977d6ec34fb97a9ac86dcdf6365b58f2e0788c5

Contents?: true

Size: 760 Bytes

Versions: 8

Compression:

Stored size: 760 Bytes

Contents

require 'spec/helper'
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

8 entries across 8 versions & 3 rubygems

Version Path
manveru-ramaze-2009.06.04 spec/contrib/rest.rb
manveru-ramaze-2009.06.12 spec/contrib/rest.rb
manveru-ramaze-2009.06 spec/contrib/rest.rb
rjspotter-ramaze-2009.06.29 spec/contrib/rest.rb
rjspotter-ramaze-2009.06.31 spec/contrib/rest.rb
ramaze-2009.06 spec/contrib/rest.rb
ramaze-2009.06.12 spec/contrib/rest.rb
ramaze-2009.06.04 spec/contrib/rest.rb