lizarb 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/dev_box.rb +24 -4
- data/app/happy_box.rb +1 -1
- data/app/net/databases/sqlite_db_test.rb +5 -5
- data/app/net/records/app_record_test.rb +1 -1
- data/app/net/records/post_record_test.rb +1 -1
- data/app/net/records/user_record_test.rb +1 -1
- data/app/net_box.rb +7 -7
- data/app/web_box.rb +2 -2
- data/lib/app.rb +1 -1
- data/lib/dev_system/dev/controllers/bench/not_found_bench.rb +17 -19
- data/lib/dev_system/dev/controllers/bench/not_found_bench_test.rb +9 -11
- data/lib/dev_system/dev/controllers/bench.rb +5 -7
- data/lib/dev_system/dev/controllers/bench_dsl_main_part.rb +37 -39
- data/lib/dev_system/dev/controllers/bench_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/bench_command.rb +20 -22
- data/lib/dev_system/dev/controllers/command/bench_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/echo_command.rb +5 -7
- data/lib/dev_system/dev/controllers/command/echo_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/generate_command.rb +20 -22
- data/lib/dev_system/dev/controllers/command/generate_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/not_found_command.rb +17 -19
- data/lib/dev_system/dev/controllers/command/not_found_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/terminal_command.rb +12 -14
- data/lib/dev_system/dev/controllers/command/terminal_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/test_command.rb +64 -53
- data/lib/dev_system/dev/controllers/command/test_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command/version_command.rb +4 -6
- data/lib/dev_system/dev/controllers/command/version_command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/command.rb +11 -13
- data/lib/dev_system/dev/controllers/command_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generator.rb +5 -7
- data/lib/dev_system/dev/controllers/generator_dsl_main_part.rb +35 -37
- data/lib/dev_system/dev/controllers/generator_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generators/app_generator.rb +103 -53
- data/lib/dev_system/dev/controllers/generators/app_generator_test.rb +8 -10
- data/lib/dev_system/dev/controllers/generators/not_found_generator.rb +17 -19
- data/lib/dev_system/dev/controllers/generators/not_found_generator_test.rb +8 -10
- data/lib/dev_system/dev/controllers/terminal/irb_terminal.rb +11 -13
- data/lib/dev_system/dev/controllers/terminal/irb_terminal_test.rb +8 -10
- data/lib/dev_system/dev/controllers/terminal/pry_terminal.rb +6 -8
- data/lib/dev_system/dev/controllers/terminal/pry_terminal_test.rb +8 -10
- data/lib/dev_system/dev/controllers/terminal.rb +11 -13
- data/lib/dev_system/dev/controllers/terminal_test.rb +8 -10
- data/lib/dev_system/dev/dev_box.rb +33 -16
- data/lib/dev_system/dev/dev_box_test.rb +12 -14
- data/lib/dev_system/dev/panels/bench_panel.rb +3 -0
- data/lib/dev_system/dev/panels/bench_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/command_panel.rb +16 -18
- data/lib/dev_system/dev/panels/command_panel_test.rb +15 -17
- data/lib/dev_system/dev/panels/generator_panel.rb +3 -0
- data/lib/dev_system/dev/panels/generator_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/log_panel.rb +9 -6
- data/lib/dev_system/dev/panels/log_panel_test.rb +11 -13
- data/lib/dev_system/dev/panels/shell_panel.rb +3 -0
- data/lib/dev_system/dev/panels/shell_panel_test.rb +12 -0
- data/lib/dev_system/dev/panels/terminal_panel.rb +3 -0
- data/lib/dev_system/dev/panels/terminal_panel_test.rb +12 -0
- data/lib/happy_system/happy/controllers/axo.rb +4 -5
- data/lib/happy_system/happy/happy_box.rb +6 -9
- data/lib/happy_system/happy/happy_box_test.rb +11 -13
- data/lib/happy_system/happy/panels/axo_panel.rb +1 -3
- data/lib/liza/base/box.rb +71 -26
- data/lib/liza/base/box_test.rb +7 -9
- data/lib/liza/base/controller.rb +19 -21
- data/lib/liza/base/controller_test.rb +7 -9
- data/lib/liza/base/panel.rb +42 -27
- data/lib/liza/base/panel_test.rb +10 -12
- data/lib/liza/meta/part.rb +12 -14
- data/lib/liza/meta/part_extension.rb +14 -16
- data/lib/liza/meta/part_test.rb +4 -6
- data/lib/liza/meta/system.rb +12 -14
- data/lib/liza/meta/system_test.rb +8 -10
- data/lib/liza/ruby_test.rb +4 -6
- data/lib/liza/ruby_tests/module_test.rb +1 -1
- data/lib/liza/test/test.rb +7 -10
- data/lib/liza/test/test_test.rb +158 -159
- data/lib/liza/test_parts/test_assertions_advanced_part.rb +102 -104
- data/lib/liza/test_parts/test_assertions_part.rb +81 -83
- data/lib/liza/test_parts/test_dsl_part.rb +47 -49
- data/lib/liza/test_parts/test_log_part.rb +88 -90
- data/lib/liza/test_parts/test_subject_part.rb +16 -18
- data/lib/liza/test_parts/test_tree_part.rb +105 -107
- data/lib/liza/unit.rb +108 -104
- data/lib/liza/unit_test.rb +69 -71
- data/lib/lizarb/version.rb +1 -1
- data/lib/net_system/dev/net_command.rb +10 -12
- data/lib/net_system/net/controllers/client/redis_client.rb +19 -21
- data/lib/net_system/net/controllers/client/redis_client_test.rb +20 -22
- data/lib/net_system/net/controllers/client/sqlite_client.rb +19 -21
- data/lib/net_system/net/controllers/client/sqlite_client_test.rb +20 -22
- data/lib/net_system/net/controllers/client.rb +1 -3
- data/lib/net_system/net/controllers/client_test.rb +8 -10
- data/lib/net_system/net/controllers/database/redis_db.rb +6 -8
- data/lib/net_system/net/controllers/database/redis_db_test.rb +15 -17
- data/lib/net_system/net/controllers/database/sqlite_db.rb +6 -8
- data/lib/net_system/net/controllers/database/sqlite_db_test.rb +15 -17
- data/lib/net_system/net/controllers/database.rb +21 -23
- data/lib/net_system/net/controllers/database_test.rb +8 -10
- data/lib/net_system/net/controllers/record.rb +21 -23
- data/lib/net_system/net/controllers/record_test.rb +8 -10
- data/lib/net_system/net/net_box.rb +11 -16
- data/lib/net_system/net/net_box_test.rb +12 -14
- data/lib/net_system/net/panels/client_panel.rb +1 -3
- data/lib/net_system/net/panels/client_panel_test.rb +11 -13
- data/lib/net_system/net/panels/database_panel.rb +6 -8
- data/lib/net_system/net/panels/database_panel_test.rb +11 -13
- data/lib/web_system/dev/rack_command.rb +26 -17
- data/lib/web_system/dev/request_command.rb +2 -2
- data/lib/web_system/dev/web_command.rb +6 -8
- data/lib/web_system/web/controllers/rack.rb +4 -6
- data/lib/web_system/web/controllers/rack_test.rb +11 -13
- data/lib/web_system/web/controllers/request/client_error_request.rb +9 -11
- data/lib/web_system/web/controllers/request/not_found_request.rb +9 -11
- data/lib/web_system/web/controllers/request/server_error_request.rb +10 -12
- data/lib/web_system/web/controllers/request.rb +1 -3
- data/lib/web_system/web/controllers/request_test.rb +11 -13
- data/lib/web_system/web/panels/rack_panel.rb +37 -39
- data/lib/web_system/web/panels/rack_panel_test.rb +8 -10
- data/lib/web_system/web/panels/request_panel.rb +54 -56
- data/lib/web_system/web/panels/request_panel_test.rb +1 -1
- data/lib/web_system/web/web_box.rb +14 -18
- data/lib/web_system/web/web_box_test.rb +11 -13
- metadata +10 -5
- data/app_new/.gitignore +0 -4
- data/app_new/Gemfile +0 -31
- data/app_new/Procfile +0 -3
@@ -1,111 +1,109 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
14
|
+
def self._assertion_todo msg
|
15
|
+
self.totals[:todos] << msg
|
16
|
+
end
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
def self._assertion_passed
|
19
|
+
self.totals[:passes] << 1
|
20
|
+
end
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
def self._assertion_failed msg
|
23
|
+
self.totals[:fails] << msg
|
24
|
+
end
|
30
25
|
|
31
|
-
|
26
|
+
def self._assertion_errored e
|
27
|
+
self.totals[:errors] << e
|
28
|
+
end
|
32
29
|
|
33
|
-
|
30
|
+
# INSTANCE
|
34
31
|
|
35
|
-
|
36
|
-
@assertions ||= 0
|
37
|
-
end
|
32
|
+
attr_writer :assertions
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
|
34
|
+
def assertions
|
35
|
+
@assertions ||= 0
|
36
|
+
end
|
42
37
|
|
43
|
-
|
38
|
+
def _inc_assertions
|
39
|
+
self.assertions += 1
|
40
|
+
end
|
44
41
|
|
45
|
-
|
46
|
-
self.class._assertion_todo msg
|
47
|
-
@last_result = :todo
|
42
|
+
# ASSERTIONS
|
48
43
|
|
49
|
-
|
50
|
-
|
44
|
+
def todo msg
|
45
|
+
self.class._assertion_todo msg
|
46
|
+
@last_result = :todo
|
51
47
|
|
52
|
-
|
53
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
51
|
+
def _groups
|
52
|
+
@_groups ||= []
|
53
|
+
end
|
62
54
|
|
63
|
-
|
64
|
-
|
65
|
-
end
|
55
|
+
def group kaller: nil, **_words, &block
|
56
|
+
block_given? || raise(ArgumentError, "No block given")
|
66
57
|
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
|
77
|
-
|
62
|
+
kaller ||= caller
|
63
|
+
log_test_assertion __method__, kaller if _groups.empty?
|
64
|
+
end
|
78
65
|
|
79
|
-
|
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
|
-
|
83
|
-
|
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
|
-
|
92
|
-
|
78
|
+
b
|
79
|
+
end
|
93
80
|
|
94
|
-
|
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
|
-
|
98
|
-
|
99
|
-
end
|
90
|
+
kaller ||= caller
|
91
|
+
log_test_assertion __method__, kaller if _groups.empty?
|
100
92
|
|
101
|
-
|
102
|
-
|
103
|
-
end
|
93
|
+
b
|
94
|
+
end
|
104
95
|
|
105
|
-
|
106
|
-
|
107
|
-
|
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
|
-
|
2
|
-
|
3
|
-
insertion do
|
1
|
+
class Liza::TestDslPart < Liza::Part
|
2
|
+
insertion do
|
4
3
|
|
5
|
-
|
6
|
-
|
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
|
-
|
7
|
+
log "+ #{counter_class} #{self} class".bold.white
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
array = [test_tree]
|
10
|
+
while array.any?
|
11
|
+
node = array.pop
|
12
|
+
i = 0
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
-
|
18
|
+
log " #{ counter_class } #{ counter_instance } #{ label.ljust(27)} #{_log_test_block test_block}"
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
29
|
+
end
|
33
30
|
|
34
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
2
|
-
class TestLogPart < Part
|
1
|
+
class Liza::TestLogPart < Liza::Part
|
3
2
|
|
4
|
-
|
3
|
+
insertion do
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
LOG_BUILDING = false
|
6
|
+
LOG_ASSERTION = true
|
7
|
+
LOG_ASSERTION_MESSAGE = true
|
8
|
+
LOG_CALL_BLOCK = true
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
14
|
+
def log_test_building?
|
15
|
+
self.class.log_test_building?
|
16
|
+
end
|
22
17
|
|
23
|
-
|
24
|
-
|
25
|
-
|
18
|
+
def log_test_assertion?
|
19
|
+
LOG_ASSERTION
|
20
|
+
end
|
26
21
|
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
def log_test_assertion_message?
|
23
|
+
LOG_ASSERTION_MESSAGE
|
24
|
+
end
|
30
25
|
|
31
|
-
|
32
|
-
|
26
|
+
def log_test_call_block?
|
27
|
+
LOG_CALL_BLOCK
|
28
|
+
end
|
33
29
|
|
34
|
-
|
30
|
+
def log_test_call_rescue e
|
31
|
+
prefix = "error".yellow
|
35
32
|
|
36
|
-
|
37
|
-
source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
|
33
|
+
kaller = e.backtrace
|
38
34
|
|
39
|
-
|
35
|
+
source_location = _caller_line_split(kaller[0])[0]
|
36
|
+
source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
|
40
37
|
|
41
|
-
|
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
|
-
|
49
|
-
|
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
|
-
|
52
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
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
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
-
|
73
|
-
|
74
|
-
|
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
|
-
|
77
|
-
|
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
|
-
|
80
|
-
|
75
|
+
source_location = _caller_line_split(kaller[0])[0]
|
76
|
+
source_location = source_location.gsub("#{Lizarb::CUR_DIR}/", "")
|
81
77
|
|
82
|
-
|
83
|
-
|
84
|
-
end
|
78
|
+
log " #{prefix} #{source_location}" if log_test_assertion?
|
79
|
+
end
|
85
80
|
|
86
|
-
|
87
|
-
|
88
|
-
|
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
|
-
|
91
|
-
|
92
|
-
|
85
|
+
def self._log_test_block test_block
|
86
|
+
test_block.source_location.join(":").gsub("#{Lizarb::CUR_DIR}/", "")
|
87
|
+
end
|
93
88
|
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
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
|
-
|
2
|
-
class TestSubjectPart < Part
|
1
|
+
class Liza::TestSubjectPart < Liza::Part
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
19
|
-
|
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
|