lizarb 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/app/dev_box.rb +24 -4
  4. data/app/happy_box.rb +1 -1
  5. data/app/net/databases/sqlite_db_test.rb +5 -5
  6. data/app/net/records/app_record_test.rb +1 -1
  7. data/app/net/records/post_record_test.rb +1 -1
  8. data/app/net/records/user_record_test.rb +1 -1
  9. data/app/net_box.rb +7 -7
  10. data/app/web_box.rb +2 -2
  11. data/lib/app.rb +1 -1
  12. data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +17 -19
  13. data/lib/dev_system/dev/controllers/bench/not_found_bench_test.rb +9 -11
  14. data/lib/dev_system/dev/controllers/bench.rb +5 -7
  15. data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +37 -39
  16. data/lib/dev_system/dev/controllers/bench_test.rb +8 -10
  17. data/lib/dev_system/dev/controllers/command/bench_command.rb +20 -22
  18. data/lib/dev_system/dev/controllers/command/bench_command_test.rb +8 -10
  19. data/lib/dev_system/dev/controllers/command/echo_command.rb +5 -7
  20. data/lib/dev_system/dev/controllers/command/echo_command_test.rb +8 -10
  21. data/lib/dev_system/dev/controllers/command/generate_command.rb +20 -22
  22. data/lib/dev_system/dev/controllers/command/generate_command_test.rb +8 -10
  23. data/lib/dev_system/dev/controllers/command/not_found_command.rb +17 -19
  24. data/lib/dev_system/dev/controllers/command/not_found_command_test.rb +8 -10
  25. data/lib/dev_system/dev/controllers/command/terminal_command.rb +12 -14
  26. data/lib/dev_system/dev/controllers/command/terminal_command_test.rb +8 -10
  27. data/lib/dev_system/dev/controllers/command/test_command.rb +64 -53
  28. data/lib/dev_system/dev/controllers/command/test_command_test.rb +8 -10
  29. data/lib/dev_system/dev/controllers/command/version_command.rb +4 -6
  30. data/lib/dev_system/dev/controllers/command/version_command_test.rb +8 -10
  31. data/lib/dev_system/dev/controllers/command.rb +11 -13
  32. data/lib/dev_system/dev/controllers/command_test.rb +8 -10
  33. data/lib/dev_system/dev/controllers/generator.rb +5 -7
  34. data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +35 -37
  35. data/lib/dev_system/dev/controllers/generator_test.rb +8 -10
  36. data/lib/dev_system/dev/controllers/generators/app_generator.rb +103 -53
  37. data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +8 -10
  38. data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +17 -19
  39. data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +8 -10
  40. data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +11 -13
  41. data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +8 -10
  42. data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +6 -8
  43. data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +8 -10
  44. data/lib/dev_system/dev/controllers/terminal.rb +11 -13
  45. data/lib/dev_system/dev/controllers/terminal_test.rb +8 -10
  46. data/lib/dev_system/dev/dev_box.rb +33 -16
  47. data/lib/dev_system/dev/dev_box_test.rb +12 -14
  48. data/lib/dev_system/dev/panels/bench_panel.rb +3 -0
  49. data/lib/dev_system/dev/panels/bench_panel_test.rb +12 -0
  50. data/lib/dev_system/dev/panels/command_panel.rb +16 -18
  51. data/lib/dev_system/dev/panels/command_panel_test.rb +15 -17
  52. data/lib/dev_system/dev/panels/generator_panel.rb +3 -0
  53. data/lib/dev_system/dev/panels/generator_panel_test.rb +12 -0
  54. data/lib/dev_system/dev/panels/log_panel.rb +9 -6
  55. data/lib/dev_system/dev/panels/log_panel_test.rb +11 -13
  56. data/lib/dev_system/dev/panels/shell_panel.rb +3 -0
  57. data/lib/dev_system/dev/panels/shell_panel_test.rb +12 -0
  58. data/lib/dev_system/dev/panels/terminal_panel.rb +3 -0
  59. data/lib/dev_system/dev/panels/terminal_panel_test.rb +12 -0
  60. data/lib/happy_system/happy/controllers/axo.rb +4 -5
  61. data/lib/happy_system/happy/happy_box.rb +6 -9
  62. data/lib/happy_system/happy/happy_box_test.rb +11 -13
  63. data/lib/happy_system/happy/panels/axo_panel.rb +1 -3
  64. data/lib/liza/base/box.rb +71 -26
  65. data/lib/liza/base/box_test.rb +7 -9
  66. data/lib/liza/base/controller.rb +19 -21
  67. data/lib/liza/base/controller_test.rb +7 -9
  68. data/lib/liza/base/panel.rb +42 -27
  69. data/lib/liza/base/panel_test.rb +10 -12
  70. data/lib/liza/meta/part.rb +12 -14
  71. data/lib/liza/meta/part_extension.rb +14 -16
  72. data/lib/liza/meta/part_test.rb +4 -6
  73. data/lib/liza/meta/system.rb +12 -14
  74. data/lib/liza/meta/system_test.rb +8 -10
  75. data/lib/liza/ruby_test.rb +4 -6
  76. data/lib/liza/ruby_tests/module_test.rb +1 -1
  77. data/lib/liza/test/test.rb +7 -10
  78. data/lib/liza/test/test_test.rb +158 -159
  79. data/lib/liza/test_parts/test_assertions_advanced_part.rb +102 -104
  80. data/lib/liza/test_parts/test_assertions_part.rb +81 -83
  81. data/lib/liza/test_parts/test_dsl_part.rb +47 -49
  82. data/lib/liza/test_parts/test_log_part.rb +88 -90
  83. data/lib/liza/test_parts/test_subject_part.rb +16 -18
  84. data/lib/liza/test_parts/test_tree_part.rb +105 -107
  85. data/lib/liza/unit.rb +108 -104
  86. data/lib/liza/unit_test.rb +69 -71
  87. data/lib/lizarb/version.rb +1 -1
  88. data/lib/net_system/dev/net_command.rb +10 -12
  89. data/lib/net_system/net/controllers/client/redis_client.rb +19 -21
  90. data/lib/net_system/net/controllers/client/redis_client_test.rb +20 -22
  91. data/lib/net_system/net/controllers/client/sqlite_client.rb +19 -21
  92. data/lib/net_system/net/controllers/client/sqlite_client_test.rb +20 -22
  93. data/lib/net_system/net/controllers/client.rb +1 -3
  94. data/lib/net_system/net/controllers/client_test.rb +8 -10
  95. data/lib/net_system/net/controllers/database/redis_db.rb +6 -8
  96. data/lib/net_system/net/controllers/database/redis_db_test.rb +15 -17
  97. data/lib/net_system/net/controllers/database/sqlite_db.rb +6 -8
  98. data/lib/net_system/net/controllers/database/sqlite_db_test.rb +15 -17
  99. data/lib/net_system/net/controllers/database.rb +21 -23
  100. data/lib/net_system/net/controllers/database_test.rb +8 -10
  101. data/lib/net_system/net/controllers/record.rb +21 -23
  102. data/lib/net_system/net/controllers/record_test.rb +8 -10
  103. data/lib/net_system/net/net_box.rb +11 -16
  104. data/lib/net_system/net/net_box_test.rb +12 -14
  105. data/lib/net_system/net/panels/client_panel.rb +1 -3
  106. data/lib/net_system/net/panels/client_panel_test.rb +11 -13
  107. data/lib/net_system/net/panels/database_panel.rb +6 -8
  108. data/lib/net_system/net/panels/database_panel_test.rb +11 -13
  109. data/lib/web_system/dev/rack_command.rb +26 -17
  110. data/lib/web_system/dev/request_command.rb +2 -2
  111. data/lib/web_system/dev/web_command.rb +6 -8
  112. data/lib/web_system/web/controllers/rack.rb +4 -6
  113. data/lib/web_system/web/controllers/rack_test.rb +11 -13
  114. data/lib/web_system/web/controllers/request/client_error_request.rb +9 -11
  115. data/lib/web_system/web/controllers/request/not_found_request.rb +9 -11
  116. data/lib/web_system/web/controllers/request/server_error_request.rb +10 -12
  117. data/lib/web_system/web/controllers/request.rb +1 -3
  118. data/lib/web_system/web/controllers/request_test.rb +11 -13
  119. data/lib/web_system/web/panels/rack_panel.rb +37 -39
  120. data/lib/web_system/web/panels/rack_panel_test.rb +8 -10
  121. data/lib/web_system/web/panels/request_panel.rb +54 -56
  122. data/lib/web_system/web/panels/request_panel_test.rb +1 -1
  123. data/lib/web_system/web/web_box.rb +14 -18
  124. data/lib/web_system/web/web_box_test.rb +11 -13
  125. metadata +10 -5
  126. data/app_new/.gitignore +0 -4
  127. data/app_new/Gemfile +0 -31
  128. data/app_new/Procfile +0 -3
@@ -1,139 +1,137 @@
1
- module Liza
2
- class TestTreePart < Part
1
+ class Liza::TestTreePart < Liza::Part
2
+
3
+ insertion do
4
+
5
+ @before_stack = []
6
+ @after_stack = []
7
+
8
+ def self.before_stack; @before_stack ||= superclass.before_stack.dup end
9
+ def self.after_stack; @after_stack ||= superclass.after_stack.dup end
10
+
11
+ def self.test_node; @test_node ||= test_tree end
12
+ def self.test_tree; @test_tree ||= Liza::TestTreePart::Extension.new nil, before_stack, after_stack end
13
+
14
+ #
15
+
16
+ def self.group *words, &block
17
+ raise ArgumentError, "No block given" unless block_given?
18
+ previous = test_node
19
+ @test_node = test_node.branch_out words
20
+ instance_exec &block
21
+ @test_node = previous
22
+ end
3
23
 
4
- insertion do
24
+ def self.test *words, &block
25
+ raise ArgumentError, "No block given" unless block_given?
26
+ test_node.add_test words, &block
27
+ end
5
28
 
6
- @before_stack = []
7
- @after_stack = []
8
-
9
- def self.before_stack; @before_stack ||= superclass.before_stack.dup end
10
- def self.after_stack; @after_stack ||= superclass.after_stack.dup end
11
-
12
- def self.test_node; @test_node ||= test_tree end
13
- def self.test_tree; @test_tree ||= Liza::TestTreePart::Extension.new nil, before_stack, after_stack end
14
-
15
- #
16
-
17
- def self.group *words, &block
18
- raise ArgumentError, "No block given" unless block_given?
19
- previous = test_node
20
- @test_node = test_node.branch_out words
21
- instance_exec &block
22
- @test_node = previous
23
- end
24
-
25
- def self.test *words, &block
26
- raise ArgumentError, "No block given" unless block_given?
27
- test_node.add_test words, &block
28
- end
29
-
30
- def self.before &block
31
- raise ArgumentError, "No block given" unless block_given?
32
- test_node.add_before &block
33
- end
34
-
35
- def self.after &block
36
- raise ArgumentError, "No block given" unless block_given?
37
- test_node.add_after &block
38
- end
29
+ def self.before &block
30
+ raise ArgumentError, "No block given" unless block_given?
31
+ test_node.add_before &block
32
+ end
39
33
 
34
+ def self.after &block
35
+ raise ArgumentError, "No block given" unless block_given?
36
+ test_node.add_after &block
40
37
  end
41
38
 
42
- extension do
43
-
44
- def log *args
45
- self.class.solder.log *args
46
- end
39
+ end
47
40
 
48
- def log_test_building?
49
- Liza::Test.log_test_building?
50
- end
41
+ extension do
42
+
43
+ def log *args
44
+ self.class.solder.log *args
45
+ end
51
46
 
52
- attr_reader :tests, :parent, :children, :before_stack, :after_stack
47
+ def log_test_building?
48
+ Liza::Test.log_test_building?
49
+ end
53
50
 
54
- def initialize parent, before_stack, after_stack
55
- @parent = parent || self
51
+ attr_reader :tests, :parent, :children, :before_stack, :after_stack
56
52
 
57
- @children, @tests = [], []
58
- @before_top, @after_top = [], []
53
+ def initialize parent, before_stack, after_stack
54
+ @parent = parent || self
59
55
 
60
- @before_stack = before_stack.push @before_top
61
- @after_stack = after_stack.unshift @after_top
56
+ @children, @tests = [], []
57
+ @before_top, @after_top = [], []
62
58
 
63
- @parent.children << self if @parent != self
64
- end
59
+ @before_stack = before_stack.push @before_top
60
+ @after_stack = after_stack.unshift @after_top
65
61
 
