[rspec-users] how to mock active record relationships

2009-10-20 Thread Christoph ----
Hi I am new to Rspec and try to mock my controller that looks like def create @friendship = current_user.friendships.build(:friend_id => params[:friend_id]) if @friendship.save flash[:notice] = "Added friend." render :text => flash[:notice] else flash[:error] = "Erro

Re: [rspec-users] how to mock active record relationships

2009-10-21 Thread Christoph ----
Thanks guys, you really helped me a lot where to put my focus on. I will refactor my code to have it more easily being mocked, I thought about this at one point, but kept it for readability. Hope to get my specs up running soon. -- Posted via http://www.ruby-forum.com/.

Re: [rspec-users] Testing multi-model-form views in Rails 2.3.3 and RSpec 1.2.7

2009-09-05 Thread Christoph Schiessl
Well, I'm still looking for a solution. Best regards, Christoph On Sep 5, 2009, at 5:32 PM, Yury Kotlyarov wrote: I have just the same problem. Any suggestion? TIA, Yury Christoph Schiessl wrote: I've created a small application to demonstrate the problem in more det

[rspec-users] Calling let(:something) from before blocks?

2010-11-05 Thread Christoph Schiessl
trace undefined method `let' for # Some kind of workaround to make this work would be really nice. Is this usage of `let` supported at all? Thx & best regards, Christoph PS: I'm using rspec 2.0.1, rails 3.0.1 and ruby 1.8.7. ___ rspec-us

[rspec-users] Calling let(:something) from before blocks?

2010-11-06 Thread Christoph Schiessl
e from backtrace undefined method `let' for # Some kind of workaround to make this work would be really nice. Is this usage of `let` supported at all? Thx & best regards, Christoph PS: I'm using rspec 2.0.1, rails 3.0.1 and ruby 1.8.7. __

[rspec-users] Stubbing Scopes

2011-02-15 Thread Christoph Schiessl
ilure/Error: Allocation.on_day(start_of_day + 3.hours).should == "result" NoMethodError: undefined method `includes_values' for "result":String I'm using Rails 3.0.4 and RSpec 2.5 (latest versions). Best regards, Christoph Schiessl

Re: [rspec-users] Stubbing Scopes

2011-02-15 Thread Christoph Schiessl
ot; } end However, (1) is passing and (2) is failing. Output as before: >> Failure/Error: Allocation.on_day(start_of_day + 3.hours).should == "result" >> NoMethodError: >> undefined method `includes_values' for "result":String Any ideas? Best regards,

Re: [rspec-users] Stubbing Scopes

2011-02-24 Thread Christoph Schiessl
So... I settled for testing with message expectations without return values. Guess that's good enough for now. Thank you anyway! Best regards, Christoph Schiessl On Feb 15, 2011, at 21:34 , Justin Ko wrote: > > > On Feb 15, 11:14 am, Christoph Schiessl wrote: >> Thanks

[rspec-users] Testing multi-model-form views in Rails 2.3.3 and RSpec 1.2.7

2009-08-23 Thread Christoph Schiessl
I have two models in a has_many relationship. The parent model (Invoice) accepts the attributes for it's children (InvoiceItem). The models and the associated controller (InvoicesController) are absolutely standard stuff. This is the significant part of the model code: class Invoice < ActiveReco

Re: [rspec-users] Testing multi-model-form views in Rails 2.3.3 and RSpec 1.2.7

2009-08-23 Thread Christoph Schiessl
opy and paste): git clone git://github.com/cs/nested_attributes_spec_demo.git cd nested_attributes_spec_demo rake db:migrate rake db:test:clone rake spec On Aug 23, 2009, at 1:57 PM, Matt Wynne wrote: On 23 Aug 2009, at 10:51, Christoph Schiessl wrote: I have two models in a has_many relations

Re: [rspec-users] Assigning instance variable :expected and :got appear to be the same

2009-08-25 Thread Christoph Schiessl
users Your controller is okay. Try to change your test like this: it "should assign an instance variable" do City.should_receive(:new).and_return(@city = mock_model(City)) get 'new' assigns[:city].should == @city end That way, you are comparing the same

Re: [rspec-users] Deprecating the mocking framework?

2007-09-05 Thread Christoph Sturm
wn mocking that you have to use. (This is fixed now and rspec plays very nice with mocha, great) regards christoph On 9/3/07, David Chelimsky <[EMAIL PROTECTED]> wrote: > Hi all, > > I've talked this over w/ a couple of the other committers and we've > decided th

Re: [rspec-users] Deprecating the mocking framework?

2007-09-06 Thread Christoph Sturm
On 9/5/07, Steven R. Baker <[EMAIL PROTECTED]> wrote: > Wilson Bilkovich wrote: > > On 9/5/07, Christoph Sturm <[EMAIL PROTECTED]> wrote: > >> One thing is clear, mocha is much nicer than the integrated mocking, > >> nicer syntax, better errormessages, be

Re: [rspec-users] Deprecating the mocking framework?

2007-09-06 Thread Christoph Sturm
t's already > there waiting for them. > > Chris Pratt > > > On 9/6/07, Christoph Sturm <[EMAIL PROTECTED]> wrote: > > > > On 9/5/07, Steven R. Baker <[EMAIL PROTECTED]> wrote: > > > Wilson Bilkovich wrote: > > > > On 9/5/07, Ch