module Crabfarm::Assertion::Fields
Public Class Methods
included(klass)
click to toggle source
# File lib/crabfarm/assertion/fields.rb, line 65 def self.included(klass) klass.extend ClassMethods end
Public Instance Methods
attributes=(_hash)
click to toggle source
# File lib/crabfarm/assertion/fields.rb, line 79 def attributes=(_hash) _hash.each { |k,v| send(k.to_s+'=', v) } end
field_hash()
click to toggle source
# File lib/crabfarm/assertion/fields.rb, line 87 def field_hash @field_hash end
mock(_hash)
click to toggle source
# File lib/crabfarm/assertion/fields.rb, line 83 def mock(_hash) @field_hash = _hash end
reset_fields()
click to toggle source
# File lib/crabfarm/assertion/fields.rb, line 69 def reset_fields klass = self.class @field_hash = {} klass.fields.each do |field| value = klass.field_defaults[field] @field_hash[field] = value.duplicable? ? value.clone : value end end