Re: [rspec-users] stub with assigns?

2007-12-12 Thread Jonathan Linowes
On Dec 13, 2007, at 2:47 AM, Jonathan Linowes wrote: > > On Dec 13, 2007, at 2:06 AM, Jarkko Laine wrote: > >> >> On 13.12.2007, at 9.00, Jonathan Linowes wrote: >> >>> is there a way to stub a method that sets an instance variable, so >>> the stub sets it too? >>> >>> def find_foo >>> @foo = F

Re: [rspec-users] stub with assigns?

2007-12-12 Thread Jonathan Linowes
On Dec 13, 2007, at 2:06 AM, Jarkko Laine wrote: > > On 13.12.2007, at 9.00, Jonathan Linowes wrote: > >> is there a way to stub a method that sets an instance variable, so >> the stub sets it too? >> >> def find_foo >> @foo = Foo.find(params[:id] >> end >> >> >> ... >> controller.stub!(:find_f

Re: [rspec-users] stub with assigns?

2007-12-12 Thread Scott Taylor
On Dec 13, 2007, at 2:00 AM, Jonathan Linowes wrote: is there a way to stub a method that sets an instance variable, so the stub sets it too? Nope. The idea behind this is that instance variables are supposed to be the inner representation of some data inside a class, while an attr_ac

Re: [rspec-users] stub with assigns?

2007-12-12 Thread Pat Maddox
On Dec 12, 2007 11:00 PM, Jonathan Linowes <[EMAIL PROTECTED]> wrote: > > is there a way to stub a method that sets an instance variable, so the stub > sets it too? > > def find_foo > @foo = Foo.find(params[:id] > end > > > ... > controller.stub!(:find_foo).and_assigns(:foo, "123") huh? I think

Re: [rspec-users] stub with assigns?

2007-12-12 Thread Jarkko Laine
On 13.12.2007, at 9.00, Jonathan Linowes wrote: > is there a way to stub a method that sets an instance variable, so > the stub sets it too? > > def find_foo > @foo = Foo.find(params[:id] > end > > > ... > controller.stub!(:find_foo).and_assigns(:foo, "123") Why don't you just stub Foo.find?

[rspec-users] stub with assigns?

2007-12-12 Thread Jonathan Linowes
is there a way to stub a method that sets an instance variable, so the stub sets it too? def find_foo @foo = Foo.find(params[:id] end ... controller.stub!(:find_foo).and_assigns(:foo, "123") ___ rspec-users mailing list rspec-users@rubyforge.org

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

2007-12-12 Thread David Chelimsky
On Dec 12, 2007 10:17 PM, Pat Maddox <[EMAIL PROTECTED]> wrote: > On Dec 12, 2007 4:01 AM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > > On Dec 12, 2007 12:48 AM, Yitzhak Bar Geva <[EMAIL PROTECTED]> wrote: > > > > > > Is it OK to go ahead and generate a Rails 2.0 project with RSpec 1.0.8? > > > A

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

2007-12-12 Thread David Chelimsky
On Dec 12, 2007 9:48 PM, Kyle Hargraves <[EMAIL PROTECTED]> wrote: > > On Dec 12, 2007 9:09 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > > I've got a model Message, which needs to send an email using action > > mailer after it's first saved in the database. > > > > I want to pass the model to the

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

2007-12-12 Thread Pat Maddox
On Dec 12, 2007 4:01 AM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > On Dec 12, 2007 12:48 AM, Yitzhak Bar Geva <[EMAIL PROTECTED]> wrote: > > > > Is it OK to go ahead and generate a Rails 2.0 project with RSpec 1.0.8? Am I > > likely to run into problems? > > When we released RSpec 1.0.8 there was

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

2007-12-12 Thread Pat Maddox
On Dec 12, 2007 7:09 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > I've got a model Message, which needs to send an email using action > mailer after it's first saved in the database. > > I want to pass the model to the mailer which then uses methods on the > message model to render the email. > >

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

2007-12-12 Thread Kyle Hargraves
On Dec 12, 2007 9:09 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote: > I've got a model Message, which needs to send an email using action > mailer after it's first saved in the database. > > I want to pass the model to the mailer which then uses methods on the > message model to render the email. > >

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

2007-12-12 Thread Rick DeNatale
I've got a model Message, which needs to send an email using action mailer after it's first saved in the database. I want to pass the model to the mailer which then uses methods on the message model to render the email. So the natural way to do this is in an after_create callback on the Message m

Re: [rspec-users] namespaced controllers

2007-12-12 Thread David Chelimsky
On Dec 12, 2007 5:57 PM, Thijs Cadier <[EMAIL PROTECTED]> wrote: > > Hi David, > > You might have taken my message the wrong way. I didn't mean to say I was > annoyed because the Rspec team hasn't delivered a solution for my problem. I > was trying to say that I'm annoyed by the consequences of thi

Re: [rspec-users] namespaced controllers

2007-12-12 Thread Kyle Hargraves
On Dec 12, 2007 5:03 AM, Thijs Cadier <[EMAIL PROTECTED]> wrote: > > Has anybody been taking a look at this issue? I'm getting a little annoyed > touching the namespaced controllers before running the specs all the time > :-). As a workaround, do what the rest of us have done and just be explicit

Re: [rspec-users] namespaced controllers

2007-12-12 Thread Kyle Hargraves
On Dec 12, 2007 4:37 PM, David Chelimsky <[EMAIL PROTECTED]> wrote: > On Dec 12, 2007 5:03 AM, Thijs Cadier <[EMAIL PROTECTED]> wrote: > > > > Has anybody been taking a look at this issue? I'm getting a little annoyed > > touching the namespaced controllers before running the specs all the time > >

Re: [rspec-users] namespaced controllers

2007-12-12 Thread Nathan Sutton
Well put. Nathan Sutton [EMAIL PROTECTED] rspec edge revision 3052 rspec_on_rails edge revision 3049 rails 2.0.1 On Dec 12, 2007, at 4:37 PM, David Chelimsky wrote: > On Dec 12, 2007 5:03 AM, Thijs Cadier <[EMAIL PROTECTED]> wrote: >> >> Has anybody been taking a look at this issue? I'm getting

Re: [rspec-users] namespaced controllers

2007-12-12 Thread Thijs Cadier
Hi David, You might have taken my message the wrong way. I didn't mean to say I was annoyed because the Rspec team hasn't delivered a solution for my problem. I was trying to say that I'm annoyed by the consequences of this problem, in a friendly way. I actually had a look at the Rspec code, but

Re: [rspec-users] namespaced controllers

2007-12-12 Thread David Chelimsky
On Dec 12, 2007 5:03 AM, Thijs Cadier <[EMAIL PROTECTED]> wrote: > > Has anybody been taking a look at this issue? I'm getting a little annoyed > touching the namespaced controllers before running the specs all the time > :-). What annoys me is the relative inverse ratio of level of whining to lev

Re: [rspec-users] namespaced controllers

2007-12-12 Thread Thijs Cadier
Has anybody been taking a look at this issue? I'm getting a little annoyed touching the namespaced controllers before running the specs all the time :-). Scott Taylor-6 wrote: > >> >> Figured out how to reproduce it. It depends on load order, I guess. >> >> Given the files: >> spec/controlle

[rspec-users] undefined method: controller_name

2007-12-12 Thread Alvin Schur
David Chelimsky wrote: > On Dec 12, 2007 9:50 AM, Alvin Schur > wrote: > >/ With rspec 1.0.8 I have a spec in the directory: /> >/ spec/units/controllers/application_controller_spec.rb /> >/ /> >/ require File.dirname(__FILE__) + '/../../spec_hel

Re: [rspec-users] undefined method: controller_name

2007-12-12 Thread Scott Taylor
On Dec 12, 2007, at 10:56 AM, David Chelimsky wrote: > On Dec 12, 2007 9:50 AM, Alvin Schur <[EMAIL PROTECTED]> wrote: >> With rspec 1.0.8 I have a spec in the directory: >> spec/units/controllers/application_controller_spec.rb >> >> require File.dirname(__FILE__) + '/../../spec_helper' >> >> cla

[rspec-users] Problem running examples with spec_server

2007-12-12 Thread David Nolan
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 fix? RSpec: 1-1-0RC1 build time 20071212145122 RSpec on Rails: Build time 2007121

Re: [rspec-users] undefined method: controller_name

2007-12-12 Thread David Chelimsky
On Dec 12, 2007 9:50 AM, Alvin Schur <[EMAIL PROTECTED]> wrote: > With rspec 1.0.8 I have a spec in the directory: > spec/units/controllers/application_controller_spec.rb > > require File.dirname(__FILE__) + '/../../spec_helper' > > class DummyController < ApplicationController > def index >

[rspec-users] undefined method: controller_name

2007-12-12 Thread Alvin Schur
With rspec 1.0.8 I have a spec in the directory: spec/units/controllers/application_controller_spec.rb require File.dirname(__FILE__) + '/../../spec_helper' class DummyController < ApplicationController def index raise "Prevent index from rendering" end end describe ApplicationControlle

Re: [rspec-users] Attachment-fu + Story Runner

2007-12-12 Thread David Chelimsky
On Dec 12, 2007 5:41 AM, Daniel Tenner <[EMAIL PROTECTED]> wrote: > > Ok, a bit more digging and I found this is a Rails issue, that is logged > here: > > http://dev.rubyonrails.org/ticket/4635 > > File uploads don't work in Rails integration tests either, only in > functional tests. This is not sp

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

2007-12-12 Thread aslak hellesoy
On Dec 12, 2007 12:48 AM, Yitzhak Bar Geva <[EMAIL PROTECTED]> wrote: > > Is it OK to go ahead and generate a Rails 2.0 project with RSpec 1.0.8? Am I > likely to run into problems? When we released RSpec 1.0.8 there was no Rails 2.0. We always have to do a fair amount of tweaks to keep up with Ra

Re: [rspec-users] Attachment-fu + Story Runner

2007-12-12 Thread Daniel Tenner
Ok, a bit more digging and I found this is a Rails issue, that is logged here: http://dev.rubyonrails.org/ticket/4635 File uploads don't work in Rails integration tests either, only in functional tests. This is not specific to Attachment-Fu. There is, however, a monkey patch that you can d

Re: [rspec-users] Attachment-fu + Story Runner

2007-12-12 Thread voodoorai2000
Hi, I had the same problem, couldn't get it to run with Stories thought... Had to test file uploads using controller specs, which works but is not as clear as a Story. I'm guessing the bug where it changes the TempFile to a String will be fixed soon by the core team, but if someone has a patch i

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

2007-12-12 Thread Stefan Magnus Landrø
I highly recommend using piston for this. Works like a breeze here. Stefan 2007/12/12, Nathan Sutton <[EMAIL PROTECTED]>: > > It's likely to fall completely on its face in a horrific manner, > you'll enjoy life much more if you use edge rspec. > > Nathan Sutton > [EMAIL PROTECTED] > rspec edge re

Re: [rspec-users] Fresh rspec on rails install blows up

2007-12-12 Thread Stefan Magnus Landrø
For your info, CURRENT means RSpec version 1.0.8. Try one of Aslak's solution for fixing this. HTH, Stefan 2007/12/11, Keith McDonnell <[EMAIL PROTECTED]>: > > Hi there, > > I installed the rspec on rails plugin for a new project today and guess > what -- it blows up! > > All by other rspec on