Fixed inconsistent use of MT::S's "expect" method (eg _)

Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
Ryan Davis 2019-05-16 18:00:44 -07:00
parent 9b0d8edfb4
commit bc028893e8
2 changed files with 7 additions and 7 deletions

View file

@ -21,7 +21,7 @@ describe Inspec::Resources::FileResource do
resource.stubs(:file_permission_granted?).with('write', 'by_usergroup', 'by_specific_user').returns('test_result')
resource.stubs(:file_permission_granted?).with('execute', 'by_usergroup', 'by_specific_user').returns('test_result')
_(resource.content).must_equal 'content'
_(resource.more_permissive_than?('000').must_equal false)
_(resource.more_permissive_than?('000')).must_equal false
_(resource.exist?).must_equal true
_(resource.mounted?).must_equal true
_(resource.to_s).must_equal 'File /fakepath/fakefile'
@ -84,11 +84,11 @@ end
describe Inspec::Resources::FileResource do
let(:file) { stub(unix_mode_mask: 000, mode: 644) }
it 'responds on Ubuntu' do
it 'more_permissive_than?' do
resource = MockLoader.new(:ubuntu1404).load_resource('file', '/fakepath/fakefile')
_(resource.more_permissive_than?('755').must_equal false)
_(resource.more_permissive_than?('644').must_equal false)
_(resource.more_permissive_than?('640').must_equal true)
_(resource.more_permissive_than?('755')).must_equal false
_(resource.more_permissive_than?('644')).must_equal false
_(resource.more_permissive_than?('640')).must_equal true
proc { resource.send(:more_permissive_than?, '0888') }.must_raise(ArgumentError)
end
end

View file

@ -5,10 +5,10 @@ require 'helper'
describe 'Inspec::Resources::PostgresSession' do
it 'verify postgres_session create_psql_cmd with a basic query' do
resource = load_resource('postgres_session','myuser','mypass','127.0.0.1')
_(resource.send(:create_psql_cmd,"SELECT * FROM STUDENTS;",['testdb']).must_equal "PGPASSWORD='mypass' psql -U myuser -d testdb -h 127.0.0.1 -A -t -c SELECT\\ \\*\\ FROM\\ STUDENTS\\;")
_(resource.send(:create_psql_cmd, "SELECT * FROM STUDENTS;",['testdb'])).must_equal "PGPASSWORD='mypass' psql -U myuser -d testdb -h 127.0.0.1 -A -t -c SELECT\\ \\*\\ FROM\\ STUDENTS\\;"
end
it 'verify postgres_session escaped_query with a complex query' do
resource = load_resource('postgres_session','myuser','mypass','127.0.0.1')
_(resource.send(:create_psql_cmd,"SELECT current_setting('client_min_messages')",['testdb']).must_equal "PGPASSWORD='mypass' psql -U myuser -d testdb -h 127.0.0.1 -A -t -c SELECT\\ current_setting\\(\\'client_min_messages\\'\\)")
_(resource.send(:create_psql_cmd, "SELECT current_setting('client_min_messages')",['testdb'])).must_equal "PGPASSWORD='mypass' psql -U myuser -d testdb -h 127.0.0.1 -A -t -c SELECT\\ current_setting\\(\\'client_min_messages\\'\\)"
end
end