jonleighton / focused_controller

MIT License
468 stars 27 forks source link

Allow default rails interface in functional tests of controllers #30

Closed timcowlishaw closed 11 years ago

timcowlishaw commented 11 years ago

Hi Jon!

Thanks a lot for focused_controller - it's tidied up the controller layer of the app I'm working on at the moment no end!

This patch is a very small proposal regarding the functional testing helpers. In my app, all but one of my controllers use focused controller, so therefore I thought I'd include the helpers in all my controller specs using the rspec config:

config.include FocusedController::RSpecFunctionalHelpers, :type => :controller 

However, I have one controller that's un-focused (as it needs to override some behaviour in Devise), and sadly this breaks my vanilla rails controller specs for that.

This patch adapts the functional test helpers to allow them to be called with an action name optionally, (as in the default rails implementation), defaulting to the FocusedController action name if none is supplied, therefore ensuring that including the functional helpers doesn't break existing rails controller specs.

Thanks!

Tim

jonleighton commented 11 years ago

Seems reasonable, I'll merge, thanks!