Sha256: 007579a343a29a92b6e6cfa8413cc47316c560d102f1a14aad8c71d9a20f2517

Contents?: true

Size: 755 Bytes

Versions: 10

Compression:

Stored size: 755 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 :mock

  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

10 entries across 10 versions & 3 rubygems

Version Path
Pistos-ramaze-2009.04.08 spec/contrib/rest.rb
manveru-ramaze-2009.04.01 spec/contrib/rest.rb
manveru-ramaze-2009.04.08 spec/contrib/rest.rb
manveru-ramaze-2009.04.18 spec/contrib/rest.rb
manveru-ramaze-2009.04.22 spec/contrib/rest.rb
manveru-ramaze-2009.04 spec/contrib/rest.rb
manveru-ramaze-2009.05.08 spec/contrib/rest.rb
manveru-ramaze-2009.05 spec/contrib/rest.rb
ramaze-2009.04 spec/contrib/rest.rb
ramaze-2009.05 spec/contrib/rest.rb