diff options
author | José Valim <jose.valim@gmail.com> | 2010-04-28 23:42:55 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-04-28 23:42:55 +0200 |
commit | 209ab7e05b148b02a2f9598a809eb10588c92259 (patch) | |
tree | 7939a51f3d23e7c0903ac45a395e35545d640f9c /railties/test/application/model_initialization_test.rb | |
parent | 3afa4847d9598f52d960b2b8cc8c94cc101bb1e3 (diff) | |
download | rails-209ab7e05b148b02a2f9598a809eb10588c92259.tar.gz rails-209ab7e05b148b02a2f9598a809eb10588c92259.tar.bz2 rails-209ab7e05b148b02a2f9598a809eb10588c92259.zip |
Fix failing test.
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 |