Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Address class stub in specs

  • Loading branch information...
commit c0627762020244f0db261ceec29aa90a53c77cf0 1 parent 86d4f42
authored May 20, 2010
22  test/unit/class_stubs/address.rb
... ...
@@ -0,0 +1,22 @@
  1
+# VirtualBase is uninitialized for some reason without below line
  2
+require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
  3
+
  4
+class Address < VirtualBase
  5
+  
  6
+  attr_accessor :city, :created_at, :updated_at, :owner
  7
+  def populate_defaults
  8
+    self.city = @city || "Vancouver"
  9
+    self.created_at = @created_at || Time.now-2.days
  10
+    self.updated_at = @updated_at || Time.now-1.day
  11
+    self
  12
+  end
  13
+
  14
+  def payload_map_for_customer
  15
+    {
  16
+      :customer_id         => {:value => @customer_id, :precedence => 2},
  17
+      :city                => {:value => @city,        :precedence => 2},
  18
+      :created_at          => {:value => @created_at,  :precedence => 4}, 
  19
+      :updated_at          => {:value => @updated_at,  :precedence => 4}
  20
+    }
  21
+  end 
  22
+end
3  test/unit/spec_helper.rb
... ...
@@ -1,4 +1,3 @@
1  
-
2 1
 def setup_active_record
3 2
   ActiveRecord::Base.establish_connection :adapter => "sqlite3",
4 3
     :database  => ":memory:"
@@ -20,9 +19,9 @@ def setup_active_record
20 19
 
21 20
 
22 21
 __DIR__ =File.dirname(__FILE__)
23  
-require File.expand_path(File.join(__DIR__, 'class_stubs', 'payload'))
24 22
 require File.expand_path(File.join(__DIR__, 'class_stubs', 'model_base'))
25 23
 require File.expand_path(File.join(__DIR__, 'class_stubs', 'user'))
26 24
 require File.expand_path(File.join(__DIR__, 'class_stubs', 'customer'))
27 25
 require File.expand_path(File.join(__DIR__, 'class_stubs', 'contact'))
  26
+require File.expand_path(File.join(__DIR__, 'class_stubs', 'address'))
28 27
 require File.expand_path(File.join(__DIR__, '..', '..', 'init'))

0 notes on commit c062776

Please sign in to comment.
Something went wrong with that request. Please try again.