Re: [rspec-users] Rspec 1.0.8 with Rails 2.0

2007-12-13 Thread Stefan Magnus Landrø
Hi there, Would it make sense to put up a page on an RSpec wiki where a table of good combinations (versions of rails and rspec) would be maintained? Anyway, I think a wiki would be a good idea. Stefan 2007/12/13, David Chelimsky <[EMAIL PROTECTED]>: > > On Dec 12, 2007 10:17 PM, Pat Maddox <[EM

Re: [rspec-users] stub with assigns?

2007-12-13 Thread Stefan Magnus Landrø
I wouldn't try doing this. You risk getting highly coupled test code. I'd rather use a little helper method that does this for you. Stefan 2007/12/13, Jonathan Linowes <[EMAIL PROTECTED]>: > > > On Dec 13, 2007, at 2:47 AM, Jonathan Linowes wrote: > > > > > On Dec 13, 2007, at 2:06 AM, Jarkko Lai

Re: [rspec-users] Problem running examples with spec_server

2007-12-13 Thread Michael Klishin
What error do you get? On 12 дек. 2007, at 19:39, David Nolan wrote: > Hello, > Running RSpec without DRB works fine. > However, "spec -X" runs without error but provides no output at all, > even though the DRB spec_server seems to be fine. > Has anyone got some suggestions as to why and how to

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/12/07, Pat Maddox <[EMAIL PROTECTED]> wrote: > I would not mock the call, and would instead just let the mailer do > its thing. You can verify that a message was sent, match the > subject/content, etc. It's very lightweight so there's no reason not > to use it. The problem with this is th

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Daniel Tenner
Hi Rick, I'm probably a heretic on this point, but I would test that :deliver_xyz is being called but not specify what parameters it's called with. What's my reasoning? - What I'm really testing in the Message spec is not the validity of the email that's being sent, but the fact that an em

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/13/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > Hi Rick, > > I'm probably a heretic on this point, but I would test > that :deliver_xyz is being called but not specify what parameters > it's called with. > > What's my reasoning? > > - What I'm really testing in the Message spec is not the v

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Daniel Tenner
Hi Rick, Could you paste us what your after_save and your deliver_xyz methods look like? I think it would be helpful to make the discussion more concrete. I've found that whenever my code is hard to spec, it's usually poorly designed in the first place, and a better split of responsibilitie

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/13/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > That said, I'd go for a lesser known feature: custom mock argument > matchers. Something like this (completely off the top of my head and > not tested or guaranteed bug-free - but this will give you the idea): > > class EquivalentMessage >

Re: [rspec-users] stub with assigns?

2007-12-13 Thread Daniel Tenner
>> Sorry, perhaps I gave too simplistic an example. >> Real code, please? :-) Simplified examples only ever result in simplistic suggestions. Daniel On 13 Dec 2007, at 07:55 13 Dec 2007, Jonathan Linowes wrote: > > On Dec 13, 2007, at 2:47 AM, Jonathan Linowes wrote: > >> >> On Dec 13, 2007, at

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/13/07, Rick DeNatale <[EMAIL PROTECTED]> wrote: > class Message < ActiveRecord::Base > > belongs_to :sender, :class_name => "Person", :foreign_key => :sender_id > belongs_to :recipient, :class_name => "Person", :foreign_key => > :recipient_id > > after_create do |msg| > puts "\n**

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/13/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > Hi Rick, > > Could you paste us what your after_save and your deliver_xyz methods > look like? I think it would be helpful to make the discussion more > concrete. > > I've found that whenever my code is hard to spec, it's usually poorly > desi

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Daniel Tenner
Then I definitely think there's little point in specifying what "deliver_secret_santa" is called with. The chances that you'll get that wrong are extremely small, and even if you do it will be picked up instantly by your integration tests, and be very easy to fix. What's much more likely to

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/13/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > Then I definitely think there's little point in specifying what > "deliver_secret_santa" is called with. The chances that you'll get > that wrong are extremely small, and even if you do it will be picked > up instantly by your integration test

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread David Chelimsky
On Dec 13, 2007 8:59 AM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > On 12/13/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > > Then I definitely think there's little point in specifying what > > "deliver_secret_santa" is called with. The chances that you'll get > > that wrong are extremely small, an

