mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
44 lines
857 B
Ruby
44 lines
857 B
Ruby
|
#
|
||
|
# test/fileutils/fileasserts.rb
|
||
|
#
|
||
|
|
||
|
module Test
|
||
|
module Unit
|
||
|
module Assertions # redefine
|
||
|
|
||
|
def assert_same_file( from, to )
|
||
|
_wrap_assertion {
|
||
|
assert_block("file #{from} != #{to}") {
|
||
|
File.read(from) == File.read(to)
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
|
||
|
def assert_file_exist( file )
|
||
|
_wrap_assertion {
|
||
|
assert_block("file not exist: #{file}") {
|
||
|
File.exist?(file)
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
|
||
|
def assert_file_not_exist( file )
|
||
|
_wrap_assertion {
|
||
|
assert_block("file not exist: #{file}") {
|
||
|
not File.exist?(file)
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
|
||
|
def assert_is_directory( file )
|
||
|
_wrap_assertion {
|
||
|
assert_block("is not directory: #{file}") {
|
||
|
File.directory?(file)
|
||
|
}
|
||
|
}
|
||
|
end
|
||
|
|
||
|
end
|
||
|
end
|
||
|
end
|