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,111 +1,109 @@
1
- module Liza
2
- class TestAssertionsPart < Part
3
- insertion do
4
- # CLASS
5
-
6
- def self.totals
7
- @totals ||= {
8
- errors: [],
9
- todos: [],
10
- fails: [],
11
- passes: [],
12
- }
13
- end
14
-
15
- def self._assertion_todo msg
16
- self.totals[:todos] << msg
17
- end
1
+ class Liza::TestAssertionsPart < Liza::Part
2
+ insertion do
3
+ # CLASS
4
+
5
+ def self.totals
6
+ @totals ||= {
7
+ errors: [],
8
+ todos: [],
9
+ fails: [],
10
+ passes: [],
11
+ }
12
+ end
18
13
 
19
- def self._assertion_passed
20
- self.totals[:passes] << 1
21
- end
14
+ def self._assertion_todo msg
15
+ self.totals[:todos] << msg
16
+ end
22
17
 
23
- def self._assertion_failed msg
24
- self.totals[:fails] << msg
25
- end
18
+ def self._assertion_passed
19
+ self.totals[:passes] << 1
20
+ end
26
21
 
27
- def self._assertion_errored e
28
- self.totals[:errors] << e
29
- end
22
+ def self._assertion_failed msg
23
+ self.totals[:fails] << msg
24
+ end
30
25
 
31
- # INSTANCE
26
+ def self._assertion_errored e
27
+ self.totals[:errors] << e
28
+ end
32
29
 
33
- attr_writer :assertions
30
+ # INSTANCE
34
31
 
35
- def assertions
36
- @assertions ||= 0
37
- end
32
+ attr_writer :assertions
38
33
 
39
- def _inc_assertions
40
- self.assertions += 1
41
- end
34
+ def assertions
35
+ @assertions ||= 0
36
+ end
42
37
 
43
- # ASSERTIONS
38
+ def _inc_assertions
39
+ self.assertions += 1
40
+ end
44
41
 
45
- def todo msg
46
- self.class._assertion_todo msg
47
- @last_result = :todo
42
+ # ASSERTIONS
48
43
 
49
- log_test_assertion __method__, caller if _groups.empty?
50
- end
44
+ def todo msg
45
+ self.class._assertion_todo msg
46
+ @last_result = :todo
51
47
 
52
- def _groups
53
- @_groups ||= []
54
- end
55
-
56
- def group kaller: nil, **_words, &block
57
- block_given? || raise(ArgumentError, "No block given")
48
+ log_test_assertion __method__, caller if _groups.empty?
49
+ end
58
50
 
59
- _groups << block
60
- instance_exec &block
61
- _groups.pop
51
+ def _groups
52
+ @_groups ||= []
53
+ end
62
54
 
63
- kaller ||= caller
64
- log_test_assertion __method__, kaller if _groups.empty?
65
- end
55
+ def group kaller: nil, **_words, &block
56
+ block_given? || raise(ArgumentError, "No block given")
66
57
 
67
- def assert b, msg = "it should have been true", kaller: nil
68
- if b
69
- self.class._assertion_passed
70
- @last_result = :passed
71
- else
72
- self.class._assertion_failed msg
73
- @last_result = :failed
74
- end
58
+ _groups << block
59
+ instance_exec &block
60
+ _groups.pop
75
61
 
76
- kaller ||= caller
77
- log_test_assertion __method__, kaller if _groups.empty?
62
+ kaller ||= caller
63
+ log_test_assertion __method__, kaller if _groups.empty?
64
+ end
78
65
 
79
- b
66
+ def assert b, msg = "it should have been true", kaller: nil
67
+ if b
68
+ self.class._assertion_passed
69
+ @last_result = :passed
70
+ else
71
+ self.class._assertion_failed msg
72
+ @last_result = :failed
80
73
  end
81
74
 
82
- def refute b, msg = "it should have been false", kaller: nil
83
- if b
84
- self.class._assertion_failed msg
85
- @last_result = :failed
86
- else
87
- self.class._assertion_passed
88
- @last_result = :passed
89
- end
75
+ kaller ||= caller
76
+ log_test_assertion __method__, kaller if _groups.empty?
90
77
 
91
- kaller ||= caller
92
- log_test_assertion __method__, kaller if _groups.empty?
78
+ b
79
+ end
93
80
 
94
- b
81
+ def refute b, msg = "it should have been false", kaller: nil
82
+ if b
83
+ self.class._assertion_failed msg
84
+ @last_result = :failed
85
+ else
86
+ self.class._assertion_passed
87
+ @last_result = :passed
95
88
  end
