Sha256: bcdbc7403d4e9431b79b9b8d58e887b3960cdef46ea5c63e956fa43e77497e72

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

# encoding: utf-8
#
require 'spec_helper'

describe Adapters::Rack::Query do
  
  before(:each) do
    @query   = stub :query
    @adapter = described_class.new @query
  end
  
  describe 'to_app' do
    it 'works' do
      lambda { @adapter.to_app }.should_not raise_error
    end
    it 'returns the right thing' do
      @adapter.to_app.should respond_to(:call)
    end
  end
  
  describe 'extracted' do
    it 'extracts the query' do
      @adapter.extracted('query' => 'some_query')[0].should == 'some_query'
    end
    it 'extracts the default ids amount' do
      @adapter.extracted('query' => 'some_query')[1].should == 20
    end
    it 'extracts the default offset' do
      @adapter.extracted('query' => 'some_query')[2].should == 0
    end
    it 'extracts a given ids amount' do
      @adapter.extracted('query' => 'some_query', 'ids' => '123')[1].should == 123
    end
    it 'extracts a given offset' do
      @adapter.extracted('query' => 'some_query', 'offset' => '123')[2].should == 123
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
picky-2.7.0 spec/lib/adapters/rack/query_spec.rb
picky-2.6.0 spec/lib/adapters/rack/query_spec.rb