[rspec-users] RSpec Routing DSL

David Chelimsky dchelimsky at gmail.com
Mon Oct 18 23:29:15 EDT 2010

On Oct 18, 2010, at 1:20 PM, Joe Fiorini wrote:

> I started testing routes for the first time in Rails 3 this weekend
> during Rails Rumble. I was so exhausted that I found writing route
> specs a very painful task. I came up with my own routing DSL and I'd
> love to see it get included in RSpec itself. Before I start adding the
> code to rspec-rails, I'd like to get some feedback and see if there
> are some ways we could clean it up. Basically the DSL looks like:
> describe "My routes" do
>  get "/blog" => { controller: "blogs-controller", action: "index" }
> end
> You can see all the details and the module used to make it work here:
> http://gist.github.com/630176. Thoughts?

Hey Joe - I think this is really nice, but it's unlike any other matchers/macros that ship with RSpec, so I don't feel it belongs in RSpec as it stands today. If future versions move in a direction that better aligns with this we can revisit.

That said, I think it's a nice clean DSL and recommend that you publish it as a gem and share it with those who wish to use it.

In terms of improving it, the only thing I see missing is a way of specifying a route that is not supported. Maybe something like:

  get "/blog" => unroutable


More information about the rspec-users mailing list