Skip to content

Commit

Permalink
Remove unnecessary exception test on index checking
Browse files Browse the repository at this point in the history
Since we are using `ignore: 404` instead of manual
`rescue` at `Elasticsearch::Model::Indexing`,
there is no need to stub exceptions in the test.
  • Loading branch information
aeroastro authored and picandocodigo committed Mar 1, 2021
1 parent 5db9207 commit ce57cc1
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions elasticsearch-model/spec/elasticsearch/model/indexing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -659,36 +659,6 @@ def changes
expect(DummyIndexingModel.index_exists?).to be(false)
end
end

context 'when the index API raises an error' do

let(:client) do
double('client').tap do |cl|
expect(cl).to receive(:indices).and_raise(StandardError)
end
end

it 'returns false' do
expect(DummyIndexingModel.index_exists?).to be(false)
end
end

context 'when the indices.exists API raises an error' do

let(:client) do
double('client', indices: indices)
end

let(:indices) do
double('indices').tap do |ind|
expect(ind).to receive(:exists).and_raise(StandardError)
end
end

it 'returns false' do
expect(DummyIndexingModel.index_exists?).to be(false)
end
end
end

describe '#delete_index!' do
Expand Down

0 comments on commit ce57cc1

Please sign in to comment.