Skip to content
  • Daniel Mack's avatar
    test: make SuckerPunch tests work · 811c1d2e
    Daniel Mack authored
    Use the database_cleaner gem to handle database persistence during tests.
    This is needed because SuckerPunch jobs are executed from a dedicated
    thread, for both synchronous and asnychronous execution. Hence, the data set
    from the MiniTest fixtures is not visible from the other thread as their
    removal races against the task performer.
    
    To fix this, set DatabaseCleaner.strategy to :truncation and implement
    ActiveSupport::TestCase::setup() and ::teardown().
    
    Also set SuckerPunch to synchronous execution for all test cases.
    811c1d2e