DEV Community

Cover image for My First Ruby on Rails Presenter

My First Ruby on Rails Presenter

Max Antonucci on November 21, 2017

As part of my ongoing career quest to become full-stack, there's several tasks I must complete, such as: Storm the castle Slay the dragon Save th...
Collapse
 
philnash profile image
Phil Nash

Over my time using Rails I drifted in and out of using presenters. I don't know why though, they do make things a whole bunch easier and let the controller just get on with its job.

Did you consider writing tests for your presenter in this case?

Collapse
 
maxwell_dev profile image
Max Antonucci

I did briefly, although I haven't been focusing on testing enough as I should be lately. Is it normal practice to write presenter tests? I just assumed each presenter should have its own tests to ensure all the data is calculated and modified correctly.

Collapse
 
philnash profile image
Phil Nash

I would normally write tests for a presenter if I was writing one, exactly as you put it, to ensure that the calculations are correct.

One other thing I was interested in, you used delegate to delegate methods on your presenter to the underlying @category but also defined the id, created_at and budget methods. Was there a reason for that?