diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-12-18 23:35:25 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-12-24 11:08:15 +0000 |
commit | 6af7192af59602e1cbb341b8bf3452afb344eff2 (patch) | |
tree | 7e02050aedff7fbd8cb916b20b9a27f71a0a559f /activerecord/test/cases | |
parent | b2c9ce341a1c907041f55461aefebb0321280cb5 (diff) | |
download | rails-6af7192af59602e1cbb341b8bf3452afb344eff2.tar.gz rails-6af7192af59602e1cbb341b8bf3452afb344eff2.tar.bz2 rails-6af7192af59602e1cbb341b8bf3452afb344eff2.zip |
I herd you like modules.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/connection_specification/resolver_test.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/inclusion_test.rb | 36 |
2 files changed, 37 insertions, 1 deletions
diff --git a/activerecord/test/cases/connection_specification/resolver_test.rb b/activerecord/test/cases/connection_specification/resolver_test.rb index d4b0f236ee..5f9a742285 100644 --- a/activerecord/test/cases/connection_specification/resolver_test.rb +++ b/activerecord/test/cases/connection_specification/resolver_test.rb @@ -1,7 +1,7 @@ require "cases/helper" module ActiveRecord - class Base + module Core class ConnectionSpecification class ResolverTest < ActiveRecord::TestCase def resolve(spec) diff --git a/activerecord/test/cases/inclusion_test.rb b/activerecord/test/cases/inclusion_test.rb new file mode 100644 index 0000000000..07d538f6bc --- /dev/null +++ b/activerecord/test/cases/inclusion_test.rb @@ -0,0 +1,36 @@ +require 'cases/helper' +require 'models/teapot' + +class BasicInclusionModelTest < ActiveRecord::TestCase + def test_basic_model + Teapot.create!(:name => "Ronnie Kemper") + assert_equal "Ronnie Kemper", Teapot.find(1).name + end +end + +class InclusionUnitTest < ActiveRecord::TestCase + def setup + @klass = Class.new { include ActiveRecord::Model } + end + + def test_non_abstract_class + assert !@klass.abstract_class? + end + + def test_abstract_class + @klass.abstract_class = true + assert @klass.abstract_class? + end + + def test_establish_connection + assert @klass.respond_to?(:establish_connection) + end + + def test_adapter_connection + assert @klass.respond_to?("#{ActiveRecord::Base.connection_config[:adapter]}_connection") + end + + def test_connection_handler + assert_equal ActiveRecord::Base.connection_handler, @klass.connection_handler + end +end |