diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-04-28 15:05:33 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-04-28 23:35:13 +0200 |
commit | 3afa4847d9598f52d960b2b8cc8c94cc101bb1e3 (patch) | |
tree | d9fbc1b8d5f936c5d4bf487a7101b8c1577a59bd /railties | |
parent | ce48b3103acd2f58931aa42b93073592b291114e (diff) | |
download | rails-3afa4847d9598f52d960b2b8cc8c94cc101bb1e3.tar.gz rails-3afa4847d9598f52d960b2b8cc8c94cc101bb1e3.tar.bz2 rails-3afa4847d9598f52d960b2b8cc8c94cc101bb1e3.zip |
failing test for: validates_acceptance_of overrides database fields
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties')
-rw-r--r-- | railties/test/model_initialization_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/railties/test/model_initialization_test.rb b/railties/test/model_initialization_test.rb new file mode 100644 index 0000000000..6a22f8d8df --- /dev/null +++ b/railties/test/model_initialization_test.rb @@ -0,0 +1,33 @@ +require 'isolation/abstract_unit' + +class PostTest < Test::Unit::TestCase + include ActiveSupport::Testing::Isolation + + def setup + build_app + boot_rails + end + + def test_reload_should_reload_constants + app_file "app/models/post.rb", <<-MODEL + class Post < ActiveRecord::Base + validates_acceptance_of :title, :accept => "omg" + end + MODEL + + require "#{rails_root}/config/environment" + ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") + ActiveRecord::Migration.verbose = false + ActiveRecord::Schema.define(:version => 1) do + create_table :posts do |t| + t.string :title + end + end + + p = Post.create(:title => 'omg') + assert_equal 1, Post.count + assert_equal 'omg', p.title + p = Post.first + assert_equal 'omg', p.title + end +end |