[rspec-users] How to spec within a block?

2009-02-08 Thread Remi Gagnon
I want to mock to Model.to_xml but not his block. How to do it? Here is what I have (sorry for the formatting) output = @detenteur.to_xml( :skip_types => false, :skip_instruct => true, :dasherize => false, :only => [:inte_no] ) do |xml_detenteur| p xml_detenteur.intervenant_adresse

[rspec-users] How to return a value passed by ref to a method

2009-02-08 Thread Remi Gagnon
Hi, I have a recursive method and I want to mock a var passed by ref. Object.should_receive(:my_method).and_return"by_ref"(@value) Something like that. Any idea? Rémi ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/

Re: [rspec-users] How to return a value passed by ref to a method

2009-02-08 Thread David Chelimsky
On Sun, Feb 8, 2009 at 6:48 AM, Remi Gagnon wrote: > Hi, > > I have a recursive method and I want to mock a var passed by ref. > Object.should_receive(:my_method).and_return"by_ref"(@value) > > Something like that. > > Any idea? AFAIK, Ruby has no language construct for "by_ref/by_val," so I'm no

Re: [rspec-users] How to spec within a block?

2009-02-08 Thread David Chelimsky
On Sun, Feb 8, 2009 at 6:44 AM, Remi Gagnon wrote: > I want to mock to Model.to_xml but not his block. How to do it? > > Here is what I have (sorry for the formatting) > > output = @detenteur.to_xml( :skip_types => false, :skip_instruct => > true, :dasherize => false, :only => [:inte_no] )

Re: [rspec-users] Fixjour and others

2009-02-08 Thread Pat Nakajima
I started writing up a response about why I wrote Fixjour, and why I want it to be its own project, but it got really long. Here's a Markdownified gist: http://gist.github.com/60389. For the record, I think FR is a great tool (I link to it in Fixjour's README), it's just not for me. Read the gist

Re: [rspec-users] How to return a value passed by ref to a method

2009-02-08 Thread Remi Gagnon
Hello, This is a question from one of my teammate, I'll revalidate tomorrow with him what is his issue. Thank you Rémi On Sun, Feb 8, 2009 at 10:02 AM, David Chelimsky wrote: > On Sun, Feb 8, 2009 at 6:48 AM, Remi Gagnon wrote: > > Hi, > > > > I have a recursive method and I want to mock a va

Re: [rspec-users] [OT] Object Mother vs Test Data Builder (was Jay Fields' blog on developer testing)

2009-02-08 Thread Nick Hoffman
On 07/02/2009, at 10:45 PM, David Chelimsky wrote: On Sat, Feb 7, 2009 at 8:05 PM, Nick Hoffman wrote: On 07/02/2009, at 1:16 PM, David Chelimsky wrote: On Sat, Feb 7, 2009 at 9:59 AM, Nick Hoffman wrote: When writing Cucumber stories and features for controllers, should you cover ev

Re: [rspec-users] How to spec within a block?

2009-02-08 Thread Nick Hoffman
On 08/02/2009, at 7:44 AM, Remi Gagnon wrote: I want to mock to Model.to_xml but not his block. How to do it? Here is what I have (sorry for the formatting) output = @detenteur.to_xml( :skip_types => false, :skip_instruct => true, :dasherize => false, :only => [:inte_no] ) do |xml_de

Re: [rspec-users] [OT] Object Mother vs Test Data Builder (was Jay Fields' blog on developer testing)

2009-02-08 Thread David Chelimsky
On Sun, Feb 8, 2009 at 9:22 AM, Nick Hoffman wrote: > On 07/02/2009, at 10:45 PM, David Chelimsky wrote: >> >> On Sat, Feb 7, 2009 at 8:05 PM, Nick Hoffman wrote: >>> >>> On 07/02/2009, at 1:16 PM, David Chelimsky wrote: On Sat, Feb 7, 2009 at 9:59 AM, Nick Hoffman wrote: > >>

Re: [rspec-users] [OT] Object Mother vs Test Data Builder (was Jay Fields' blog on developer testing)

2009-02-08 Thread David Chelimsky
On Sun, Feb 8, 2009 at 9:49 AM, David Chelimsky wrote: > On Sun, Feb 8, 2009 at 9:22 AM, Nick Hoffman wrote: >> On 07/02/2009, at 10:45 PM, David Chelimsky wrote: >>> >>> On Sat, Feb 7, 2009 at 8:05 PM, Nick Hoffman wrote: On 07/02/2009, at 1:16 PM, David Chelimsky wrote: > > O

Re: [rspec-users] Speccing the format portion of a controller

2009-02-08 Thread doug livesey
Groovy!Cheers, Doug. 2009/2/7 David Chelimsky > On Sat, Feb 7, 2009 at 10:20 AM, Pat Maddox wrote: > > On Sat, Feb 7, 2009 at 3:16 AM, doug livesey wrote:. > > > > def do_get > > get :index, :format => "xml" > > end > > > > should work. Notice it's a string instead of symbol. > > I should

Re: [rspec-users] [OT] Silver Bullets (was Object Mother vs Test Data Builder)

2009-02-08 Thread Ben Mabey
David Chelimsky wrote: On Sun, Feb 8, 2009 at 9:22 AM, Nick Hoffman wrote: On 07/02/2009, at 10:45 PM, David Chelimsky wrote: On Sat, Feb 7, 2009 at 8:05 PM, Nick Hoffman wrote: On 07/02/2009, at 1:16 PM, David Chelimsky wrote: On Sat, Feb 7, 2009 at 9:59 AM, Nick Ho

Re: [rspec-users] [OT] Object Mother vs Test Data Builder (was Jay Fields' blog on developer testing)

2009-02-08 Thread Scott Taylor
Jim Morris wrote: Yet another way to do fixtures/factories is a hybrid that I outline in my blog, its basically what I do. http://blog.wolfman.com/posts/42 Basically I can't use the existing libraries as I am not using ActiveRecord. I'd be interested in supporting Datamapper, Sequel, and t

Re: [rspec-users] Fixjour and others

2009-02-08 Thread Scott Taylor
Pat Nakajima wrote: I started writing up a response about why I wrote Fixjour, and why I want it to be its own project, but it got really long. Here's a Markdownified gist: http://gist.github.com/60389. For the record, I think FR is a great tool (I link to it in Fixjour's README), it's just not

Re: [rspec-users] [RSpec] Setting a gem dep on rspec-rails

2009-02-08 Thread Matt Wynne
On 7 Feb 2009, at 19:02, David Chelimsky wrote: On Sat, Feb 7, 2009 at 12:27 PM, Pat Maddox wrote: On Sat, Feb 7, 2009 at 9:30 AM, Nick Hoffman wrote: With that said, I'm wondering what the accepted way to setup gem dependencies on rspec and rspec-rails is. Should one not bother? Should

Re: [rspec-users] How to return a value passed by ref to a method

2009-02-08 Thread Scott Taylor
Remi Gagnon wrote: Hi, I have a recursive method and I want to mock a var passed by ref. Object.should_receive(:my_method).and_return"by_ref"(@value) Often a way to spec a recursive function is to alias it, and have the recursive call call the alias. So if you want to check the recursion,

Re: [rspec-users] RecordNotFound bubbling thru to cucumber

2009-02-08 Thread Matt Wynne
Which version of cucumber / webrat are you using? On 6 Feb 2009, at 17:12, Jeff Talbot wrote: Hello, I have a controller action that raises a RecordNotFound exception if you're not allowed to see something. In my global application controller (application.rb), I catch these and render the 404

[rspec-users] [OT] RSpec on MSDN

2009-02-08 Thread Matt Wynne
Just saw this twitter by and thought people might be interested: http://msdn.microsoft.com/en-us/magazine/dd434651.aspx Matt Wynne http://blog.mattwynne.net http://www.songkick.com ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforg

Re: [rspec-users] Fixjour and others

2009-02-08 Thread Pat Nakajima
I think that named fixtures are primarily a matter of taste. With that being said, I did want to explain mine a bit. > When extra attributes are needed as well, I think the test can become too > busy. > A lot of time, I feel like processing the overrides hash is just a bandaid over something mis

[rspec-users] how can this pass?

2009-02-08 Thread Sergio Bayona
how could this test pass? I have: class PropertiesController < ApplicationController def show @property = Property.non_existing_method #causes a method missing error end end describe PropertiesController do def mock_property(stubs={}) @mock_property ||= mock_model(Property, stub

Re: [rspec-users] how can this pass?

2009-02-08 Thread Mark Wilden
On Sun, Feb 8, 2009 at 5:35 PM, Sergio Bayona wrote: > how could this test pass? > > I have: > > class PropertiesController < ApplicationController > def show >@property = Property.non_existing_method #causes a method missing > error > end > end > > > describe PropertiesController do > def

Re: [rspec-users] how can this pass?

2009-02-08 Thread aslak hellesoy
On Mon, Feb 9, 2009 at 2:35 AM, Sergio Bayona wrote: > how could this test pass? > > I have: > > class PropertiesController < ApplicationController > def show >@property = Property.non_existing_method #causes a method missing > error > end > end > > > describe PropertiesController do > def

Re: [rspec-users] how can this pass?

2009-02-08 Thread David Chelimsky
On Sun, Feb 8, 2009 at 7:35 PM, Sergio Bayona wrote: > how could this test pass? > > I have: > > class PropertiesController < ApplicationController > def show >@property = Property.non_existing_method #causes a method missing > error > end > end > > > describe PropertiesController do > def

Re: [rspec-users] how can this pass?

2009-02-08 Thread James Byrne
Sergio Bayona wrote: > how could this test pass? > > I have: > > class PropertiesController < ApplicationController ... > why zero failures? more specifically, why would :non_existing_method > return mock_property? and why would the assigns[:property] be equal to > mock_property? did I eat some

Re: [rspec-users] how can this pass?

2009-02-08 Thread Sergio Bayona
Aslak Hellesøy wrote: > On Mon, Feb 9, 2009 at 2:35 AM, Sergio Bayona > wrote: >> >>assigns[:property].should equal(mock_property) >> 1 example, 0 failures >> >> >> why zero failures? more specifically, why would :non_existing_method >> return mock_property? > > Because you have stubbed

Re: [rspec-users] how can this pass?

2009-02-08 Thread Matías Flores
2009/2/8 Sergio Bayona > how could this test pass? > > I have: > > class PropertiesController < ApplicationController > def show >@property = Property.non_existing_method #causes a method missing > error > end > end > > > describe PropertiesController do > def mock_property(stubs={}) >

Re: [rspec-users] how can this pass?

2009-02-08 Thread David Chelimsky
On Sun, Feb 8, 2009 at 8:54 PM, Sergio Bayona wrote: > Aslak Hellesøy wrote: >> On Mon, Feb 9, 2009 at 2:35 AM, Sergio Bayona >> wrote: >>> >>>assigns[:property].should equal(mock_property) >>> 1 example, 0 failures >>> >>> >>> why zero failures? more specifically, why would :non_existing

Re: [rspec-users] how can this pass?

2009-02-08 Thread Mark Wilden
On Sun, Feb 8, 2009 at 6:54 PM, Sergio Bayona wrote: > > On Mon, Feb 9, 2009 at 2:35 AM, Sergio Bayona > > wrote: > >> > >>assigns[:property].should equal(mock_property) > >> 1 example, 0 failures > >> > >> > >> why zero failures? more specifically, why would :non_existing_method > >> re

Re: [rspec-users] how can this pass?

2009-02-08 Thread Mark Wilden
On Sun, Feb 8, 2009 at 6:09 PM, Matías Flores wrote: > > You can find more info at > http://rspec.info/documentation/mocks/message_expectations.html. > On that page, I found this example of using a computed return value with an expectation: my_mock.should_receive(:msg).with(:numeric, :numeric)