Forum: Ruby on Rails Capybara throws printer errors with every test

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
159d448982fbdf2e8ee0394c5051b5c5?d=identicon&s=25 Andy J. (f2andy)
on 2013-10-07 11:41
I am in the process of upgrading from Rails 3 to 4. Whenever I run a
test I always get two errors like this:

ActionController::UrlGenerationError: No route matches {:action=>"test",
:controller=>"printers"} missing required keys: [:id]

If I test all my controllers I get 2, if I just test one of my models I
get the same 2. They are nothing to do with any test I have written
myself, they seem to be tests Capybara is running on itself.

The problem seems to arise because I have a route for printers in my
project, set up like this.

 resources :printers do
    member do
      get :test

Okay, so just rename it to something to stop the name collision... If I
rename "test" to "test_printer45745dc", or I change it from GET to POST
it still fails! And if I have a second member line in there, I get four

If I change it to a collection, I get a different error:

ArgumentError: Missing host to link to! Please provide the :host
parameter, set default_url_options[:host], or set :only_path to true

What Capybara seems to do is to generate tests on the fly, based on the
routes, and then generate errors however they are set up.

Why would it do that? What can I do about it?

I am using JRuby 1.7.4 on Windows, by the way
159d448982fbdf2e8ee0394c5051b5c5?d=identicon&s=25 Andy J. (f2andy)
on 2013-10-08 15:18
The problem seems to be the name of the action, "test", and nothing to
do with printers at all. Any action that starts "test" seems to be
affected, though I am still not sure why.
This topic is locked and can not be replied to.