Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionController::RoutingError: No route matches {:action=>"testmail", :controller=>"spree/admin/mail_methods"} #1180

Closed
citrus opened this issue Feb 23, 2012 · 4 comments

Comments

@citrus
Copy link
Contributor

@citrus citrus commented Feb 23, 2012

While running integration tests on extensions I get this error and I can't figure out what's causing it.

testmail_admin_mail_method_url(Spree::Admin::UploadIntegrationTest):
ActionController::RoutingError: No route matches {:action=>"testmail", :controller=>"spree/admin/mail_methods"}
    /Users/Spencer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:466:in `raise_routing_error'
    /Users/Spencer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:456:in `generate'
    /Users/Spencer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:495:in `generate'
    /Users/Spencer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:520:in `url_for'
    /Users/Spencer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/url_for.rb:147:in `url_for'
    /Users/Spencer/.rbenv/versions/1.9.2-p290/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/action_dispatch/routing/route_set.rb:201:in `testmail_admin_mail_method_url'

To recreate this error follow these steps with spree_essentials as an example:

git clone git://github.com/citrus/spree_essentials.git
cd spree_essentials
bundle install
bundle exec dummier

Now run rake and all tests should pass. Comment out lines 28 through 31 in lib/spree_essentials/test_helper.rb and you should see the error.

Does anybody have any idea what is causing this? And what is testmail_admin_mail_method_url used for?

Thanks!!

@radar
Copy link
Member

@radar radar commented Feb 23, 2012

You should look at how we deal with this problem inside of Spree. To be specific this line which includes this module that provides a method that's used like this.

The reason for it to be failing is because the engine's routes are not included by default into your RSpec environment, and so you have to include them and use them like this.

You'll also run into a similar issue with controller specs too. We have this file which is included automatically in spec/spec_helper.rb.

@radar radar closed this Feb 23, 2012
@citrus
Copy link
Contributor Author

@citrus citrus commented Feb 23, 2012

Awesome! Thank you @radar, this solved my issue.

@Numerico
Copy link

@Numerico Numerico commented Aug 21, 2013

I'm having no route matches in a controller spec indeed. Unfortunately, the links you provide are broken one year after.
In capybara I can use visit spree.my_path. But what about functional tests?
Cheers

@radar
Copy link
Member

@radar radar commented Aug 26, 2013

@Numerico in your functional tests, you should be including Spree::TestingSupport::ControllerRequests, and then using the spree_get, spree_post, spree_put and spree_delete methods in place of get, post, put, and delete respectively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.