amatsuda/active_decorator

Undefined decorator methods in test environment

Closed this issue · 5 comments

Unless I manually include my decorators into my models, my tests (RSpec and Turnip) that utilize decorator methods fail. I'd be happy to work on this and submit a pull request if you want to give your input and point me in the right direction. Thanks.

I'm having a slightly different problem that might be related: the unit tests are choking on calls to Rails' view helpers.

  2) ProspectDecorator#priority_icon 
     Failure/Error: subject { prospect.priority_icon }
     NoMethodError:
       undefined method `content_tag' for #<Prospect:0x007fe88bb7fe78>
     # ./app/decorators/prospect_decorator.rb:36:in `priority_icon'
     # ./spec/decorators/prospect_decorator_spec.rb:39:in `block (3 levels) in <top (required)>'
     # ./spec/decorators/prospect_decorator_spec.rb:40:in `block (3 levels) in <top (required)>'

This makes them impossible to test without some ridiculous stubbing.

Related I guess to #28

Documented via #55 📝