Class: Liza::UnitTest
Direct Known Subclasses
BoxTest, ControllerTest, PanelTest, PartTest, SystemTest, TestTest
Constant Summary
Constants inherited from Test
Test::LOG_ASSERTION, Test::LOG_ASSERTION_MESSAGE, Test::LOG_BUILDING, Test::LOG_CALL_BLOCK
Instance Attribute Summary
Attributes inherited from Test
Class Method Summary collapse
- .test_erbs_available(*keys) ⇒ Object
- .test_erbs_defined(*keys) ⇒ Object
- .test_methods_defined(&block) ⇒ Object
- .test_sections(hash = {}) ⇒ Object
Methods inherited from Test
_assertion_errored, _assertion_failed, _assertion_passed, _assertion_todo, #_caller_line_split, #_groups, #_inc_assertions, #_log_test_assertion_tag, #_log_test_block, _log_test_block, after, after_stack, #assert, #assert!, #assert_equality, #assert_equality!, #assert_gt, #assert_lt, #assert_no_raise, #assert_no_raise!, #assert_raises, #assert_raises!, before, before_stack, call, #call, color, #critical, #division, division, #group, group, #initialize, #log_test_assertion, #log_test_assertion?, #log_test_assertion_message, #log_test_assertion_message?, #log_test_assertion_result, log_test_building, log_test_building?, #log_test_building?, #log_test_call, #log_test_call_block?, #log_test_call_rescue, #refute, #refute!, #refute_equality, #refute_equality!, #refute_gt, #refute_lt, #refute_no_raise, #refute_no_raise!, #refute_raises, #refute_raises!, #subject, #subject_class, subject_class, subsystem, system, #system, test, test_node, test_tree, #todo, totals
Methods inherited from Unit
_erbs_for, #add, add, cl, #cl, class_methods_defined, const_added, const_missing, constants_defined, define_error, descendants_select, division, erbs_available, erbs_defined, erbs_for, errors, #fetch, fetch, get, #get, instance_methods_defined, log, #log, log?, #log?, #log_array, log_array, log_hash, #log_hash, #log_level, log_level, #log_level?, log_level?, log_levels, #log_levels, #log_render_convert, #log_render_format, #log_render_in, #log_render_out, method_added, methods_defined, namespace, part, raise_error, #raise_error, reload!, #reload!, #render, #render!, #render_stack, renderable_formats_for, renderable_names, section, sections, #set, set, #settings, settings, singleton_method_added, sleep, #sleep, stick, #stick, sticks, #sticks, subclasses_select, subunits, system, #system, system?, test_class, time_diff, #time_diff
Constructor Details
This class inherits a constructor from Liza::Test
Class Method Details
.test_erbs_available(*keys) ⇒ Object
96 97 98 99 100 101 |
# File 'lib/liza/unit_test.rb', line 96 def self.test_erbs_available(*keys) test :erbs_available do actual = subject_class.erbs_available.map &:key assert_equality actual, keys end end |
.test_erbs_defined(*keys) ⇒ Object
89 90 91 92 93 94 |
# File 'lib/liza/unit_test.rb', line 89 def self.test_erbs_defined(*keys) test :erbs_defined do actual = subject_class.erbs_defined.map &:key assert_equality actual, keys end end |
.test_methods_defined(&block) ⇒ Object
8 9 10 11 12 |
# File 'lib/liza/unit_test.rb', line 8 def self.test_methods_defined(&block) test :subject_class, :methods_defined do todo "replace me with test_sections" end end |
.test_sections(hash = {}) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/liza/unit_test.rb', line 16 def self.test_sections(hash={}) test :sections do assert_equality! subject_class.sections.keys, hash.keys # each section should match the hash group do hash.each do |section_name, section| assert_equality section, subject_class.sections[section_name] end end hash_class_methods = hash.values.map { _1[:class_methods] }.flatten hash_instance_methods = hash.values.map { _1[:instance_methods] }.flatten actual_class_methods = subject_class.sections.values.map { _1[:class_methods] }.flatten actual_instance_methods = subject_class.sections.values.map { _1[:instance_methods] }.flatten # each section should have unique methods group do assert_equality actual_class_methods, hash_class_methods assert_equality actual_instance_methods, hash_instance_methods end # methods in all sections should be unique group do assert_equality actual_class_methods.count, actual_class_methods.uniq.count assert_equality actual_instance_methods.count, actual_instance_methods.uniq.count assert_equality actual_class_methods.sort, actual_class_methods.sort.uniq assert_equality actual_instance_methods.sort, actual_instance_methods.sort.uniq end end end |