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
@@ -3,16 +3,6 @@ require File.dirname(__FILE__) + '/../../spec_helper.rb'
|
|
3
3
|
require 'ciat/processors/parrot'
|
4
4
|
|
5
5
|
describe CIAT::Processors::Parrot do
|
6
|
-
describe "mixins" do
|
7
|
-
it "should use basic processing module" do
|
8
|
-
CIAT::Processors::Parrot.should include(CIAT::Processors::BasicProcessing)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should use basic processing module" do
|
12
|
-
CIAT::Processors::Parrot.should include(CIAT::Differs::HtmlDiffer)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
6
|
describe "default executor" do
|
17
7
|
before(:each) do
|
18
8
|
@executor = CIAT::Processors::Parrot.new
|
@@ -0,0 +1,27 @@
|
|
1
|
+
shared_examples_for "Any element namer" do
|
2
|
+
describe "element-name hash" do
|
3
|
+
[CIAT::TrafficLight::RED, CIAT::TrafficLight::YELLOW, CIAT::TrafficLight::GREEN, CIAT::TrafficLight::UNSET].each do |light|
|
4
|
+
[:happy, :sad].each do |path|
|
5
|
+
it "should compute relevant elements for #{light.color} light and #{path} path" do
|
6
|
+
@namer.relevant_elements(light, path).should_not be_nil
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have an output name" do
|
13
|
+
@namer.output_name.should be_an_instance_of(Symbol)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have an input name" do
|
17
|
+
@namer.input_name.should be_an_instance_of(Symbol)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should have an error name" do
|
21
|
+
@namer.error_name.should be_an_instance_of(Symbol)
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have a happy_path?" do
|
25
|
+
@namer.happy_path_element.should be_an_instance_of(Symbol)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe CIAT::RakeTask do
|
4
|
+
it "should initialize" do
|
5
|
+
CIAT::RakeTask.new.should_not be_nil
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should let me set processors" do
|
9
|
+
processors = mock("processors")
|
10
|
+
CIAT::RakeTask.new do |task|
|
11
|
+
task.processors = processors
|
12
|
+
end.processors.should == processors
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should let me append processors" do
|
16
|
+
processors = array_of_mocks(3, "processor")
|
17
|
+
CIAT::RakeTask.new do |task|
|
18
|
+
task.processors << processors[0]
|
19
|
+
task.processors << processors[1]
|
20
|
+
task.processors << processors[2]
|
21
|
+
end.processors.should == processors
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should let me set the files for input" do
|
25
|
+
files = mock("file")
|
26
|
+
CIAT::RakeTask.new do |task|
|
27
|
+
task.files = files
|
28
|
+
end.files.should == files
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should let me set the feedback" do
|
32
|
+
feedback = mock("feedback")
|
33
|
+
CIAT::RakeTask.new do |task|
|
34
|
+
task.feedback = feedback
|
35
|
+
end.feedback.should == feedback
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should let set the folder for input files" do
|
39
|
+
folder = mock("folder")
|
40
|
+
CIAT::RakeTask.new do |task|
|
41
|
+
task.folder = folder
|
42
|
+
end.folder.should == folder
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should let me set the report filename" do
|
46
|
+
report_filename = mock("report filename")
|
47
|
+
CIAT::RakeTask.new do |task|
|
48
|
+
task.report_filename = report_filename
|
49
|
+
end.report_filename.should == report_filename
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should let me set the report title" do
|
53
|
+
report_title = mock("report title")
|
54
|
+
CIAT::RakeTask.new do |task|
|
55
|
+
task.report_title = report_title
|
56
|
+
end.report_title.should == report_title
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should let me set the output folder" do
|
60
|
+
output_folder = mock("output folder")
|
61
|
+
CIAT::RakeTask.new do |task|
|
62
|
+
task.output_folder = output_folder
|
63
|
+
end.output_folder.should == output_folder
|
64
|
+
end
|
65
|
+
end
|
data/spec/ciat/subresult_spec.rb
CHANGED
@@ -3,10 +3,11 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
3
3
|
describe CIAT::Subresult do
|
4
4
|
before(:each) do
|
5
5
|
@elements = mock("elements")
|
6
|
+
@path_kind = mock("path kind")
|
6
7
|
@light = mock("light")
|
7
|
-
@
|
8
|
+
@subtest = mock("subtest")
|
8
9
|
|
9
|
-
@
|
10
|
+
@subresult = CIAT::Subresult.new(@elements, @path_kind, @light, @subtest)
|
10
11
|
end
|
11
12
|
|
12
13
|
it "should look up relevant elements" do
|
@@ -14,7 +15,7 @@ describe CIAT::Subresult do
|
|
14
15
|
names = [mock("name 0"), mock("name 1"), mock("name 2")]
|
15
16
|
relevants = [mock("element 0"), mock("element 1"), mock("element 2")]
|
16
17
|
|
17
|
-
@
|
18
|
+
@subresult.should_receive(:relevant_element_names).and_return(names)
|
18
19
|
@elements.should_receive(:element?).with(names[0]).and_return(true)
|
19
20
|
@elements.should_receive(:element).with(names[0]).and_return(relevants[0])
|
20
21
|
@elements.should_receive(:element?).with(names[1]).and_return(true)
|
@@ -22,19 +23,19 @@ describe CIAT::Subresult do
|
|
22
23
|
@elements.should_receive(:element?).with(names[2]).and_return(true)
|
23
24
|
@elements.should_receive(:element).with(names[2]).and_return(relevants[2])
|
24
25
|
|
25
|
-
@
|
26
|
+
@subresult.relevant_elements.should == relevants
|
26
27
|
end
|
27
28
|
|
28
29
|
it "should have relevant element names" do
|
29
|
-
kind
|
30
|
-
|
30
|
+
kind = mock("kind")
|
31
|
+
path_kind = mock("path kind")
|
31
32
|
names = mock("names")
|
33
|
+
|
34
|
+
@subtest.should_receive(:path_kind).and_return(path_kind)
|
35
|
+
@subtest.stub_chain(:processor, :kind).and_return(kind)
|
36
|
+
kind.should_receive(:relevant_elements).
|
37
|
+
with(@light, path_kind).and_return(names)
|
32
38
|
|
33
|
-
@
|
34
|
-
kind.should_receive(:element_name_hash).and_return(hash)
|
35
|
-
@light.should_receive(:setting).and_return(setting)
|
36
|
-
hash.should_receive(:[]).with(setting).and_return(names)
|
37
|
-
|
38
|
-
@subtest_result.relevant_element_names.should == names
|
39
|
+
@subresult.relevant_element_names.should == names
|
39
40
|
end
|
40
41
|
end
|
@@ -0,0 +1,199 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe CIAT::Subtest do
|
4
|
+
before(:each) do
|
5
|
+
@ciat_file = mock("ciat file")
|
6
|
+
@processor = mock("processor")
|
7
|
+
@subtest = CIAT::Subtest.new(@ciat_file, @processor)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "processing" do
|
11
|
+
it "should execute and diff normally" do
|
12
|
+
@subtest.should_receive(:execute).with().and_return(true)
|
13
|
+
@subtest.should_receive(:diff).with().and_return(true)
|
14
|
+
|
15
|
+
@subtest.process.should == CIAT::TrafficLight::GREEN
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should execute with an error" do
|
19
|
+
@subtest.should_receive(:execute).with().and_return(false)
|
20
|
+
|
21
|
+
@subtest.process.should == CIAT::TrafficLight::YELLOW
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should execute normally and diff with a failure" do
|
25
|
+
@subtest.should_receive(:execute).with().and_return(true)
|
26
|
+
@subtest.should_receive(:diff).with().and_return(false)
|
27
|
+
|
28
|
+
@subtest.process.should == CIAT::TrafficLight::RED
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should determine a happy path" do
|
33
|
+
result = mock("result")
|
34
|
+
|
35
|
+
@processor.stub_chain(:kind, :happy_path_element).and_return(:foobar)
|
36
|
+
@ciat_file.should_receive(:element?).with(:foobar).and_return(result)
|
37
|
+
|
38
|
+
@subtest.happy_path?.should == result
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "path kind" do
|
42
|
+
it "should indicate happy path as path kind" do
|
43
|
+
@subtest.should_receive(:happy_path?).with().and_return(true)
|
44
|
+
|
45
|
+
@subtest.path_kind.should == :happy
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should indicate sad path as path kind" do
|
49
|
+
@subtest.should_receive(:happy_path?).with().and_return(false)
|
50
|
+
|
51
|
+
@subtest.path_kind.should == :sad
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe "executing a processor for a test" do
|
56
|
+
it "should run successful command line for happy path" do
|
57
|
+
kind = mock("kind")
|
58
|
+
result = mock("result")
|
59
|
+
|
60
|
+
@subtest.should_receive(:command_line).and_return("[command line]")
|
61
|
+
@subtest.should_receive(:happy_path?).with().and_return(true)
|
62
|
+
@subtest.should_receive(:sh).with("[command line]").
|
63
|
+
and_yield(true, result)
|
64
|
+
|
65
|
+
@subtest.execute.should be_true
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should run erroring command line for happy path" do
|
69
|
+
test, kind = mock("test"), mock("kind")
|
70
|
+
result = mock("result")
|
71
|
+
|
72
|
+
@subtest.should_receive(:command_line).and_return("[command line]")
|
73
|
+
@subtest.should_receive(:happy_path?).with().and_return(true)
|
74
|
+
@subtest.should_receive(:sh).with("[command line]").
|
75
|
+
and_yield(false, result)
|
76
|
+
|
77
|
+
@subtest.execute.should be_false
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should prepare a command line" do
|
81
|
+
test = mock("test")
|
82
|
+
|
83
|
+
@processor.should_receive(:executable).and_return("[executable]")
|
84
|
+
@subtest.should_receive(:input_file).with().
|
85
|
+
and_return("[input]")
|
86
|
+
@subtest.should_receive(:command_line_args).with().
|
87
|
+
and_return("[args]")
|
88
|
+
@subtest.should_receive(:output_file).with().
|
89
|
+
and_return("[output]")
|
90
|
+
@subtest.should_receive(:error_file).with().
|
91
|
+
and_return("[error]")
|
92
|
+
|
93
|
+
@subtest.command_line.should ==
|
94
|
+
"[executable] '[input]' [args] > '[output]' 2> '[error]'"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "handling command-line arguments" do
|
99
|
+
it "should strip command-line arguments" do
|
100
|
+
command_line = mock("command_line")
|
101
|
+
|
102
|
+
@ciat_file.should_receive(:element?).with(:command_line).
|
103
|
+
and_return(true)
|
104
|
+
@ciat_file.should_receive(:element).with(:command_line).
|
105
|
+
and_return(command_line)
|
106
|
+
command_line.should_receive(:content).
|
107
|
+
and_return(" argument1 \t argument2 \n\n")
|
108
|
+
|
109
|
+
@subtest.command_line_args.should == "argument1 \t argument2"
|
110
|
+
end
|
111
|
+
|
112
|
+
it "should return empty string if none provided" do
|
113
|
+
@ciat_file.should_receive(:element?).
|
114
|
+
with(:command_line).and_return(false)
|
115
|
+
|
116
|
+
@subtest.command_line_args.should == ''
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "computing a diff" do
|
121
|
+
it "should compute a diff in HTML for normal output" do
|
122
|
+
kind, result = mock("processor kind"), mock("result")
|
123
|
+
output_name = mock("output name")
|
124
|
+
|
125
|
+
@subtest.should_receive(:happy_path?).with().and_return(true)
|
126
|
+
@processor.should_receive(:kind).any_number_of_times.and_return(kind)
|
127
|
+
kind.should_receive(:output_name).any_number_of_times.
|
128
|
+
and_return(output_name)
|
129
|
+
original_file = expect_element_as_file(output_name)
|
130
|
+
generated_file = expect_element_as_file(output_name, :generated)
|
131
|
+
diff_file = expect_element_as_file(output_name, :diff)
|
132
|
+
@subtest.should_receive(:html_diff).
|
133
|
+
with(original_file, generated_file, diff_file).and_return(result)
|
134
|
+
|
135
|
+
@subtest.diff.should == result
|
136
|
+
end
|
137
|
+
|
138
|
+
it "should compute a diff in HTML for error output" do
|
139
|
+
kind, result = mock("processor kind"), mock("result")
|
140
|
+
error_name = mock("error name")
|
141
|
+
|
142
|
+
@subtest.should_receive(:happy_path?).with().and_return(false)
|
143
|
+
@processor.should_receive(:kind).any_number_of_times.and_return(kind)
|
144
|
+
kind.should_receive(:error_name).any_number_of_times.
|
145
|
+
and_return(error_name)
|
146
|
+
original_file = expect_element_as_file(error_name)
|
147
|
+
generated_file = expect_element_as_file(error_name, :generated)
|
148
|
+
diff_file = expect_element_as_file(error_name, :diff)
|
149
|
+
@subtest.should_receive(:html_diff).
|
150
|
+
with(original_file, generated_file, diff_file).and_return(result)
|
151
|
+
|
152
|
+
@subtest.diff.should == result
|
153
|
+
end
|
154
|
+
|
155
|
+
def expect_element_as_file(*names)
|
156
|
+
element, filename = mock("#{names} element"), mock("#{names} filename")
|
157
|
+
@ciat_file.should_receive(:element).with(*names).and_return(element)
|
158
|
+
element.should_receive(:as_file).and_return(filename)
|
159
|
+
filename
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should get filename of input" do
|
164
|
+
kind, element, name = mock("kind"), mock("element"), mock("name")
|
165
|
+
filename = mock("filename")
|
166
|
+
|
167
|
+
@processor.should_receive(:kind).and_return(kind)
|
168
|
+
kind.should_receive(:input_name).and_return(name)
|
169
|
+
@ciat_file.should_receive(:element).with(name).and_return(element)
|
170
|
+
element.should_receive(:as_file).and_return(filename)
|
171
|
+
|
172
|
+
@subtest.input_file.should == filename
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should get filename of output" do
|
176
|
+
kind, element, name = mock("kind"), mock("element"), mock("name")
|
177
|
+
filename = mock("filename")
|
178
|
+
|
179
|
+
@processor.should_receive(:kind).and_return(kind)
|
180
|
+
kind.should_receive(:output_name).and_return(name)
|
181
|
+
@ciat_file.should_receive(:element).with(name, :generated).and_return(element)
|
182
|
+
element.should_receive(:as_file).and_return(filename)
|
183
|
+
|
184
|
+
@subtest.output_file.should == filename
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should get filename of error" do
|
188
|
+
kind, element, name = mock("kind"), mock("element"), mock("name")
|
189
|
+
filename = mock("filename")
|
190
|
+
|
191
|
+
@processor.should_receive(:kind).and_return(kind)
|
192
|
+
kind.should_receive(:error_name).and_return(name)
|
193
|
+
@ciat_file.should_receive(:element).
|
194
|
+
with(name, :generated).and_return(element)
|
195
|
+
element.should_receive(:as_file).and_return(filename)
|
196
|
+
|
197
|
+
@subtest.error_file.should == filename
|
198
|
+
end
|
199
|
+
end
|
@@ -17,23 +17,23 @@ describe CIAT::SuiteBuilder do
|
|
17
17
|
it "should make test files" do
|
18
18
|
files = array_of_mocks(3, "files")
|
19
19
|
output_folder = mock("output folder")
|
20
|
-
|
20
|
+
ciat_files = array_of_mocks(3, "ciat file")
|
21
21
|
|
22
22
|
@default_builder.should_receive(:build_output_folder).
|
23
23
|
at_least(:once).and_return(output_folder)
|
24
|
-
CIAT::
|
25
|
-
with(files[0], output_folder).and_return(
|
26
|
-
CIAT::
|
27
|
-
with(files[1], output_folder).and_return(
|
28
|
-
CIAT::
|
29
|
-
with(files[2], output_folder).and_return(
|
24
|
+
CIAT::CiatFile.should_receive(:new).
|
25
|
+
with(files[0], output_folder).and_return(ciat_files[0])
|
26
|
+
CIAT::CiatFile.should_receive(:new).
|
27
|
+
with(files[1], output_folder).and_return(ciat_files[1])
|
28
|
+
CIAT::CiatFile.should_receive(:new).
|
29
|
+
with(files[2], output_folder).and_return(ciat_files[2])
|
30
30
|
|
31
|
-
@default_builder.
|
31
|
+
@default_builder.make_ciat_files(files).should == ciat_files
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should complain if no test files to make" do
|
35
35
|
lambda {
|
36
|
-
@default_builder.
|
36
|
+
@default_builder.make_ciat_files([])
|
37
37
|
}.should raise_error(IOError)
|
38
38
|
end
|
39
39
|
end
|
@@ -41,30 +41,30 @@ describe CIAT::SuiteBuilder do
|
|
41
41
|
describe "getting and processing test files" do
|
42
42
|
it "should get filename from filenames option" do
|
43
43
|
files = mock("files")
|
44
|
-
|
44
|
+
ciat_files = mock("ciat files")
|
45
45
|
|
46
46
|
options[:files] = files
|
47
|
-
@default_builder.should_receive(:
|
48
|
-
with(files).and_return(
|
47
|
+
@default_builder.should_receive(:make_ciat_files).
|
48
|
+
with(files).and_return(ciat_files)
|
49
49
|
|
50
|
-
@default_builder.
|
50
|
+
@default_builder.build_ciat_files.should == ciat_files
|
51
51
|
end
|
52
52
|
|
53
53
|
it "should get filenames from folder" do
|
54
54
|
input_folder, pattern = mock("input folder"), mock("pattern")
|
55
55
|
files = mock("files")
|
56
56
|
output_folder = mock("output folder")
|
57
|
-
|
57
|
+
ciat_files = mock("ciat files")
|
58
58
|
|
59
59
|
options[:folder] = input_folder
|
60
60
|
options[:pattern] = pattern
|
61
61
|
File.should_receive(:join).with(input_folder, "**", pattern).
|
62
62
|
and_return("the full path")
|
63
63
|
Dir.should_receive(:[]).with("the full path").and_return(files)
|
64
|
-
@default_builder.should_receive(:
|
65
|
-
with(files).and_return(
|
64
|
+
@default_builder.should_receive(:make_ciat_files).
|
65
|
+
with(files).and_return(ciat_files)
|
66
66
|
|
67
|
-
@default_builder.
|
67
|
+
@default_builder.build_ciat_files.should == ciat_files
|
68
68
|
end
|
69
69
|
end
|
70
70
|
end
|
data/spec/ciat/suite_spec.rb
CHANGED
@@ -6,9 +6,9 @@ describe CIAT::Suite do
|
|
6
6
|
it "should construct with suite builder" do
|
7
7
|
options = mock("options")
|
8
8
|
suite_builder = mock("suite builder")
|
9
|
-
processors, output_folder,
|
9
|
+
processors, output_folder, ciat_files, feedback =
|
10
10
|
mock("processors"), mock("output folder"),
|
11
|
-
mock("
|
11
|
+
mock("ciat files"), mock("feedback")
|
12
12
|
suite = mock("suite")
|
13
13
|
|
14
14
|
CIAT::SuiteBuilder.should_receive(:new).
|
@@ -16,10 +16,10 @@ describe CIAT::Suite do
|
|
16
16
|
suite_builder.should_receive(:build_processors).and_return(processors)
|
17
17
|
suite_builder.should_receive(:build_output_folder).
|
18
18
|
and_return(output_folder)
|
19
|
-
suite_builder.should_receive(:
|
19
|
+
suite_builder.should_receive(:build_ciat_files).and_return(ciat_files)
|
20
20
|
suite_builder.should_receive(:build_feedback).and_return(feedback)
|
21
21
|
CIAT::Suite.should_receive(:new).
|
22
|
-
with(processors, output_folder,
|
22
|
+
with(processors, output_folder, ciat_files, feedback).and_return(suite)
|
23
23
|
|
24
24
|
CIAT::Suite.build(options).should == suite
|
25
25
|
end
|
@@ -28,15 +28,15 @@ describe CIAT::Suite do
|
|
28
28
|
before(:each) do
|
29
29
|
@processors = array_of_mocks(3, "processor")
|
30
30
|
@output_folder = mock("output folder")
|
31
|
-
@
|
31
|
+
@ciat_files = array_of_mocks(3, "ciat file")
|
32
32
|
@feedback = mock("feedback")
|
33
33
|
@suite = CIAT::Suite.new(
|
34
|
-
@processors, @output_folder, @
|
34
|
+
@processors, @output_folder, @ciat_files, @feedback
|
35
35
|
)
|
36
36
|
end
|
37
37
|
|
38
38
|
it "should have a size based on the number of test files" do
|
39
|
-
@suite.stub_chain(:
|
39
|
+
@suite.stub_chain(:ciat_files, :size).and_return(42)
|
40
40
|
|
41
41
|
@suite.size.should == 42
|
42
42
|
end
|
@@ -46,18 +46,18 @@ describe CIAT::Suite do
|
|
46
46
|
results = array_of_mocks(3, "result")
|
47
47
|
|
48
48
|
@feedback.should_receive(:pre_tests).with(@suite)
|
49
|
-
expect_create_and_run_test(@
|
50
|
-
expect_create_and_run_test(@
|
51
|
-
expect_create_and_run_test(@
|
49
|
+
expect_create_and_run_test(@ciat_files[0], results[0])
|
50
|
+
expect_create_and_run_test(@ciat_files[1], results[1])
|
51
|
+
expect_create_and_run_test(@ciat_files[2], results[2])
|
52
52
|
@feedback.should_receive(:post_tests).with(@suite)
|
53
53
|
|
54
54
|
@suite.run.should == results
|
55
55
|
@suite.results.should == results
|
56
56
|
end
|
57
57
|
|
58
|
-
def expect_create_and_run_test(
|
59
|
-
test = mock("test for #{
|
60
|
-
@suite.should_receive(:create_test).with(
|
58
|
+
def expect_create_and_run_test(ciat_file, result)
|
59
|
+
test = mock("test for #{ciat_file}")
|
60
|
+
@suite.should_receive(:create_test).with(ciat_file).and_return(test)
|
61
61
|
test.should_receive(:run).and_return(result)
|
62
62
|
end
|
63
63
|
end
|