Sha256: d1ac9c6c6e3ed6f1bdf79169ca6cff00dfa3077555ab09f99ac0114cc89e51e8
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
############################################################################## # Elasticsearch Plugin ############################################################################## begin require 'elasticsearch-extensions' RSpec.configure do |config| config.before(:suite, elasticsearch: ->(v) { !!v }) do Elasticsearch::Extensions::Test::Cluster.start(port: 9200) unless Elasticsearch::Extensions::Test::Cluster.running? end config.around(:each, elasticsearch: ->(v) { !!v }) do |example| model = case example.metadata[:elasticsearch] when String example.metadata[:elasticsearch].constantize end model.__elasticsearch__.client.indices.delete index: '_all' model.__elasticsearch__.create_index! index: model.index_name example.run model.__elasticsearch__.client.indices.delete index: '_all' end config.after(:suite, elasticsearch: ->(v) { !!v }) do Elasticsearch::Extensions::Test::Cluster.stop(port: 9200) if Elasticsearch::Extensions::Test::Cluster.running? end # config.around(:each, time_mock: ->(v) { !!v }) do |example| # options = example.metadata[:time_mock] # options = case options # when Time # { time: options } # when FalseClass # false # when TrueClass # {} # end # # if options # mock_type = options.fetch(:type, :freeze) # time = options.fetch(:time, Time.utc(2012, 7, 26, 18, 0, 0)) # # Timecop.send(mock_type, time) # else # Timecop.return # end # # example.run # # Timecop.return # end end rescue LoadError end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rspectacular-0.63.0 | lib/rspectacular/plugins/elasticsearch.rb |