On 7/5/10 2:14 AM, Matt Wynne wrote:
> Seems like progress. One thought: Why not use a macro-style syntax to 
> eliminate the boring boilerplate call to #it / #example and generate examples 
> instead?
I thought this was an insightful comment.  Riffing on that, I get what
clearly becomes a DSL along the lines of the following:

describe_routes do  # method of a controller spec
  describe "GET /foo"
    recognizes "GET /foo"  # redundant?
    ignores "PUT /foo"
    formats [ :html, :json ], :not => [ :xml, :pdf ]
    generated_from "controller#action", :args => ijef
    helper :action_controller_path
  end
end

You could possibly mix and match some of these, like with multiple
"recognizes".  Some of these assertive verbs could certainly be
optimized too.  And, at risk of being promoted to Captain Obvious, I'll
point out that the examples generated from these declarations can be
crystal clear in their phrasing because the DSL is.. well, more specific
to the domain.

I'm not sure how to honor the one-directional requirement, but if there
are use-cases, I think we could express that case in this DSL and
specify the expected outcomes.

Of course, there's more than one way to do it.  

Randy
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to