96
89
 
97
- def assert! b, msg = "it should have been true"
98
- critical assert b, msg, kaller: caller
99
- end
90
+ kaller ||= caller
91
+ log_test_assertion __method__, kaller if _groups.empty?
100
92
 
101
- def refute! b, msg = "it should have been false"
102
- critical refute b, msg, kaller: caller
103
- end
93
+ b
94
+ end
104
95
 
105
- def critical passed
106
- throw :critical, :critical if not passed
107
- end
96
+ def assert! b, msg = "it should have been true"
97
+ critical assert b, msg, kaller: caller
98
+ end
108
99
 
100
+ def refute! b, msg = "it should have been false"
101
+ critical refute b, msg, kaller: caller
109
102
  end
103
+
104
+ def critical passed
105
+ throw :critical, :critical if not passed
106
+ end
107
+
110
108
  end
111
109
  end
@@ -1,70 +1,68 @@
1
- module Liza
2
- class TestDslPart < Part
3
- insertion do
1
+ class Liza::TestDslPart < Liza::Part
2
+ insertion do
4
3
 
5
- def self.call class_index, class_count
6
- counter_class = "#{class_index.to_s.rjust 3, "0"}/#{class_count.to_s.rjust 3, "0"}"
4
+ def self.call class_index, class_count
5
+ counter_class = "#{class_index.to_s.rjust 3, "0"}/#{class_count.to_s.rjust 3, "0"}"
7
6
 
8
- log "+ #{counter_class} #{self} class".bold.white
7
+ log "+ #{counter_class} #{self} class".bold.white
9
8
 
10
- array = [test_tree]
11
- while array.any?
12
- node = array.pop
13
- i = 0
9
+ array = [test_tree]
10
+ while array.any?
11
+ node = array.pop
12
+ i = 0
14
13
 
15
- node.tests.each do |test_words, test_block|
16
- counter_instance = "#{(i+=1).to_s.rjust 2, '0'}/#{node.tests.size.to_s.rjust 2, '0'}"
17
- label = test_words.to_a.flatten.join(" ")[0..25]
14
+ node.tests.each do |test_words, test_block|
15
+ counter_instance = "#{(i+=1).to_s.rjust 2, '0'}/#{node.tests.size.to_s.rjust 2, '0'}"
16
+ label = test_words.to_a.flatten.join(" ")[0..25]
18
17
 
19
- log " #{ counter_class } #{ counter_instance } #{ label.ljust(27)} #{_log_test_block test_block}"
18
+ log " #{ counter_class } #{ counter_instance } #{ label.ljust(27)} #{_log_test_block test_block}"
20
19
 
21
- log_test_building node, test_block if log_test_building?
22
-
23
- instance = new test_words, node.before_stack, node.after_stack, &test_block
24
- instance.call
25
- end
26
-
27
- array.concat node.children
20
+ log_test_building node, test_block if log_test_building?
21
+
22
+ instance = new test_words, node.before_stack, node.after_stack, &test_block
23
+ instance.call
28
24
  end
29
25
 
26
+ array.concat node.children
30
27
  end
31
28
 
32
- attr_reader :test_words
29
+ end
33
30
 
34
- def initialize test_words, before_stack, after_stack, &test_block
35
- @test_words, @before_stack, @after_stack, @test_block = test_words, before_stack, after_stack, test_block
36
- end
31
+ attr_reader :test_words
37
32
 
38
- def call
39
- catch :critical do
40
- @before_stack.each do |stack|
41
- log " calling stacked before blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
42
- stack.each do |bl|
43
- log_test_call "B&", &bl if log_test_call_block?
44
- instance_exec &bl
45
- end
33
+ def initialize test_words, before_stack, after_stack, &test_block
34
+ @test_words, @before_stack, @after_stack, @test_block = test_words, before_stack, after_stack, test_block
35
+ end
36
+
37
+ def call
38
+ catch :critical do
39
+ @before_stack.each do |stack|
40
+ log " calling stacked before blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
41
+ stack.each do |bl|
42
+ log_test_call "B&", &bl if log_test_call_block?
43
+ instance_exec &bl
46
44
  end
45
+ end
47
46
 
48
- bl = @test_block
49
- log " calling test block #{_log_test_block bl}".magenta if log_test_building?
50
- log_test_call "T&", &bl if log_test_call_block?
51
- instance_exec &bl
47
+ bl = @test_block
48
+ log " calling test block #{_log_test_block bl}".magenta if log_test_building?
49
+ log_test_call "T&", &bl if log_test_call_block?
50
+ instance_exec &bl
52
51
 
53
- @after_stack.each do |stack|
54
- log " calling stacked after blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
55
- stack.each do |bl|
56
- log_test_call "A&", &bl if log_test_call_block?
57
- instance_exec &bl
58
- end
52
+ @after_stack.each do |stack|
53
+ log " calling stacked after blocks #{stack.map { |bl| _log_test_block bl }}".magenta if log_test_building?
54
+ stack.each do |bl|
55
+ log_test_call "A&", &bl if log_test_call_block?
56
+ instance_exec &bl
59
57
  end
60
58
  end
61
- rescue Exception => e
62
- self.class._assertion_errored e
63
- log_test_call_rescue e
64
- ensure
65
- puts
66
59
  end
67
-
60
+ rescue Exception => e
61
+ self.class._assertion_errored e
62
+ log_test_call_rescue e
63
+ ensure
64
+ puts
68
65
  end
66
+
69
67
  end
70
68
  end
@@ -1,124 +1,122 @@
1
- module Liza
2
- class TestLogPart < Part
1
+ class Liza::TestLogPart < Liza::Part
3
2
 
4
- insertion do
3
+ insertion do
5
4
 
6
- LOG_BUILDING = false
7
- LOG_ASSERTION = true
8
- LOG_ASSERTION_MESSAGE = true
9
- LOG_CALL_BLOCK = true
5
+ LOG_BUILDING = false
6
+ LOG_ASSERTION = true
7
+ LOG_ASSERTION_MESSAGE = true
8
+ LOG_CALL_BLOCK = true
10
9
 
11
- def self.log_test_building?
12
- LOG_BUILDING
13
- end
14
-
15
- def log_test_building?
16
- self.class.log_test_building?
17
- end
10
+ def self.log_test_building?
11
+ LOG_BUILDING
12
+ end
18
13
 
19
- def log_test_assertion?
20
- LOG_ASSERTION
21
- end
14
+ def log_test_building?
15
+ self.class.log_test_building?
16
+ end
22
17
 
23
- def log_test_assertion_message?
24
- LOG_ASSERTION_MESSAGE
25
- end
18
+ def log_test_assertion?
19
+ LOG_ASSERTION
20
+ end
26
21
 
27
- def log_test_call_block?
28
- LOG_CALL_BLOCK
29
- end
22
+ def log_test_assertion_message?
23
+ LOG_ASSERTION_MESSAGE
24
+ end
30
25
 
31
- def log_test_call_rescue e
32
- prefix = "error".yellow
26
+ def log_test_call_block?
27
+ LOG_CALL_BLOCK
28
+ end
33
29
 
34
- kaller = e.backtrace
30
+ def log_test_call_rescue e
31
+ prefix = "error".yellow
35
32
 
36
- source_location = _caller_line_split(kaller[0])[0]
37
- source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
33
+ kaller = e.backtrace
38
34
 
39
- log " #{prefix} #{e.class.to_s.ljust 20} #{source_location}"
35
+ source_location = _caller_line_split(kaller[0])[0]
36
+ source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
40
37
 
41
- puts "Exception!".red
42
- puts e.class.to_s.red
43
- puts e.message.red
44
- puts
45
- puts e.backtrace.join("\n").red
46
- end
38
+ log " #{prefix} #{e.class.to_s.ljust 20} #{source_location}"
47
39
 
48
- def self.log_test_building node, test_block
49
- log " the building blocks are".magenta
40
+ puts "Exception!".red
41
+ puts e.class.to_s.red
42
+ puts e.message.red
43
+ puts
44
+ puts e.backtrace.join("\n").red
45
+ end
50
46
 
51
- node.before_stack.each do |stack|
52
- stack.each do |bl|
53
- log " before block #{_log_test_block bl}".magenta
54
- end
55
- end
56
-
57
- log " test block #{_log_test_block test_block}".magenta
47
+ def self.log_test_building node, test_block
48
+ log " the building blocks are".magenta
58
49
 
59
- node.after_stack.each do |stack|
60
- stack.each do |bl|
61
- log " after block #{_log_test_block bl}".magenta
62
- end
50
+ node.before_stack.each do |stack|
51
+ stack.each do |bl|
52
+ log " before block #{_log_test_block bl}".magenta
63
53
  end
64
54
  end
55
+
56
+ log " test block #{_log_test_block test_block}".magenta
65
57
 
