Permalink
Browse files

failing test for: validates_acceptance_of overrides database fields

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent ce48b31 commit 3afa4847d9598f52d960b2b8cc8c94cc101bb1e3 @spastorino spastorino committed with josevalim Apr 28, 2010
Showing with 33 additions and 0 deletions.
  1. +33 −0 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

0 comments on commit 3afa484

Please sign in to comment.