Module: Clickwrap::TestHelpers::ClassMethods
- Defined in:
- lib/clickwrap/test_helpers.rb
Overview
Opt-in class macro for integration tests that must reach real commit callbacks instead of Rails' normal transactional-test rollback boundary.
Instance Method Summary collapse
-
#use_real_database_commits! ⇒ Object
Sensitive exports deliberately refuse to reveal data from inside an outer transaction: their access audit must commit before bytes leave the process.
Instance Method Details
#use_real_database_commits! ⇒ Object
Sensitive exports deliberately refuse to reveal data from inside an outer transaction: their access audit must commit before bytes leave the process. Rails wraps tests in transactions by default, so tests of that production contract can opt into real commits explicitly.
This also installs deterministic cleanup around each such test. It is a test-only facility; production code never truncates host tables.
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/clickwrap/test_helpers.rb', line 69 def use_real_database_commits! self.use_transactional_tests = false setup do reset_clickwrap_test_database! publish_clickwrap_documents! end teardown { reset_clickwrap_test_database! } end |