Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-29 Thread Sven Fuchs
All the mentioned solutions are great, but for me they implied a bit too much hassle to set up and also, given a larger number of specs, a bit slow. This discussion actually motivated me to publish my own stubbing solution that I've recently implemented on GitHub. (This actually is a kind

Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-27 Thread Jarkko Laine
On 27.5.2008, at 10.52, Mark Dodwell wrote: Also, any opinions on using a Factory pattern for instantiating mocks of models? I like the idea of maintaining mocks in one place as I frequently use them across several specs for models that have associations. Do you think it would create dependen

Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-27 Thread Mark Dodwell
Also, any opinions on using a Factory pattern for instantiating mocks of models? I like the idea of maintaining mocks in one place as I frequently use them across several specs for models that have associations. Do you think it would create dependency issues between the specs using that Factory

Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-27 Thread Mark Dodwell
Many thanks for your replies. David Chelimsky wrote: > Use stub_model instead (if you're using source from github - if not > the 1.4 release is coming soon). Thanks - that helps a great deal. Scott Taylor wrote: > I would highly suggest using :null_object => true in view specs (or > controller

Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-27 Thread Bart Zonneveld
On 26-mei-2008, at 21:52, Mark Dodwell wrote: I find myself doing this kind of thing a lot in Controller Specs: @vacancy = mock_model(Vacancy) @vacancy.stub!(:reference) @vacancy.stub!(:title) @vacancy.stub!(:created_at) @vacancy.stub!(:updated_at) @vacancy.

Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-26 Thread Scott Taylor
On May 26, 2008, at 3:52 PM, Mark Dodwell wrote: I find myself doing this kind of thing a lot in Controller Specs: @vacancy = mock_model(Vacancy) @vacancy.stub!(:reference) @vacancy.stub!(:title) @vacancy.stub!(:created_at) @vacancy.stub!(:updated_at) @vacancy.stu

Re: [rspec-users] Mocking Models in Controller Specs...

2008-05-26 Thread David Chelimsky
On May 26, 2008, at 2:52 PM, Mark Dodwell wrote: I find myself doing this kind of thing a lot in Controller Specs: @vacancy = mock_model(Vacancy) @vacancy.stub!(:reference) @vacancy.stub!(:title) @vacancy.stub!(:created_at) @vacancy.stub!(:updated_at) @vacancy.stu

[rspec-users] Mocking Models in Controller Specs...

2008-05-26 Thread Mark Dodwell
I find myself doing this kind of thing a lot in Controller Specs: @vacancy = mock_model(Vacancy) @vacancy.stub!(:reference) @vacancy.stub!(:title) @vacancy.stub!(:created_at) @vacancy.stub!(:updated_at) @vacancy.stub!(:body) @vacancy.stub!(:contract)