After adding three custom member routes, everything works fine in the development and production environments, but fails in the testing environment.
In config/routes.rb, our custom member routes are copy, download and abort:
resources :kw_researches do
member do
get 'copy'
get 'download'
put 'abort'
end
end
Running rake routes shows the member routes are all fine and dandy (not a big surprise, as they actually work in production and development):
$ rake routes
copy_kw_research GET /kw_researches/:id/copy(.:format) kw_researches#copy
download_kw_research GET /kw_researches/:id/download(.:format) kw_researches#download
abort_kw_research PUT /kw_researches/:id/abort(.:format) kw_researches#abort
kw_researches GET /kw_researches(.:format) kw_researches#index
POST /kw_researches(.:format) kw_researches#create
new_kw_research GET /kw_researches/new(.:format) kw_researches#new
edit_kw_research GET /kw_researches/:id/edit(.:format) kw_researches#edit
kw_research GET /kw_researches/:id(.:format) kw_researches#show
PUT /kw_researches/:id(.:format) kw_researches#update
DELETE /kw_researches/:id(.:format) kw_researches#destroy
But the tests in both ./spec/views/kw_researches/index.html.erb_spec.rb and ./spec/integration/kw_research_index_page_spec.rb fail with errors such as the following:
10) KwResearch index page KwResearch has all relevant actions
Failure/Error: visit kw_researches_path
ActionView::Template::Error:
undefined method `copy_kw_research_path' for #<#<Class:0x007faab8c9a238>:0x007faab717fd40>
Why is copy_kw_research_path not available, while its good (standard helper) friend edit_kw_research_path is? Thanks…
When we returned to the problem two weeks later, it just disappeared: It would appear that restarting both the rails server (thin) and guard solved it.