Re: [rspec-users] Assumption tests

2007-11-27 Thread Daniel Tenner
Just thought I'd post an update on this, since I promised Pat that I would :-) Ultra-detailed, "pure behaviour/interaction" specs the way I wanted to do them has turned out to be unproductive in the long run. The specs are too complex to write, and too hard to read, and the lack of refacto

Re: [rspec-users] Assumption tests

2007-10-21 Thread Ashley Moran
On Oct 21, 2007, at 1:12 am, Jay Levitt wrote: > I keep threatening (in my head) to build a "proper" mock of at least > part of AR, but it just keeps joining the large list of open source > tools I use that I'm gonna go "fix" someday... Mock ActiveRecord? Hell to that, I've had enough of DHH's

Re: [rspec-users] Assumption tests

2007-10-20 Thread Pat Maddox
On 10/20/07, Jay Levitt <[EMAIL PROTECTED]> wrote: > On 10/20/2007 12:09 PM, Pat Maddox wrote: > > I've read plenty of > > sources that say a unit test only touches one class, and if you're > > interacting with more than one class then it's an integration test. > > That's a silly distinction to

Re: [rspec-users] Assumption tests

2007-10-20 Thread Jay Levitt
On 10/20/2007 12:09 PM, Pat Maddox wrote: > I've read plenty of > sources that say a unit test only touches one class, and if you're > interacting with more than one class then it's an integration test. > That's a silly distinction to make Very! I think we all know here that a unit test tests

Re: [rspec-users] Assumption tests

2007-10-20 Thread Jay Levitt
On 10/20/2007 4:37 PM, Scott Taylor wrote: > Sure - I'm only advocating a solution to AR, not a more a general > one. How many other (ruby) apps are built on top of a giant DSL? .. > Not going to happen soon, because I don't care to dig into the > internals of ActiveRecord. Maybe if I get rea

Re: [rspec-users] Assumption tests

2007-10-20 Thread Pat Maddox
On 10/20/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > I'm all for pragmatism but it kind of irks me that I'd have to test > behaviours in some cases and outcomes in others. I suppose neither of > them is black nor white, and David's suggestion that it's all down to > balancing design forces on a

Re: [rspec-users] Assumption tests

2007-10-20 Thread Daniel Tenner
On 20 Oct 2007, at 19:54 20 Oct 2007, Pat Maddox wrote: > You seem to believe that the only way to define behavior is in terms > of interactions with other objects. That is flat-out wrong. Please > read http://martinfowler.com/articles/mocksArentStubs.html. Thanks for that excellent link. I hadn

Re: [rspec-users] Assumption tests

2007-10-20 Thread Scott Taylor
On Oct 20, 2007, at 4:29 PM, David Chelimsky wrote: > On 10/20/07, Scott Taylor <[EMAIL PROTECTED]> wrote: >>> These two specs are basically the same, and I can tell you that I >>> would likely NOT write the first one, but I would very likely write >>> the second one. This means that my decision

Re: [rspec-users] Assumption tests

2007-10-20 Thread David Chelimsky
On 10/20/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > > These two specs are basically the same, and I can tell you that I > > would likely NOT write the first one, but I would very likely write > > the second one. This means that my decision is based on the > > implementation, which might bug our

Re: [rspec-users] Assumption tests

2007-10-20 Thread Scott Taylor
> > These two specs are basically the same, and I can tell you that I > would likely NOT write the first one, but I would very likely write > the second one. This means that my decision is based on the > implementation, which might bug our purist BDD sensibilities. > > Which brings us to an import

Re: [rspec-users] Assumption tests

2007-10-20 Thread David Chelimsky
On 10/20/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > On 20 Oct 2007, at 17:34 20 Oct 2007, David Chelimsky wrote: > > The distinction we make between stories and specs is that stories > > describe how a system behaves in terms of a user's experience, whereas > > specs describe how an object beha

Re: [rspec-users] Assumption tests