Re: [rspec-users] Problem running examples with spec_server

2007-12-13 Thread David Nolan
Hello, It doesn't output any error messages. It doesn't output anything, not a sausage, and just returns the prompt after a brief pause. Thanks, Dave On 13/12/2007, Michael Klishin <[EMAIL PROTECTED]> wrote: > > What error do you get? > > On 12 дек. 2007, at 19:39, David Nolan wrote: > > > Hello,

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Pat Maddox
On Dec 13, 2007 4:57 AM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > On 12/12/07, Pat Maddox <[EMAIL PROTECTED]> wrote: > > > I would not mock the call, and would instead just let the mailer do > > its thing. You can verify that a message was sent, match the > > subject/content, etc. It's very lig

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/13/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Dec 13, 2007 8:59 AM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > > On 12/13/07, Daniel Tenner <[EMAIL PROTECTED]> wrote: > > > Then I definitely think there's little point in specifying what > > > "deliver_secret_santa" is called with. Th

Re: [rspec-users] "Tricks" for testing after_create callback???

2007-12-13 Thread Rick DeNatale
On 12/13/07, Rick DeNatale <[EMAIL PROTECTED]> wrote: > On 12/13/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > > This is a bit scary :( > > > > Rick - would you mind sticking this information, a bit filtered, into > > the tracker? > > Well, as I was doing just that, I looked a bit closer at tho

Re: [rspec-users] stub with assigns?

2007-12-13 Thread Jonathan Linowes
thx I ended up wrapping the instance variable in a method, which I can then stub also Its cleaner that way anyhow def current_foo @foo end On Dec 13, 2007, at 9:06 AM, Daniel Tenner wrote: >>> Sorry, perhaps I gave too simplistic an example. >>> > Real code, please? :-) > > Simplified exa

[rspec-users] RSpec and Mock Tutorial/Cheatsheet

2007-12-13 Thread [EMAIL PROTECTED]
I wrote a simple summary of Mocks with RSpec as an answer to a discussion on our local Ruby users group. I was wondering if people here could review it, adding comments for any corrections or other important ideas regarding mocks and RSpec. You can find the article here: http://blog.showc

Re: [rspec-users] RSpec and Mock Tutorial/Cheatsheet

2007-12-13 Thread Scott Taylor
On Dec 13, 2007, at 12:36 PM, [EMAIL PROTECTED] wrote: > I wrote a simple summary of Mocks with RSpec as an answer to a > discussion on our local Ruby users group. I was wondering if people > here could review it, adding comments for any corrections or other > important ideas regarding mocks and

[rspec-users] [ANN] RSpec-1.1.0 is released

2007-12-13 Thread David Chelimsky
The RSpec Development Team is pleased as glug (that's kind of like punch, but more festive) to announce RSpec-1.1.0. Thanks to all who have contributed patches over the last few months. Big thanks to Dan North and Brian Takita for their important work on this release. Dan contributed his rbehave f

Re: [rspec-users] can't access helper methods for model testing

2007-12-13 Thread Chris Olsen
>> What am I missing? Are these helpers only for controller tests? > > Rails helpers are there for views and controllers, not for models. > > If you want an RSpec helper, something you use to set up state for > your examples, you can write a module and include it in the example > groups - but t

Re: [rspec-users] How do I mock params?

2007-12-13 Thread Chris Olsen
Ya, just ignore this post, except for the question regarding the rpsec book. I really do wish there was a way to delete your own posts :) -- Posted via http://www.ruby-forum.com/. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge

[rspec-users] How do I mock params?

2007-12-13 Thread Chris Olsen
Here is the code within the controller: Line 69: @photo = @member.build_photo(params[:photo]) unless params[:photo][:uploaded_data].blank? I got a little ahead of myself and wrote the code, and now have a bunch of errors telling me that: --- 6) NoMethodError in 'Spec::Rails::Example::Control

Re: [rspec-users] [ANN] RSpec-1.1.0 is released

2007-12-13 Thread Pat Maddox
On Dec 13, 2007 9:58 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > > The RSpec Development Team is pleased as glug (that's kind of like > punch, but more festive) to announce RSpec-1.1.0. > > Thanks to all who have contributed patches over the last few months. > Big thanks to Dan North and Brian