Sha256: 4473b372f15283265cc8cdd5271f1d1a685cccc778b4e0b8fb936ee61d8b0bcc

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'

module Beatport::Catalog
  describe Autocomplete do
    before :each do
      VCR.insert_cassette 'autocomplete'
    end

    after :each do
      VCR.eject_cassette
    end

    describe 'stucture' do
      subject { Autocomplete.query('lutzen').first }
      
      its (:'name.downcase') { should match(/lutzen/) }
    end
    
    describe 'collection' do
      subject { Autocomplete.query('lutzen') }
      
      its (:host) { should == "api.beatport.com" }
      its (:path) { should == "/catalog/autocomplete" }
      its (:query) { should == "query=lutzen" }
      its (:page) { should == 1 }
      its (:per_page) { should == 10 }
      its (:count) { should be > 1 }
      its (:total_pages) { should be > 1 }
      its (:next_query) { should == "query=lutzen&page=2"}
      its (:per_page_options) { should_not be_nil }
      its (:facets) { should_not be_nil }
      its (:spellcheck) { should_not be_nil }
    end
    
    describe '.query' do
      subject { Autocomplete.query('lutzen', :page => 3, :per_page => 2) }
      
      its (:page) { should == 3 }
      its (:per_page) { should == 2 }
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
beatport-0.1.9 spec/catalog/autocomplete_spec.rb
beatport-0.1.8 spec/catalog/autocomplete_spec.rb
beatport-0.1.7 spec/catalog/autocomplete_spec.rb
beatport-0.1.6 spec/catalog/autocomplete_spec.rb