Class: Believer::Test::RSpec::TestRunLifeCycle::Destructor
- Inherits:
-
Observer
- Object
- ActiveModel::Observer
- Observer
- Believer::Test::RSpec::TestRunLifeCycle::Destructor
- Defined in:
- lib/believer/test/rspec/test_run_life_cycle.rb
Overview
Detroys all CqlRecord::Base instances created
Instance Method Summary collapse
Instance Method Details
#after_save(model) ⇒ Object
42 43 44 |
# File 'lib/believer/test/rspec/test_run_life_cycle.rb', line 42 def after_save(model) saved_models << model end |
#cleanup ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/believer/test/rspec/test_run_life_cycle.rb', line 28 def cleanup saved_models.each do |model| begin model.destroy rescue Exception => e puts "Could not destroy model #{model}: #{e}\n#{e.backtrace.join("\n")}" end end end |
#saved_models ⇒ Object
38 39 40 |
# File 'lib/believer/test/rspec/test_run_life_cycle.rb', line 38 def saved_models @saved_models ||= [] end |