dysania/onebox — pull request #142 by krainboltgreene (2013-09-28 21:35:44+00:00)
Title: Fixing global state cache problems

In fixing an issue with [here](https://github.com/dysania/onebox/compare/fixing-global-state-cache-problems?expand=1#L1R16) I discovered a global state issue.

The fix was that we're setting the Preview cache as the entire defaults object, which is not what we want. I changed it and discovered failures across all objects.

This was from the fact that the cache objects were getting carried over from previous tests. In order to fix this I've got an before-all for clearing the cache. In addition I also specified that the fake happen before ALL tests.

This caused a third issue in that `let()` is a promise (doesn't evaluate until it gets called) and doing this inside a `before(:all)` obviously doesn't make sense. Rspec warned me this wont be allowed in rspec v3 so I switched it to an instance variable.