Re: [rspec-users] Testing file attachment with Paperclip

2010-01-28 Thread Deven Patel
Nicholas Wieland wrote: > Does someone have an example on faking a file upload for just ensuring > it gets called, without actually uploading the file to s3. > I thought that stubbing Model.has_attached_file would be enough, but > it doesn't seem so ... > > This is what I did: > > Video.stub!( :h

Re: [rspec-users] Testing file attachment with Paperclip

2010-01-28 Thread Deven Patel
Nicholas Wieland wrote: > Does someone have an example on faking a file upload for just ensuring > it gets called, without actually uploading the file to s3. > I thought that stubbing Model.has_attached_file would be enough, but > it doesn't seem so ... > > This is what I did: > > Video.stub!( :h

Re: [rspec-users] Message expectation that verifies result of passed block

2010-01-28 Thread Matt Wynne
On 28 Jan 2010, at 21:43, Nicolás Sanguinetti wrote: You're definitely testing too much implementation and not enough behavior. Basically, what you want to spec, is that provided some options, when you call a certain method of your form builder, you get a certain html output. At least that's

Re: [rspec-users] Message expectation that verifies result of passed block

2010-01-28 Thread Matt Wynne
On 28 Jan 2010, at 21:14, Paul Hinze wrote: Ashley Moran on 2010-01-28 at 13:28: On Jan 28, 2010, at 1:29 pm, Paul Hinze wrote: I believe the lack of ability to use this notation comes down to a ruby limitation, but I'm not sure. If that's the case, then we would need a specific argume

Re: [rspec-users] Message expectation that verifies result of passed block

2010-01-28 Thread Nicolás Sanguinetti
You're definitely testing too much implementation and not enough behavior. Basically, what you want to spec, is that provided some options, when you call a certain method of your form builder, you get a certain html output. At least that's how I would approach the problem. So I would have somethi

Re: [rspec-users] Message expectation that verifies result of passed block

2010-01-28 Thread Paul Hinze
Ashley Moran on 2010-01-28 at 13:28: > > On Jan 28, 2010, at 1:29 pm, Paul Hinze wrote: > > > I believe the lack of ability to use this notation comes down to a ruby > > limitation, but I'm not sure. If that's the case, then we would need a > > specific argument expectation (along the lines of

Re: [rspec-users] Message expectation that verifies result of passed block

2010-01-28 Thread Ashley Moran
On Jan 28, 2010, at 1:29 pm, Paul Hinze wrote: > I believe the lack of ability to use this notation comes down to a ruby > limitation, but I'm not sure. If that's the case, then we would need a > specific argument expectation (along the lines of my suggestion) that > executes in a context in whi

Re: [rspec-users] Can I set an expectation that a method invokes super?

2010-01-28 Thread Ashley Moran
On Jan 28, 2010, at 5:49 pm, Rick DeNatale wrote: > I'd like to write a spec to ensure that this doesn't regress, but my > imagination is failing me as to how to do it. > > Any ideas? Yes: don't use inheritance for implementations. The bug you describe is arguably a violation of the Liskov Su

[rspec-users] somewhat confused by the help instructions...

2010-01-28 Thread rogerdpack
As a note of feedback, when I do a spec --help, I saw this line... -e, --example [NAME|FILE_NAME] Execute example(s) with matching name(s). If the argument is the path to an existing file (typically generated by a previous

[rspec-users] Can I set an expectation that a method invokes super?

2010-01-28 Thread Rick DeNatale
Not sure if I can easily do this Just ran into a bug in a rails app where ApplicationController overrides rescue_action_in_public leading to the error page not being displayed. The fix was to call super at the end of the method. I'd like to write a spec to ensure that this doesn't regress, but m

[rspec-users] Message expectation that verifies result of passed block

2010-01-28 Thread Paul Hinze
Hey speclers, My spec-fu is failing me on a message expectation in which I would like to verify that the block passed to a certain method yields the proper value. I would like to be able to say something like: def bar # .. some code foo do 'bar' # want to verify this value end end des