66
- def initialize parent, before_stack, after_stack
67
- @parent = parent || self
62
+ @parent.children << self if @parent != self
63
+ end
68
64
 
69
- @children, @tests, @before_top, @after_top = [], [], [], []
65
+ def initialize parent, before_stack, after_stack
66
+ @parent = parent || self
70
67
 
71
- @before_stack = before_stack.push @before_top
72
- @after_stack = after_stack.unshift @after_top
68
+ @children, @tests, @before_top, @after_top = [], [], [], []
73
69
 
74
- @parent.children << self if @parent != self
75
- end
70
+ @before_stack = before_stack.push @before_top
71
+ @after_stack = after_stack.unshift @after_top
76
72
 
77
- def initialize parent, before_stack, after_stack
78
- @parent = parent || self
79
- @children, @tests = [], []
80
- @parent.children << self if @parent != self
73
+ @parent.children << self if @parent != self
74
+ end
81
75
 
82
- @before_top, @after_top = [], []
83
- @before_stack = before_stack.push @before_top
84
- @after_stack = after_stack.unshift @after_top
85
- end
76
+ def initialize parent, before_stack, after_stack
77
+ @parent = parent || self
78
+ @children, @tests = [], []
79
+ @parent.children << self if @parent != self
86
80
 
87
- def initialize parent, before_stack, after_stack
88
- @tests = []
81
+ @before_top, @after_top = [], []
82
+ @before_stack = before_stack.push @before_top
83
+ @after_stack = after_stack.unshift @after_top
84
+ end
89
85
 
90
- @parent = parent || self
91
- @children = []
92
- @parent.children << self if @parent != self
86
+ def initialize parent, before_stack, after_stack
87
+ @tests = []
93
88
 
94
- @before_top, @after_top = [], []
95
- @before_stack = before_stack.push @before_top
96
- @after_stack = after_stack.unshift @after_top
97
- end
89
+ @parent = parent || self
90
+ @children = []
91
+ @parent.children << self if @parent != self
98
92
 
99
- def initialize parent, before_stack, after_stack
100
- @tests = []
101
- initialize_parenting parent
102
- initialize_filters before_stack, after_stack
103
- end
93
+ @before_top, @after_top = [], []
94
+ @before_stack = before_stack.push @before_top
95
+ @after_stack = after_stack.unshift @after_top
96
+ end
104
97
 
105
- def initialize_parenting parent
106
- @parent = parent || self
107
- @children = []
108
- @parent.children << self if @parent != self
109
- end
98
+ def initialize parent, before_stack, after_stack
99
+ @tests = []
100
+ initialize_parenting parent
101
+ initialize_filters before_stack, after_stack
102
+ end
110
103
 
111
- def initialize_filters before_stack, after_stack
112
- @before_top, @after_top = [], []
113
- @before_stack = before_stack.push @before_top
114
- @after_stack = after_stack.unshift @after_top
115
- end
104
+ def initialize_parenting parent
105
+ @parent = parent || self
106
+ @children = []
107
+ @parent.children << self if @parent != self
108
+ end
116
109
 
117
- def add_before &block
118
- log "add_before to ##{object_id} #{block}" if log_test_building?
119
- @before_top.push block
120
- end
110
+ def initialize_filters before_stack, after_stack
111
+ @before_top, @after_top = [], []
112
+ @before_stack = before_stack.push @before_top
113
+ @after_stack = after_stack.unshift @after_top
114
+ end
121
115
 
122
- def add_test words, &block
123
- log "add_test to ##{object_id} #{words} #{block}" if log_test_building?
124
- tests << [words, block]
125
- end
116
+ def add_before &block
117
+ log "add_before to ##{object_id} #{block}" if log_test_building?
118
+ @before_top.push block
119
+ end
126
120
 
127
- def add_after &block
128
- log "add_after to ##{object_id} #{block}" if log_test_building?
129
- @after_top.push block
130
- end
121
+ def add_test words, &block
122
+ log "add_test to ##{object_id} #{words} #{block}" if log_test_building?
123
+ tests << [words, block]
124
+ end
131
125
 
132
- def branch_out words, &block
133
- self.class.new self, before_stack.dup, after_stack.dup
134
- end
126
+ def add_after &block
127
+ log "add_after to ##{object_id} #{block}" if log_test_building?
128
+ @after_top.push block
129
+ end
135
130
 
131
+ def branch_out words, &block
132
+ self.class.new self, before_stack.dup, after_stack.dup
136
133
  end
137
134
 
138
135
  end
136
+
139
137
  end
data/lib/liza/unit.rb CHANGED
@@ -1,151 +1,155 @@
1
- module Liza
2
- class Unit
1
+ class Liza::Unit
3
2
 
4
- # PARTS
3
+ # PARTS
5
4
 
6
- def self.part key, system: nil
7
- App.connect_part self, key, system
8
- end
9
-
10
- part :unit_procedure
5
+ def self.part key, system: nil
6
+ App.connect_part self, key, system
7
+ end
11
8
 
12
- # SETTINGS
9
+ def self.const_missing name
10
+ Liza.const name
11
+ rescue Liza::ConstNotFound => e
12
+ raise NameError, "uninitialized constant #{name}", caller[1..], cause: nil
13
+ end
13
14
 
14
- def self.settings
15
- @settings ||= {}
16
- end
15
+ part :unit_procedure
17
16
 
18
- def self.get key
19
- return settings[key] if settings.has_key? key
17
+ # SETTINGS
20
18
 
21
- found = nil
19
+ def self.settings
20
+ @settings ||= {}
21
+ end
22
22
 
23
- for klass in ancestors
24
- break unless klass.respond_to? :settings
23
+ def self.get key
24
+ return settings[key] if settings.has_key? key
25
25
 
26
- if klass.settings.has_key? key
27
- found = klass.settings[key]
26
+ found = nil
28
27
 
29
- break
30
- end
31
- end
28
+ for klass in ancestors
29
+ break unless klass.respond_to? :settings
32
30
 
33
- found = settings[key] = found.dup if found.is_a? Enumerable
31
+ if klass.settings.has_key? key
32
+ found = klass.settings[key]
34
33
 
35
- found
34
+ break
35
+ end
36
36
  end
37
37
 
38
- def self.set key, value
39
- settings[key] = value
40
- value
41
- end
38
+ found = settings[key] = found.dup if found.is_a? Enumerable
42
39
 
43
- def self.add list, key = nil, value
44
- if key
45
- fetch(list) { Hash.new }[key] = value
46
- else
47
- fetch(list) { Set.new } << value
48
- end
49
- end
40
+ found
41
+ end
50
42
 
51
- def self.fetch key, &block
52
- x = get key
53
- x ||= set key, instance_eval(&block)
54
- x
55
- end
43
+ def self.set key, value
44
+ settings[key] = value
45
+ value
46
+ end
56
47
 
57
- def settings
58
- @settings ||= {}
48
+ def self.add list, key = nil, value
49
+ if key
50
+ fetch(list) { Hash.new }[key] = value
51
+ else
52
+ fetch(list) { Set.new } << value
59
53
  end
54
+ end
60
55
 
61
- def get key
62
- return settings[key] if settings.has_key? key
56
+ def self.fetch key, &block
57
+ x = get key
58
+ x ||= set key, instance_eval(&block)
59
+ x
60
+ end
63
61
 
64
- self.class.get key
65
- end
62
+ def settings
63
+ @settings ||= {}
64
+ end
66
65
 
67
- def set key, value
68
- settings[key] = value
69
- end
66
+ def get key
67
+ return settings[key] if settings.has_key? key
70
68
 
71
- def add list, key = nil, value
72
- if key
73
- fetch(list) { Hash.new }[key] = value
74
- else
75
- fetch(list) { Set.new } << value
76
- end
77
- end
69
+ self.class.get key
70
+ end
78
71
 
79
- def fetch key, &block
80
- x = get key
81
- x ||= set key, eval(&block)
82
- x
72
+ def set key, value
73
+ settings[key] = value
74
+ end
75
+
76
+ def add list, key = nil, value
77
+ if key
78
+ fetch(list) { Hash.new }[key] = value
79
+ else
80
+ fetch(list) { Set.new } << value
83
81
  end
82
+ end
84
83
 
85
- # LOG
84
+ def fetch key, &block
85
+ x = get key
86
+ x ||= set key, eval(&block)
87
+ x
88
+ end
86
89
 
