aboutsummaryrefslogblamecommitdiffstats
path: root/activerecord/test/cases/configuration_test.rb
blob: 872f1fc33bf3fd0fca4ea4d855023618ab3fd94b (plain) (tree)

























                                                                        
require 'cases/helper'

class ConfigurationTest < ActiveRecord::TestCase
  def test_configuration
    @klass = Class.new do
      include ActiveRecord::Configuration
    end

    ActiveRecord::Configuration.define :omg

    ActiveRecord::Configuration.omg = "omg"

    assert_equal "omg", @klass.new.omg
    assert !@klass.new.respond_to?(:omg=)
    assert_equal "omg", @klass.omg

    @klass.omg = "wtf"

    assert_equal "wtf", @klass.omg
    assert_equal "wtf", @klass.new.omg
  ensure
    ActiveRecord::Configuration.send(:undef_method, :omg)
    ActiveRecord::Configuration::ClassMethods.send(:undef_method, :omg)
    ActiveRecord::Configuration::ClassMethods.send(:undef_method, :omg=)
  end
end