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



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rspec/hive/with_hive_connection.rb', line 6

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



22
23
24
# File 'lib/rspec/hive/with_hive_connection.rb', line 22

def connection
  @connection ||= hive_connector.start_connection
end