ruby on rails - Rspec: test for all controller actions -


i have rspec controller test:

describe testcontroller   "test actions"     all_controller_actions.each |a|       expect{get a}.to_not rais_error(someerror)     end   end end 

how implement all_controller_actions method?

while prefer test 1 one, question doable.

# must state variable excluded later because mycontroller has them.  = applicationcontroller.action_methods  m = mycontroller.action_methods  # custom methods exclude e = %w{"create", "post}   @test_methods = m - - e  describe testcontroller   "all actions got response"     @test_methods.each |t|       expect{get t}.to_not rais_error(someerror)     end   end end 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -