drapergem/draper — pull request #438 by haines (2013-01-24 00:52:21+00:00)
Title: Store helper proxies instead of raw view contexts

Any time we want to use `Draper::ViewContext.current` to access helper methods, we create a helper proxy to `send` the helpers because things like `html_escape` are private. Each decorator class gets its own stateless `HelperProxy`

This pull request changes this behaviour so that instead of having one proxy per decorator class, we create a proxy when we store the view context. All decorators then use this same helper proxy, which means that in tests we can do something like this

```ruby
it "stubs a helper" do
helper.stub content_tag: "hello"
expect(decorator.h.content_tag).to eq "hello"
end
```

which is not currently possible because `helper` and `decorator.h` are different objects (#436).

I also made `HelperProxy#method_missing` define a method on the `HelperProxy` class so that future calls to the helper don't go through `method_missing` again, à la #89.