简体   繁体   中英

RSpec 3 - Test controller action that does not have routes

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM