Skip to content

Instantly share code, notes, and snippets.

@dansteen
Created June 27, 2010 03:29
Show Gist options
  • Save dansteen/454606 to your computer and use it in GitHub Desktop.
Save dansteen/454606 to your computer and use it in GitHub Desktop.
# Here is the Call model:
class Call < ActiveRecord::Base
include PimNormalizer
extend PimValidator
before_validation :normalize_state
belongs_to :clear_unit, :class_name=>"Member"
belongs_to :call_dispatcher
belongs_to :call_category
....
# Here is the CallCategory model
class CallCategory < ActiveRecord::Base
has_many :calls
....
# Here is the Call Fixture
fall:
address: 2342 Berkly ave
city: Baltimore
state: MD
zip: 21215
time: <%= DateTime.now-1.hour %>
dispatch_time: <%= DateTime.now-59.minutes %>
clear_time: <%= DateTime.now-10.minutes %>
called_911_time: <%= DateTime.now-58.minutes %>
log_number: A-<%= (DateTime.now-1.hour).strftime('%m%d%y') %>-1
cancelled: false
false_call: false
log_submitted: false
reviewed: false
call_category: categoryFall
clear_unit: memberBob
call_dispatcher: baseA
# Here is the CallCategory Fixture
categoryFall:
name: fall
....
# Here is the Call test:
# First ensure that a valid entry can be saved
test "valid test" do
fall=calls :fall
stroke=calls :stroke
assert fall.save
assert stroke.save
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment