Sha256: a1e30dd37e74a1846e35445cab478f73ede2ed68cecbcaa36e8c0d8ef99d698b

Contents?: true

Size: 748 Bytes

Versions: 4

Compression:

Stored size: 748 Bytes

Contents

require 'spec_helper'

describe 'Parameter Transformations' do
  describe 'default' do
    it 'sets a default value when none is given' do
      get('/default') do |response|
        response.status.should == 200
        JSON.parse(response.body)['sort'].should == 'title'
      end
    end

    it 'sets a default value from a proc' do
      get('/default/proc') do |response|
        response.status.should == 200
        JSON.parse(response.body)['year'].should == 2014
      end
    end
  end

  describe 'transform' do
    it 'transforms the input using to_proc' do
      get('/transform', order: 'asc') do |response|
        response.status.should == 200
        JSON.parse(response.body)['order'].should == 'ASC'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sinatra-param-1.2.1 spec/parameter_transformations_spec.rb
sinatra-param-1.2.0 spec/parameter_transformations_spec.rb
sinatra-param-1.1.2 spec/parameter_transformations_spec.rb
sinatra-param-1.1.1 spec/parameter_transformations_spec.rb