Re: [rspec-users] Mocking MiddleMan

2008-06-23 Thread Pat Maddox
On Mon, Jun 23, 2008 at 11:08 AM, s.ross <[EMAIL PROTECTED]> wrote: > I'm trying to verify (using expectations) that a backgroundrb job is being > started. I ran across this thread: > http://rubyforge.org/pipermail/rspec-users/2007-October/004115.html, in > which Pat Maddox conditionally loads back

Re: [rspec-users] Mocking MiddleMan

2008-06-23 Thread Shane Mingins
This is what worked for me back then: In our spec_helper I did: class Object; remove_const :MiddleMan; end MiddleMan = Object.new And then the spec looked like: it "should call the admin email worker" do MiddleMan.should_receive(:new_worker).with(:class => :admin_email_worker, :args =

[rspec-users] Mocking MiddleMan

2008-06-23 Thread s.ross
I'm trying to verify (using expectations) that a backgroundrb job is being started. I ran across this thread: http://rubyforge.org/pipermail/rspec-users/2007-October/004115.html , in which Pat Maddox conditionally loads backgroundrb. However, I don't see why the original construct that started

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Yi Wen
Well, at least now we know this is nothing to do with RSpec. My suggestion is that you comment out the code which will be executed during a creation, bit by bit in User (such as before_save) and try to create a user. In this way you can pinpoint where the problem is. On Mon, Jun 23, 2008 at 10:26

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Csongor Bartus
Yi Wen wrote: > You don't have attr_accessor :password, :password_confirmation in > User, do you? You may want to add this and try again I had :password, I've added :password_confirmation but still the same: >> u = User.create!(:login => "test", :email => "[EMAIL PROTECTED]", :password >> => "te

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Yi Wen
You don't have attr_accessor :password, :password_confirmation in User, do you? You may want to add this and try again On Mon, Jun 23, 2008 at 9:59 AM, Csongor Bartus <[EMAIL PROTECTED]> wrote: > Yi Wen wrote: >> fire up script/console and copy line 82 and try it out. and report the >> result here

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Csongor Bartus
Yi Wen wrote: > fire up script/console and copy line 82 and try it out. and report the > result here. >> u = User.create!(:login => "test", :email => "[EMAIL PROTECTED]", :password >> => "test123", :password_confirmation => "test123") NoMethodError: You have a nil object when you didn't expect it

Re: [rspec-users] before_save model callback rspec testing

2008-06-23 Thread Yi Wen
fire up script/console and copy line 82 and try it out. and report the result here. On Fri, Jun 20, 2008 at 11:11 AM, Csongor Bartus <[EMAIL PROTECTED]> wrote: > David Chelimsky wrote: > >> >> Try using create! or save! - I'll bet the record is not being saved >> correctly and you're not seeing th