Module: Assert::ConfigHelpers

Included in:
Runner
Defined in:
lib/assert/config_helpers.rb

Instance Method Summary collapse

Instance Method Details

#all_pass?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/assert/config_helpers.rb', line 17

def all_pass?
  self.count(:pass) == self.count(:results)
end

#count(type) ⇒ Object



9
10
11
# File 'lib/assert/config_helpers.rb', line 9

def count(type)
  self.config.suite.count(type)
end

#ocurring_result_typesObject

return a list of result symbols that have actually occurred



67
68
69
70
71
# File 'lib/assert/config_helpers.rb', line 67

def ocurring_result_types
  @result_types ||= [:pass, :fail, :ignore, :skip, :error].select do |sym|
    self.count(sym) > 0
  end
end

#ordered_suite_contextsObject



43
44
45
# File 'lib/assert/config_helpers.rb', line 43

def ordered_suite_contexts
  self.suite_contexts.sort{ |a,b| a.to_s <=> b.to_s }
end

#ordered_suite_filesObject



54
55
56
# File 'lib/assert/config_helpers.rb', line 54

def ordered_suite_files
  self.suite_files.sort{ |a,b| a.to_s <=> b.to_s }
end

#result_rate(format = '%.6f') ⇒ Object

get the formatted suite result rate



32
33
34
# File 'lib/assert/config_helpers.rb', line 32

def result_rate(format = '%.6f')
  format % self.config.suite.result_rate
end

#run_time(format = '%.6f') ⇒ Object

get the formatted suite run time



22
23
24
# File 'lib/assert/config_helpers.rb', line 22

def run_time(format = '%.6f')
  format % self.config.suite.run_time
end

#runner_seedObject



5
6
7
# File 'lib/assert/config_helpers.rb', line 5

def runner_seed
  self.config.runner_seed
end

#show_test_profile_info?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/assert/config_helpers.rb', line 58

def show_test_profile_info?
  !!self.config.profile
end

#show_test_verbose_info?Boolean

Returns:

  • (Boolean)


62
63
64
# File 'lib/assert/config_helpers.rb', line 62

def show_test_verbose_info?
  !!self.config.verbose
end

#suite_contextsObject

get a uniq list of contexts for the test suite



37
38
39
40
41
# File 'lib/assert/config_helpers.rb', line 37

def suite_contexts
  @suite_contexts ||= self.config.suite.tests.inject([]) do |contexts, test|
    contexts << test.context_info.klass
  end.uniq
end

#suite_filesObject

get a uniq list of files containing contexts for the test suite



48
49
50
51
52
# File 'lib/assert/config_helpers.rb', line 48

def suite_files
  @suite_files ||= self.config.suite.tests.inject([]) do |files, test|
    files << test.context_info.file
  end.uniq
end

#test_rate(format = '%.6f') ⇒ Object

get the formatted suite test rate



27
28
29
# File 'lib/assert/config_helpers.rb', line 27

def test_rate(format = '%.6f')
  format % self.config.suite.test_rate
end

#tests?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/assert/config_helpers.rb', line 13

def tests?
  self.count(:tests) > 0
end