I am creating a ruby project with the class which is the inheritance of ActiveRecord::Base. How can i write rspec testing and simple coverage for the following code sample without using database.
class Person < ActiveRecord::Base
validates_length_of :name, within: 10..40
end
person = Person.create(:name => "aungaung")
person.save
Here's a short example of testing the validations on an ActiveRecord model. You can certainly go into much more depth, and there are plenty of ways to make the tests more elegant, but this will suffice for a first test.