mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
use a real test
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5180 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
133fe85f2b
commit
9898a62bf7
1 changed files with 6 additions and 9 deletions
|
@ -11,20 +11,17 @@ require 'fixtures/category'
|
|||
require 'fixtures/post'
|
||||
require 'fixtures/author'
|
||||
|
||||
# Can't declare new classes in test case methods, so tests before that
|
||||
bad_collection_keys = false
|
||||
begin
|
||||
class Car < ActiveRecord::Base; has_many :wheels, :name => "wheels"; end
|
||||
rescue ArgumentError
|
||||
bad_collection_keys = true
|
||||
end
|
||||
raise "ActiveRecord should have barked on bad collection keys" unless bad_collection_keys
|
||||
|
||||
|
||||
class AssociationsTest < Test::Unit::TestCase
|
||||
fixtures :accounts, :companies, :developers, :projects, :developers_projects,
|
||||
:computers
|
||||
|
||||
def test_bad_collection_keys
|
||||
assert_raise(ArgumentError, 'ActiveRecord should have barked on bad collection keys') do
|
||||
Class.new(ActiveRecord::Base).has_many(:wheels, :name => 'wheels')
|
||||
end
|
||||
end
|
||||
|
||||
def test_force_reload
|
||||
firm = Firm.new("name" => "A New Firm, Inc")
|
||||
firm.save
|
||||
|
|
Loading…
Reference in a new issue