Forum: RSpec A smarter autospec?

Posted by Fernando Perez (fernando)
on 2008-11-09 18:05
Let's say I change a method in one of my models in a Rails app.

I hit save: autospec kicks in and starts specing.

But I haven't yet edited my spec(s) to the new method name so the specs
will obviously fail, but I already know that. So I edit my specs.
Autospec will run a second time (or even more if more than one spec file
is changed).

But I haven't yet edited my controller(s) to reflect the new change(s),
so I edit more files and save, therefore Autospec will run again.

In such case (which happens often), autospec has been running a few
times for nothing. Would it be possible to implement a sort of timeout
(like 10") to let us make additional changes to other files before
autospec starts his job? It's pretty annoying to have growl display
plenty error messages as we already know specs will fail.
Posted by Matt Wynne (mattwynne)
on 2008-11-09 18:15
(Received via mailing list)
On 9 Nov 2008, at 17:05, Fernando Perez wrote:
>
> But I haven't yet edited my controller(s) to reflect the new  
> change(s),
> so I edit more files and save, therefore Autospec will run again.
>
> In such case (which happens often), autospec has been running a few
> times for nothing. Would it be possible to implement a sort of timeout
> (like 10") to let us make additional changes to other files before
> autospec starts his job? It's pretty annoying to have growl display
> plenty error messages as we already know specs will fail.

Personally, I draw great comfort from those error messages.
http://www.google.co.uk/search?q=red+green+refactor

cheers,
Matt
Posted by Joseph Wilk (joesniff)
on 2008-11-09 18:18
(Received via mailing list)
Fernando Perez wrote:
> so I edit more files and save, therefore Autospec will run again.
>
> In such case (which happens often), autospec has been running a few
> times for nothing. Would it be possible to implement a sort of timeout
> (like 10") to let us make additional changes to other files before
> autospec starts his job? It's pretty annoying to have growl display
> plenty error messages as we already know specs will fail.
>   
The problem is I would want feedback asap on a fail. The faster I get
feedback the earlier I realize I've broken something and the easier it
will be to localise the error. I think getting error messages I already
know about is easily worth the sacrifice of this.
--
Joseph Wilk
http://blog.josephwilk.net
Posted by Ashley Moran (Guest)
on 2008-11-09 18:32
(Received via mailing list)
On Nov 09, 2008, at 5:05 pm, Fernando Perez wrote:

> Let's say I change a method in one of my models in a Rails app.
>
> I hit save: autospec kicks in and starts specing.
>
> But I haven't yet edited my spec(s) to the new method name so the  
> specs
> will obviously fail, but I already know that. So I edit my specs.
> Autospec will run a second time (or even more if more than one spec  
> file
> is changed).

Why are you routinely changing the code without updating the specs in
advance?

Ashley

--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
Posted by Fernando Perez (fernando)
on 2008-11-09 18:58
> Why are you routinely changing the code without updating the specs in
> advance?
> 
> Ashley
That's not the point of my question.

Anyway I have just discovered TextMate has a "save-all" keyboard 
shortcut that works exactly as I want it. Now autospec runs only once. 
Sweet :-)
Posted by Ashley Moran (Guest)
on 2008-11-09 20:12
(Received via mailing list)
On Nov 09, 2008, at 5:58 pm, Fernando Perez wrote:

>> Why are you routinely changing the code without updating the specs in
>> advance?
>
> That's not the point of my question.

I learnt early on when I joined this list, that whenever I ask a
question of the form "When I do XXX, I get weird/undesirable
behaviour, how do I avoid it?", 90%+ of the time the answer is of the
form "Don't do XXX."*.  What you were describing sounded like
something you shouldn't be doing often enough to worry about it's
consequences, but I wanted to rule that out first...

Ashley

* Probably half the emails I write to rspec-users I delete without
sending, because by the time I've explained the problem in enough
detail, I realise I've answered my own question

--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
Posted by Caius Durling (Guest)
on 2008-11-09 20:39
(Received via mailing list)
On 9 Nov 2008, at 19:07, Ashley Moran wrote:

> * Probably half the emails I write to rspec-users I delete without  
> sending, because by the time I've explained the problem in enough  
> detail, I realise I've answered my own question


Technical term is "Teddy Bear Programming" :)

C
---
Caius Durling
caius@caius.name
+44 (0) 7960 268 100
http://caius.name/
Posted by Ashley Moran (Guest)
on 2008-11-09 21:09
(Received via mailing list)
On Nov 09, 2008, at 7:35 pm, Caius Durling wrote:

>> * Probably half the emails I write to rspec-users I delete without  
>> sending, because by the time I've explained the problem in enough  
>> detail, I realise I've answered my own question
>
>
> Technical term is "Teddy Bear Programming" :)

So it is :)

http://headrush.typepad.com/creating_passionate_users/2005/01/rubberducking_a.html

And it's known as rubber-ducking too.  There's a definite Sesame
Street vibe here.  From now on all my programming sessions are going
to look like this:

http://uk.youtube.com/watch?v=B8IfCSnYPYo

And I'll have NO bugs!

Ashley

--
http://www.patchspace.co.uk/
http://aviewfromafar.net/
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.