Rspec2, rails 3, subdomain constraints

I’m trying to constrain access to admin routes in my application to
either www or canonical. I need the custom constraint in
root_domain.rb (RootDomain) to handle the canonical part. Since the
subdomains will represent accounts, I don’t want /admin available on
any of the subdomains.

Here is a gist showing exactly how my code and tests are setup:

In the first test, I expect /admin not to be routable on a generic
subdomain (this test currently doesn’t pass). However, when I check in
a browser, I receive a not routable error.

If I remove the custom constraint and use, for example, the :subdomain
=> “www” constraint, the test does pass. I’ve tested both the custom
constraint and the subdomain constraint in my browser and both
restrict access as expected.

Is this an issue with rspec and how it handles constraints or am I
doing something wrong?

https://rails.lighthouseapp.com/projects/8994/tickets/5805-assert_recognizes-does-not-support-constraints
anyone?

On Nov 25, 5:03am, Evgeniy D. [email protected] wrote:

#5805 [PATCH] assert_recognizes does not support constraints - Ruby on Rails - rails
anyone?

I appreciate the reply. Given that these routing constraints are core
to my application do you have any suggestions as to how to test this
in the meantime? It makes me uneasy to have them sitting there
completely untested as this point.

John