| 25 |
25 |
end
|
| 26 |
26 |
|
| 27 |
27 |
def test_empty
|
| 28 |
|
assert_kind_of Hash, load_conf('empty.yml.example', 'test')
|
|
28 |
assert_kind_of Hash, load_conf('empty.yml', 'test')
|
| 29 |
29 |
end
|
| 30 |
30 |
|
| 31 |
31 |
def test_default
|
| 32 |
|
assert_kind_of Hash, load_conf('default.yml.example', 'test')
|
|
32 |
assert_kind_of Hash, load_conf('default.yml', 'test')
|
| 33 |
33 |
assert_equal 'foo', @conf['somesetting']
|
| 34 |
34 |
end
|
| 35 |
35 |
|
| 36 |
36 |
def test_no_default
|
| 37 |
|
assert_kind_of Hash, load_conf('no_default.yml.example', 'test')
|
|
37 |
assert_kind_of Hash, load_conf('no_default.yml', 'test')
|
| 38 |
38 |
assert_equal 'foo', @conf['somesetting']
|
| 39 |
39 |
end
|
| 40 |
40 |
|
| 41 |
41 |
def test_overrides
|
| 42 |
|
assert_kind_of Hash, load_conf('overrides.yml.example', 'test')
|
|
42 |
assert_kind_of Hash, load_conf('overrides.yml', 'test')
|
| 43 |
43 |
assert_equal 'bar', @conf['somesetting']
|
| 44 |
44 |
end
|
| 45 |
45 |
|
| 46 |
46 |
def test_with
|
| 47 |
|
load_conf('default.yml.example', 'test')
|
|
47 |
load_conf('default.yml', 'test')
|
| 48 |
48 |
assert_equal 'foo', @conf['somesetting']
|
| 49 |
49 |
@conf.with 'somesetting' => 'bar' do
|
| 50 |
50 |
assert_equal 'bar', @conf['somesetting']
|
| ... | ... | |
| 56 |
56 |
|
| 57 |
57 |
def load_conf(file, env)
|
| 58 |
58 |
@conf.load(
|
| 59 |
|
:file => File.join(Rails.root, 'test', 'fixtures', 'configuration', file),
|
|
59 |
:file => file_fixture(File.join('configuration', file)),
|
| 60 |
60 |
:env => env
|
| 61 |
61 |
)
|
| 62 |
62 |
end
|