2007-10-20 Thread Ashley Moran
On Oct 20, 2007, at 7:05 pm, Daniel Tenner wrote: > I know I keep coming back to this. I promise I'm not doing it to be a > pain, but because I'm curious about whether there is something in > pushing this thing to extreme and saying "it's not a spec unless it > describes what the object _does_" (

Re: [rspec-users] Assumption tests

2007-10-20 Thread Pat Maddox
On 10/20/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > On 20 Oct 2007, at 17:34 20 Oct 2007, David Chelimsky wrote: > > > Agreed. This is exactly why we talk about stories and specs instead of > > integration and units. I realize that I've slung the term integration > > tests around when talking a

Re: [rspec-users] Assumption tests

2007-10-20 Thread Daniel Tenner
On 20 Oct 2007, at 17:34 20 Oct 2007, David Chelimsky wrote: > Agreed. This is exactly why we talk about stories and specs instead of > integration and units. I realize that I've slung the term integration > tests around when talking about about stories so I apologize if I've > added to the confus

Re: [rspec-users] Assumption tests

2007-10-20 Thread David Chelimsky
On 10/20/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > Another idea of Dave Astels which I think has been lost, is that each > spec should not map one-to-on onto each implementation file (If you > rename the file, do you rename the spec? If you create tiny inner- > classes, or start delegating to o

Re: [rspec-users] Assumption tests

2007-10-20 Thread Scott Taylor
On Oct 20, 2007, at 11:50 AM, David Chelimsky wrote: > On 10/20/07, Ashley Moran <[EMAIL PROTECTED]> wrote: >>> Following up on the last idea: One thing that I don't think is yet >>> widely understood is that there is no such thing as a "unit" or >>> "integration" test - test happen on a continuu

Re: [rspec-users] Assumption tests

2007-10-20 Thread Ashley Moran
On Oct 20, 2007, at 5:09 pm, Pat Maddox wrote: > I think it becomes too easy to use process or arbitrary constraints as > a crutch, instead of simple careful thought. If you find yourself > doing strange or painful things in order to make them fit some > definition, then you're doing yourself a

Re: [rspec-users] Assumption tests

2007-10-20 Thread David Chelimsky
On 10/20/07, Pat Maddox <[EMAIL PROTECTED]> wrote: > On 10/19/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > > Following up on the last idea: One thing that I don't think is yet > > widely understood is that there is no such thing as a "unit" or > > "integration" test - test happen on a continuum (t

Re: [rspec-users] Assumption tests

2007-10-20 Thread Pat Maddox
On 10/19/07, Scott Taylor <[EMAIL PROTECTED]> wrote: > Following up on the last idea: One thing that I don't think is yet > widely understood is that there is no such thing as a "unit" or > "integration" test - test happen on a continuum (the classification > of a test is not a black and white sort

Re: [rspec-users] Assumption tests

2007-10-20 Thread Ashley Moran
On Oct 20, 2007, at 4:50 pm, David Chelimsky wrote: > Dave Astels said that 2 years ago. Yes but I'm new to this :) Hang on while I catch up! -- blog @ http://aviewfromafar.net/ linked-in @ http://www.linkedin.com/in/ashleymoran currently @ home _

Re: [rspec-users] Assumption tests

2007-10-20 Thread David Chelimsky
On 10/20/07, Ashley Moran <[EMAIL PROTECTED]> wrote: > > Following up on the last idea: One thing that I don't think is yet > > widely understood is that there is no such thing as a "unit" or > > "integration" test - test happen on a continuum (the classification > > of a test is not a black and wh

Re: [rspec-users] Assumption tests

2007-10-20 Thread Ashley Moran
On Oct 20, 2007, at 5:34 am, Scott Taylor wrote: > As I see it, the problem is that ActiveRecord is not like a typical > library, which is completely external. With rails, > ActiveRecord::Base (and co) *become* your code. Surely the implication is that the only way to thoroughly spec an Activ

Re: [rspec-users] Assumption tests

2007-10-19 Thread Scott Taylor
On Oct 19, 2007, at 12:29 PM, Pat Maddox wrote: > On 10/19/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: >>> If I read correctly, Daniel is suggesting that this is not behaviour >>> because he's equating behaviour with interaction. This example >>> checks >>> an outcome, not an interaction. >>>

Re: [rspec-users] Assumption tests

2007-10-19 Thread Pat Maddox
On 10/19/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > > If I read correctly, Daniel is suggesting that this is not behaviour > > because he's equating behaviour with interaction. This example checks > > an outcome, not an interaction. > > > > That's right, one of my axioms is that "specifying" in

Re: [rspec-users] Assumption tests

2007-10-19 Thread Daniel Tenner
> If I read correctly, Daniel is suggesting that this is not behaviour > because he's equating behaviour with interaction. This example checks > an outcome, not an interaction. > That's right, one of my axioms is that "specifying" involves behaviour/interaction, not state/outcome. The reason fo

Re: [rspec-users] Assumption tests

2007-10-19 Thread David Chelimsky
On 10/19/07, Jonathan Linowes <[EMAIL PROTECTED]> wrote: > But dont you really just want to test the behavior of the class? The object, not the class. > (whereas the validator call is an implementation) > such as > > it "should require digits" do >p = PhoneNumber.new( :digits => nil ) >

Re: [rspec-users] Assumption tests

2007-10-19 Thread Jonathan Linowes
But dont you really just want to test the behavior of the class? (whereas the validator call is an implementation) such as it "should require digits" do p = PhoneNumber.new( :digits => nil ) p.should_not be_valid p.errors.on(:digits).should == "can't be blank" end On Oct 19,

[rspec-users] Assumption tests

2007-10-19 Thread Daniel Tenner
Hi all, I've been thinking about the whole validator/relationship speccing issue, and I came up with a suggestion, which I'd love to get some feedback on. The full article is available at http://www.inter-sections.net/ 2007/10/19/what-to-test-and-specify-and-where-to-do-it/ , with the rele