fluke/devops-service/spec/shared_contexts/with_tester_connector.rb
2016-01-27 16:44:59 +04:00

23 lines
613 B
Ruby

def set_tester_connector(klass)
define_method :tester_connector_class do
klass
end
include_context 'with tester connector'
end
RSpec.shared_context 'with tester connector' do
before(:all) do
@connector = described_class.new(SpecSupport.db)
@tester_connector = tester_connector_class.new
@tester_connector.cleanup
end
after(:all){ @tester_connector.cleanup }
end
RSpec.shared_context 'cleanup after all', cleanup_after: :all do
after(:all){ @tester_connector.cleanup }
end
RSpec.shared_context 'cleanup after each', cleanup_after: :each do
after { @tester_connector.cleanup }
end