Sha256: 6099c1a7b48e2b1daddfd91ca3f0b63b625e90d0e1a0c608b9e2a519d13a85a5

Contents?: true

Size: 1.1 KB

Versions: 4

Compression:

Stored size: 1.1 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 == "oauth-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 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.4.0 spec/catalog/autocomplete_spec.rb
beatport-0.3.0 spec/catalog/autocomplete_spec.rb
beatport-0.2.3 spec/catalog/autocomplete_spec.rb
beatport-0.2.2 spec/catalog/autocomplete_spec.rb