Module: RSpec::Hive::WithHiveConnection

Defined in:
lib/rspec/hive/with_hive_connection.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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

Instance Method Details

#connectionObject



24
25
26
# File 'lib/rspec/hive/with_hive_connection.rb', line 24

def connection
  @connection ||= hive_connector.start_connection
end