Commit e703662f by Prem Sichanugrist

Make sure that Paperclip is working well with Rails 3.1.0.rc1

parent 73ee9b8f
...@@ -67,6 +67,7 @@ end ...@@ -67,6 +67,7 @@ end
def rebuild_model options = {} def rebuild_model options = {}
ActiveRecord::Base.connection.create_table :dummies, :force => true do |table| ActiveRecord::Base.connection.create_table :dummies, :force => true do |table|
table.column :title, :string
table.column :other, :string table.column :other, :string
table.column :avatar_file_name, :string table.column :avatar_file_name, :string
table.column :avatar_content_type, :string table.column :avatar_content_type, :string
...@@ -85,6 +86,7 @@ def rebuild_class options = {} ...@@ -85,6 +86,7 @@ def rebuild_class options = {}
include Paperclip::Glue include Paperclip::Glue
has_attached_file :avatar, options has_attached_file :avatar, options
end end
Dummy.reset_column_information
end end
class FakeModel class FakeModel
......
...@@ -193,7 +193,7 @@ class PaperclipTest < Test::Unit::TestCase ...@@ -193,7 +193,7 @@ class PaperclipTest < Test::Unit::TestCase
@dummy.valid? @dummy.valid?
end end
should "not have an error when assigned a valid file" do should "not have an error when assigned a valid file" do
assert_equal 0, @dummy.errors.length, @dummy.errors.full_messages.join(", ") assert_equal 0, @dummy.errors.size, @dummy.errors.full_messages.join(", ")
end end
end end
context "and assigned an invalid file" do context "and assigned an invalid file" do
...@@ -202,7 +202,7 @@ class PaperclipTest < Test::Unit::TestCase ...@@ -202,7 +202,7 @@ class PaperclipTest < Test::Unit::TestCase
@dummy.valid? @dummy.valid?
end end
should "have an error when assigned a valid file" do should "have an error when assigned a valid file" do
assert @dummy.errors.length > 0 assert @dummy.errors.size > 0
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment