Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-25 Thread Ashley Moran
On 25 Jul 2007, at 01:07, Kyle Hargraves wrote: > Going through reflect_on_association feels too much like specifying > the > use of a particular implementation, rather than the desired outcome. I second that. I agree that you should only test the code you write, but unfortunately(!) you ge

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-25 Thread Ashley Moran
On 24 Jul 2007, at 14:49, Daniel N wrote: > That looks like the kind of thing I was initially thinking of, but > I started to think that having all those objects being created in a > non-related spec could lead to trouble. If I change what makes any > of those objects valid, these supposed

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-25 Thread Daniel N
On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: Kyle, That is a good point. We are after the behaviour, not the implementation. Regards Mikel On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote: > > > > On 7/25/07, Kyle Hargraves <[EMAIL PROTECTED]> wrote: > > Daniel N wrote: > > > On 7/25

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Mikel Lindsaar
Kyle, That is a good point. We are after the behaviour, not the implementation. Regards Mikel On 7/25/07, Daniel N <[EMAIL PROTECTED]> wrote: > > > > On 7/25/07, Kyle Hargraves <[EMAIL PROTECTED]> wrote: > > Daniel N wrote: > > > On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: > > >> > >

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Daniel N
On 7/25/07, Kyle Hargraves <[EMAIL PROTECTED]> wrote: Daniel N wrote: > On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: >> >> There would be a different way. >> >> In the idea of "Only test the code you write" all you really need to >> spec is that you have set the right association, becau

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Kyle Hargraves
Daniel N wrote: > On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: >> >> There would be a different way. >> >> In the idea of "Only test the code you write" all you really need to >> spec is that you have set the right association, because activerecord >> has it's own tests to ensure the uniq

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Daniel N
On 7/25/07, Mikel Lindsaar <[EMAIL PROTECTED]> wrote: There would be a different way. In the idea of "Only test the code you write" all you really need to spec is that you have set the right association, because activerecord has it's own tests to ensure the uniq call works. You can do this wit

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Mikel Lindsaar
There would be a different way. In the idea of "Only test the code you write" all you really need to spec is that you have set the right association, because activerecord has it's own tests to ensure the uniq call works. You can do this with a call to reflect_on_association. Unfortunately that c

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Daniel N
On 7/24/07, Daniel N <[EMAIL PROTECTED]> wrote: On 7/24/07, Ashley Moran <[EMAIL PROTECTED]> wrote: > > > On 24 Jul 2007, at 14:07, Daniel N wrote: > > > Any hints as to how to do this without using fixtures? > > I did this literally minutes ago. I don't use fixtures at all, > ever. Instead

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Daniel N
On 7/24/07, Ashley Moran <[EMAIL PROTECTED]> wrote: On 24 Jul 2007, at 14:07, Daniel N wrote: > Any hints as to how to do this without using fixtures? I did this literally minutes ago. I don't use fixtures at all, ever. Instead I put the data in the before block, eg: describe Purchase, "as

Re: [rspec-users] Mock or Stub strategy for validates_uniqueness_of

2007-07-24 Thread Ashley Moran
On 24 Jul 2007, at 14:07, Daniel N wrote: > Any hints as to how to do this without using fixtures? I did this literally minutes ago. I don't use fixtures at all, ever. Instead I put the data in the before block, eg: describe Purchase, "assigned to a Quote that already has a saved purchase