Skip to content

Instantly share code, notes, and snippets.

@tatey
Created June 6, 2012 05:17
Show Gist options
  • Select an option

  • Save tatey/2880052 to your computer and use it in GitHub Desktop.

Select an option

Save tatey/2880052 to your computer and use it in GitHub Desktop.
def store store, &block
begin
original = Thread.current[:store]
Thread.current[:store] = store
yield
ensure
Thread.current[:store] = original
end
end
def test_foo
store(Store.first) do
# Anything you do here uses this store.
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment