Forum: RSpec RSpec a DSL

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E7cff3cfd41c495e1012227d7dc24202?d=identicon&s=25 Luis Lavena (luislavena)
on 2008-10-25 08:47
(Received via mailing list)
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?

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
5d38ab152e1e3e219512a9859fcd93af?d=identicon&s=25 David Chelimsky (Guest)
on 2008-10-25 15:17
(Received via mailing list)
On Sat, Oct 25, 2008 at 1:45 AM, Luis Lavena <luislavena@gmail.com>
wrote:
> 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.

Cheers,
David
This topic is locked and can not be replied to.