87
- LOG_LEVELS = {
88
- :higher => 2,
89
- :high => 1,
90
- :normal => 0,
91
- :low => -1,
92
- :lower => -2,
93
- }
90
+ # LOG
94
91
 
95
- set :log_level, :normal
96
- set :log_color, :white
92
+ LOG_LEVELS = {
93
+ :higher => 2,
94
+ :high => 1,
95
+ :normal => 0,
96
+ :low => -1,
97
+ :lower => -2,
98
+ }
97
99
 
98
- #
100
+ set :log_level, :normal
101
+ set :log_color, :white
99
102
 
100
- LOG_JUST = 40
103
+ #
101
104
 
102
- def self.log log_level = :normal, string
103
- raise "invalid log_level `#{log_level}`" unless LOG_LEVELS.keys.include? log_level
104
- return unless log_level? log_level
105
+ LOG_JUST = 40
105
106
 
106
- source = (self.is_a? Class) ? self : self.class
107
- source = source.to_s.ljust(LOG_JUST).bold.colorize(source.log_color)
107
+ def self.log log_level = :normal, string
108
+ raise "invalid log_level `#{log_level}`" unless LOG_LEVELS.keys.include? log_level
109
+ return unless log_level? log_level
108
110
 
109
- string = "#{source} #{string}"
111
+ source = (self.is_a? Class) ? self : self.class
112
+ source = source.to_s.ljust(LOG_JUST).bold.colorize(source.log_color)
110
113
 
111
- DevBox.logs.call string
112
- end
114
+ string = "#{source} #{string}"
113
115
 
114
- def self.log_level
115
- get(:log_level) || :normal
116
- end
116
+ DevBox[:log].call string
117
+ end
117
118
 
118
- def self.log_level? log_level = :normal
119
- # TODO
120
- true
121
- end
119
+ def self.log_level
120
+ get(:log_level) || :normal
121
+ end
122
122
 
123
- def self.log_color
124
- (get(:system) || self).get :log_color
125
- end
123
+ def self.log_level? log_level = :normal
124
+ # TODO
125
+ true
126
+ end
126
127
 
127
- def self.log?(log_level = :normal)= log_level? log_level
128
- def log(...)= self.class.log(...)
129
- def log_level(...)= self.class.log_level(...)
130
- def log?(...)= self.class.log?(...)
131
- def log_level?(...)= self.class.log_level?(...)
132
- def log_color(...)= self.class.log_color(...)
128
+ def self.log_color
129
+ (get(:system) || self).get :log_color
130
+ end
133
131
 
134
- # SYSTEM
132
+ def self.log?(log_level = :normal)= log_level? log_level
133
+ def log(...)= self.class.log(...)
134
+ def log_level(...)= self.class.log_level(...)
135
+ def log?(...)= self.class.log?(...)
136
+ def log_level?(...)= self.class.log_level?(...)
137
+ def log_color(...)= self.class.log_color(...)
135
138
 
136
- def self.inherited_explicitly_sets_system
139
+ # SYSTEM
137
140
 
138
- def self.inherited sub
139
- super
141
+ def self.inherited_explicitly_sets_system
140
142
 
141
- return unless sub.name.to_s.include? "::"
143
+ def self.inherited sub
144
+ super
142
145
 
143
- system = Object.const_get sub.first_namespace
146
+ return unless sub.name.to_s.include? "::"
144
147
 
145
- sub.set :system, system
146
- end
148
+ system = Object.const_get sub.first_namespace
147
149
 
150
+ sub.set :system, system
148
151
  end
149
152
 
150
153
  end
154
+
151
155
  end
@@ -1,79 +1,77 @@
1
- module Liza
2
- class UnitTest < Test
3
- test :subject_class do
4
- assert subject_class == Liza::Unit
5
- end
1
+ class Liza::UnitTest < Liza::Test
2
+ test :subject_class do
3
+ assert subject_class == Liza::Unit
4
+ end
5
+
6
+ test :settings do
7
+ assert subject_class.get(:log_level) == :normal
8
+ assert subject_class.get(:log_color) == :white
9
+ assert subject_class.log_level == :normal
10
+ assert subject_class.log_color == :white
11
+
12
+ assert subject_class.settings == {log_level: :normal, log_color: :white}
13
+ end
14
+
15
+ test :settings_inheritance do
16
+ class_a = Class.new(subject_class) do
17
+ set :number, 1
18
+
19
+ add :default, 10
20
+ add :default, 20
6
21
 
