Forum: RSpec A smarter autospec?

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.
059ed46172a087063ce26250e44c8627?d=identicon&s=25 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.
Cdf378de2284d8acf137122e541caa28?d=identicon&s=25 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
F68f69615423aa3851bd445409754dbf?d=identicon&s=25 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
2ce9c0106b5851b2294ba5eb9f5c04bd?d=identicon&s=25 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/
059ed46172a087063ce26250e44c8627?d=identicon&s=25 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 :-)
2ce9c0106b5851b2294ba5eb9f5c04bd?d=identicon&s=25 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/
5f01846708cd8d474cae677fb20c786e?d=identicon&s=25 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/
2ce9c0106b5851b2294ba5eb9f5c04bd?d=identicon&s=25 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_us...

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/
This topic is locked and can not be replied to.