require File.expand_path(File.dirname(__FILE__) + '/spec_helper') describe DynamicAttribute do before do reset_database @page = Page.create end it "should allow transferring between String and Text" do @page.add_dynamic_attribute(:foo, "string") @page.write_dynamic_attribute :foo, "this is a string" @page.save @page.write_dynamic_attribute :foo, "t"*300 @page.save @page.dynamic_attributes.find_by_attr_key("foo").object_type.should == "text" @page.write_dynamic_attribute :foo, "this is a string again" @page.save @page.dynamic_attributes.find_by_attr_key("foo").object_type.should == "string" end end