blob: 872f1fc33bf3fd0fca4ea4d855023618ab3fd94b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
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
|