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
14
# 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]
  @expect_failure = opts[:expect_failure]
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

#expect_failureObject (readonly)

Returns the value of attribute expect_failure.



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

def expect_failure
  @expect_failure
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



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

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

#path_matches?(pattern) ⇒ Boolean

Parameters:

  • pattern (String)

Returns:

  • (Boolean)


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

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

#template?Boolean

Returns:

  • (Boolean)


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

def template?
  type == 'template'
end