Class: TestRunner::TestScript

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(test, name, description:, expect_failure:, tags:, labels:) ⇒ TestScript

Returns a new instance of TestScript.



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

def initialize(test, name, description:, expect_failure:, tags:, labels:)
  @test = test
  @name = name
  @path = "#{test.path}##{name}"
  @description = description || test.description
  @expect_failure = expect_failure.nil? ? test.expect_failure : expect_failure
  @tags = test.tags + tags
  @labels = test.labels.merge(labels)
  @singleton = false
end

Instance Attribute Details

#descriptionString (readonly)

Returns:

  • (String)


13
14
15
# File 'lib/test-runner/test_script.rb', line 13

def description
  @description
end

#expect_failureBoolean? (readonly)

Returns:

  • (Boolean, nil)


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

def expect_failure
  @expect_failure
end

#labelsHash<String, String> (readonly)

Returns:

  • (Hash<String, String>)


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

def labels
  @labels
end

#nameString (readonly)

Returns:

  • (String)


7
8
9
# File 'lib/test-runner/test_script.rb', line 7

def name
  @name
end

#pathString (readonly)

Returns:

  • (String)


10
11
12
# File 'lib/test-runner/test_script.rb', line 10

def path
  @path
end

#tagsArray<String> (readonly)

Returns:

  • (Array<String>)


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

def tags
  @tags
end

#testTest (readonly)

Returns:



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

def test
  @test
end

Instance Method Details

#path_matches?(pattern) ⇒ Boolean

Parameters:

  • pattern (String)

Returns:

  • (Boolean)


36
37
38
# File 'lib/test-runner/test_script.rb', line 36

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

#set_singletonObject



40
41
42
43
# File 'lib/test-runner/test_script.rb', line 40

def set_singleton
  @path = test.path
  @singleton = true
end

#singleton?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/test-runner/test_script.rb', line 45

def singleton?
  @singleton
end