Sha256: a1f409584fee249885a6fc66c1d3aeb1a12fbbbac91baed36033fa221c2191a6

Contents?: true

Size: 942 Bytes

Versions: 5

Compression:

Stored size: 942 Bytes

Contents

require 'elasticrawl'
require 'rspec'
require 'database_cleaner'
require 'shoulda-matchers'

RSpec.configure do |config|
  # Run each test in a transaction and rollback data on completion.
  DatabaseCleaner.strategy = :transaction

  config.before(:each) do
    # Stub S3 call to get WARC file paths
    warc_paths = IO.read(File.join(File.dirname(__FILE__), 'fixtures', 'warc.paths'))
    allow_any_instance_of(Elasticrawl::Crawl).to receive(:warc_paths).and_return(warc_paths)

    # Load config from spec/fixtures/ rather than ~/.elasticrawl/
    config_dir = File.join(File.dirname(__FILE__), 'fixtures')
    allow_any_instance_of(Elasticrawl::Config).to receive(:config_dir).and_return(config_dir)

    # Load sqlite database. For testing this is stored at db/elasticrawl.sqlite3
    config = Elasticrawl::Config.new
    config.load_database

    DatabaseCleaner.start
  end

  config.after(:each) do
    DatabaseCleaner.clean
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
elasticrawl-1.1.4 spec/spec_helper.rb
elasticrawl-1.1.3 spec/spec_helper.rb
elasticrawl-1.1.2 spec/spec_helper.rb
elasticrawl-1.1.1 spec/spec_helper.rb
elasticrawl-1.1.0 spec/spec_helper.rb