Class: TestRunner::Test
- Inherits:
-
Object
- Object
- TestRunner::Test
- Defined in:
- lib/test-runner/test.rb
Instance Attribute Summary collapse
- #args ⇒ Hash readonly
- #description ⇒ String readonly
- #expect_failure ⇒ Boolean readonly
- #labels ⇒ Hash<String, String> readonly
- #name ⇒ String readonly
- #path ⇒ String readonly
- #tags ⇒ Array<String> readonly
- #template ⇒ String readonly
- #type ⇒ String readonly
Instance Method Summary collapse
- #file_path ⇒ Object
-
#initialize(**opts) ⇒ Test
constructor
A new instance of Test.
- #path_matches?(pattern) ⇒ Boolean
- #template? ⇒ Boolean
Constructor Details
#initialize(**opts) ⇒ Test
Returns a new instance of Test.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/test-runner/test.rb', line 31 def initialize(**opts) @path = opts[:path] @type = opts[:type] @template = opts[:template] @args = opts[:args] @name = opts[:name] @description = opts[:description] @expect_failure = opts[:expect_failure] @tags = opts[:tags] @labels = opts[:labels] end |
Instance Attribute Details
#args ⇒ Hash (readonly)
13 14 15 |
# File 'lib/test-runner/test.rb', line 13 def args @args end |
#description ⇒ String (readonly)
19 20 21 |
# File 'lib/test-runner/test.rb', line 19 def description @description end |
#expect_failure ⇒ Boolean (readonly)
22 23 24 |
# File 'lib/test-runner/test.rb', line 22 def expect_failure @expect_failure end |
#labels ⇒ Hash<String, String> (readonly)
28 29 30 |
# File 'lib/test-runner/test.rb', line 28 def labels @labels end |
#name ⇒ String (readonly)
16 17 18 |
# File 'lib/test-runner/test.rb', line 16 def name @name end |
#path ⇒ String (readonly)
4 5 6 |
# File 'lib/test-runner/test.rb', line 4 def path @path end |
#tags ⇒ Array<String> (readonly)
25 26 27 |
# File 'lib/test-runner/test.rb', line 25 def @tags end |
#template ⇒ String (readonly)
10 11 12 |
# File 'lib/test-runner/test.rb', line 10 def template @template end |
#type ⇒ String (readonly)
7 8 9 |
# File 'lib/test-runner/test.rb', line 7 def type @type end |
Instance Method Details
#file_path ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/test-runner/test.rb', line 52 def file_path if template? "#{template}.nix" else "#{path}.nix" end end |
#path_matches?(pattern) ⇒ Boolean
44 45 46 |
# File 'lib/test-runner/test.rb', line 44 def path_matches?(pattern) File.fnmatch?(pattern, path, File::FNM_EXTGLOB) end |
#template? ⇒ Boolean
48 49 50 |
# File 'lib/test-runner/test.rb', line 48 def template? type == 'template' end |