Permalink
Browse files

test fail. progress on property types.

  • Loading branch information...
1 parent 59efaf9 commit 67b9bf14953cae5ce6fdc23e931a0f33202e266d @jdwyah committed May 21, 2009
Showing with 29 additions and 2 deletions.
  1. +9 −0 db/migrate/20090521204802_property_type_sti_conflict.rb
  2. +2 −2 db/schema.rb
  3. +5 −0 test/factories.rb
  4. +13 −0 test/unit/topic_test.rb
@@ -0,0 +1,9 @@
+class PropertyTypeStiConflict < ActiveRecord::Migration
+ def self.up
+ rename_column :property_types, :type, :type_name
+ end
+
+ def self.down
+ rename_column :property_types, :type_name, :type
+ end
+end
View
@@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20090521194112) do
+ActiveRecord::Schema.define(:version => 20090521204802) do
create_table "occurrences", :force => true do |t|
t.string "name"
@@ -44,7 +44,7 @@
create_table "property_types", :force => true do |t|
t.integer "topic_id"
t.string "name"
- t.string "type"
+ t.string "type_name"
t.datetime "created_at"
t.datetime "updated_at"
end
View
@@ -7,4 +7,9 @@
Factory.define :topic do |topic|
topic.sequence(:name) {|n| "name_#{n}" }
topic.user { Factory(:user)}
+end
+
+Factory.define :property_type do |ptype|
+ ptype.name 'Date Seen'
+ ptype.type_name 'DateProperty'
end
View
@@ -13,5 +13,18 @@ class TopicTest < ActiveSupport::TestCase
should "be tagged" do
assert_equal [@book], @crime_and_punishment.tags
end
+
+ context "and some properties" do
+ setup do
+ @date_read = Factory(:property_type, :name => 'Date Read', :type_name => 'MetaDate')
+ @book.property_types << @date_read
+ end
+
+ should "books should have dates read " do
+ assert_equals [@date_read], @book.property_types
+ assert_equals [@date_read], @crime_and_punishment.properties_to_use
+ end
+
+ end
end
end

0 comments on commit 67b9bf1

Please sign in to comment.