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:
https://gist.github.com/712968
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?