Re: [rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread Zach Dennis
On Thu, Feb 19, 2009 at 4:51 PM, Zach Dennis wrote: > On Thu, Feb 19, 2009 at 3:54 PM, Martin wrote: >> Hi, >> >> I'm trying to test my views using rspec. I want to test my edit- and >> new-view also for the case an error occurs (something like "title can't be >> blank" and so on). >> Can someone

Re: [rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread Zach Dennis
On Thu, Feb 19, 2009 at 3:54 PM, Martin wrote: > Hi, > > I'm trying to test my views using rspec. I want to test my edit- and > new-view also for the case an error occurs (something like "title can't be > blank" and so on). > Can someone point me please to an example where I can see how to mock my

Re: [rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread Zach Dennis
On Thu, Feb 19, 2009 at 4:24 PM, Matt Wynne wrote: > > On 19 Feb 2009, at 20:54, Martin wrote: > >> Hi, >> >> I'm trying to test my views using rspec. I want to test my edit- and >> new-view also for the case an error occurs (something like "title can't be >> blank" and so on). >> Can someone poin

Re: [rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread David Chelimsky
On Thu, Feb 19, 2009 at 2:54 PM, Martin wrote: > Hi, > > I'm trying to test my views using rspec. I want to test my edit- and > new-view also for the case an error occurs (something like "title can't be > blank" and so on). > Can someone point me please to an example where I can see how to mock my

Re: [rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread Jim Gay
On Feb 19, 2009, at 3:54 PM, Martin wrote: Hi, I'm trying to test my views using rspec. I want to test my edit- and new-view also for the case an error occurs (something like "title can't be blank" and so on). Can someone point me please to an example where I can see how to mock my mode

Re: [rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread Bart Zonneveld
On 19 feb 2009, at 21:54, Martin wrote: Hi, I'm trying to test my views using rspec. I want to test my edit- and new-view also for the case an error occurs (something like "title can't be blank" and so on). Can someone point me please to an example where I can see how to mock my model

Re: [rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread Matt Wynne
On 19 Feb 2009, at 20:54, Martin wrote: Hi, I'm trying to test my views using rspec. I want to test my edit- and new-view also for the case an error occurs (something like "title can't be blank" and so on). Can someone point me please to an example where I can see how to mock my model

[rspec-users] Mocking / stubbing errors for ActiveRecord

2009-02-19 Thread Martin
Hi, I'm trying to test my views using rspec. I want to test my edit- and new-view also for the case an error occurs (something like "title can't be blank" and so on). Can someone point me please to an example where I can see how to mock my model and stub all methods needed for the view? Th

Re: [rspec-users] ActiveRecord::Base.should_receive(:find) fails

2009-02-19 Thread David Chelimsky
On Thu, Feb 19, 2009 at 12:34 PM, Tero Tilus wrote: > I've got an AR-model with some find-magic I want to test. When I have > > ActiveRecord::Base.should_receive(:find).with(anything(),assert_options) > MyModel.find(:all,find_options) MyModel != ActiveRecord::Base Try this MyModel.should_rec

[rspec-users] ActiveRecord::Base.should_receive(:find) fails

2009-02-19 Thread Tero Tilus
I've got an AR-model with some find-magic I want to test. When I have ActiveRecord::Base.should_receive(:find).with(anything(),assert_options) MyModel.find(:all,find_options) in my example find-method somehow disappears alltogether and I get NoMethodError in 'MyModel find-options are pass

Re: [rspec-users] validate_presence_of

2009-02-19 Thread David Chelimsky
On Thu, Feb 19, 2009 at 11:38 AM, Mark Wilden wrote: > On Wed, Feb 18, 2009 at 9:40 PM, Stephen Eley wrote: >> On Wed, Feb 18, 2009 at 11:42 PM, Yi Wen wrote: >> >> validates_presence_of happens to be the name of the method in >> ActiveRecord that does that. But if you decide to write your own

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Stephen Eley
On Thu, Feb 19, 2009 at 10:55 AM, David Chelimsky wrote: > > This is where this all gets tricky. Yep. >8-> > TDD (remember? that's where this all started) says you don't write any > subject code without a failing *unit test*. This is not about the end > result - it's about a process. What you'

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Mark Wilden
On Wed, Feb 18, 2009 at 9:40 PM, Stephen Eley wrote: > On Wed, Feb 18, 2009 at 11:42 PM, Yi Wen wrote: > > validates_presence_of happens to be the name of the method in > ActiveRecord that does that. But if you decide to write your own > check_to_see_if_this_thingy_is_in_my_whatsis() method that

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Stephen Eley
On Thu, Feb 19, 2009 at 12:15 PM, Stephen Eley wrote: > > But I did not write any code yet setting the message. Because I > haven't written any tests for the message. At this point I don't care > what the message is, just that I have the right data. I care about > the message when I start focus

Re: [rspec-users] Ruby 1.9 - autospec loadpath problem

2009-02-19 Thread David Chelimsky
On Thu, Feb 19, 2009 at 8:52 AM, lasitha wrote: > > On Mon, Dec 01, 2008 at 03:51pm, David Chelimsky > wrote: >>On Sun, Nov 30, 2008 at 4:24 PM, Mikel Lindsaar wrote: >>> [...] >>> mi...@baci.local ~/ruby_programs/mail >>> $ autospec >>> /usr/local/bin/autotest:19:in `load': Is a directory - >>

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Stephen Eley
On Thu, Feb 19, 2009 at 9:55 AM, David Chelimsky wrote: > On Wed, Feb 18, 2009 at 11:40 PM, Stephen Eley wrote: > > >> If your spec breaks because you changed a method call, you're not >> testing behavior any more. You're testing syntax. > > > We've got to stop making laws out of guidelines. T

Re: [rspec-users] [Cucumber] Level of features / Feature dependent steps

2009-02-19 Thread Lenny Marks
Just wanted to thank everyone for their replies. I actually recall that thread now about imperative vs. declarative. I've just re-read Ben's post along with some of the linked content off the post and now and I feel a bit more comfortable with the direction I was going in. I personally tend

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Zach Dennis
On Thu, Feb 19, 2009 at 10:41 AM, Yi Wen wrote: > Good point, that's actually I am debating with myself everyday and haven't > got a clear answer. This is classical "calssic unit tester" vs. mockist war. > :) > > Talking about this case: > > 1. I haven't checked how should valite_presence_of is im

[rspec-users] Cucumber 0.2 final release date?

2009-02-19 Thread aidy lewis
Hi, I know this seems all take and no give, but do we have an estimated final release date for Cucumber 0.2? Thanks Aidy Celerity, Cucumber and Firewatir: http://skillsmatter.com/event/ruby-on-rails/lrug-march ___ rspec-users mailing list rspec-users@

Re: [rspec-users] validate_presence_of

2009-02-19 Thread David Chelimsky
On Thu, Feb 19, 2009 at 8:20 AM, Stephen Eley wrote: > On Thu, Feb 19, 2009 at 12:58 AM, David Chelimsky > wrote: >> >>> Also, while I used to be very anal and write "should >>> have(1).error_on(:login)" and such, I eventually realized that there's >>> no point. Checking on 'valid?' is entire a

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Yi Wen
Good point, that's actually I am debating with myself everyday and haven't got a clear answer. This is classical "calssic unit tester" vs. mockist war. :) Talking about this case: 1. I haven't checked how should valite_presence_of is implemented, but it could pretty much be checking if the value

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Zach Dennis
On Thu, Feb 19, 2009 at 12:31 AM, Stephen Eley wrote: > On Wed, Feb 18, 2009 at 10:42 PM, Mark Wilden wrote: >> On Wed, Feb 18, 2009 at 4:39 PM, Fernando Perez wrote: >>> >>> What's the point in testing validates_presence_of for a model? >> >> To make sure you wrote that line of code. > > And th

Re: [rspec-users] Cucumber + Webrat + Selenium + ActionMailer

2009-02-19 Thread Raimond Garcia
>1. >http://seattlerb.rubyforge.org/ar_mailer/classes/ActionMailer/ARMailer.html > P.S. I'll follow up with a confirmation post just to let the people know > how it worked out for us with ARMailer. Yeap everything worked like a charm, once again checking email contents like there is no tomorrow

Re: [rspec-users] validate_presence_of

2009-02-19 Thread David Chelimsky
On Wed, Feb 18, 2009 at 11:40 PM, Stephen Eley wrote: > If your spec breaks because you changed a method call, you're not > testing behavior any more. You're testing syntax. We've got to stop making laws out of guidelines. This is a very general statement about what is really a very specific

Re: [rspec-users] [ANN] rspec-1.2 release candidate

2009-02-19 Thread David Chelimsky
On Thu, Feb 19, 2009 at 12:56 AM, David Chelimsky wrote: > Hey fellow behaviour-drivers, > > rspec-1.2 and rspec-rails-1.2 are just about ready, but I'd like to > get some feedback from the field before the release. Would the > adventurous among you kindly grab the latest github gems (1.1.99.7 as

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Stephen Eley
On Thu, Feb 19, 2009 at 12:58 AM, David Chelimsky wrote: > >> Also, while I used to be very anal and write "should >> have(1).error_on(:login)" and such, I eventually realized that there's >> no point. Checking on 'valid?' is entire and sufficient. > > I think this depends on whether or not error

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Mike Gaffney
Dave, you make a good point. In our system, where we are converting a legacy database/application, we typically have no user stories and have the technical (or you could argue user) requirement that the database logic / constraints get converted. This is where we are typically just encoding all

Re: [rspec-users] Ruby 1.9 - autospec loadpath problem

2009-02-19 Thread lasitha
On Mon, Dec 01, 2008 at 03:51pm, David Chelimsky wrote: >On Sun, Nov 30, 2008 at 4:24 PM, Mikel Lindsaar wrote: >> [...] >> mi...@baci.local ~/ruby_programs/mail >> $ autospec >> /usr/local/bin/autotest:19:in `load': Is a directory - >> /usr/local/lib/ruby-trunk/gems/1.9.1/gems/rspec-1.1.11/lib

Re: [rspec-users] [ANN] rspec-1.2 release candidate

2009-02-19 Thread David Chelimsky
On Thu, Feb 19, 2009 at 3:57 AM, Wincent Colaiuta wrote: > El 19/2/2009, a las 7:56, David Chelimsky escribió: > >> rspec-1.2 and rspec-rails-1.2 are just about ready, but I'd like to >> get some feedback from the field before the release. Would the >> adventurous among you kindly grab the latest

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Fernando Perez
> Wrong. You don't have to test validates_presence_of. What matters, > and therefore what you should test, is whether the model will complain > at you if a particular value is left empty. > ... > If your spec breaks because you changed a method call, you're not > testing behavior any more. You'r

Re: [rspec-users] Cucumber + Webrat + Selenium + ActionMailer

2009-02-19 Thread Raimond Garcia
Thanks guys, very interesting points. As a good collegue of mine says, its all about trade offs :) I agree with changing your production code to make it more testable, definitely, especially early on in the development process, once your site is up and running it would have to be done with extr

Re: [rspec-users] [ANN] rspec-1.2 release candidate

2009-02-19 Thread Wincent Colaiuta
El 19/2/2009, a las 7:56, David Chelimsky escribió: rspec-1.2 and rspec-rails-1.2 are just about ready, but I'd like to get some feedback from the field before the release. Would the adventurous among you kindly grab the latest github gems (1.1.99.7 as of this email) and check 'em out? I'm ho

Re: [rspec-users] [Cucumber] Hi-res logo?

2009-02-19 Thread aslak hellesoy
On Thu, Feb 19, 2009 at 8:46 AM, Ben Mabey wrote: > I'm hoping that the designer (or the co-worker programmer) who won the > Cucumber logo contest will see this message... > > I'm looking for a hi-res or vector-based version of the Cucumber logo for > use in a presentation. If the image is not ve

Re: [rspec-users] validate_presence_of

2009-02-19 Thread Matt Wynne
On 19 Feb 2009, at 05:40, Stephen Eley wrote: On Wed, Feb 18, 2009 at 11:42 PM, Yi Wen wrote: Without this syntax sugar, we still have to test validates_presence_of to make sure it's there and won't broken, right? Wrong. You don't have to test validates_presence_of. What matters, and

[rspec-users] [Cucumber] Hi-res logo?

2009-02-19 Thread Ben Mabey
I'm hoping that the designer (or the co-worker programmer) who won the Cucumber logo contest will see this message... I'm looking for a hi-res or vector-based version of the Cucumber logo for use in a presentation. If the image is not vector based then a hi-res version with a transparent back