Re: [rspec-users] RSpec makes me want to write better code

2009-04-03 Thread Chuck van der Linden
dammit me be moron, forgot to edit subject On Wed, Apr 1, 2009 at 11:33 AM, Chuck van der Linden cerne...@gmail.comwrote: Date: Wed, 1 Apr 2009 17:24:21 +0100 From: aidy lewis aidy.le...@googlemail.com Subject: Re: [rspec-users] RSpec makes me want to write better code To: rspec-users

Re: [rspec-users] RSpec makes me want to write better code

2009-04-01 Thread aidy lewis
Hi David 2009/3/31 David Chelimsky dchelim...@gmail.com: The point of TDD is writing small examples and small bits of code in a cycle. The point of BDD is to write high level scenarios so you know what code to write, but then drive it out in detail with TDD. Does this necessitate that the

Re: [rspec-users] RSpec makes me want to write better code

2009-04-01 Thread David Chelimsky
On Wed, Apr 1, 2009 at 8:01 AM, aidy lewis aidy.le...@googlemail.com wrote: Hi David 2009/3/31 David Chelimsky dchelim...@gmail.com: The point of TDD is writing small examples and small bits of code in a cycle. The point of BDD is to write high level scenarios so you know what code to

Re: [rspec-users] RSpec makes me want to write better code

2009-04-01 Thread aidy lewis
Hi David 2009/4/1 David Chelimsky dchelim...@gmail.com: . That said, in some idealistic BDD fashion, I'd think the best deal would be the tester and developer pairing on automating AC. Then that developer would pair with another developer driving out the code w/ TDD. If we have two different

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread Fernando Perez
Fernando Perez wrote: Hi, Today is a big day. I officially transitioned from manually testing by clicking around in my app, to automated testing with RSpec + Autotest. 6 months since my initial post, what happened in between? - My controllers are getting anorexic, and that's good. An action

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread Fernando Perez
By getting, do you mean new controllers arrive skinny? Or that you have refactored the same fat controllers, over time, until they are skinny? The latter is preferred, because we should not be writing the same sites over and over again. In theory! My good ole' fat pig controllers, are

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread Phlip
Fernando Perez wrote: As a habit I like to abuse of the save button even if I only corrected some typos in comments, or changed the indentation. Suddenly autotest would kick in for nothing. Autotest sucks. If we have too many tests, it runs them all, and this slows us down. Our editor

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread Zach Dennis
On Tue, Mar 31, 2009 at 1:10 PM, Zach Dennis zach.den...@gmail.com wrote: On Tue, Mar 31, 2009 at 5:39 AM, Fernando Perez li...@ruby-forum.com wrote: Fernando Perez wrote: Hi, Today is a big day. I officially transitioned from manually testing by clicking around in my app, to automated

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread David Chelimsky
On Tue, Mar 31, 2009 at 12:16 PM, Phlip phlip2...@gmail.com wrote: Fernando Perez wrote: As a habit I like to abuse of the save button even if I only corrected some typos in comments, or changed the indentation. Suddenly autotest would kick in for nothing. Autotest sucks. If we have too

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread aidy lewis
Hi Phlip, On 31/03/2009, Phlip phlip2...@gmail.com wrote: Our editor support for TDD also sucks. It should run the most recently edited test cases, nearly automatically. Everyone swears by Textmate, and it simply can't do that. Then, the Java-based editors also can't do it! What editor are

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread David Chelimsky
On Tue, Mar 31, 2009 at 4:39 AM, Fernando Perez li...@ruby-forum.com wrote: Fernando Perez wrote: Hi, Today is a big day. I officially transitioned from manually testing by clicking around in my app, to automated testing with RSpec + Autotest. 6 months since my initial post, what happened

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread Phlip
aidy lewis wrote: What editor are you then proposing? Or are you saying that all current editors lag behind XP practices? http://www.oreillynet.com/onlamp/blog/2008/05/dynamic_languages_vs_editors.html ___ rspec-users mailing list

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread Fernando Perez
Please be careful when making absolute statements like this. First of all, even just a bug reporting tool adds tremendous value for the customer, because your catching bugs before they make it to production. Value is what a customer is something he is ready to pay more money for. Well, we

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread David Chelimsky
On Tue, Mar 31, 2009 at 2:19 PM, Fernando Perez li...@ruby-forum.com wrote: Please be careful when making absolute statements like this. First of all, even just a bug reporting tool adds tremendous value for the customer, because your catching bugs before they make it to production. Value is

Re: [rspec-users] RSpec makes me want to write better code

2009-03-31 Thread Matt Wynne
On 31 Mar 2009, at 18:19, David Chelimsky wrote: Autotest sucks. If we have too many tests, it runs them all, and this slows us down. Or, conversely, autotest is awesome if you take the time to learn how to use it: http://blog.davidchelimsky.net/2008/3/5/limiting-scope-of-autotest

