Created
April 18, 2013 15:23
-
-
Save vanwhale/5413605 to your computer and use it in GitHub Desktop.
Elasticsearch tire rspec filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prevent calls from going out to elasticsearch unless we specify the example is an elasticsearch test | |
config.before :each do | |
unless (example.metadata[:elasticsearch] && example.metadata[:elasticsearch] == true) | |
stub_request(:any, %r|\Ahttp://.*9200.*|).to_return(:status => 200, :body => "{}") | |
end | |
end | |
config.before :each, elasticsearch: true do | |
[Product, User].each do |klass| | |
klass.index.delete | |
klass.create_elasticsearch_index | |
end | |
Resque.inline = true | |
end | |
config.after :each, elasticsearch: true do | |
[Product, User].each do |klass| | |
klass.index.delete | |
end | |
Resque.inline = false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment