Displaying 1 result from an estimated 1 matches for "settingsmock".
2007 Apr 30
4
Mocking with Calculated Results
...:all => Array
find with anything else => nil
This roughly approximates how ActiveRecord::find works in this case
(neglecting the optional parameters).
My question is: Is this calculation of the return value a bad thing,
and if so, how better to accomplish it?
Thanks
---------
module SettingsMock
def setup_mock
@countable = mock(''countable'')
@countable.stub!(:count).and_return(1)
@countable.stub!(:full_messages).and_return([''a message''])
@setting = mock_model Setting do |m|
m.stub!(:save).and_return(true)
m.stub!(:dest...