Re: [rspec-users] RSpec makes me want to write better code

2008-09-30 Thread Matt Wynne
I like them much better than the gremlins. On 30 Sep 2008, at 14:09, Dan North wrote: We do have pixies! They do all the magic stuff. How else do you think it happens? ;) 2008/9/27 aslak hellesoy [EMAIL PROTECTED] On Sat, Sep 27, 2008 at 10:32 PM, David Chelimsky [EMAIL PROTECTED] wrote:

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread Matt Wynne
On 26 Sep 2008, at 17:28, Mark Wilden wrote: On Fri, Sep 26, 2008 at 8:28 AM, Ashley Moran [EMAIL PROTECTED] wrote: One downside to STI is it forces you to leave NULL columns for attributes that don't exist in all models. This is also really bad for integrity. I think all of your

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread Dan North
2008/9/26 David Chelimsky [EMAIL PROTECTED] On Fri, Sep 26, 2008 at 12:18 PM, Mark Wilden [EMAIL PROTECTED] wrote: On Fri, Sep 26, 2008 at 9:47 AM, Ashley Moran [EMAIL PROTECTED] wrote: To me, spec'ing attributes is a red flag. It is not always a bad thing or wrong, but it suggests that

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread Mark Wilden
On Sat, Sep 27, 2008 at 11:26 AM, Dan North [EMAIL PROTECTED] wrote: It seems these conversations come up time and again because Rails overloads the idea of model. In a Rails app the model serves as both your domain model and your persistence strategy, because of the coupling inherent in the

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread David Chelimsky
On Sat, Sep 27, 2008 at 2:29 PM, Mark Wilden [EMAIL PROTECTED] wrote: On Sat, Sep 27, 2008 at 11:26 AM, Dan North [EMAIL PROTECTED] wrote: It seems these conversations come up time and again because Rails overloads the idea of model. In a Rails app the model serves as both your domain model

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread Mark Wilden
On Sat, Sep 27, 2008 at 1:32 PM, David Chelimsky [EMAIL PROTECTED]wrote: On Sat, Sep 27, 2008 at 2:29 PM, Mark Wilden [EMAIL PROTECTED] wrote: I guess this makes me an AR pixie. :) I *think* Dan means underlying magic code when he uses the word pixie. Oh. Right. Never mind. :) ///ark

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread aslak hellesoy
On Sat, Sep 27, 2008 at 10:32 PM, David Chelimsky [EMAIL PROTECTED] wrote: On Sat, Sep 27, 2008 at 2:29 PM, Mark Wilden [EMAIL PROTECTED] wrote: On Sat, Sep 27, 2008 at 11:26 AM, Dan North [EMAIL PROTECTED] wrote: It seems these conversations come up time and again because Rails overloads the

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread Ashley Moran
On Sep 27, 2008, at 12:16 am, David Chelimsky wrote: This is really a deficiency of ActiveRecord migrations in my view. DataMapper, for example, offers auto-migrations. You just add a property to your model file and it takes care of the migration for you. Of course, the way it does this is to

Re: [rspec-users] RSpec makes me want to write better code

