Sha256: 987e89b6585ac8ae63e39c92ceae9bbfdffaafd5c7db13868feafcb93c8e1eff

Contents?: true

Size: 703 Bytes

Versions: 14

Compression:

Stored size: 703 Bytes

Contents

require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))

require 'algolia/webmock'
WebMock.disable!

describe 'With a mocked client' do

  before(:each) do
    WebMock.enable!
    Thread.current[:algolia_hosts] = Thread.current[:algolia_search_hosts] = nil # reset session objects
  end

  it "should add a simple object" do
    index = Algolia::Index.new("friends")
    index.add_object!({ :name => "John Doe", :email => "john@doe.org" })
    index.search('').should == { "hits" => [ { "objectID" => 42 } ], "page" => 1, "hitsPerPage" => 1 } # mocked
    index.list_user_keys
    index.browse
    index.clear
    index.delete
  end

  after(:each) do
    WebMock.disable!
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
algoliasearch-1.12.2 spec/mock_spec.rb
algoliasearch-1.12.1 spec/mock_spec.rb
algoliasearch-1.12.0 spec/mock_spec.rb
algoliasearch-1.11.0 spec/mock_spec.rb
algoliasearch-1.10.0 spec/mock_spec.rb
algoliasearch-1.9.0 spec/mock_spec.rb
algoliasearch-1.8.1 spec/mock_spec.rb
algoliasearch-1.8.0 spec/mock_spec.rb
algoliasearch-1.7.0 spec/mock_spec.rb
algoliasearch-1.6.1 spec/mock_spec.rb
algoliasearch-1.6.0 spec/mock_spec.rb
algoliasearch-1.5.1 spec/mock_spec.rb
algoliasearch-1.5.0 spec/mock_spec.rb
algoliasearch-1.4.3 spec/mock_spec.rb