felipeelias/resubject

Unable to use helpers in tests

Closed this issue · 2 comments

For some reason when I use the resubject/rspec helper, I'm not able to test methods which use helpers. Basically the code you're using is

SomePresenter.new(object, ActionView::Base.new)

If then the presenter method looks something like

def foo
  helpers.number_with_precision(bar)
end

it yields weird errors which don't happen when the same code is executed outside the context of the presenter.

TypeError: can't convert NilClass to String

Sorry that I'm not very specific, but I wasn't able to diff out the root cause of this from just looking at the source.

Could you post the file/line number of the error?

It seems that you bar is nil, but I can't tell without the file/line number.

Hi, I'm closing this because of no activity. Please reopen if your problem wasn't solved yet.