Module: Assert::ConfigHelpers
- Included in:
- Runner
- Defined in:
- lib/assert/config_helpers.rb
Instance Method Summary collapse
- #all_pass? ⇒ Boolean
- #count(type) ⇒ Object
-
#ocurring_result_types ⇒ Object
return a list of result symbols that have actually occurred.
- #ordered_suite_contexts ⇒ Object
- #ordered_suite_files ⇒ Object
-
#result_rate(format = '%.6f') ⇒ Object
get the formatted suite result rate.
-
#run_time(format = '%.6f') ⇒ Object
get the formatted suite run time.
- #runner_seed ⇒ Object
- #show_test_profile_info? ⇒ Boolean
- #show_test_verbose_info? ⇒ Boolean
-
#suite_contexts ⇒ Object
get a uniq list of contexts for the test suite.
-
#suite_files ⇒ Object
get a uniq list of files containing contexts for the test suite.
-
#test_rate(format = '%.6f') ⇒ Object
get the formatted suite test rate.
- #tests? ⇒ Boolean
Instance Method Details
#all_pass? ⇒ 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_types ⇒ Object
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_contexts ⇒ Object
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_files ⇒ Object
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_seed ⇒ Object
5 6 7 |
# File 'lib/assert/config_helpers.rb', line 5 def runner_seed self.config.runner_seed end |
#show_test_profile_info? ⇒ 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
62 63 64 |
# File 'lib/assert/config_helpers.rb', line 62 def show_test_verbose_info? !!self.config.verbose end |
#suite_contexts ⇒ Object
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_files ⇒ Object
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
13 14 15 |
# File 'lib/assert/config_helpers.rb', line 13 def tests? self.count(:tests) > 0 end |