File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,6 +88,10 @@ def insync?(_is)
8888 'mongodb'
8989 end
9090
91+ autorequire ( :mongodb_database ) do
92+ self [ :database ]
93+ end
94+
9195 validate do
9296 if self [ :password_hash ] . nil? && self [ :password ] . nil? && provider . password . nil? && provider . password_hash . nil?
9397 err ( "Either 'password_hash' or 'password' should be provided" )
Original file line number Diff line number Diff line change 3939 username => $user ,
4040 database => $db_name ,
4141 roles => $roles ,
42- require => Mongodb_database[$db_name ],
4342 }
4443
4544}
Original file line number Diff line number Diff line change 1414 end
1515
1616 it 'contains mongodb_user with mongodb_database requirement' do
17- is_expected . to contain_mongodb_user ( 'User testuser on db testdb' ) . with ( 'username' => 'testuser' ,
18- 'database' => 'testdb' ,
19- 'require' => 'Mongodb_database[testdb]' )
17+ is_expected . to contain_mongodb_user ( 'User testuser on db testdb' ) . \
18+ with_username ( 'testuser' ) . \
19+ with_database ( 'testdb' ) . \
20+ that_requires ( 'Mongodb_database[testdb]' )
2021 end
2122
2223 it 'contains mongodb_user with proper roles' do
5354 end
5455
5556 it 'contains mongodb_user with mongodb_database requirement' do
56- is_expected . to contain_mongodb_user ( 'User testuser on db testdb' ) . with ( 'username' => 'testuser' ,
57- 'database' => 'testdb' ,
58- 'require' => 'Mongodb_database[testdb]' )
57+ is_expected . to contain_mongodb_user ( 'User testuser on db testdb' ) . \
58+ with_username ( 'testuser' ) . \
59+ with_database ( 'testdb' ) . \
60+ that_requires ( 'Mongodb_database[testdb]' )
5961 end
6062
6163 it 'contains mongodb_user with proper roles' do
You can’t perform that action at this time.
0 commit comments