66
- def log_test_call prefix, &block
67
- source_location = block.source_location.join(":").gsub("#{Lizarb::CUR_DIR}/", "")
68
- source_location = source_location[0..-1]
69
- log " #{prefix} #{source_location}"
58
+ node.after_stack.each do |stack|
59
+ stack.each do |bl|
60
+ log " after block #{_log_test_block bl}".magenta
61
+ end
70
62
  end
63
+ end
71
64
 
72
- def log_test_assertion method_name, kaller
73
- _inc_assertions
74
- prefix = "#{assertions.to_s.rjust 2, "0"} #{_log_test_assertion_tag method_name}"
65
+ def log_test_call prefix, &block
66
+ source_location = block.source_location.join(":").gsub("#{Lizarb::CUR_DIR}/", "")
67
+ source_location = source_location[0..-1]
68
+ log " #{prefix} #{source_location}"
69
+ end
75
70
 
76
- source_location = _caller_line_split(kaller[0])[0]
77
- source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
71
+ def log_test_assertion method_name, kaller
72
+ _inc_assertions
73
+ prefix = "#{assertions.to_s.rjust 2, "0"} #{_log_test_assertion_tag method_name}"
78
74
 
79
- log " #{prefix} #{source_location}" if log_test_assertion?
80
- end
75
+ source_location = _caller_line_split(kaller[0])[0]
76
+ source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
81
77
 
82
- def _log_test_assertion_tag method_name
83
- "#{log_test_assertion_result} #{method_name.to_s.ljust(20).bold.white}"
84
- end
78
+ log " #{prefix} #{source_location}" if log_test_assertion?
79
+ end
85
80
 
86
- def self._log_test_block test_block
87
- test_block.source_location.join(":").gsub("#{Lizarb::CUR_DIR}/", "")
88
- end
81
+ def _log_test_assertion_tag method_name
82
+ "#{log_test_assertion_result} #{method_name.to_s.ljust(20).bold.white}"
83
+ end
89
84
 
90
- def _log_test_block test_block
91
- self.class._log_test_block test_block
92
- end
85
+ def self._log_test_block test_block
86
+ test_block.source_location.join(":").gsub("#{Lizarb::CUR_DIR}/", "")
87
+ end
93
88
 
94
- def log_test_assertion_result
95
- case @last_result
96
- when :todo
97
- " todo".blue
98
- when :passed
99
- "passed".green
100
- when :failed
101
- "failed".red
102
- else
103
- raise "Unknown result: #{@last_result}"
104
- end
105
- end
89
+ def _log_test_block test_block
90
+ self.class._log_test_block test_block
91
+ end
106
92
 
107
- def log_test_assertion_message b, msg
108
- if b
109
- log " passed #{msg}".green
110
- else
111
- log " failed #{msg}".red
112
- end
93
+ def log_test_assertion_result
94
+ case @last_result
95
+ when :todo
96
+ " todo".blue
97
+ when :passed
98
+ "passed".green
99
+ when :failed
100
+ "failed".red
101
+ else
102
+ raise "Unknown result: #{@last_result}"
113
103
  end
104
+ end
114
105
 
115
- def _caller_line_split s
116
- x = s.split ":in `"
117
- x[1] = x[1][0..-2]
118
- x
106
+ def log_test_assertion_message b, msg
107
+ if b
108
+ log " passed #{msg}".green
109
+ else
110
+ log " failed #{msg}".red
119
111
  end
112
+ end
120
113
 
114
+ def _caller_line_split s
115
+ x = s.split ":in `"
116
+ x[1] = x[1][0..-2]
117
+ x
121
118
  end
122
119
 
123
120
  end
121
+
124
122
  end
@@ -1,24 +1,22 @@
1
- module Liza
2
- class TestSubjectPart < Part
1
+ class Liza::TestSubjectPart < Liza::Part
3
2
 
4
- insertion do
5
- def self.subject_class
6
- @subject_class ||=
7
- if first_namespace == "Liza"
8
- Liza.const_get last_namespace[0..-5]
9
- else
10
- Object.const_get name[0..-5]
11
- end
12
- end
13
-
14
- def subject_class
15
- self.class.subject_class
16
- end
3
+ insertion do
4
+ def self.subject_class
5
+ @subject_class ||=
6
+ if first_namespace == "Liza"
7
+ Liza.const_get last_namespace[0..-5]
8
+ else
9
+ Object.const_get name[0..-5]
10
+ end
11
+ end
17
12
 
18
- def subject
19
- @subject ||= subject_class.new
20
- end
13
+ def subject_class
14
+ self.class.subject_class
21
15
  end
22
16
 
17
+ def subject
18
+ @subject ||= subject_class.new
19
+ end
23
20
  end
21
+
24
22
  end