Skip to content

Instantly share code, notes, and snippets.

@rowanoulton
Created October 6, 2015 12:38
Show Gist options
  • Save rowanoulton/7665bb3acb1e065ff0ca to your computer and use it in GitHub Desktop.
Save rowanoulton/7665bb3acb1e065ff0ca to your computer and use it in GitHub Desktop.
# spec/model/fruit_spec.rb
RSpec.describe Fruit, elasticsearch: true, :type => :model do
it 'should be indexed' do
# create an instance of your model
Fruit.create(name: 'apple')
# refresh the index
Fruit.__elasticsearch__.refresh_index!
# verify your model was indexed
expect(Fruit.search('apple').records.length).to eq(1)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment