I often want to do
context "empty stack" do
SOME_CONSTANT = "value"
it "should be empty" do
# use SOME_CONSTANT
end
end
context "populated stack" do
SOME_CONSTANT = "a different value"
it "should have some items" do
# use SOME_CONSTANT
end
end
ruby doesn't scope constants to closures so they leak out. Does anyone have a trick for declaring constants that are scoped to a context?
it
block do:self.class::SOME_CONSTANT
– Grapery