Re: [rspec-users] Asserting on a yield

2012-03-08 Thread Morten Møller Riis
en? } end Then: block_yield(thing, :do_stuff).should == "value" Mvh Morten Møller Riis On Mar 7, 2012, at 9:42 PM, David Chelimsky wrote: > On Wed, Mar 7, 2012 at 2:32 PM, Matt Wynne wrote: >> >> On 7 Mar 2012, at 18:16, David Chelimsky wrote: >> >> O

Re: [rspec-users] Asserting on a yield

2012-03-07 Thread Morten Møller Riis
How about this? thing.do_stuff(&:to_s).should == expected Best regards Morten Møller Riis On Mar 7, 2012, at 8:22 AM, Matt Wynne wrote: > Hi all, > > I'm spec'ing a method that yields a value. Right now, I spec it like this: > > result = nil >

Re: [rspec-users] Such a simple test fails. But why ?

2012-02-15 Thread Morten Møller Riis
This looks a little funny in my phone. But what happens if you do this? ... options = Options.new(argv) puts "argv[0]: #{argv[0]}" puts "argv[1]: #{argv[1]}" ... Best regards Morten Sent from my iPhone On 15/02/2012, at 19.26, Serguei Cambour wrote: > I just tried to integrate a simple test

Re: [rspec-users] What is the pattern for testing a time argument using argument matcher

2012-01-26 Thread Morten Møller Riis
You can use things like Timecop. I prefer to just stub Time.now: timestamp = Time.now.to_i Time.stub(:now).returns(Time.at(timestamp)) Best regards Morten Møller Riis On Jan 26, 2012, at 4:44 PM, Yi Wen wrote: > Say I do: > > ```ruby > object.method 5.days.ago > ``` >

Re: [rspec-users] how to test arguments going into a mailer method?

2011-12-09 Thread Morten Møller Riis
d => @user.id, :foo => "bar", :custom => @encoded })).and_yield(paypal_error) Mvh Morten Møller Riis On Dec 9, 2011, at 8:02 AM, Patrick J. Collins wrote: > Hi, > > So I am not really intere

Re: [rspec-users] Spec'ing a block

2011-12-06 Thread Morten Møller Riis
FakeFS definitely looks like a nice solution! I also like the argument about not tightly coupling the specs to File and FileUtils. Mvh Morten Møller Riis On Dec 5, 2011, at 6:21 PM, David Chelimsky wrote: > On Mon, Dec 5, 2011 at 9:13 AM, Morten Møller Riis > wrote: >> Hi Matt

Re: [rspec-users] Spec'ing a block

2011-12-05 Thread Morten Møller Riis
could be worked out, but for things like #rm_r I do like just to mock them. Please let me know if this is not best practice. I know one can "over-mock" a spec suite, but I generally tend to mock things that are tested/spec'ed themselves. Mvh Morten Møller Riis On Dec 5, 2011, a

Re: [rspec-users] Spec'ing a block

2011-12-05 Thread Morten Møller Riis
For the moment I have done this: def Process.fork(&block) block.call end So that Process.fork doesn't actually spawn a new process but just runs it in the current one. But any better suggestions are welcome :) Mvh Morten Møller Riis On Dec 5, 2011, at 1:04 PM, Morten Møller R

[rspec-users] Spec'ing a block

2011-12-05 Thread Morten Møller Riis
od_R).with(0755, "#{@domain.directory}/*") I guess that is because it is passed in the block and fired off in a seperate process (Process.fork). Mvh Morten Møller Riis ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.o