7
- test :settings do
8
- assert subject_class.get(:log_level) == :normal
9
- assert subject_class.get(:log_color) == :white
10
- assert subject_class.log_level == :normal
11
- assert subject_class.log_color == :white
22
+ set :array, []
23
+ add :array, 10
24
+ add :array, 20
12
25
 
13
- assert subject_class.settings == {log_level: :normal, log_color: :white}
26
+ add :hash, :a, 10
27
+ add :hash, :b, 20
14
28
  end
15
29
 
16
- test :settings_inheritance do
17
- class_a = Class.new(subject_class) do
18
- set :number, 1
19
-
20
- add :default, 10
21
- add :default, 20
22
-
23
- set :array, []
24
- add :array, 10
25
- add :array, 20
26
-
27
- add :hash, :a, 10
28
- add :hash, :b, 20
29
- end
30
-
31
- assert class_a.settings == {
32
- number: 1,
33
- default: Set[10, 20],
34
- array: [10, 20],
35
- hash: {a: 10, b: 20}
36
- }
37
-
38
- assert class_a.get(:default) == Set[10, 20]
39
- assert class_a.get(:array) == [10, 20]
40
- assert class_a.get(:hash) == {a: 10, b: 20}
41
-
42
- class_b = Class.new(class_a) do
43
- set :string, "a"
44
-
45
- add :default, 30
46
- add :default, 40
47
-
48
- add :array, 30
49
- add :array, 40
50
-
51
- add :hash, :c, 30
52
- add :hash, :d, 40
53
- end
54
-
55
- assert class_a.settings == {
56
- number: 1,
57
- default: Set[10, 20],
58
- array: [10, 20],
59
- hash: {a: 10, b: 20}
60
- }
61
-
62
- assert class_a.get(:default) == Set[10, 20]
63
- assert class_a.get(:array) == [10, 20]
64
- assert class_a.get(:hash) == {a: 10, b: 20}
65
-
66
- assert class_b.settings == {
67
- string: "a",
68
- default: Set[10, 20, 30, 40],
69
- array: [10, 20, 30, 40],
70
- hash: {a: 10, b: 20, c: 30, d: 40}
71
- }
72
-
73
- assert class_b.get(:default) == Set[10, 20, 30, 40]
74
- assert class_b.get(:array) == [10, 20, 30, 40]
75
- assert class_b.get(:hash) == {a: 10, b: 20, c: 30, d: 40}
30
+ assert class_a.settings == {
31
+ number: 1,
32
+ default: Set[10, 20],
33
+ array: [10, 20],
34
+ hash: {a: 10, b: 20}
35
+ }
36
+
37
+ assert class_a.get(:default) == Set[10, 20]
38
+ assert class_a.get(:array) == [10, 20]
39
+ assert class_a.get(:hash) == {a: 10, b: 20}
40
+
41
+ class_b = Class.new(class_a) do
42
+ set :string, "a"
43
+
44
+ add :default, 30
45
+ add :default, 40
46
+
47
+ add :array, 30
48
+ add :array, 40
49
+
50
+ add :hash, :c, 30
51
+ add :hash, :d, 40
76
52
  end
77
53
 
54
+ assert class_a.settings == {
55
+ number: 1,
56
+ default: Set[10, 20],
57
+ array: [10, 20],
58
+ hash: {a: 10, b: 20}
59
+ }
60
+
61
+ assert class_a.get(:default) == Set[10, 20]
62
+ assert class_a.get(:array) == [10, 20]
63
+ assert class_a.get(:hash) == {a: 10, b: 20}
64
+
65
+ assert class_b.settings == {
66
+ string: "a",
67
+ default: Set[10, 20, 30, 40],
68
+ array: [10, 20, 30, 40],
69
+ hash: {a: 10, b: 20, c: 30, d: 40}
70
+ }
71
+
72
+ assert class_b.get(:default) == Set[10, 20, 30, 40]
73
+ assert class_b.get(:array) == [10, 20, 30, 40]
74
+ assert class_b.get(:hash) == {a: 10, b: 20, c: 30, d: 40}
78
75
  end
76
+
79
77
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lizarb
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.3"
5
5
  end