Re: [rspec-users] STDOUT.should_receive(:puts).with Works *** (:print) fails

2013-05-10 Thread Bas Vodde
Hi Chuck, If you just call "print" and "getch" then you should be able to test for these by checking for these messages on your object under test: subject.should_receive(:print) Hope that helps? Bas On 11 May, 2013, at 11:36 AM, Charles Thornton wrote: > I use: STDOUT.should_receive(:put

Re: [rspec-users] and_raise with a message

2012-08-22 Thread Bas Vodde
Chelimsky wrote: >> On Wed, Aug 22, 2012 at 6:43 AM, Bas Vodde wrote: >>> >>> On 22 Aug, 2012, at 7:25 PM, David Chelimsky wrote: >>> >>>> On Wed, Aug 22, 2012 at 12:56 AM, Bas Vodde wrote: >>>>> >>>>> Hiya all, >&

Re: [rspec-users] and_raise with a message

2012-08-22 Thread Bas Vodde
was one of the cases where my default excepted behavior from RSpec was different from what the API wanted. Therefore, I had to dive in the RSpec doc to see how I could pass the message…. Bas On 22 Aug, 2012, at 7:25 PM, David Chelimsky wrote: > On Wed, Aug 22, 2012 at 12:56 AM, Bas

[rspec-users] and_raise with a message

2012-08-21 Thread Bas Vodde
Hiya all, I was trying to get and_raise to raise an exception filled with a message and I was struggling with the API for a while (not on the latest RSpec, but assume it didn't change). Based on that, I have a suggestion for improvement. My first attempt was to mirror how I use raise, so I tr

Re: [rspec-users] How do I specify that a class does not receive any message

2012-08-21 Thread Bas Vodde
JB is right. Sometimes, for clarity, it is useful to add should_not, but for functionality it is usually not needed. Bas On 22 Aug, 2012, at 4:12 AM, J. B. Rainsberger wrote: > On Tue, Aug 21, 2012 at 5:02 PM, Andrew Premdas wrote: > I want to write > > it "should ..." do > Client.shoul

Re: [rspec-users] Rspec: How to mock class method

2012-07-26 Thread Bas Vodde
Indeed it should be :) Tnx. Bas On 27-Jul-2012, at 2:42 PM, Srushti Ambekallu wrote: > On 27-Jul-2012, at 11:34 AM, Bas Vodde wrote: > >> >> Hi, >> >> How about: >> >> Message.should_receive(:Message.method_a).with(xxx).and_

Re: [rspec-users] Rspec: How to mock class method

2012-07-26 Thread Bas Vodde
Hi, How about: Message.should_receive(:Message.method_a).with(xxx).and_return(true) Bas On 27-Jul-2012, at 1:31 PM, bill gate wrote: > Hi, I have two model: Message, User > > message.rb > ``` > class Message < ActiveRecord::Base > class << self >def method_a(args) > [1,2] >end

Re: [rspec-users] New to rspec

2012-06-20 Thread Bas Vodde
How about writing a spec instead of an email :) Bas On 20-Jun-2012, at 5:58 PM, farh...@deeproot.co.in wrote: > Hi all, > > As I am new to rspec, would like to know how to go about learning to write > tests in rspec. > > Regards, > Farheen Zahara > > _

Re: [rspec-users] RSpec exactly behavior (it doesn't exactly fail)

2012-04-15 Thread Bas Vodde
ub.com/rspec/rspec-mocks/commit/fb9c76c2e40b4b25f4dcc5de95f8c60319b6d9c1. > It'll be fixed in the next release (2.10). > > Cheers, > David > > -- > David Chelimsky > Sent with Sparrow > > On Sunday, April 15, 2012 at 4:48 PM, David Chelimsky wrote: > >&g

[rspec-users] RSpec exactly behavior (it doesn't exactly fail)

2012-04-14 Thread Bas Vodde
Hiya all, I've got a quick question related to RSpec. I was test-driving some code and ended up in an endless loop. I was surprised by this, but traced it down to the mock not failing on additional calls but only in the end. Let me explain. I was writing code like this: subject.wrapper.sho