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

C56d14d32eddc6e2bd6364bc2ebbf542?d=identicon&s=25 Andy Joel (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
C56d14d32eddc6e2bd6364bc2ebbf542?d=identicon&s=25 Andy Joel (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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.