My specs:
it "has empty thread" do
Thread.current[:foo].should be_nil
Thread.current[:foo] = "bar"
end
it "has empty thread" do
Thread.current[:foo].should be_nil
end
Second spec fails because thread was changed by previous spec.
How can I run specs in different threads or ‘nullify’ thread’s keys before each spec or something else to pass second spec?
You can create the
Threadin the spec ; don’t’ forget tojoinit to get the results of theshould‘s from the thread re-evaluated: