I have a route that does an external redirect, which I want to test like,
it "should route to the www site" do
There is apparently no standard way to test for redirects (see http://stackoverflow.com/questions/10842448/do-routing-specs-support-redirect-routes-rspec), which is why I am trying to use a request spec for this.
However, I'm unable to override the :type of my spec like,
describe "redirected routes", :type => :request do
This looks like a bug.
I'm guessing the rspec-rails auto typing is happening later in the scope (or both are applying), so a workaround for this would be to place the spec in a different folder...
Yes, I worked around by putting it in spec/external_routing. The issue is about this being confusing. We should add something to the docs (or a feature) to make it clearer how to spec external redirects.
Well I also feel you should be able to specify the type metadata regardless of any auto setup happening behind the scenes. A caveat could also be added to the documentation, but that's actually a Rails issue too (as it's there test helpers in use)
Docs welcomed as a PR, but I'm going to close this issue as I think everything is technically performing correctly.
Would you like me to update the README and send a pull request?
@alindeman are we concerned at all by the fact that the magic overrides manually set :type?
FWIW, I'd advocate moving away from the auto-assignment of :type based on file location. I suggested an alternate approach in #662, and if we're going to move in that direction the 3.0 release is the time to do so.
Keeping with the rails way, it would be great if by default :type was derived based on location but does not overwrite an override that the spec author has put in.
Allows metadata to override the type of Rails spec