qunited 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,64 +1,64 @@
1
1
  require File.expand_path('../../test_helper', __FILE__)
2
2
  require File.expand_path('../driver_common_tests', __FILE__)
3
- require 'stringio'
4
3
 
5
4
  # Test running tests with the Rhino driver.
6
5
  class TestRhinoDriver < MiniTest::Unit::TestCase
7
6
  include QUnited::DriverCommonTests
8
7
 
9
8
  def test_undefined_error_in_source
10
- runner = QUnited::Driver::Rhino.new(
9
+ driver = QUnited::Driver::Rhino.new(
11
10
  [File.join(FIXTURES_DIR, 'errors_project/app/assets/javascripts/undefined_error.js')],
12
11
  [File.join(FIXTURES_DIR, 'errors_project/test/javascripts/this_test_has_no_errors_in_it.js')])
13
12
 
14
- stderr = capture_stderr { runner.run }
15
- assert stderr.size > 10, 'Got some stderr output to describe the crash'
16
- results = runner.results
17
- assert results.passed?, 'Should succeed even if crash in source file as long as tests pass'
18
- assert_equal 1, results.total_tests, 'Correct number of tests run'
19
- assert_equal 1, results.total_assertions, 'Correct number of assertions executed'
20
- assert_equal 0, results.total_failures, 'Correct number of failures given'
13
+ driver.run
14
+ assert captured_stderr.size > 10, 'Got some stderr output to describe the crash'
15
+ @results = driver.results
16
+ assert @results.all? { |r| r.passed? }, 'Should succeed even if crash in source file as long as tests pass'
17
+ assert_equal 1, total_tests, 'Correct number of tests run'
18
+ assert_equal 1, total_assertions, 'Correct number of assertions executed'
19
+ assert_equal 0, total_failed_tests, 'Correct number of test failures given'
20
+ assert_equal 0, total_failed_assertions, 'Correct number of assertion failures given'
21
21
  end
22
22
 
23
23
  def test_syntax_error_in_source
24
- runner = QUnited::Driver::Rhino.new(
24
+ driver = QUnited::Driver::Rhino.new(
25
25
  [File.join(FIXTURES_DIR, 'errors_project/app/assets/javascripts/syntax_error.js')],
26
26
  [File.join(FIXTURES_DIR, 'errors_project/test/javascripts/this_test_has_no_errors_in_it.js')])
27
27
 
28
- stderr = capture_stderr { runner.run }
29
- assert stderr.size > 10, 'Got some stderr output to describe the crash'
30
- results = runner.results
31
- assert runner.results.passed?, 'Should succeed even if crash in source file as long as tests pass'
32
- assert_equal 1, results.total_tests, 'Correct number of tests run'
33
- assert_equal 1, results.total_assertions, 'Correct number of assertions executed'
34
- assert_equal 0, results.total_failures, 'Correct number of failures given'
28
+ driver.run
29
+ assert captured_stderr.size > 10, 'Got some stderr output to describe the crash'
30
+ @results = driver.results
31
+ assert @results.all? { |r| r.passed? }, 'Should succeed even if crash in source file as long as tests pass'
32
+ assert_equal 1, total_tests, 'Correct number of tests run'
33
+ assert_equal 1, total_assertions, 'Correct number of assertions executed'
34
+ assert_equal 0, total_failed_tests, 'Correct number of failures given'
35
+ assert_equal 0, total_failed_assertions, 'Correct number of assertion failures given'
35
36
  end
36
37
 
37
38
  def test_undefined_error_in_test
38
- runner = QUnited::Driver::Rhino.new(
39
+ driver = QUnited::Driver::Rhino.new(
39
40
  [File.join(FIXTURES_DIR, 'errors_project/app/assets/javascripts/no_error.js')],
40
41
  [File.join(FIXTURES_DIR, 'errors_project/test/javascripts/this_test_has_undefined_error.js')])
41
42
 
42
- stderr = capture_stderr { runner.run }
43
- assert stderr.strip.empty?, 'No stderr if test crashes - should have been caught'
44
- results = runner.results
45
- assert results.failed?, 'We got a failure with the undefined error'
46
- assert_equal 2, results.total_tests, 'Correct number of tests run'
47
- # "assertions" count will actually be 1, plus the unefined error being recorded
48
- assert_equal 2, results.total_assertions, 'Correct number of assertions executed'
49
- assert_equal 0, results.total_failures, 'Correct number of failures given'
43
+ driver.run
44
+ assert captured_stderr.strip.empty?, 'No stderr if test crashes - should have been caught'
45
+ @results = driver.results
46
+ assert_equal 2, total_tests, 'Correct number of tests run'
47
+ # "assertions" count will actually be 1, plus the undefined error being recorded
48
+ assert_equal 2, total_assertions, 'Correct number of assertions executed'
49
+ assert_equal 0, total_failed_tests, 'Correct number of failures given'
50
50
  # The crashed test errors, but the other should be allowed to succeed
51
- assert_equal 1, results.total_errors, 'Correct number of errors given'
51
+ assert_equal 1, total_error_tests, 'Correct number of errors given'
52
52
  end
53
53
 
54
54
  def test_no_tests_in_test_file_means_failure
55
- runner = QUnited::Driver::Rhino.new(
55
+ driver = QUnited::Driver::Rhino.new(
56
56
  [File.join(FIXTURES_DIR, 'errors_project/app/assets/javascripts/no_error.js')],
57
57
  [File.join(FIXTURES_DIR, 'errors_project/test/javascripts/this_test_has_no_tests.js')])
58
- runner.run
58
+ driver.run
59
59
 
60
- results = runner.results
61
- assert results.failed?, 'No tests in a file means failure'
60
+ @results = driver.results
61
+ assert @results.find { |r| r.failed? }, 'No tests in a file means failure'
62
62
  end
63
63
 
64
64
  private
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qunited
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-21 00:00:00.000000000 Z
12
+ date: 2013-03-06 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: QUnited runs headless QUnit tests as part of your normal build
15
15
  email:
@@ -32,14 +32,18 @@ files:
32
32
  - lib/qunited/driver/phantomjs/phantomjs.rb
33
33
  - lib/qunited/driver/phantomjs/support/runner.js
34
34
  - lib/qunited/driver/phantomjs/support/tests_page.html.erb
35
+ - lib/qunited/driver/results_collector.rb
35
36
  - lib/qunited/driver/rhino/rhino.rb
36
37
  - lib/qunited/driver/rhino/support/env.rhino.js
37
38
  - lib/qunited/driver/rhino/support/js.jar
38
39
  - lib/qunited/driver/rhino/support/runner.js
39
40
  - lib/qunited/driver/support/qunit.js
40
41
  - lib/qunited/driver/support/qunited.js
42
+ - lib/qunited/formatter.rb
43
+ - lib/qunited/formatter/base.rb
44
+ - lib/qunited/formatter/dots.rb
45
+ - lib/qunited/qunit_test_result.rb
41
46
  - lib/qunited/rake_task.rb
42
- - lib/qunited/results.rb
43
47
  - lib/qunited/runner.rb
44
48
  - lib/qunited/server.rb
45
49
  - lib/qunited/server/qunit.css
@@ -63,9 +67,10 @@ files:
63
67
  - test/fixtures/failures_project/test/javascripts/test_basics.js
64
68
  - test/fixtures/failures_project/test/javascripts/test_math.js
65
69
  - test/test_helper.rb
70
+ - test/unit/driver/test_results_collector.rb
66
71
  - test/unit/driver_common_tests.rb
72
+ - test/unit/formatter/test_dots.rb
67
73
  - test/unit/test_phantomjs_driver.rb
68
- - test/unit/test_results.rb
69
74
  - test/unit/test_rhino_driver.rb
70
75
  - test/unit/test_runner.rb
71
76
  homepage: https://github.com/aaronroyer/qunited
@@ -109,8 +114,9 @@ test_files:
109
114
  - test/fixtures/failures_project/test/javascripts/test_basics.js
110
115
  - test/fixtures/failures_project/test/javascripts/test_math.js
111
116
  - test/test_helper.rb
117
+ - test/unit/driver/test_results_collector.rb
112
118
  - test/unit/driver_common_tests.rb
119
+ - test/unit/formatter/test_dots.rb
113
120
  - test/unit/test_phantomjs_driver.rb
114
- - test/unit/test_results.rb
115
121
  - test/unit/test_rhino_driver.rb
116
122
  - test/unit/test_runner.rb
@@ -1,195 +0,0 @@
1
- require 'yaml'
2
-
3
- module QUnited
4
-
5
- # Simple tests results compiler. Takes a raw results hash that was produced by a runner.
6
- class Results
7
- class ModuleResults
8
- def initialize(data)
9
- @data = data
10
- end
11
-
12
- def tests
13
- @tests ||= @data[:tests].map { |test_data| TestResults.new test_data, @data[:name] }
14
- end
15
- end
16
-
17
- class TestResults
18
- def initialize(data, module_name)
19
- @data, @module_name = data, module_name
20
- end
21
-
22
- def assertions
23
- @data[:assertion_data].map do |assertion_data|
24
- AssertionResults.new assertion_data, @data[:name], @module_name, @data[:file]
25
- end
26
- end
27
-
28
- def passed?; result == :passed end
29
- def failed?; result == :failed end
30
- def error?; result == :error end
31
-
32
- def result
33
- @result ||= if assertions.find { |a| a.error? }
34
- :error
35
- else
36
- assertions.find { |a| a.failed? } ? :failed : :passed
37
- end
38
- end
39
-
40
- def duration; @data[:duration] end
41
-
42
- def to_s; passed? ? '.' : (error? ? 'E' : 'F') end
43
- end
44
-
45
- class AssertionResults
46
- def initialize(data, test_name, module_name, file)
47
- @data, @test_name, @module_name, @file = data, test_name, module_name, file
48
- end
49
-
50
- def message
51
- @data[:message]
52
- end
53
-
54
- def result
55
- if @data[:result]
56
- :passed
57
- else
58
- @data[:message] =~ /^Died on test/ ? :error : :failed
59
- end
60
- end
61
-
62
- def passed?; result == :passed end
63
- def failed?; result == :failed end
64
- def error?; result == :error end
65
-
66
- def output(count)
67
- return "" if passed?
68
- msg = " " + (count ? "#{count.to_s}) " : "")
69
- msg << "#{error? ? 'Error' : 'Failure'}:\n"
70
- msg << "#{@test_name} (#{@module_name}) [#{@file}]\n"
71
- msg << "#{@data[:message] || 'Failed assertion, no message given.'}\n"
72
-
73
- # Results can be nil. Also, JavaScript nulls will be converted, by the YAML serializer, to
74
- # Ruby nil. Convert that back to 'null' for the output.
75
- if @data.key? :expected
76
- expected, actual = @data[:expected], @data[:actual]
77
- msg << "Expected: #{expected.nil? ? 'null' : expected.inspect}\n"
78
- msg << " Actual: #{actual.nil? ? 'null' : actual.inspect}\n"
79
- end
80
- msg
81
- end
82
- end
83
-
84
- def self.from_javascript_produced_json(json)
85
- self.new clean_up_results(YAML.load(json))
86
- end
87
-
88
- def initialize(modules_results_array)
89
- @data = modules_results_array.freeze
90
- @module_results = @data.map { |module_data| ModuleResults.new module_data }
91
- end
92
-
93
- def to_s
94
- return <<-OUTPUT
95
- #{dots}
96
- #{"\n\n#{failures_output}\n\n" unless failures_output.empty?}
97
- #{times_line}
98
-
99
- #{bottom_line}
100
- OUTPUT
101
- end
102
-
103
- def to_i
104
- passed? ? 0 : 1
105
- end
106
-
107
- def passed?
108
- total_failures.zero? && total_errors.zero?
109
- end
110
-
111
- def failed?
112
- !passed?
113
- end
114
-
115
- def dots
116
- tests.map { |test| test.to_s }.join
117
- end
118
-
119
- def bottom_line
120
- "#{total_tests} tests, #{total_assertions} assertions, " +
121
- "#{total_failures} failures, #{total_errors} errors, 0 skips"
122
- end
123
-
124
- def times_line
125
- tests_per = (total_time > 0) ? (total_tests / total_time) : total_tests
126
- assertions_per = (total_time > 0) ? (total_assertions / total_time) : total_assertions
127
-
128
- "Finished in #{"%.6g" % total_time} seconds, #{"%.6g" % tests_per} tests/s, " +
129
- "#{"%.6g" % assertions_per} assertions/s."
130
- end
131
-
132
- def failures_output
133
- failures_output_array.join("\n")
134
- end
135
-
136
- # Array of failure output block strings
137
- def failures_output_array
138
- return @failures_output_array if @failures_output_array
139
- count = 0
140
- @failures_output_array = (failures + errors).map { |failure| failure.output(count += 1) }
141
- end
142
-
143
- def total_tests
144
- @total_tests ||= @module_results.inject(0) { |count, mod| count += mod.tests.size }
145
- end
146
-
147
- def total_assertions; assertions.size end
148
- def total_failures; failures.size end
149
- def total_errors; errors.size end
150
-
151
- def total_time
152
- @total_time ||= tests.inject(0) { |total, test| total += test.duration }
153
- end
154
-
155
- private
156
-
157
- def tests
158
- @tests ||= @module_results.inject([]) { |tests, mod| tests += mod.tests }
159
- end
160
-
161
- def assertions
162
- @assertions ||= tests.inject([]) { |asserts, test| asserts += test.assertions }
163
- end
164
-
165
- def failures
166
- @failures ||= assertions.select { |assert| assert.failed? }
167
- end
168
-
169
- def errors
170
- @errors ||= assertions.select { |assert| assert.error? }
171
- end
172
-
173
- # The YAML serializing JavaScript library does not put things into the cleanest form
174
- # for us to work with. This turns the String keys into Symbols and converts Strings
175
- # representing dates and numbers into their appropriate objects.
176
- def self.clean_up_results(results)
177
- results.map! { |mod_results| symbolize_keys mod_results }
178
- results.each do |mod_results|
179
- mod_results[:tests].map! { |test| clean_up_test_results(symbolize_keys(test)) }
180
- end
181
- end
182
-
183
- def self.clean_up_test_results(test_results)
184
- test_results[:start] = DateTime.parse(test_results[:start])
185
- test_results[:assertion_data].map! { |data| symbolize_keys data }
186
- test_results
187
- end
188
-
189
- def self.symbolize_keys(hash)
190
- new_hash = {}
191
- hash.keys.each { |key| new_hash[key.to_sym] = hash[key] }
192
- new_hash
193
- end
194
- end
195
- end
@@ -1,338 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- class TestResults < MiniTest::Unit::TestCase
4
-
5
- def test_gives_you_various_counts
6
- results = QUnited::Results.new test_module_results
7
- assert results.passed?, 'passed? is true when all tests have passed'
8
- assert !results.failed?, 'failed? is false when all tests have passed'
9
- assert_equal 3, results.total_tests, 'total_tests gives total tests count'
10
- assert_equal 4, results.total_assertions, 'total_assertions gives total assertions count'
11
- assert_equal 0, results.total_failures, 'total_failures gives total failures count when there are none'
12
- assert_equal 0, results.total_errors, 'total_errors gives total errors when there are none'
13
-
14
- other_results = QUnited::Results.new test_failed_module_results
15
-
16
- assert !other_results.passed?, 'passed? is false when there are failures'
17
- assert other_results.failed?, 'failed? is true when there are failures'
18
- assert_equal 4, other_results.total_tests, 'total_tests gives total tests count'
19
- assert_equal 5 + 1, other_results.total_assertions, 'total_assertions gives total assertions count'
20
- assert_equal 4, other_results.total_failures, 'total_failures gives total failures count when there are some'
21
- assert_equal 0, results.total_errors, 'total_errors gives total errors when there are none'
22
- end
23
-
24
- def test_basic_output
25
- results = QUnited::Results.new test_module_results
26
- assert_equal "3 tests, 4 assertions, 0 failures, 0 errors, 0 skips", results.bottom_line
27
- assert_equal "...", results.dots
28
- end
29
-
30
- def test_failures_output
31
- results = QUnited::Results.new test_failed_module_results
32
-
33
- assert_equal "4 tests, 6 assertions, 4 failures, 0 errors, 0 skips", results.bottom_line
34
- assert_equal "F.FF", results.dots
35
-
36
- failure = results.failures_output_array[0].split("\n")
37
- assert_equal 3, failure.size
38
- assert_equal ' 1) Failure:', failure[0]
39
- assert_equal 'This has one failure (Basics) [test/javascripts/test_basics.js]', failure[1]
40
- assert_equal 'Failed assertion, no message given.', failure[2]
41
-
42
- failure = results.failures_output_array[1].split("\n")
43
- assert_equal 5, failure.size
44
- assert_equal ' 2) Failure:', failure[0]
45
- assert_equal 'Addition is hard (Math) [test/javascripts/test_math.js]', failure[1]
46
- assert_equal 'I got my math right', failure[2]
47
- assert_equal 'Expected: 3', failure[3]
48
- assert_equal ' Actual: 2', failure[4]
49
-
50
- failure = results.failures_output_array[2].split("\n")
51
- assert_equal 5, failure.size
52
- assert_equal ' 3) Failure:', failure[0]
53
- assert_equal 'Addition is hard (Math) [test/javascripts/test_math.js]', failure[1]
54
- assert_equal 'These strings match', failure[2]
55
- assert_equal 'Expected: "String here"', failure[3]
56
- assert_equal ' Actual: "Identical string here"', failure[4]
57
-
58
- failure = results.failures_output_array[3].split("\n")
59
- assert_equal 3, failure.size
60
- assert_equal ' 4) Failure:', failure[0]
61
- assert_equal 'Check some subtraction (Math) [test/javascripts/test_math.js]', failure[1]
62
- assert_equal 'Expected 2 assertions, but 1 were run', failure[2]
63
- end
64
-
65
- # Test results are converted to JavaScript appropriate null, not nil
66
- def test_null_failures_output
67
- results = QUnited::Results.new test_failed_module_results_with_null
68
-
69
- failure = results.failures_output_array[0].split("\n")
70
- assert_equal 5, failure.size
71
- assert_equal ' 1) Failure:', failure[0]
72
- assert_equal 'The test (The module) [test/javascripts/test_module.js]', failure[1]
73
- assert_equal 'Was it null?', failure[2]
74
- assert_equal 'Expected: 5', failure[3]
75
- assert_equal ' Actual: null', failure[4]
76
- end
77
-
78
- def test_errors_and_error_output
79
- results = QUnited::Results.new test_failed_module_results_with_an_error
80
-
81
- assert results.failed?, 'failed? is true when there are errors'
82
- assert_equal 2, results.total_tests, 'total_tests gives total tests count'
83
- assert_equal 3, results.total_assertions, 'total_assertions gives total assertions count'
84
- assert_equal 0, results.total_failures, 'total_failures gives total failures count when there are none'
85
- assert_equal 1, results.total_errors, 'total_errors gives total errors when there are none'
86
-
87
- error = results.failures_output_array[0].split("\n")
88
- assert_equal 3, error.size
89
- assert_equal ' 1) Error:', error[0]
90
- assert_equal 'Error test (The module) [test/javascripts/test_module.js]', error[1]
91
- assert_equal 'Died on test #3: asdf is undefined', error[2]
92
-
93
- assert_equal "2 tests, 3 assertions, 0 failures, 1 errors, 0 skips", results.bottom_line
94
- assert_equal "E.", results.dots
95
- end
96
-
97
- private
98
-
99
- def test_module_results
100
- [
101
- {
102
- :name => "(no module)",
103
- :tests => [
104
- { :name => "The source code was loaded",
105
- :failures => [],
106
- :start => DateTime.parse('2012-06-12T23:52:33+00:00'),
107
- :assertions => 1,
108
- :duration => 0.002,
109
- :failed => 0,
110
- :total => 1,
111
- :file => 'test/javascripts/test_basics.js',
112
- :assertion_data => [
113
- { :result => true,
114
- :message => "We have loaded it",
115
- :actual => 1,
116
- :expected => 1
117
- }
118
- ]
119
- }
120
- ]
121
- },
122
- { :name => "Math",
123
- :tests =>[
124
- {
125
- :name => "Addition works",
126
- :failures => [],
127
- :start => DateTime.parse('2012-06-12T23:52:33+00:00'),
128
- :assertions => 2,
129
- :duration => 0.01,
130
- :failed => 0,
131
- :total => 2,
132
- :file => 'test/javascripts/test_math.js',
133
- :assertion_data => [
134
- {
135
- :result => true,
136
- :message => "One plus one does equal two",
137
- :actual => 2,
138
- :expected => 2
139
- },
140
- {
141
- :result => true,
142
- :message => "Two plus two does equal four",
143
- :actual => 4,
144
- :expected => 4
145
- }
146
- ]
147
- },
148
- { :name => "Subtraction works",
149
- :failures => [],
150
- :start => DateTime.parse('2012-06-12T23:52:33+00:00'),
151
- :assertions => 1,
152
- :duration => 0.009,
153
- :failed => 0,
154
- :total => 1,
155
- :file => 'test/javascripts/test_math.js',
156
- :assertion_data => [
157
- {
158
- :result=>true,
159
- :message=>"Two minus one equals one",
160
- :actual=>1,
161
- :expected=>1
162
- }
163
- ]
164
- }
165
- ]
166
- }
167
- ]
168
- end
169
-
170
- def test_failed_module_results
171
- [
172
- {
173
- :name => "Basics",
174
- :tests => [
175
- {
176
- :name => "This has one failure",
177
- :assertion_data => [
178
- {
179
- :result => false,
180
- :message => nil
181
- }
182
- ],
183
- :start => DateTime.parse('2012-06-14T13:24:11+00:00'),
184
- :assertions => 1,
185
- :file => "test/javascripts/test_basics.js",
186
- :duration => 0.002,
187
- :failed => 1,
188
- :total => 1
189
- },
190
- {
191
- :name => "This has no failures",
192
- :assertion_data => [
193
- {
194
- :result => true,
195
- :message => "It is 1",
196
- :actual => 1,
197
- :expected => 1
198
- }
199
- ],
200
- :start => DateTime.parse('2012-06-14T13:24:11+00:00'),
201
- :assertions => 1,
202
- :file => "test/javascripts/test_basics.js",
203
- :duration => 0.006,
204
- :failed => 0,
205
- :total => 1
206
- }
207
- ]
208
- },
209
- {
210
- :name => "Math",
211
- :tests => [
212
- {
213
- :name => "Addition is hard",
214
- :assertion_data => [
215
- {
216
- :result => false,
217
- :message => "I got my math right",
218
- :actual => 2,
219
- :expected => 3
220
- },
221
- {
222
- :result => false,
223
- :message => "These strings match",
224
- :actual => "Identical string here",
225
- :expected => "String here"
226
- }
227
- ],
228
- :start => DateTime.parse('2012-06-14T13:24:11+00:00'),
229
- :assertions => 2,
230
- :file => "test/javascripts/test_math.js",
231
- :duration => 0.02,
232
- :failed => 2,
233
- :total => 2
234
- },
235
- {
236
- :name => "Check some subtraction",
237
- :assertion_data => [
238
- {
239
- :result => true,
240
- :message => "Two minus one equals one",
241
- :actual => 1,
242
- :expected => 1
243
- },
244
- {
245
- :result => false,
246
- :message => "Expected 2 assertions, but 1 were run"
247
- }
248
- ],
249
- :start => DateTime.parse('2012-06-14T13:24:11+00:00'),
250
- :assertions => 2,
251
- :file => "test/javascripts/test_math.js",
252
- :duration => 0.008,
253
- :failed => 1,
254
- :total => 2
255
- }
256
- ]
257
- }
258
- ]
259
- end
260
-
261
- def test_failed_module_results_with_null
262
- [
263
- {
264
- :name => "The module",
265
- :tests => [
266
- {
267
- :name => "The test",
268
- :assertion_data => [
269
- {
270
- :result => false,
271
- :message => "Was it null?",
272
- :actual => nil,
273
- :expected => 5
274
- }
275
- ],
276
- :start => DateTime.parse('2012-06-14T13:24:11+00:00'),
277
- :assertions => 1,
278
- :file => "test/javascripts/test_module.js",
279
- :duration => 0.002,
280
- :failed => 1,
281
- :total => 1
282
- }
283
- ]
284
- }
285
- ]
286
- end
287
-
288
- def test_failed_module_results_with_an_error
289
- [
290
- {
291
- :name => "The module",
292
- :tests => [
293
- {
294
- :name => "Error test",
295
- :assertion_data => [
296
- {
297
- :result => true,
298
- :message => "This one fine",
299
- :actual => "String",
300
- :expected => "String"
301
- },
302
- {
303
- :result => false,
304
- :message => "Died on test #3: asdf is undefined"
305
- }
306
-
307
- ],
308
- :start => DateTime.parse('2012-06-14T13:24:11+00:00'),
309
- :assertions => 2,
310
- :file => "test/javascripts/test_module.js",
311
- :duration => 0.002,
312
- :failed => 1,
313
- :total => 2
314
- },
315
- {
316
- :name => "OK test",
317
- :assertion_data => [
318
- {
319
- :result => true,
320
- :message => "All good",
321
- :actual => 5,
322
- :expected => 5
323
- }
324
-
325
- ],
326
- :start => DateTime.parse('2012-06-14T13:24:11+00:00'),
327
- :assertions => 1,
328
- :file => "test/javascripts/test_module.js",
329
- :duration => 0.002,
330
- :failed => 0,
331
- :total => 1
332
- }
333
- ]
334
- }
335
- ]
336
- end
337
-
338
- end