rspec-core 2.0.0.beta.22 → 2.6.0
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/.gitignore +1 -0
- data/.rspec +0 -1
- data/.travis.yml +7 -0
- data/Gemfile +46 -20
- data/Guardfile +5 -0
- data/License.txt +2 -1
- data/{README.markdown → README.md} +23 -5
- data/Rakefile +58 -31
- data/bin/autospec +13 -0
- data/bin/rspec +24 -2
- data/cucumber.yml +1 -1
- data/features/.nav +57 -0
- data/features/Autotest.md +38 -0
- data/features/Changelog.md +269 -0
- data/features/README.md +17 -0
- data/features/Upgrade.md +320 -0
- data/features/command_line/README.md +28 -0
- data/features/command_line/configure.feature +18 -15
- data/features/command_line/example_name_option.feature +37 -23
- data/features/command_line/exit_status.feature +16 -31
- data/features/command_line/format_option.feature +73 -0
- data/features/command_line/line_number_appended_to_path.feature +25 -27
- data/features/command_line/line_number_option.feature +11 -10
- data/features/command_line/rake_task.feature +68 -0
- data/features/command_line/tag.feature +90 -0
- data/features/configuration/alias_example_to.feature +48 -0
- data/features/configuration/custom_settings.feature +8 -10
- data/features/configuration/fail_fast.feature +77 -0
- data/features/configuration/read_options_from_file.feature +42 -26
- data/features/example_groups/basic_structure.feature +55 -0
- data/features/example_groups/shared_context.feature +74 -0
- data/features/example_groups/shared_example_group.feature +56 -41
- data/features/expectation_framework_integration/configure_expectation_framework.feature +73 -0
- data/features/filtering/exclusion_filters.feature +69 -9
- data/features/filtering/if_and_unless.feature +168 -0
- data/features/filtering/inclusion_filters.feature +58 -26
- data/features/filtering/run_all_when_everything_filtered.feature +46 -0
- data/features/formatters/custom_formatter.feature +17 -13
- data/features/formatters/text_formatter.feature +43 -0
- data/features/helper_methods/arbitrary_methods.feature +40 -0
- data/features/helper_methods/let.feature +50 -0
- data/features/helper_methods/modules.feature +149 -0
- data/features/hooks/around_hooks.feature +99 -69
- data/features/hooks/before_and_after_hooks.feature +74 -40
- data/features/hooks/filtering.feature +227 -0
- data/features/metadata/current_example.feature +17 -0
- data/features/metadata/described_class.feature +17 -0
- data/features/metadata/user_defined.feature +111 -0
- data/features/mock_framework_integration/use_any_framework.feature +106 -0
- data/features/mock_framework_integration/use_flexmock.feature +84 -11
- data/features/mock_framework_integration/use_mocha.feature +85 -11
- data/features/mock_framework_integration/use_rr.feature +86 -11
- data/features/mock_framework_integration/use_rspec.feature +85 -11
- data/features/pending/pending_examples.feature +143 -5
- data/features/spec_files/arbitrary_file_suffix.feature +2 -2
- data/features/step_definitions/additional_cli_steps.rb +30 -0
- data/features/subject/attribute_of_subject.feature +93 -15
- data/features/subject/explicit_subject.feature +28 -17
- data/features/subject/implicit_receiver.feature +29 -0
- data/features/subject/implicit_subject.feature +9 -10
- data/features/support/env.rb +6 -1
- data/lib/autotest/discover.rb +1 -0
- data/lib/autotest/rspec2.rb +15 -11
- data/lib/rspec/autorun.rb +2 -0
- data/lib/rspec/core/backward_compatibility.rb +33 -4
- data/lib/rspec/core/command_line.rb +4 -28
- data/lib/rspec/core/command_line_configuration.rb +16 -16
- data/lib/rspec/core/configuration.rb +279 -89
- data/lib/rspec/core/configuration_options.rb +46 -35
- data/lib/rspec/core/deprecation.rb +1 -1
- data/lib/rspec/core/drb_command_line.rb +5 -11
- data/lib/rspec/core/example.rb +63 -39
- data/lib/rspec/core/example_group.rb +109 -59
- data/lib/rspec/core/expecting/with_rspec.rb +11 -0
- data/lib/rspec/core/expecting/with_stdlib.rb +9 -0
- data/lib/rspec/core/extensions/kernel.rb +1 -1
- data/lib/rspec/core/extensions/object.rb +1 -3
- data/lib/rspec/core/formatters/base_formatter.rb +22 -11
- data/lib/rspec/core/formatters/base_text_formatter.rb +46 -30
- data/lib/rspec/core/formatters/documentation_formatter.rb +4 -2
- data/lib/rspec/core/formatters/helpers.rb +0 -4
- data/lib/rspec/core/formatters/html_formatter.rb +146 -41
- data/lib/rspec/core/formatters/progress_formatter.rb +1 -0
- data/lib/rspec/core/formatters/snippet_extractor.rb +1 -1
- data/lib/rspec/core/formatters/text_mate_formatter.rb +3 -1
- data/lib/rspec/core/hooks.rb +55 -17
- data/lib/rspec/core/metadata.rb +75 -64
- data/lib/rspec/core/metadata_hash_builder.rb +93 -0
- data/lib/rspec/core/mocking/with_flexmock.rb +2 -0
- data/lib/rspec/core/mocking/with_mocha.rb +2 -0
- data/lib/rspec/core/mocking/with_rr.rb +2 -0
- data/lib/rspec/core/mocking/with_rspec.rb +3 -1
- data/lib/rspec/core/option_parser.rb +48 -5
- data/lib/rspec/core/pending.rb +22 -4
- data/lib/rspec/core/rake_task.rb +64 -28
- data/lib/rspec/core/reporter.rb +3 -2
- data/lib/rspec/core/ruby_project.rb +2 -2
- data/lib/rspec/core/runner.rb +50 -6
- data/lib/rspec/core/shared_context.rb +16 -0
- data/lib/rspec/core/shared_example_group.rb +19 -4
- data/lib/rspec/core/subject.rb +92 -65
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +83 -25
- data/lib/rspec/core.rb +40 -24
- data/lib/rspec/monkey/spork/test_framework/rspec.rb +1 -0
- data/rspec-core.gemspec +4 -25
- data/script/FullBuildRakeFile +63 -0
- data/script/cucumber +1 -0
- data/script/full_build +1 -0
- data/script/spec +1 -0
- data/spec/autotest/discover_spec.rb +19 -0
- data/spec/autotest/failed_results_re_spec.rb +25 -9
- data/spec/autotest/rspec_spec.rb +32 -41
- data/spec/rspec/core/command_line_spec.rb +62 -7
- data/spec/rspec/core/configuration_options_spec.rb +184 -148
- data/spec/rspec/core/configuration_spec.rb +406 -108
- data/spec/rspec/core/deprecations_spec.rb +38 -1
- data/spec/rspec/core/drb_command_line_spec.rb +21 -56
- data/spec/rspec/core/example_group_spec.rb +366 -127
- data/spec/rspec/core/example_spec.rb +125 -45
- data/spec/rspec/core/formatters/base_formatter_spec.rb +61 -1
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +39 -5
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +7 -6
- data/spec/rspec/core/formatters/helpers_spec.rb +1 -1
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +199 -81
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +199 -83
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +199 -81
- data/spec/rspec/core/formatters/html_formatted-1.9.1.html +206 -81
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +206 -61
- data/spec/rspec/core/formatters/html_formatter_spec.rb +17 -9
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +1 -1
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +199 -81
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +199 -81
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +199 -81
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +206 -81
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +206 -81
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +22 -7
- data/spec/rspec/core/hooks_filtering_spec.rb +128 -5
- data/spec/rspec/core/hooks_spec.rb +90 -4
- data/spec/rspec/core/metadata_spec.rb +176 -163
- data/spec/rspec/core/option_parser_spec.rb +73 -6
- data/spec/rspec/core/pending_example_spec.rb +137 -35
- data/spec/rspec/core/rake_task_spec.rb +62 -29
- data/spec/rspec/core/reporter_spec.rb +20 -4
- data/spec/rspec/core/resources/formatter_specs.rb +25 -1
- data/spec/rspec/core/rspec_matchers_spec.rb +45 -0
- data/spec/rspec/core/runner_spec.rb +60 -10
- data/spec/rspec/core/shared_context_spec.rb +30 -0
- data/spec/rspec/core/shared_example_group_spec.rb +59 -23
- data/spec/rspec/core/subject_spec.rb +136 -0
- data/spec/rspec/core/world_spec.rb +211 -68
- data/spec/rspec/core_spec.rb +28 -0
- data/spec/spec_helper.rb +41 -23
- data/spec/support/matchers.rb +44 -13
- data/spec/support/shared_example_groups.rb +41 -0
- data/spec/support/spec_files.rb +44 -0
- data/spec.txt +1126 -0
- metadata +99 -168
- data/.treasure_map.rb +0 -23
- data/History.md +0 -30
- data/Upgrade.markdown +0 -150
- data/autotest/discover.rb +0 -2
- data/features/README.markdown +0 -12
- data/features/example_groups/describe_aliases.feature +0 -25
- data/features/example_groups/nested_groups.feature +0 -44
- data/features/hooks/described_class.feature +0 -14
- data/features/hooks/halt.feature +0 -26
- data/lib/rspec/core/around_proxy.rb +0 -14
- data/lib/rspec/core/formatters.rb +0 -8
- data/spec/ruby_forker.rb +0 -13
- data/specs.watchr +0 -59
|
@@ -18,24 +18,78 @@
|
|
|
18
18
|
</style>
|
|
19
19
|
<script type="text/javascript">
|
|
20
20
|
// <![CDATA[
|
|
21
|
+
|
|
22
|
+
function addClass(element_id, classname) {
|
|
23
|
+
document.getElementById(element_id).className += (" " + classname);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function removeClass(element_id, classname) {
|
|
27
|
+
var elem = document.getElementById(element_id);
|
|
28
|
+
var classlist = elem.className.replace(classname,'');
|
|
29
|
+
elem.className = classlist;
|
|
30
|
+
}
|
|
31
|
+
|
|
21
32
|
function moveProgressBar(percentDone) {
|
|
22
33
|
document.getElementById("rspec-header").style.width = percentDone +"%";
|
|
23
34
|
}
|
|
35
|
+
|
|
24
36
|
function makeRed(element_id) {
|
|
25
|
-
|
|
26
|
-
|
|
37
|
+
removeClass(element_id, 'passed');
|
|
38
|
+
removeClass(element_id, 'not_implemented');
|
|
39
|
+
addClass(element_id,'failed');
|
|
27
40
|
}
|
|
28
41
|
|
|
29
42
|
function makeYellow(element_id) {
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
43
|
+
var elem = document.getElementById(element_id);
|
|
44
|
+
if (elem.className.indexOf("failed") == -1) { // class doesn't includes failed
|
|
45
|
+
if (elem.className.indexOf("not_implemented") == -1) { // class doesn't include not_implemented
|
|
46
|
+
removeClass(element_id, 'passed');
|
|
47
|
+
addClass(element_id,'not_implemented');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function apply_filters() {
|
|
53
|
+
var passed_filter = document.getElementById('passed_checkbox').checked;
|
|
54
|
+
var failed_filter = document.getElementById('failed_checkbox').checked;
|
|
55
|
+
var pending_filter = document.getElementById('pending_checkbox').checked;
|
|
56
|
+
|
|
57
|
+
assign_display_style("example passed", passed_filter);
|
|
58
|
+
assign_display_style("example failed", failed_filter);
|
|
59
|
+
assign_display_style("example not_implemented", pending_filter);
|
|
60
|
+
|
|
61
|
+
assign_display_style_for_group("example_group passed", passed_filter);
|
|
62
|
+
assign_display_style_for_group("example_group not_implemented", pending_filter, pending_filter || passed_filter);
|
|
63
|
+
assign_display_style_for_group("example_group failed", failed_filter, failed_filter || pending_filter || passed_filter);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function get_display_style(display_flag) {
|
|
67
|
+
var style_mode = 'none';
|
|
68
|
+
if (display_flag == true) {
|
|
69
|
+
style_mode = 'block';
|
|
34
70
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
71
|
+
return style_mode;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function assign_display_style(classname, display_flag) {
|
|
75
|
+
var style_mode = get_display_style(display_flag);
|
|
76
|
+
var elems = document.getElementsByClassName(classname)
|
|
77
|
+
for (var i=0; i<elems.length;i++) {
|
|
78
|
+
elems[i].style.display = style_mode;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function assign_display_style_for_group(classname, display_flag, subgroup_flag) {
|
|
83
|
+
var display_style_mode = get_display_style(display_flag);
|
|
84
|
+
var subgroup_style_mode = get_display_style(subgroup_flag);
|
|
85
|
+
var elems = document.getElementsByClassName(classname)
|
|
86
|
+
for (var i=0; i<elems.length;i++) {
|
|
87
|
+
var style_mode = display_style_mode;
|
|
88
|
+
if ((display_flag != subgroup_flag) && (elems[i].getElementsByTagName('dt')[0].innerHTML.indexOf(", ") != -1)) {
|
|
89
|
+
elems[i].style.display = subgroup_style_mode;
|
|
90
|
+
} else {
|
|
91
|
+
elems[i].style.display = display_style_mode;
|
|
92
|
+
}
|
|
39
93
|
}
|
|
40
94
|
}
|
|
41
95
|
|
|
@@ -54,13 +108,21 @@ function makeYellow(element_id) {
|
|
|
54
108
|
position: absolute;
|
|
55
109
|
}
|
|
56
110
|
|
|
111
|
+
#label {
|
|
112
|
+
float:left;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
#display-filters {
|
|
116
|
+
float:left;
|
|
117
|
+
padding: 28px 0 0 40%;
|
|
118
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
|
119
|
+
}
|
|
120
|
+
|
|
57
121
|
#summary {
|
|
58
|
-
|
|
122
|
+
float:right;
|
|
123
|
+
padding: 5px 10px;
|
|
59
124
|
font-family: "Lucida Grande", Helvetica, sans-serif;
|
|
60
125
|
text-align: right;
|
|
61
|
-
top: 0px;
|
|
62
|
-
right: 0px;
|
|
63
|
-
float:right;
|
|
64
126
|
}
|
|
65
127
|
|
|
66
128
|
#summary p {
|
|
@@ -93,30 +155,58 @@ dd {
|
|
|
93
155
|
padding: 3px 3px 3px 18px;
|
|
94
156
|
}
|
|
95
157
|
|
|
96
|
-
|
|
158
|
+
|
|
159
|
+
dd.example.passed {
|
|
97
160
|
border-left: 5px solid #65C400;
|
|
98
161
|
border-bottom: 1px solid #65C400;
|
|
99
162
|
background: #DBFFB4; color: #3D7700;
|
|
100
163
|
}
|
|
101
164
|
|
|
102
|
-
dd.
|
|
103
|
-
border-left: 5px solid #C20000;
|
|
104
|
-
border-bottom: 1px solid #C20000;
|
|
105
|
-
color: #C20000; background: #FFFBD3;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
dd.spec.not_implemented {
|
|
165
|
+
dd.example.not_implemented {
|
|
109
166
|
border-left: 5px solid #FAF834;
|
|
110
167
|
border-bottom: 1px solid #FAF834;
|
|
111
168
|
background: #FCFB98; color: #131313;
|
|
112
169
|
}
|
|
113
170
|
|
|
114
|
-
dd.
|
|
171
|
+
dd.example.pending_fixed {
|
|
115
172
|
border-left: 5px solid #0000C2;
|
|
116
173
|
border-bottom: 1px solid #0000C2;
|
|
117
174
|
color: #0000C2; background: #D3FBFF;
|
|
118
175
|
}
|
|
119
176
|
|
|
177
|
+
dd.example.failed {
|
|
178
|
+
border-left: 5px solid #C20000;
|
|
179
|
+
border-bottom: 1px solid #C20000;
|
|
180
|
+
color: #C20000; background: #FFFBD3;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
dt.not_implemented {
|
|
185
|
+
color: #000000; background: #FAF834;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
dt.pending_fixed {
|
|
189
|
+
color: #FFFFFF; background: #C40D0D;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
dt.failed {
|
|
193
|
+
color: #FFFFFF; background: #C40D0D;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
#rspec-header.not_implemented {
|
|
198
|
+
color: #000000; background: #FAF834;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
#rspec-header.pending_fixed {
|
|
202
|
+
color: #FFFFFF; background: #C40D0D;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
#rspec-header.failed {
|
|
206
|
+
color: #FFFFFF; background: #C40D0D;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
|
|
120
210
|
.backtrace {
|
|
121
211
|
color: #000;
|
|
122
212
|
font-size: 12px;
|
|
@@ -172,78 +262,101 @@ a {
|
|
|
172
262
|
<h1>RSpec Code Examples</h1>
|
|
173
263
|
</div>
|
|
174
264
|
|
|
265
|
+
<div id="display-filters">
|
|
266
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
|
|
267
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
|
|
268
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
|
|
269
|
+
</div>
|
|
270
|
+
|
|
175
271
|
<div id="summary">
|
|
176
272
|
<p id="totals"> </p>
|
|
177
273
|
<p id="duration"> </p>
|
|
178
274
|
</div>
|
|
179
275
|
</div>
|
|
180
276
|
|
|
277
|
+
|
|
181
278
|
<div class="results">
|
|
182
|
-
<div class="example_group">
|
|
183
|
-
<dl>
|
|
184
|
-
<dt id="example_group_1">pending spec with no implementation</dt>
|
|
279
|
+
<div id="div_group_1" class="example_group passed">
|
|
280
|
+
<dl style="margin-left: 0px;">
|
|
281
|
+
<dt id="example_group_1" class="passed">pending spec with no implementation</dt>
|
|
185
282
|
<script type="text/javascript">makeYellow('rspec-header');</script>
|
|
283
|
+
<script type="text/javascript">makeYellow('div_group_1');</script>
|
|
186
284
|
<script type="text/javascript">makeYellow('example_group_1');</script>
|
|
187
|
-
<script type="text/javascript">moveProgressBar('
|
|
188
|
-
<dd class="
|
|
285
|
+
<script type="text/javascript">moveProgressBar('14.2');</script>
|
|
286
|
+
<dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not Yet Implemented)</span></dd>
|
|
189
287
|
</dl>
|
|
190
288
|
</div>
|
|
191
|
-
<div class="example_group">
|
|
192
|
-
<dl>
|
|
193
|
-
<dt id="example_group_2">pending command with block format</dt>
|
|
289
|
+
<div id="div_group_2" class="example_group passed">
|
|
290
|
+
<dl style="margin-left: 0px;">
|
|
291
|
+
<dt id="example_group_2" class="passed">pending command with block format</dt>
|
|
194
292
|
</dl>
|
|
195
293
|
</div>
|
|
196
|
-
<div class="example_group">
|
|
197
|
-
<dl>
|
|
198
|
-
<dt id="example_group_3">with content that would fail</dt>
|
|
294
|
+
<div id="div_group_3" class="example_group passed">
|
|
295
|
+
<dl style="margin-left: 15px;">
|
|
296
|
+
<dt id="example_group_3" class="passed">with content that would fail</dt>
|
|
199
297
|
<script type="text/javascript">makeYellow('rspec-header');</script>
|
|
298
|
+
<script type="text/javascript">makeYellow('div_group_3');</script>
|
|
200
299
|
<script type="text/javascript">makeYellow('example_group_3');</script>
|
|
201
|
-
<script type="text/javascript">moveProgressBar('
|
|
202
|
-
<dd class="
|
|
300
|
+
<script type="text/javascript">moveProgressBar('28.5');</script>
|
|
301
|
+
<dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
|
|
203
302
|
</dl>
|
|
204
303
|
</div>
|
|
205
|
-
<div class="example_group">
|
|
206
|
-
<dl>
|
|
207
|
-
<dt id="example_group_4">with content that would pass</dt>
|
|
304
|
+
<div id="div_group_4" class="example_group passed">
|
|
305
|
+
<dl style="margin-left: 15px;">
|
|
306
|
+
<dt id="example_group_4" class="passed">with content that would pass</dt>
|
|
208
307
|
<script type="text/javascript">makeRed('rspec-header');</script>
|
|
308
|
+
<script type="text/javascript">makeRed('div_group_4');</script>
|
|
209
309
|
<script type="text/javascript">makeRed('example_group_4');</script>
|
|
210
|
-
<script type="text/javascript">moveProgressBar('
|
|
211
|
-
<dd class="
|
|
310
|
+
<script type="text/javascript">moveProgressBar('42.8');</script>
|
|
311
|
+
<dd class="example pending_fixed">
|
|
212
312
|
<span class="failed_spec_name">fails</span>
|
|
213
|
-
<div class="failure" id="
|
|
313
|
+
<div class="failure" id="failure_1">
|
|
214
314
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
|
215
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
315
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `block (3 levels) in <top (required)>'
|
|
316
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
|
|
317
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
|
|
318
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
|
|
319
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
|
|
320
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
|
|
321
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
|
|
322
|
+
<pre class="ruby"><code><span class="linenum">29</span> <span class="ident">teardown_mocks_for_rspec</span>
|
|
323
|
+
<span class="linenum">30</span> <span class="keyword">end</span>
|
|
324
|
+
<span class="offending"><span class="linenum">31</span> <span class="keyword">raise</span> <span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Core</span><span class="punct">::</span><span class="constant">PendingExampleFixedError</span><span class="punct">.</span><span class="ident">new</span> <span class="keyword">if</span> <span class="ident">result</span></span>
|
|
325
|
+
<span class="linenum">32</span> <span class="keyword">end</span>
|
|
326
|
+
<span class="linenum">33</span> <span class="keyword">raise</span> <span class="constant">PendingDeclaredInExample</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">)</span></code></pre>
|
|
221
327
|
</div>
|
|
222
328
|
</dd>
|
|
223
329
|
</dl>
|
|
224
330
|
</div>
|
|
225
|
-
<div class="example_group">
|
|
226
|
-
<dl>
|
|
227
|
-
<dt id="example_group_5">passing spec</dt>
|
|
228
|
-
<script type="text/javascript">moveProgressBar('
|
|
229
|
-
<dd class="
|
|
331
|
+
<div id="div_group_5" class="example_group passed">
|
|
332
|
+
<dl style="margin-left: 0px;">
|
|
333
|
+
<dt id="example_group_5" class="passed">passing spec</dt>
|
|
334
|
+
<script type="text/javascript">moveProgressBar('57.1');</script>
|
|
335
|
+
<dd class="example passed"><span class="passed_spec_name">passes</span></dd>
|
|
230
336
|
</dl>
|
|
231
337
|
</div>
|
|
232
|
-
<div class="example_group">
|
|
233
|
-
<dl>
|
|
234
|
-
<dt id="example_group_6">failing spec</dt>
|
|
338
|
+
<div id="div_group_6" class="example_group passed">
|
|
339
|
+
<dl style="margin-left: 0px;">
|
|
340
|
+
<dt id="example_group_6" class="passed">failing spec</dt>
|
|
341
|
+
<script type="text/javascript">makeRed('div_group_6');</script>
|
|
235
342
|
<script type="text/javascript">makeRed('example_group_6');</script>
|
|
236
|
-
<script type="text/javascript">moveProgressBar('
|
|
237
|
-
<dd class="
|
|
343
|
+
<script type="text/javascript">moveProgressBar('71.4');</script>
|
|
344
|
+
<dd class="example failed">
|
|
238
345
|
<span class="failed_spec_name">fails</span>
|
|
239
|
-
<div class="failure" id="
|
|
346
|
+
<div class="failure" id="failure_2">
|
|
240
347
|
<div class="message"><pre>
|
|
241
348
|
expected 2
|
|
242
349
|
got 1
|
|
243
350
|
|
|
244
351
|
(compared using ==)
|
|
245
352
|
</pre></div>
|
|
246
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:
|
|
353
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `block (2 levels) in <top (required)>'
|
|
354
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
|
|
355
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
|
|
356
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
|
|
357
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
|
|
358
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
|
|
359
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
|
|
247
360
|
<pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
|
|
248
361
|
<span class="linenum">28</span>
|
|
249
362
|
<span class="offending"><span class="linenum">29</span> <span class="keyword">raise</span><span class="punct">(</span><span class="constant">RSpec</span><span class="punct">::</span><span class="constant">Expectations</span><span class="punct">::</span><span class="constant">ExpectationNotMetError</span><span class="punct">.</span><span class="ident">new</span><span class="punct">(</span><span class="ident">message</span><span class="punct">))</span></span>
|
|
@@ -252,8 +365,40 @@ expected 2
|
|
|
252
365
|
</dd>
|
|
253
366
|
</dl>
|
|
254
367
|
</div>
|
|
368
|
+
<div id="div_group_7" class="example_group passed">
|
|
369
|
+
<dl style="margin-left: 0px;">
|
|
370
|
+
<dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
|
|
371
|
+
<script type="text/javascript">makeRed('div_group_7');</script>
|
|
372
|
+
<script type="text/javascript">makeRed('example_group_7');</script>
|
|
373
|
+
<script type="text/javascript">moveProgressBar('85.7');</script>
|
|
374
|
+
<dd class="example failed">
|
|
375
|
+
<span class="failed_spec_name">fails with a backtrace that has no file</span>
|
|
376
|
+
<div class="failure" id="failure_3">
|
|
377
|
+
<div class="message"><pre>foo</pre></div>
|
|
378
|
+
<div class="backtrace"><pre>(erb):1:in `<main>'
|
|
379
|
+
./spec/rspec/core/resources/formatter_specs.rb:41:in `block (2 levels) in <top (required)>'
|
|
380
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `block (2 levels) in <module:Formatters>'
|
|
381
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (5 levels) in <module:Formatters>'
|
|
382
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
|
|
383
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `block (4 levels) in <module:Formatters>'
|
|
384
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
|
|
385
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `block (3 levels) in <module:Formatters>'</pre></div>
|
|
386
|
+
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
|
387
|
+
</div>
|
|
388
|
+
</dd>
|
|
389
|
+
<script type="text/javascript">moveProgressBar('100.0');</script>
|
|
390
|
+
<dd class="example failed">
|
|
391
|
+
<span class="failed_spec_name">fails with a backtrace containing an erb file</span>
|
|
392
|
+
<div class="failure" id="failure_4">
|
|
393
|
+
<div class="message"><pre>Exception</pre></div>
|
|
394
|
+
<div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
|
|
395
|
+
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
|
|
396
|
+
</div>
|
|
397
|
+
</dd>
|
|
398
|
+
</dl>
|
|
399
|
+
</div>
|
|
255
400
|
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>x seconds</strong>";</script>
|
|
256
|
-
<script type="text/javascript">document.getElementById('totals').innerHTML = "
|
|
401
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
|
|
257
402
|
</div>
|
|
258
403
|
</div>
|
|
259
404
|
</body>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
|
+
require 'rspec/core/formatters/html_formatter'
|
|
2
3
|
require 'nokogiri'
|
|
3
4
|
|
|
4
5
|
module RSpec
|
|
@@ -39,22 +40,29 @@ module RSpec
|
|
|
39
40
|
|
|
40
41
|
# Uncomment this group temporarily in order to overwrite the expected
|
|
41
42
|
# with actual. Use with care!!!
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
describe "file generator", :if => ENV['GENERATE'] do
|
|
44
|
+
it "generates a new comparison file" do
|
|
45
|
+
Dir.chdir(root) do
|
|
46
|
+
File.open(expected_file, 'w') {|io| io.write(generated_html)}
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def extract_backtrace_from(doc)
|
|
52
|
+
backtrace = doc.search("div.backtrace").
|
|
53
|
+
collect {|e| e.at("pre").inner_html}.
|
|
54
|
+
collect {|e| e.split("\n")}.flatten.
|
|
55
|
+
select {|e| e =~ /formatter_specs\.rb/}
|
|
56
|
+
end
|
|
49
57
|
|
|
50
58
|
it "produces HTML identical to the one we designed manually" do
|
|
51
59
|
Dir.chdir(root) do
|
|
52
60
|
actual_doc = Nokogiri::HTML(generated_html)
|
|
53
|
-
actual_backtraces = actual_doc
|
|
61
|
+
actual_backtraces = extract_backtrace_from(actual_doc)
|
|
54
62
|
actual_doc.css("div.backtrace").remove
|
|
55
63
|
|
|
56
64
|
expected_doc = Nokogiri::HTML(expected_html)
|
|
57
|
-
expected_backtraces = expected_doc
|
|
65
|
+
expected_backtraces = extract_backtrace_from(expected_doc)
|
|
58
66
|
expected_doc.search("div.backtrace").remove
|
|
59
67
|
|
|
60
68
|
actual_doc.inner_html.should == expected_doc.inner_html
|