How do you test a Rails controller method exposed as a helper_method?

后端 未结 5 2480
眼角桃花
眼角桃花 2021-02-18 17:22

They don\'t seem to be accessible from ActionView::TestCase

5条回答
  •  囚心锁ツ
    2021-02-18 17:50

    Indeed they're not. The view tests are specifically for the views. They don't load the controllers.
    You should mock this method and make it return whatever is appropriate depending of your context.

提交回复
热议问题