Implement `file_eq' condition keyword
This commit is contained in:
@@ -25,6 +25,7 @@ module Producer
|
||||
define_test :`, Tests::ShellCommandStatus
|
||||
define_test :sh, Tests::ShellCommandStatus
|
||||
define_test :file_contains, Tests::FileContains
|
||||
define_test :file_eq, Tests::FileEq
|
||||
define_test :env?, Tests::HasEnv
|
||||
define_test :executable?, Tests::HasExecutable
|
||||
define_test :dir?, Tests::HasDir
|
||||
|
22
lib/producer/core/tests/file_eq.rb
Normal file
22
lib/producer/core/tests/file_eq.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
module Producer
|
||||
module Core
|
||||
module Tests
|
||||
class FileEq < Test
|
||||
def verify
|
||||
file_content ? file_content == expected_content : false
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
def file_content
|
||||
@file_content ||= fs.file_read(arguments[0])
|
||||
end
|
||||
|
||||
def expected_content
|
||||
arguments[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user