@@ -6,16 +6,18 @@ use config::*;
66
77#[ test]
88fn test_file_not_required ( ) {
9- let mut c = Config :: default ( ) ;
10- let res = c. merge ( File :: new ( "tests/NoSettings" , FileFormat :: Yaml ) . required ( false ) ) ;
9+ let mut c = Config :: builder ( ) ;
10+ c. add_source ( File :: new ( "tests/NoSettings" , FileFormat :: Yaml ) . required ( false ) ) ;
11+ let res = c. build ( ) ;
1112
1213 assert ! ( res. is_ok( ) ) ;
1314}
1415
1516#[ test]
1617fn test_file_required_not_found ( ) {
17- let mut c = Config :: default ( ) ;
18- let res = c. merge ( File :: new ( "tests/NoSettings" , FileFormat :: Yaml ) ) ;
18+ let mut c = Config :: builder ( ) ;
19+ c. add_source ( File :: new ( "tests/NoSettings" , FileFormat :: Yaml ) ) ;
20+ let res = c. build ( ) ;
1921
2022 assert ! ( res. is_err( ) ) ;
2123 assert_eq ! (
@@ -26,18 +28,20 @@ fn test_file_required_not_found() {
2628
2729#[ test]
2830fn test_file_auto ( ) {
29- let mut c = Config :: default ( ) ;
30- c. merge ( File :: with_name ( "tests/Settings-production" ) )
31- . unwrap ( ) ;
31+ let mut builder = Config :: builder ( ) ;
32+ builder. add_source ( File :: with_name ( "tests/Settings-production" ) ) ;
33+
34+ let c = builder. build ( ) . unwrap ( ) ;
3235
3336 assert_eq ! ( c. get( "debug" ) . ok( ) , Some ( false ) ) ;
3437 assert_eq ! ( c. get( "production" ) . ok( ) , Some ( true ) ) ;
3538}
3639
3740#[ test]
3841fn test_file_auto_not_found ( ) {
39- let mut c = Config :: default ( ) ;
40- let res = c. merge ( File :: with_name ( "tests/NoSettings" ) ) ;
42+ let mut c = Config :: builder ( ) ;
43+ c. add_source ( File :: with_name ( "tests/NoSettings" ) ) ;
44+ let res = c. build ( ) ;
4145
4246 assert ! ( res. is_err( ) ) ;
4347 assert_eq ! (
@@ -48,8 +52,10 @@ fn test_file_auto_not_found() {
4852
4953#[ test]
5054fn test_file_ext ( ) {
51- let mut c = Config :: default ( ) ;
52- c. merge ( File :: with_name ( "tests/Settings.json" ) ) . unwrap ( ) ;
55+ let mut builder = Config :: builder ( ) ;
56+ builder. add_source ( File :: with_name ( "tests/Settings.json" ) ) ;
57+
58+ let c = builder. build ( ) . unwrap ( ) ;
5359
5460 assert_eq ! ( c. get( "debug" ) . ok( ) , Some ( true ) ) ;
5561 assert_eq ! ( c. get( "production" ) . ok( ) , Some ( false ) ) ;
0 commit comments