Ishit Parikh wrote in post #956228:
>> Do something like this instead:
>> --------------------------
>> describe DrugsController do
>> it "assigns the drugs within a given category as @drugs" do
>> Drug.stub!(:where).with([ 'drug_category_id = ?', "37"
>> ]).and_return([ mock_drug ])
>> get :search, :id => "37"
>> assigns[:drugs].should equal([ mock_drug ])
>> end
>>
>> private
>> def mock_drug(stubs={})
>> @mock_drug ||= mock_model(Drug, stubs)
>> end
>> end
>> --------------------------
>
> The above code gives failure on:
> get :search, :id => "37"
> undefined method `abstract_class?' for Object:Class
Well, I didn't actually run that code. I just reworked a bit of working
code from one of my old projects. I'll leave it as an exercise for you
to figure out what I did wrong.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.