mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
Wrap deprecated ServerSpec matchers in procs
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This commit is contained in:
parent
5ea640a2cd
commit
3fe7091254
1 changed files with 15 additions and 7 deletions
|
@ -34,14 +34,22 @@ describe 'Inspec::Resources::User' do
|
|||
end
|
||||
|
||||
# serverspec compatibility tests (do not test matcher)
|
||||
it 'verify serverspec compatibility' do
|
||||
it 'returns deprecation notices' do
|
||||
resource = MockLoader.new(:ubuntu1404).load_resource('user', 'root')
|
||||
_(resource.has_uid?(0)).must_equal true
|
||||
_(resource.has_home_directory?('/root')).must_equal true
|
||||
_(resource.has_login_shell?('/bin/bash')).must_equal true
|
||||
_(resource.minimum_days_between_password_change).must_equal 0
|
||||
_(resource.maximum_days_between_password_change).must_equal 99999
|
||||
# _(resource.has_authorized_key?('abc')).must_equal true
|
||||
proc { resource.has_uid?(0).must_equal true }
|
||||
.must_output nil, "[DEPRECATION] has_uid? is deprecated. \n"
|
||||
proc { resource.has_home_directory?('/root').must_equal true }
|
||||
.must_output nil, "[DEPRECATION] has_home_directory? is deprecated. Please use: its('home')\n"
|
||||
proc { resource.has_login_shell?('/bin/bash').must_equal true }
|
||||
.must_output nil, "[DEPRECATION] has_login_shell? is deprecated. Please use: its('shell')\n"
|
||||
proc { resource.minimum_days_between_password_change.must_equal 0 }
|
||||
.must_output nil, "[DEPRECATION] minimum_days_between_password_change is deprecated. Please use: its('mindays')\n"
|
||||
proc { resource.maximum_days_between_password_change.must_equal 99999 }
|
||||
.must_output nil, "[DEPRECATION] maximum_days_between_password_change is deprecated. Please use: its('maxdays')\n"
|
||||
|
||||
assert_output(nil, "[DEPRECATION] has_authorized_key? is deprecated. \n") do
|
||||
proc { resource.has_authorized_key?('abc') }.must_raise NotImplementedError
|
||||
end
|
||||
end
|
||||
|
||||
it 'read user on centos7' do
|
||||
|
|
Loading…
Reference in a new issue