Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Issue #3 - Implementing spec for serialized columns

  • Loading branch information...
commit 0aa235970ab4d9a260f2aadd5e4676c12bdb9351 1 parent f94fe82
@rocksolidwebdesign rocksolidwebdesign authored
View
9 spec/lib/amoeba_spec.rb
@@ -83,10 +83,11 @@
new_post.widgets.map(&:id).each do |id|
old_post.widgets.map(&:id).include?(id).should_not be true
end
- old_post.custom_things.length.should == 3
- old_post.custom_things.select{ |ct| ct.value == [] }.length.should == 1
- old_post.custom_things.select{ |ct| ct.value == [1,2]}.length.should == 1
- old_post.custom_things.select{ |ct| ct.value == [78]}.length.should == 1
+
+ new_post.custom_things.length.should == 3
+ new_post.custom_things.select{ |ct| ct.value == [] }.length.should == 1
+ new_post.custom_things.select{ |ct| ct.value == [1,2]}.length.should == 1
+ new_post.custom_things.select{ |ct| ct.value == [78]}.length.should == 1
# }}}
# Author {{{
old_author = Author.find(1)
View
4 spec/support/data.rb
@@ -81,6 +81,8 @@
s3.superkittens.create(:value => "Dopey")
s3.superkittens.create(:value => "Sneezy")
s3.superkittens.create(:value => "Sleepy")
+
+p1.custom_things.create([{:value => [1,2]}, {:value => []}, {:value => [78]}])
# }}}
# Product {{{
@@ -115,6 +117,4 @@
necklace1.sections << jewelry
necklace1.sections << accessories
necklace1.save
-
-p1.custom_things.create [{:value => [1,2]}, {:value => []},{ :value => [78]}]
# }}}
View
11 spec/support/models.rb
@@ -74,17 +74,8 @@ class Post < ActiveRecord::Base
class CustomThing < ActiveRecord::Base
belongs_to :post
- class ArrayPack
- def load(str)
- str.split(',')
- end
-
- def dump(int_array)
- int_array.join(',')
- end
- end
- serialize :value, ArrayPack.new
+ serialize :value
end
class Account < ActiveRecord::Base
Please sign in to comment.
Something went wrong with that request. Please try again.