module RSpec::Hive::WithHiveConnection

Public Class Methods

included(mod) click to toggle source
# File lib/rspec/hive/with_hive_connection.rb, line 8
def self.included(mod)
  mod.before(:all) do
    ExponentialBackoff.retryable(on: Thrift::TransportException) do
      connection
    end
  end

  mod.before(:each) do
    connection.switch_database(DbName.random_name)
  end

  mod.after(:all) do
    hive_connector.stop_connection(connection) if hive_connector && @connection
  end
end

Public Instance Methods

connection() click to toggle source
# File lib/rspec/hive/with_hive_connection.rb, line 24
def connection
  @connection ||= hive_connector.start_connection
end

Private Instance Methods

hive_connector() click to toggle source
# File lib/rspec/hive/with_hive_connection.rb, line 30
def hive_connector
  ::RSpec::Hive.connector
end