i have two question
1.How do i stub a nil object in rails test cases.
2.Mock an Active Record Abstract class
for example
Y::table.find_by_email("[email protected]").selected_lan["iden"]
module Y
class table <Base
belongs_to:selected_lan, :class =>lan
def self.find_by_email(iden)
find_by_email(license_iden)
end
end
end
module Y
class Base <ActiveRecord::Base
self.abstract_class = true
end
end
Y::table.expects(:find_by_email).with('[email protected]').returns(nil)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With