I'm creating a Ruby gem that will extend the ActiveRecord functionality. I read the following Stack Overflow posts of how to extend ActiveRecord: post 1, post 2.
I'm using rspec for testing as describe in this great tutorial.
My question is, how do I test my active record extension methods using Rspec, because as I can think, we are not using a DB to save records.
How can I write tests for these kind of gems?
You probably want to have a look at acts_as_fu gem: https://github.com/nakajima/acts_as_fu.
Btw, you can use db in your rspec tests, but you don;t want to do this to test extensions.