diff options
Diffstat (limited to 'railties/test/application/model_initialization_test.rb')
-rw-r--r-- | railties/test/application/model_initialization_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/railties/test/application/model_initialization_test.rb b/railties/test/application/model_initialization_test.rb new file mode 100644 index 0000000000..6a22f8d8df --- /dev/null +++ b/railties/test/application/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 |