Let statements don't retain their memoization when referenced inside of a before statement
Here's a failing spec:
context "Callbacks" do
setup_all do
Agent.start_link(fn -> 0 end, name: :memoized_let)
:ok
end
before :each do
Agent.update(:memoized_let, fn acc -> 0 end)
something
:ok
end
it "only invokes the letted block once" do
assert Agent.get(:memoized_let, fn acc -> acc end) == 1
something
assert Agent.get(:memoized_let, fn acc -> acc end) == 1
end
end
It fails with the following message:
1) .let, Callbacks, only invokes the letted block once (:"Elixir.PavlovCaseTest.let.Callbacks")
test/case/case_test.exs:91
Assertion with == failed
code: Agent.get(:memoized_let, fn acc -> acc end) == 1
lhs: 2
rhs: 1
stacktrace:
test/case/case_test.exs:94
.................................
Finished in 1.1 seconds (1.0s on load, 0.1s on tests)
91 tests, 1 failure, 5 skipped
Randomized with seed 69531
Let statements don't retain their memoization when referenced inside of a before statement
Here's a failing spec:
It fails with the following message:
This doesn't follow the behavior in rspec