ciat 0.4.9 → 0.4.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/ciat.rb +1 -2
- data/lib/ciat/{test_file.rb → ciat_file.rb} +21 -9
- data/lib/ciat/erb_helpers.rb +6 -1
- data/lib/ciat/feedback/feedback_counter.rb +11 -19
- data/lib/ciat/feedback/return_status.rb +6 -2
- data/lib/ciat/feedback/standard_output.rb +7 -2
- data/lib/ciat/processors/compilation_interpreter.rb +20 -7
- data/lib/ciat/processors/compiler.rb +38 -15
- data/lib/ciat/processors/interpreter.rb +28 -7
- data/lib/ciat/processors/java.rb +2 -8
- data/lib/ciat/processors/parrot.rb +0 -3
- data/lib/ciat/subresult.rb +14 -4
- data/lib/ciat/subtest.rb +83 -0
- data/lib/ciat/suite.rb +9 -9
- data/lib/ciat/suite_builder.rb +5 -5
- data/lib/ciat/test.rb +36 -28
- data/lib/ciat/test_result.rb +2 -2
- data/lib/ciat/traffic_light.rb +5 -14
- data/lib/data/ciat.css +14 -2
- data/lib/data/elements.yml +8 -2
- data/lib/templates/detail_row.html.erb +10 -4
- data/lib/templates/report.html.erb +5 -5
- data/lib/templates/summary_row.html.erb +5 -3
- data/spec/ciat/{test_file_spec.rb → ciat_file_spec.rb} +51 -19
- data/spec/ciat/erb_helpers_spec.rb +8 -13
- data/spec/ciat/feedback/feedback_counter_spec.rb +37 -57
- data/spec/ciat/feedback/return_status_spec.rb +67 -61
- data/spec/ciat/feedback/standard_output_spec.rb +21 -15
- data/spec/ciat/processors/compilation_interpreter_spec.rb +12 -0
- data/spec/ciat/processors/compiler_spec.rb +12 -0
- data/spec/ciat/processors/interpreter_spec.rb +12 -0
- data/spec/ciat/processors/java_spec.rb +0 -10
- data/spec/ciat/processors/parrot_spec.rb +0 -10
- data/spec/ciat/processors/shared_examples_for_element_names.rb +27 -0
- data/spec/ciat/rake_task_spec.rb +65 -0
- data/spec/ciat/subresult_spec.rb +13 -12
- data/spec/ciat/subtest_spec.rb +199 -0
- data/spec/ciat/suite_builder_spec.rb +17 -17
- data/spec/ciat/suite_spec.rb +13 -13
- data/spec/ciat/test_result_spec.rb +36 -0
- data/spec/ciat/test_spec.rb +73 -83
- data/spec/ciat/traffic_light_spec.rb +21 -31
- data/spec/spec_helper.rb +16 -53
- data/spec/templates/detail_row/elements_html_erb_spec.rb +3 -4
- data/spec/templates/detail_row_html_erb_spec.rb +84 -23
- data/spec/templates/elements/diff_html_erb_spec.rb +5 -3
- data/spec/templates/summary_row_html_erb_spec.rb +21 -14
- metadata +13 -7
- data/lib/ciat/processors/basic_processing.rb +0 -55
- data/spec/ciat/processors/basic_processing_spec.rb +0 -146
@@ -4,49 +4,44 @@ describe CIAT::ERBHelpers do
|
|
4
4
|
before(:each) do
|
5
5
|
@helper = Object.new
|
6
6
|
@helper.extend(CIAT::ERBHelpers)
|
7
|
-
|
8
|
-
@unset = CIAT::TrafficLight.new(:unset)
|
9
|
-
@green = CIAT::TrafficLight.new(:green)
|
10
|
-
@yellow = CIAT::TrafficLight.new(:yellow)
|
11
|
-
@red = CIAT::TrafficLight.new(:red)
|
12
7
|
end
|
13
8
|
|
14
9
|
describe "converting light to word" do
|
15
10
|
it "should handle unset light" do
|
16
|
-
@helper.light_to_word(
|
11
|
+
@helper.light_to_word(CIAT::TrafficLight::UNSET).should == "n/a"
|
17
12
|
end
|
18
13
|
|
19
14
|
it "should handle green light" do
|
20
|
-
@helper.light_to_word(
|
15
|
+
@helper.light_to_word(CIAT::TrafficLight::GREEN).should == "passed"
|
21
16
|
end
|
22
17
|
|
23
18
|
it "should handle yellow light" do
|
24
|
-
@helper.light_to_word(
|
19
|
+
@helper.light_to_word(CIAT::TrafficLight::YELLOW).should == "ERROR"
|
25
20
|
end
|
26
21
|
|
27
22
|
it "should handle red light" do
|
28
|
-
@helper.light_to_word(
|
23
|
+
@helper.light_to_word(CIAT::TrafficLight::RED).should == "FAILURE"
|
29
24
|
end
|
30
25
|
end
|
31
26
|
|
32
27
|
describe "converting light to sentence" do
|
33
28
|
it "should handle unset light" do
|
34
|
-
@helper.light_to_sentence("prefix",
|
29
|
+
@helper.light_to_sentence("prefix", CIAT::TrafficLight::UNSET).should ==
|
35
30
|
"<span class=\"unset\">prefix not run.</span>"
|
36
31
|
end
|
37
32
|
|
38
33
|
it "should handle green light" do
|
39
|
-
@helper.light_to_sentence("prefix",
|
34
|
+
@helper.light_to_sentence("prefix", CIAT::TrafficLight::GREEN).should ==
|
40
35
|
"<span class=\"green\">prefix passed.</span>"
|
41
36
|
end
|
42
37
|
|
43
38
|
it "should handle yellow light" do
|
44
|
-
@helper.light_to_sentence("prefix",
|
39
|
+
@helper.light_to_sentence("prefix", CIAT::TrafficLight::YELLOW).should ==
|
45
40
|
"<span class=\"yellow\">prefix errored.</span>"
|
46
41
|
end
|
47
42
|
|
48
43
|
it "should handle red light" do
|
49
|
-
@helper.light_to_sentence("prefix",
|
44
|
+
@helper.light_to_sentence("prefix", CIAT::TrafficLight::RED).should ==
|
50
45
|
"<span class=\"red\">prefix failed.</span>"
|
51
46
|
end
|
52
47
|
end
|
@@ -7,85 +7,65 @@ describe CIAT::Feedback::FeedbackCounter do
|
|
7
7
|
@feedback = CIAT::Feedback::FeedbackCounter.new
|
8
8
|
end
|
9
9
|
|
10
|
-
describe "
|
11
|
-
|
12
|
-
@
|
13
|
-
@subresult = mock("subresult")
|
14
|
-
@subresult.should_receive(:light).at_least(:once).and_return(@light)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should report a green light" do
|
18
|
-
expect_light(:green)
|
19
|
-
|
20
|
-
@feedback.report_subresult(@subresult)
|
10
|
+
describe "error count" do
|
11
|
+
it "should be zero initially" do
|
12
|
+
@feedback.error_count.should == 0
|
21
13
|
end
|
22
14
|
|
23
|
-
it "should
|
24
|
-
|
25
|
-
@feedback.should_receive(:increment_failure_count)
|
15
|
+
it "should increment" do
|
16
|
+
@feedback.report_subresult(yellow_subresult)
|
26
17
|
|
27
|
-
@feedback.
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should report a yellow light" do
|
31
|
-
expect_light(:yellow)
|
32
|
-
@feedback.should_receive(:increment_error_count)
|
33
|
-
|
34
|
-
@feedback.report_subresult(@subresult)
|
18
|
+
@feedback.error_count.should == 1
|
35
19
|
end
|
36
20
|
|
37
|
-
it "should
|
38
|
-
|
21
|
+
it "should increment lots" do
|
22
|
+
666.times { @feedback.report_subresult(yellow_subresult) }
|
39
23
|
|
40
|
-
@feedback.
|
41
|
-
end
|
42
|
-
|
43
|
-
def expect_light(setting)
|
44
|
-
@light.should_receive(:setting).at_least(:once).and_return(setting)
|
24
|
+
@feedback.error_count.should == 666
|
45
25
|
end
|
46
26
|
end
|
47
|
-
|
27
|
+
|
48
28
|
describe "failure count" do
|
49
29
|
it "should be zero initially" do
|
50
30
|
@feedback.failure_count.should == 0
|
51
31
|
end
|
52
32
|
|
53
|
-
it "should increment" do
|
54
|
-
@feedback.
|
33
|
+
it "should increment" do
|
34
|
+
@feedback.report_subresult(red_subresult)
|
55
35
|
|
56
36
|
@feedback.failure_count.should == 1
|
57
37
|
end
|
58
38
|
|
59
39
|
it "should increment lots" do
|
60
|
-
|
40
|
+
666.times { @feedback.report_subresult(red_subresult) }
|
61
41
|
|
62
|
-
@feedback.failure_count.should ==
|
42
|
+
@feedback.failure_count.should == 666
|
63
43
|
end
|
64
44
|
end
|
65
|
-
|
66
|
-
describe "error count" do
|
67
|
-
it "should be zero initially" do
|
68
|
-
@feedback.error_count.should == 0
|
69
|
-
end
|
70
45
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
it "should increment lots" do
|
78
|
-
666.times { @feedback.increment_error_count }
|
79
|
-
|
80
|
-
@feedback.error_count.should == 666
|
81
|
-
end
|
46
|
+
it "should keep distinct counts" do
|
47
|
+
666.times { @feedback.report_subresult(yellow_subresult) }
|
48
|
+
777.times { @feedback.report_subresult(red_subresult) }
|
49
|
+
111.times { @feedback.report_subresult(unset_subresult) }
|
50
|
+
444.times { @feedback.report_subresult(green_subresult) }
|
82
51
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
52
|
+
@feedback.failure_count.should == 777
|
53
|
+
@feedback.error_count.should == 666
|
54
|
+
end
|
55
|
+
|
56
|
+
def red_subresult
|
57
|
+
mock("red subresult", :light => CIAT::TrafficLight::RED)
|
58
|
+
end
|
59
|
+
|
60
|
+
def yellow_subresult
|
61
|
+
mock("yellow subresult", :light => CIAT::TrafficLight::YELLOW)
|
62
|
+
end
|
63
|
+
|
64
|
+
def green_subresult
|
65
|
+
mock("green subresult", :light => CIAT::TrafficLight::GREEN)
|
66
|
+
end
|
67
|
+
|
68
|
+
def unset_subresult
|
69
|
+
mock("unset subresult", :light => CIAT::TrafficLight::UNSET)
|
90
70
|
end
|
91
71
|
end
|
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
3
3
|
require 'ciat/feedback/return_status'
|
4
4
|
|
5
5
|
describe CIAT::Feedback::ReturnStatus do
|
6
|
-
GREEN = CIAT::TrafficLight
|
6
|
+
GREEN = CIAT::TrafficLight::GREEN
|
7
7
|
YELLOW = CIAT::TrafficLight.new(:yellow)
|
8
8
|
RED = CIAT::TrafficLight.new(:red)
|
9
9
|
|
@@ -11,80 +11,86 @@ describe CIAT::Feedback::ReturnStatus do
|
|
11
11
|
@feedback = CIAT::Feedback::ReturnStatus.new
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
it "should ignore a green light" do
|
19
|
-
@feedback.report_subresult(mock("processor", :light => GREEN))
|
20
|
-
|
21
|
-
lambda { @feedback.post_tests(mock("suite")) }.should_not raise_error
|
14
|
+
describe "notification after tests have been run" do
|
15
|
+
it "should be okay without any tests" do
|
16
|
+
lambda { @feedback.post_tests(mock("suite")) }.should_not raise_error
|
17
|
+
end
|
22
18
|
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
@feedback.report_subresult(mock("processor", :light => GREEN))
|
20
|
+
describe "reporting a subresult with a happy path" do
|
21
|
+
it "should ignore a green light" do
|
22
|
+
@feedback.report_subresult(mock("subtest", :light => GREEN))
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
it "should fail after yellow processor" do
|
33
|
-
@feedback.report_subresult(mock("processor", :light => YELLOW))
|
24
|
+
lambda { @feedback.post_tests(mock("suite")) }.should_not raise_error
|
25
|
+
end
|
34
26
|
|
35
|
-
|
36
|
-
|
37
|
-
|
27
|
+
it "should fail after yellow subtest" do
|
28
|
+
@feedback.report_subresult(mock("subtest", :light => YELLOW))
|
29
|
+
|
30
|
+
lambda { @feedback.post_tests(mock("suite")) }.
|
31
|
+
should raise_error(RuntimeError)
|
32
|
+
end
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
@feedback.report_subresult(mock("processor", :light => YELLOW))
|
42
|
-
@feedback.report_subresult(mock("processor", :light => YELLOW))
|
34
|
+
it "should fail after red subtest" do
|
35
|
+
@feedback.report_subresult(mock("subtest", :light => RED))
|
43
36
|
|
44
|
-
|
45
|
-
|
37
|
+
lambda { @feedback.post_tests(mock("suite")) }.
|
38
|
+
should raise_error(RuntimeError)
|
39
|
+
end
|
46
40
|
end
|
47
41
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
42
|
+
describe "reporting multiple subresults" do
|
43
|
+
it "should ignore many green lights" do
|
44
|
+
@feedback.report_subresult(mock("subtest", :light => GREEN))
|
45
|
+
@feedback.report_subresult(mock("subtest", :light => GREEN))
|
46
|
+
@feedback.report_subresult(mock("subtest", :light => GREEN))
|
47
|
+
|
48
|
+
lambda { @feedback.post_tests(mock("suite")) }.should_not raise_error
|
49
|
+
end
|
54
50
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
51
|
+
it "should fail after many yellow subtests" do
|
52
|
+
@feedback.report_subresult(mock("subtest", :light => YELLOW))
|
53
|
+
@feedback.report_subresult(mock("subtest", :light => YELLOW))
|
54
|
+
@feedback.report_subresult(mock("subtest", :light => YELLOW))
|
59
55
|
|
60
|
-
|
61
|
-
|
62
|
-
|
56
|
+
lambda { @feedback.post_tests(mock("suite")) }.
|
57
|
+
should raise_error(RuntimeError)
|
58
|
+
end
|
63
59
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
60
|
+
it "should fail after many red subtests" do
|
61
|
+
@feedback.report_subresult(mock("subtest", :light => RED))
|
62
|
+
@feedback.report_subresult(mock("subtest", :light => RED))
|
63
|
+
@feedback.report_subresult(mock("subtest", :light => RED))
|
68
64
|
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
lambda { @feedback.post_tests(mock("suite")) }.
|
66
|
+
should raise_error(RuntimeError)
|
67
|
+
end
|
72
68
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
69
|
+
it "should fail after many different subtests (red last)" do
|
70
|
+
@feedback.report_subresult(mock("subtest", :light => GREEN))
|
71
|
+
@feedback.report_subresult(mock("subtest", :light => YELLOW))
|
72
|
+
@feedback.report_subresult(mock("subtest", :light => RED))
|
77
73
|
|
78
|
-
|
79
|
-
|
80
|
-
|
74
|
+
lambda { @feedback.post_tests(mock("suite")) }.
|
75
|
+
should raise_error(RuntimeError)
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should fail after many different subtests (yellow last)" do
|
79
|
+
@feedback.report_subresult(mock("subtest", :light => GREEN))
|
80
|
+
@feedback.report_subresult(mock("subtest", :light => RED))
|
81
|
+
@feedback.report_subresult(mock("subtest", :light => YELLOW))
|
82
|
+
|
83
|
+
lambda { @feedback.post_tests(mock("suite")) }.
|
84
|
+
should raise_error(RuntimeError)
|
85
|
+
end
|
81
86
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
87
|
+
it "should fail after many different subtests (green last)" do
|
88
|
+
@feedback.report_subresult(mock("subtest", :light => YELLOW))
|
89
|
+
@feedback.report_subresult(mock("subtest", :light => RED))
|
90
|
+
@feedback.report_subresult(mock("subtest", :light => GREEN))
|
86
91
|
|
87
|
-
|
88
|
-
|
92
|
+
lambda { @feedback.post_tests(mock("suite")) }.
|
93
|
+
should raise_error(RuntimeError)
|
94
|
+
end
|
89
95
|
end
|
90
|
-
end
|
96
|
+
end
|
@@ -66,43 +66,49 @@ describe CIAT::Feedback::StandardOutput do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
describe "reporting on a
|
69
|
+
describe "reporting on a subresult" do
|
70
70
|
before(:each) do
|
71
|
-
@
|
72
|
-
@processor = mock("processor")
|
73
|
-
@processor.should_receive(:light).at_least(:once).and_return(@light)
|
71
|
+
@subresult = mock("subresult")
|
74
72
|
end
|
75
73
|
|
76
74
|
it "should report a green light" do
|
77
|
-
|
75
|
+
@subresult.should_receive(:light).at_least(:once).
|
76
|
+
and_return(CIAT::TrafficLight::GREEN)
|
78
77
|
@feedback.should_receive(:putc).with(".")
|
79
78
|
|
80
|
-
@feedback.report_subresult(@
|
79
|
+
@feedback.report_subresult(@subresult)
|
81
80
|
end
|
82
81
|
|
83
82
|
it "should report a red light" do
|
84
|
-
|
83
|
+
@subresult.should_receive(:light).at_least(:once).
|
84
|
+
and_return(CIAT::TrafficLight::RED)
|
85
85
|
@feedback.should_receive(:putc).with("F")
|
86
86
|
|
87
|
-
@feedback.report_subresult(@
|
87
|
+
@feedback.report_subresult(@subresult)
|
88
88
|
end
|
89
89
|
|
90
90
|
it "should report a yellow light" do
|
91
|
-
|
91
|
+
@subresult.should_receive(:light).at_least(:once).
|
92
|
+
and_return(CIAT::TrafficLight::YELLOW)
|
92
93
|
@feedback.should_receive(:putc).with("E")
|
93
94
|
|
94
|
-
@feedback.report_subresult(@
|
95
|
+
@feedback.report_subresult(@subresult)
|
95
96
|
end
|
96
97
|
|
97
98
|
it "should report an unset light" do
|
98
|
-
|
99
|
+
@subresult.should_receive(:light).at_least(:once).
|
100
|
+
and_return(CIAT::TrafficLight::UNSET)
|
99
101
|
@feedback.should_receive(:putc).with("-")
|
100
102
|
|
101
|
-
@feedback.report_subresult(@
|
103
|
+
@feedback.report_subresult(@subresult)
|
102
104
|
end
|
103
|
-
|
104
|
-
|
105
|
-
@
|
105
|
+
|
106
|
+
it "should report an unneeded light" do
|
107
|
+
@subresult.should_receive(:light).at_least(:once).
|
108
|
+
and_return(CIAT::TrafficLight::UNNEEDED)
|
109
|
+
@feedback.should_receive(:putc).with(".")
|
110
|
+
|
111
|
+
@feedback.report_subresult(@subresult)
|
106
112
|
end
|
107
113
|
end
|
108
114
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + "/shared_examples_for_element_names"
|
3
|
+
|
4
|
+
require 'ciat/processors/compilation_interpreter'
|
5
|
+
|
6
|
+
describe CIAT::Processors::CompilationInterpreter do
|
7
|
+
it_should_behave_like "Any element namer"
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@namer = CIAT::Processors::CompilationInterpreter.new
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + "/shared_examples_for_element_names"
|
3
|
+
|
4
|
+
require 'ciat/processors/compiler'
|
5
|
+
|
6
|
+
describe CIAT::Processors::Compiler do
|
7
|
+
it_should_behave_like "Any element namer"
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@namer = CIAT::Processors::Compiler.new
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + "/shared_examples_for_element_names"
|
3
|
+
|
4
|
+
require 'ciat/processors/interpreter'
|
5
|
+
|
6
|
+
describe CIAT::Processors::Interpreter do
|
7
|
+
it_should_behave_like "Any element namer"
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@namer = CIAT::Processors::Interpreter.new
|
11
|
+
end
|
12
|
+
end
|
@@ -3,16 +3,6 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
3
3
|
require 'ciat/processors/java'
|
4
4
|
|
5
5
|
describe CIAT::Processors::Java do
|
6
|
-
describe "mixins" do
|
7
|
-
it "should use basic processing module" do
|
8
|
-
CIAT::Processors::Java.should include(CIAT::Processors::BasicProcessing)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should use HTML differ" do
|
12
|
-
CIAT::Processors::Java.should include(CIAT::Differs::HtmlDiffer)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
6
|
it "should have settable options" do
|
17
7
|
CIAT::Processors::Java.new(mock("classpath"), mock("interpreter class")) do |executor|
|
18
8
|
executor.kind = mock("processor kind")
|