jeudi 5 février 2015

Unit testing in rails using factory_girl

I am trying to unit test a method inside a model as shown below in rails. The whole aim is to do a database independent testing here and so thinking of using Factory girl.


For eg.,



Class A < ActiveRecord::Base
def method_A(param1,param2) do
/*do a select query on a table with param1 and param2*/
end


end


How to go about testing the method here with arguments here. Any help would be appreciated.


Aucun commentaire:

Enregistrer un commentaire