Sha256: 655d7f7ed4c55bfa42e4cfb43328f3b197c6c847f06432ee02b04a48d14ff874

Contents?: true

Size: 674 Bytes

Versions: 3

Compression:

Stored size: 674 Bytes

Contents

#encoding: utf-8
require 'spec_helper'

describe 'ActiveSearch::Algolia' do

  before(:all) do
    SetupEngine.setup(:algolia)

    # can not use the rspec let method
    @model          = AlgoliaModel
    @another_model  = AnotherAlgoliaModel
  end

  include_examples 'an engine'

  context 'retry on errors' do

    before do
      times_called = 0
      @instance = AlgoliaModel.new(title: 'Example')
      ActiveSearch::Algolia::Client.should_receive(:put).exactly(3).times.and_return do
        times_called += 1
        raise Errno::ECONNRESET if times_called <= 2
      end
    end

    subject { -> { @instance.save } }

    it { should_not raise_error }
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activesearch-0.3.2 spec/engines/algolia_spec.rb
activesearch-0.3.1 spec/engines/algolia_spec.rb
activesearch-0.3.0 spec/engines/algolia_spec.rb