We should give users (and ourselves) the ability to override function variables that use get_package_scope_var, namely DB connection objects so that we can easily use in-memory databases while testing, rather than having to load a separate .env file for testing.
Updates would follow this template:
foo <- function(
...,
+db_conn = NULL
) {
- db_conn <- get_package_scope_var("db_conn")
+ if (is.null(db_conn)) {
+ db_conn <- get_package_scope_var("db_conn")
+ }
...
}
Relevant places that get_package_scope_var is called:
https://github.com/search?q=repo%3Actsit/rcc.billing%20get_package_scope_var&type=code