Skip to content

Instantly share code, notes, and snippets.

@dansteen
Created April 9, 2010 02:23
Show Gist options
  • Save dansteen/360810 to your computer and use it in GitHub Desktop.
Save dansteen/360810 to your computer and use it in GitHub Desktop.
require 'validators'
class Call < ActiveRecord::Base
belongs_to :clear_unit, :class_name=>"Member"
belongs_to :call_dispatcher
belongs_to :category, :class_name=>"CallCategory"
has_many :patients
has_many :responses
has_many :recordings
has_many :city_responders
has_many :members, :through=>:responses
validates_presence_of :address, :city, :state, :zip
validates_as_state :state
validates_length_of :zip, :is=>8
...
and my test script is:
require 'test_helper'
class CallTest < ActiveSupport::TestCase
fixtures :calls
# Ensure that the address information is present
test "address_present" do
fall=Call.new
fall.zip="21215"
p fall.zip
assert fall.save!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment