简体   繁体   中英

How to write rspec test for custom routes

I have the following custom route:

match '/boeing-737', controller: :planes, action: :display, id: 1000

The 'get' method in rspec only accepts action name, but doing this:

get :display, id: 1000

I am getting:

And there is no option to do get '/boeing-737' in the test.

找到解决方案后,id必须是字符串值,我将其发布在这里,因为我认为该用例在rspec中没有足够的文档说明:

match '/boeing-737', controller: :planes, action: :display, id: '1000'

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