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

2009-04-15 Thread Fernando Perez
> 6 months since my initial post, what happened in between? Damn! BDD + writing specs that don't hit the database, also taught me to not break Demeter's law :-D It's simply a huge pain to spec a double dot method call, i.e: user.membership.paid? ActiveRecord associations are super, but they c

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 wrote: > > > >> Date: Wed, 1 Apr 2009 17:24:21 +0100 >> From: aidy lewis >> Subject: Re: [rspec-users] RSpec makes me want to write better code >&g

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

2009-04-01 Thread aidy lewis
Hi David 2009/4/1 David Chelimsky : >. 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 sets of people i

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 wrote: > Hi David > > 2009/3/31 David Chelimsky : > >> 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 wi

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

2009-04-01 Thread aidy lewis
Hi David 2009/3/31 David Chelimsky : > 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 same person or pair

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 Th

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 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 what a cus

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, w

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

2009-03-31 Thread Phlip
David Chelimsky wrote: 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 Even with -f, after it ran our most recently changed test... ...it started the grand wazoo test batch. Pass! I can just

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

2009-03-31 Thread Fernando Perez
> 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 Well, I find it easier to simply type: $ rake spec Then depending on what failed I will from time to time run a single spec file: $ spec

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

2009-03-31 Thread Zach Dennis
On Tue, Mar 31, 2009 at 5:39 AM, Fernando Perez 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 in between?

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 rspec-users@rubyfo

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 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 in between?

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

2009-03-31 Thread aidy lewis
Hi Phlip, On 31/03/2009, Phlip 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 you then proposing

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 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 many tests, i

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 wrote: > On Tue, Mar 31, 2009 at 5:39 AM, Fernando Perez 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. >

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 suppo

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 controller

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

2009-03-31 Thread Phlip
Fernando Perez wrote: 6 months since my initial post, what happened in between? - My controllers are getting anorexic, and that's good. An action typically does only 1 call to a model and behind the scenes that model will make other calls to other models and do some fancy stuff, this used to

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 act

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] > w

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

2008-09-30 Thread Dan North
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: > > On Sat, Sep 27, 2008 at 2:29 PM, Mark Wilden <[EMAIL PROTECTED]> wrote: > >>

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

2008-09-27 Thread Mark Wilden
On Sat, Sep 27, 2008 at 5:04 PM, Ashley Moran <[EMAIL PROTECTED] > wrote: > The thing is, with a full suite of stories (that work through the public > interface) your *entire app* is an implementation detail. > Yep. I would go further and say that, at the end of the day, the only interface that

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 b

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 d

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 >

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. :

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 >> d

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 t

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 i

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 com

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

2008-09-26 Thread Nick Hoffman
I must say, I quite enjoyed that conversation. You guys (David and Mark) both have some very good points, and it was great to see another discussion about client interaction. Thanks guys! ___ rspec-users mailing list rspec-users@rubyforge.org http://

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 >> yo

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

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 >

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

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,

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 c

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's exactly > > like a Tas

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 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

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 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 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

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 inten

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 o

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 on

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 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

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. Rub

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 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 encourag

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 > >

[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,