[rspec-users] RSpec a DSL

David Chelimsky dchelimsky at gmail.com
Sat Oct 25 09:14:37 EDT 2008

On Sat, Oct 25, 2008 at 1:45 AM, Luis Lavena <luislavena at gmail.com> wrote:
> Hello Guys,
> I'm creating a small DSL that simplifies the creation of Rake tasks to
> handle multiple packages and their dependencies.
> (sorry David, tried Thor, do not do what I need).
> The thing is that basically I have several classes that "help"
> constructing the final Rake tasks, and also are not called directly
> but using some helpers in the middle.
> These tasks involves the creation, download, extraction, compilation
> and installation of several files and some hooks pre and post these
> actions.
> Since the goal is try to specify the behavior, I wonder if any of you
> guys succeed spec'ing your Rake actions and if so, what was your
> approach. Right now I'm using a fake "fixtures" folder where I put the
> different rake files for specs and adjust the "dumping" to a temporary
> folder that I use to verify the results.
> Maybe should I go with a feature/scenario design instead of low level specs?

I'd start with that anyhow, using cucumber. Then crack open rspec when
you have some details that you want to drive in a more granular way
(probably influencing your design in the process).

Last year I heard Martin Fowler speak about DSLs and one thing he said
that really stuck with me (largely because it's been a pain point w/
RSpec) is that you should make a clean separation between the DSL and
the underlying framework. I don't know what that looks like yet, but I
can imagine that you'd end up with a bunch of cucumber scenarios for
the DSL and then rspec code examples for the underlying framework.

Please report back on your progress.


> BTW: The DSL looks like this:
> http://gist.github.com/19707
> Thanks in advance for any suggestions.
> Regards,
> --
> Luis Lavena
> AREA 17
> -
> Human beings, who are almost unique in having the ability to learn from
> the experience of others, are also remarkable for their apparent
> disinclination to do so.
> Douglas Adams
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list