fluke/devops-service/spec/shared_contexts/with_tester_connector.rb

23 lines
613 B
Ruby
Raw Normal View History

2015-11-20 18:31:54 +03:00
def set_tester_connector(klass)
define_method :tester_connector_class do
klass
end
include_context 'with tester connector'
2015-11-20 18:31:54 +03:00
end
RSpec.shared_context 'with tester connector' do
2015-11-20 18:31:54 +03:00
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