RSpec 3 - Test controller action that does not have routes

259 views Asked by At

I have a controller and there is an action within that controller. That action contains only a few lines of code and this method doesn't have any routes, as follows:

class MyController < ApplicationController
   def action_a # an action does have routes
      ..some code..
   end

   def action b #(an action without a route, just contains few logic)
      ..some code..
   end
end

My question is what is a proper way to write rspec to test action_b ? Any help would be appreciated.

1

There are 1 answers

3
Andy Waite On BEST ANSWER

action_b should really be a private method. Normally, you would not test this directly, you would verify it implicitly by testing action_a.