Sha256: 873a1298243743d831629170e123509cf59c34ed7c2b0c6a3846d2c08e4b6efe

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 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!
    # reset session objects
    app_id = Algolia.client.application_id
    Thread.current["algolia_hosts_#{app_id}"] = nil
    Thread.current["algolia_search_hosts_#{app_id}"] = nil
  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

1 entries across 1 versions & 1 rubygems

Version Path
algoliasearch-1.12.3 spec/mock_spec.rb