I am working on Ruby 2.2.0, I have a class
class JobOffer
include DataMapper::Resource
property :id, Serial
property :title, String
property :location, String
property :experience, Numeric, :default => 0
property :description, String
property :created_on, Date
property :updated_on, Date
property :is_active, Boolean, :default => true
belongs_to :user
validates_presence_of :title
validates_numericality_of :experience => {
:greater_than_or_equal_to => 0,
:less_than_or_equal_to => 16
}
end
My question is: How I can test values of experience field in rspec tests? It's easy to test title, because I ask for valid? and it returns if title is present or not, but I don't know if is there something like this for numeric fields. Thanks in advance!