Bit beyond me, but the RSpec users' google group is an ace resource for this sort of thing.
2009/11/10 Dave Spurr <[email protected]> > I'm getting really cheesed off with RSpec not matching some of my routes > when controller testing (that appear in the rake routes output, and via HTTP > requests) when I have subdomain checking (courtesy of subdomain-fu) on > namespaces. The really annoying thing is it's working fine for routes that > aren't at the root of the namespace. > > E.g. > > map.namespace :foo, :path_prefix => '', :conditions => { :subdomain => > 'foo' } do |foo| > > foo.bars, :controller => 'bars', :only => [:show] do |bar| > bar.resources some_things .... > end > > foo.resources :monkeys > end > > My specs for bars/some_things/ all resolve the routes fine. > > Any spec that tries to hit monkeys/ give me a even though these routes > exist > > No route matches {:controller=>"foo/monkeys", :action=>"update"} > > I've tried setting both @request.host and request.host to foo.test.host but > that doesn't make a blind bit of difference. > > Maybe RSpec is doing something different with the request, as if I monkey > patch the routing with the following I never get the dumps when using RSpec > even though both these are called pretty early on in route recognition. > > module Foo > > module RouteSetExtensions > def self.included(base) > base.alias_method_chain :extract_request_environment, :debug > base.alias_method_chain :recognize_path, :debug > end > > def recognize_path_with_debug(path, environment={}) > puts path > puts environment.to_yaml > recognize_path_without_debug(path, environment) > end > > def extract_request_environment_with_debug(request) > env = extract_request_environment_without_debug(request) > puts env.to_yaml > env > end > end > > end > > ActionController::Routing::RouteSet.send :include, Foo::RouteSetExtensions > > So as you can probably tell, I'm out of ideas so I wondered if anyone had > any thoughts. > > -D > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NWRUG" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nwrug-members?hl=en -~----------~----~----~----~------~----~------~--~---
