Advertisement
happy-barney

context-singleton

Sep 23rd, 2020
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. use Context::Singleton;
  2.  
  3. contrive 'db-connection' => (
  4. as => sub { DBI->connect (...) },
  5. );
  6.  
  7. sub foo {
  8. deduce ('db-connection')->do (...);
  9. }
  10.  
  11. # your tests
  12.  
  13. frame {
  14. proclaim 'db-connection' => $fixture_connection_1;
  15.  
  16. test foo;
  17. };
  18.  
  19. frame {
  20. proclaim 'db-connection' => $fixture_connection_2;
  21.  
  22. test foo;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement