Class: Capsium::Package::Testing::FileTest
- Defined in:
- lib/capsium/package/testing/file_test.rb,
sig/capsium/package/testing/file_test.rbs
Overview
A "file" test (05x-testing): the file must exist in the package; optionally its content must contain a string.
Instance Attribute Summary collapse
-
#contains ⇒ String?
readonly
Returns the value of attribute contains.
-
#path ⇒ String
readonly
Returns the value of attribute path.
Attributes inherited from TestCase
Instance Method Summary collapse
-
#initialize(name:, path:, contains: nil) ⇒ FileTest
constructor
A new instance of FileTest.
- #run(context) ⇒ TestCase::Result
Methods inherited from TestCase
build, from_h, register, types
Constructor Details
#initialize(name:, path:, contains: nil) ⇒ FileTest
Returns a new instance of FileTest.
11 12 13 14 15 |
# File 'lib/capsium/package/testing/file_test.rb', line 11 def initialize(name:, path:, contains: nil) super(name: name) @path = path @contains = contains end |
Instance Attribute Details
#contains ⇒ String? (readonly)
Returns the value of attribute contains.
9 10 11 |
# File 'lib/capsium/package/testing/file_test.rb', line 9 def contains @contains end |
#path ⇒ String (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/capsium/package/testing/file_test.rb', line 9 def path @path end |
Instance Method Details
#run(context) ⇒ TestCase::Result
17 18 19 20 |
# File 'lib/capsium/package/testing/file_test.rb', line 17 def run(context) problems = existence_problems(context) + contains_problems(context) Result.new(name: name, ok: problems.empty?, messages: problems) end |