ruby - Why isn't rspec memoizing this? -


I have a test that is a bit like the following. Details are not necessary, but I have a way that takes about 10 seconds, and takes away some data, which I want to use a bunch of tests several times. The data will no longer be refreshing - I just need to bring it only once. Let's have my understanding that it is remembered, so I hope that only after slow call, once in a while. But I think it is called many times because I mention to slow down. What am I doing wrong?

  Description 'example' def def_thing puts "call me!" Sleep (100) Ends (slow)} hopes to slow 'do something slow' (slow down). To do this, it is expected to slow down (slow down). Be_true end end  

When I run the trial, I have to call me! Use as many times as I claim or slow down.

Document state values ​​ not cached in all instances:

The value will be cached in multiple calls in the same example but not in all instances [emphasis mine.]

For example, From the documents:

  $ count = 0 Let's describe "let's do" (counting) {$ count + = 1} This "values ​​the value" counts. Sheesh == 1 count. Shield == 1 "Counts are not cashed in examples" at the end. Rulers == 2 Ends  

to


Comments