[rspec-users] Philosophical questions

Evan David Light evan at tiggerpalace.com
Thu Sep 13 18:38:50 EDT 2007

On Sep 13, 2007, at 6:10 PM, Pat Maddox wrote:

> On 9/12/07, Evan David Light <evan at tiggerpalace.com> wrote:
>> ... (Evan's RSpec n00bish ramblings) ...

>> Thanks,
>> Evan
> Hi Evan,
> I think you have the right idea about approaching specification from
> the user's viewpoint (or more appropriately, as David C said, business
> value).  It just seems like you're not completely familiar with the
> tools that RSpec provides.  Nothing wrong with that, because one of
> the most important tools still hasn't been officially released!

	Quite so.  Certainly not with RSpec-on-Rails at least.  I have been  
milling around the RDoc. in my spare moments and have written a few  
specs for a statistical analysis tool that I wrote recently.  Work  
has been  dragging me away from coding too much lately.  Fortunately,  
I've had this afternoon and have all of tomorrow to get my hands dirty.

> View specs are for unit testing your view, not for exercising
> functionality.  In fact they shouldn't do very much at all.  They
> should be pretty simple...make sure that certain attributes from an
> object are being displayed, perhaps how some of the markup is
> structured, etc.  That can be brittle, and will become painfully so if
> you specify too much.  You'll want to specify the bare minimum it
> takes to get the job done.

	Understood.  Admittedly, I had not even seen a Rails Integration  
Test until I after I read a few posts on this list and did some  
googling.  I've been fortunate to be able to pick Ruby for my current  
project but I haven't had an excuse to develop a production Rails app  
until a few days ago.  I've only done a lot of tinkering at home for  
which I now wish that I had used TDD or BDD.  That said...

> Others have mentioned Story Runner, which is a new feature of RSpec.
> I'm pretty jazzed about it, because it's a very lightweight tool for
> acceptance tests.  The structure is clean, it just makes sense to me.
> I wrote an introduction which you can find at
> http://evang.eli.st/blog/2007/9/1/user-stories-with-rspec-s-story- 
> runner.
>  It also has links to some of Dan North's articles which are a great
> resource for really getting BDD.

	I know!  I saw them both!  After reading David's messages from  
yesterday, I was inspired to checkout from trunk this afternoon,  
plowed through some of the spec for Story Runner,  and then some of  
the examples.  I love what I see.  My immediate impression was Story  
== Use Case.  That seems to be bear out the more that I looked at the  
RSpec for Story Runner and at the code samples.  In fact, I was just  
getting ready to dig into writing my first Story when I decided to  
pop over to the mailing list for a second.  Who needs to read an  
RDoc? ;-)

> As far as tackling BDD from the top down...for me, it all starts with
> a Story.

	I can totally see that.  Use cases tend to proceed lower level  
requirements in the waterfall process (not that many of us are using  
this one anymore...).

> This can be a bit tough if you don't write user stories to
> define features, and instead just get told "hey we should add this."

	Not necessarily.  Just as you say below, the Story lets you put meat  
on that skeleton of an idea.

> We've already resolved an
> issue like this...I showed him the story, he said that he was making
> different assumptions.  I coded those up into the story and off we
> went.
	Very cool.

> I hope you check out Story Runner, it's a really cool tool.  If your
> development philosophy is about creating business value, then it
> should totally vibe with you.  From there you use the finer-grained
> aspects of RSpec to achieve that business value with code that doesn't
> drive you insane :)

	Seriously, this is exactly the kind of thing that I was looking for  
when I mistakenly began playing with View specs.

	Now I'm also going to have to "Storify" my personal Rails project  
when I get some spare time!

	Thanks guys.  This looks like it will be very useful.  More as I dig  

Evan Light
IMs (all): sleight42

More information about the rspec-users mailing list