0

I'm testing my application using rspec and poltergeist/phantomjs, and after I installed the gem friendly_id to change my default routes, all my javascript tests started to throw this error:

Failure/Error: Unable to find matching line from backtrace
    ActiveRecord::RecordNotFound:
        Couldn't find SelectionProcess with id = assets

My assets configs in test.rb:

config.serve_static_assets = true 
config.static_cache_control = "public, max-age=3600"

The last lines in backtrace:

 # /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/activerecord-3.2.12/lib/active_record/relation/finder_methods.rb:267:in `find_by_attributes'
 # /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/activerecord-3.2.12/lib/active_record/dynamic_matchers.rb:50:in `method_missing'
 # /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:109:in `find_resource'
 # /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:68:in `load_resource_instance'
 # /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:32:in `load_resource'
 # /Users/Augusto/.rvm/gems/ruby-1.9.3-p362@startupbase/gems/cancan-1.6.9/lib/cancan/controller_resource.rb:10:in `block in add_before_filter'

1 Answers1

0

Sounds like friendly_id is kicking in for asset urls as well. If you define friendly_id for the root url (/) all asset requests (/assets) will be taken over. Therefore a Rails tries to find a record with id = assets.

iltempo
  • 15,718
  • 8
  • 61
  • 72