2008-09-27 Thread Ashley Moran
On Sep 27, 2008, at 9:17 am, Matt Wynne wrote: I wouldn't call this the 'rails way' particularly - I think it's more of a general OO design philosophy that says the database is just an implementation detail. I have gradually moved, over the years, from feeling like the database needed to

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Ashley Moran
On 25 Sep 2008, at 17:48, Mark Wilden wrote: Each controller action only calls one model method other than an initial find or new.. I didn't get that article (or, rather, that particular subarticle) at all. I kinda tuned out when I read, Polymorphic associations, however, are

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Matt Wynne
On 26 Sep 2008, at 12:31, Ashley Moran wrote: On 25 Sep 2008, at 17:48, Mark Wilden wrote: Each controller action only calls one model method other than an initial find or new.. I didn't get that article[1] (or, rather, that particular subarticle) at all. I kinda tuned out when I read,

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 4:49 AM, Matt Wynne [EMAIL PROTECTED] wrote: Also why is the article so down on STI? What are the drawbacks? What do people use instead? I think the guy is really just down on inheritance itself, which is not an unusual nor even entirely unjustified attitude. Ruby has

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 4:31 AM, Ashley Moran [EMAIL PROTECTED] wrote: Is a better rule each controller action should contain no more than two branches? (But then, I try to apply that to all methods, and even then, I try to push conditional code as far down as possible.) On an OOP mailing

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Ashley Moran
On 26 Sep 2008, at 12:49, Matt Wynne wrote: Would you mind elaborating on why you don't like these? I'm pretty new to rails (but not programming generally) and rather naive about such things! It's quite hard to explain briefly, but basically it makes the predicate (interpretation of the

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Ashley Moran
On 26 Sep 2008, at 15:16, Mark Wilden wrote: Also why is the article so down on STI? What are the drawbacks? What do people use instead? One downside to STI is it forces you to leave NULL columns for attributes that don't exist in all models. This is also really bad for integrity. I

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 8:28 AM, Ashley Moran [EMAIL PROTECTED] wrote: One downside to STI is it forces you to leave NULL columns for attributes that don't exist in all models. This is also really bad for integrity. I think all of your comments make sense, but I did just want to call out

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Ashley Moran
On 26 Sep 2008, at 17:28, Mark Wilden wrote: I think all of your comments make sense, but I did just want to call out that the Rails way is not typically concerned with this sort of integrity at the database level. It's handled in the model. Ah ok, I wasn't sure if your comment was

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 9:47 AM, Ashley Moran [EMAIL PROTECTED] wrote: (be sure to spec what attributes your classes have if you're scared of pollution!) As part of the TDD process, I spec all attributes, but this doesn't seem universal. Is this a misconception? Do people actually make sure

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Scott Taylor
On Sep 26, 2008, at 1:18 PM, Mark Wilden wrote: On Fri, Sep 26, 2008 at 9:47 AM, Ashley Moran [EMAIL PROTECTED] wrote: (be sure to spec what attributes your classes have if you're scared of pollution!) As part of the TDD process, I spec all attributes, but this doesn't seem universal.

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 10:24 AM, Scott Taylor [EMAIL PROTECTED] wrote: I usually end up doing something like this: columns = [:email, :message] columns.each do |column| it should have a reader and writer for the column #{column} do @invite.should respond_to(column)

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Pat Maddox
Mark Wilden [EMAIL PROTECTED] writes: On Fri, Sep 26, 2008 at 4:49 AM, Matt Wynne span dir=ltrmailto:[EMAIL PROTECTED]/span wrote: Also why is the article so down on STI? What are the drawbacks? What do people use instead?I think the guy is really just down on inheritance itself, which is

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 11:46 AM, Pat Maddox [EMAIL PROTECTED] wrote: Mark Wilden [EMAIL PROTECTED] writes: Task class and an Appointment subclass. An Appointment (in this context) is simply a Task that can only be performed on one day. Otherwise it#39;s exactly like a Task (again, in

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Ashley Moran
On Sep 26, 2008, at 6:18 pm, Mark Wilden wrote: As part of the TDD process, I spec all attributes, but this doesn't seem universal. Is this a misconception? Do people actually make sure that all columns exist and can be written to and read from? What I meant by this was that say you have

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread David Chelimsky
On Fri, Sep 26, 2008 at 12:18 PM, Mark Wilden [EMAIL PROTECTED] wrote: On Fri, Sep 26, 2008 at 9:47 AM, Ashley Moran [EMAIL PROTECTED] wrote: (be sure to spec what attributes your classes have if you're scared of pollution!) As part of the TDD process, I spec all attributes, but this

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 3:10 PM, David Chelimsky [EMAIL PROTECTED]wrote: Now sometimes there will be some up-front modeling discussions and you may have a sense that a model needs a specific set of fields just because that's what the customer says. In those cases, I'd recommend trying to

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread David Chelimsky
On Fri, Sep 26, 2008 at 5:38 PM, Mark Wilden [EMAIL PROTECTED] wrote: On Fri, Sep 26, 2008 at 3:10 PM, David Chelimsky [EMAIL PROTECTED] wrote: Now sometimes there will be some up-front modeling discussions and you may have a sense that a model needs a specific set of fields just because

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread Mark Wilden
On Fri, Sep 26, 2008 at 4:16 PM, David Chelimsky [EMAIL PROTECTED]wrote: DataMapper, for example, offers auto-migrations. You just add a property to your model file and it takes care of the migration for you. The relationship between schema and models in Rails is weird. The basic source of

Re: [rspec-users] RSpec makes me want to write better code

2008-09-26 Thread David Chelimsky
On Fri, Sep 26, 2008 at 6:47 PM, Mark Wilden [EMAIL PROTECTED] wrote: On Fri, Sep 26, 2008 at 4:16 PM, David Chelimsky [EMAIL PROTECTED] wrote: DataMapper, for example, offers auto-migrations. You just add a property to your model file and it takes care of the migration for you. The

[rspec-users] RSpec makes me want to write better code

2008-09-25 Thread Fernando Perez
Hi, Today is a big day. I officially transitioned from manually testing by clicking around in my app, to automated testing with RSpec + Autotest. Yes RSpec made me find a few weaknesses in my app: while I was writing specs for one of my models, I discovered that I had forgotten some validations,

Re: [rspec-users] RSpec makes me want to write better code

2008-09-25 Thread Mark Wilden
On Thu, Sep 25, 2008 at 8:01 AM, Fernando Perez [EMAIL PROTECTED]wrote: Also, RSpec made me discover something else: my model has some custom find methods. Often over time I find myself changing the name of these custom find methods, e.g: find_all_products - find_available_products As some