Skip to content

Commit 52341f6

Browse files
committed
fix: pass parent.frame environment to describe_it
1 parent 30f5b11 commit 52341f6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

R/describe.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,5 @@ it <- function(description, code = NULL) {
9494
check_string(description, allow_empty = FALSE)
9595

9696
code <- substitute(code)
97-
describe_it(description, code)
97+
describe_it(description, code, env = parent.frame())
9898
}

tests/testthat/test-describe.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ describe("describe", {
3737
expect_equal(1, someInternalVariable)
3838
})
3939

40+
testthat::it("should be possible to use variables from outer environments with package prefix", {
41+
expect_equal(1, someExternalVariable)
42+
expect_equal(1, someInternalVariable)
43+
})
44+
4045
it("should not be possible to access variables from other specs (1)", {
4146
some_test_var <- 5
4247
})

0 commit comments

Comments
 (0)