Class: TestRunner::Test

Inherits:
Object
  • Object
show all
Defined in:
lib/test-runner/test.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ Test

Returns a new instance of Test.

Parameters:

  • opts (Hash)


6
7
8
9
10
11
12
13
# File 'lib/test-runner/test.rb', line 6

def initialize(**opts)
  @path = opts[:path]
  @type = opts[:type]
  @template = opts[:template]
  @args = opts[:args]
  @name = opts[:name]
  @description = opts[:description]
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



3
4
5
# File 'lib/test-runner/test.rb', line 3

def args
  @args
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/test-runner/test.rb', line 3

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/test-runner/test.rb', line 3

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/test-runner/test.rb', line 3

def path
  @path
end

#templateObject (readonly)

Returns the value of attribute template.



3
4
5
# File 'lib/test-runner/test.rb', line 3

def template
  @template
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/test-runner/test.rb', line 3

def type
  @type
end

Instance Method Details

#file_pathObject



24
25
26
27
28
29
30
# File 'lib/test-runner/test.rb', line 24

def file_path
  if template?
    "#{template}.nix"
  else
    "#{path}.nix"
  end
end

#path_matches?(pattern) ⇒ Boolean

Parameters:

  • pattern (String)

Returns:

  • (Boolean)


16
17
18
# File 'lib/test-runner/test.rb', line 16

def path_matches?(pattern)
  File.fnmatch?(pattern, path, File::FNM_EXTGLOB)
end

#template?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/test-runner/test.rb', line 20

def template?
  type == 'template'
end