[Rspec-devel] RSpec on Rails
Lachie
lachiec at gmail.com
Thu Jun 1 20:19:00 EDT 2006
On 6/2/06, Steven R. Baker <srbaker at pobox.com> wrote:
> > Hi everyone,
> > I've been working on an RSpec plugin for rails
>
> Great, so have I. You should look me up on irc (srbaker) so we can
> combine notes.
I'll try... I'm in Australia, so timezones will be an issue. Do you
tend to hang out there all day?
>
> > Features:
> > * minimal impact on RSpec - overwrites Spec::Runner::Context#run, adds
> > to Context, Specification and ExecutionContext
> > * pragmatic - only supports what I (and my contributor :) have
> > needed so far
> > * mashes in rails' fixture loading - I only use yaml
> > * mashes in rails' test controller setup
> > * mashes in much of zenspider's Test::Rails::ControllerTestCase
> > * can automatically load the Controller for verification.
> > * many of rails' custom, crufty asserts aren't even needed with the
> > beauty of "should"
> > * provides rake tasks for running specs
> > * uses the plugin install hook to create a spec directory, including
> > the spec_helper required to use the rails features
> > * its a plugin, so the barrier of using it in a rails app is very low.
>
> I have rake integration, database loading, fixtures, etc. We should
> discuss the best way to set up the environment for what Rails Tests
> use for controller loading. Currently, the way functional tests are
> done in rails encourages (requires?) a 1:1 Class:Test, which is bad.
Would you mind expanding on this? I'm not exactly sure how this translates to
rSpec.
I usually create contexts so that their meaning in English is heightened.
Generally, that means 1 Controller -> 1 spec file but 1 Controller ->
many contexts.
I dig the rSpec approach's openness.
> > AntiFeatures:
> > * pragmatic - only supports what I (and my contributor :) have
> > needed so far
> > * opportunistic - lots of snatch-n-grab code from Rails and Zenspider
> > source. I blame the tightly coupled design of the original code, of
> > course.
>
> I have been pulling the code that I've been using from rails into a
> module that mixes in at run time. This will get submitted as a patch
> back to rails, since Rails Testing, RSpec, and the RailsTest stuff
> use a lot of ti.
I thought of doing that too. But Rails-corites have said that the way
to Rails' heart is through its plugins. In other words, its only worth
their while to integrate that kind of patch if the popularity of the
rSpec Way mandates it.
Also, IMO the rails stuff works, but could be better. In particular,
Zenspider's Controller and View TestCase stuff makes much more sense
than Rails' own.
I don't think there's anything super complex or holy about the Rails
internal implementation.
> > However, it does bring RSpec to Rails. My recent apps have received a
> > dose of RSpec goodness, and both I and the apps have benefitted
> > immensely from the experience.
> >
> > Is anyone actively pimping RSpec? I've talked to fellow Rails/Ruby
> > devs who've never heard of it!
>
> A couple of us have been speaking at conferences and user groups on
> the subject. The word is getting around well.
Unfortunately, most of the world doesn't get the same glut of ruby or
rails conferences which the north america or even europe does.
<sniff,sniff>
Australia, for example, has zero. We are connected via lists like
this, and IRC when the timezones match -- but we have to know about
them first. The blogosphere is really the only way we can learn about
the new coolness.
I think that rSpec needs lots more good blog articles - tips and
tricks, style guides, complex usage. The spec site is very slick and
quite helpful, but you have to want it before you go there. Are there
some out there which I've overlooked?
Fortunately, a rails community is growing in Sydney. There are
probably half a dozen of us, whom I may have the opportunity to
present rSpec and my plugin.
> -Steven
>
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel
--
Lachie
http://lachie.info/
http://www.flickr.com/photos/lachie/
More information about the Rspec-devel
mailing list