rspec-core 2.0.1 → 2.1.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.
Files changed (63) hide show
  1. data/Gemfile +8 -3
  2. data/Guardfile +5 -0
  3. data/History.markdown +32 -2
  4. data/README.markdown +10 -3
  5. data/Rakefile +12 -13
  6. data/Upgrade.markdown +175 -121
  7. data/bin/autospec +13 -0
  8. data/bin/rspec +24 -1
  9. data/features/command_line/line_number_appended_to_path.feature +3 -1
  10. data/features/command_line/line_number_option.feature +3 -1
  11. data/features/command_line/tag.feature +74 -0
  12. data/features/filtering/exclusion_filters.feature +1 -1
  13. data/features/filtering/implicit_filters.feature +166 -0
  14. data/features/hooks/around_hooks.feature +51 -44
  15. data/features/metadata/described_class.feature +3 -0
  16. data/features/pending/pending_examples.feature +76 -0
  17. data/features/step_definitions/additional_cli_steps.rb +11 -0
  18. data/features/subject/attribute_of_subject.feature +8 -0
  19. data/features/subject/explicit_subject.feature +8 -13
  20. data/features/subject/implicit_receiver.feature +29 -0
  21. data/features/subject/implicit_subject.feature +6 -7
  22. data/lib/rspec/core.rb +3 -21
  23. data/lib/rspec/core/backward_compatibility.rb +22 -3
  24. data/lib/rspec/core/command_line.rb +1 -0
  25. data/lib/rspec/core/configuration.rb +34 -6
  26. data/lib/rspec/core/configuration_options.rb +1 -3
  27. data/lib/rspec/core/example.rb +0 -5
  28. data/lib/rspec/core/example_group.rb +9 -8
  29. data/lib/rspec/core/expecting/with_rspec.rb +11 -0
  30. data/lib/rspec/core/extensions/object.rb +1 -1
  31. data/lib/rspec/core/formatters/base_formatter.rb +1 -6
  32. data/lib/rspec/core/hooks.rb +1 -1
  33. data/lib/rspec/core/metadata.rb +15 -5
  34. data/lib/rspec/core/option_parser.rb +17 -0
  35. data/lib/rspec/core/pending.rb +10 -1
  36. data/lib/rspec/core/rake_task.rb +32 -10
  37. data/lib/rspec/core/reporter.rb +1 -0
  38. data/lib/rspec/core/subject.rb +58 -59
  39. data/lib/rspec/core/version.rb +1 -1
  40. data/lib/rspec/core/world.rb +9 -4
  41. data/rspec-core.gemspec +4 -11
  42. data/spec/rspec/core/command_line_spec.rb +16 -5
  43. data/spec/rspec/core/configuration_options_spec.rb +6 -0
  44. data/spec/rspec/core/configuration_spec.rb +89 -6
  45. data/spec/rspec/core/deprecations_spec.rb +17 -1
  46. data/spec/rspec/core/example_group_spec.rb +29 -14
  47. data/spec/rspec/core/example_spec.rb +0 -7
  48. data/spec/rspec/core/formatters/html_formatted-1.8.6.html +49 -33
  49. data/spec/rspec/core/formatters/html_formatted-1.8.7.html +5 -5
  50. data/spec/rspec/core/formatters/html_formatted-1.9.1.html +46 -26
  51. data/spec/rspec/core/formatters/html_formatted-1.9.2.html +5 -5
  52. data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +49 -33
  53. data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +19 -19
  54. data/spec/rspec/core/formatters/text_mate_formatted-1.9.1.html +56 -33
  55. data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +26 -38
  56. data/spec/rspec/core/metadata_spec.rb +153 -132
  57. data/spec/rspec/core/pending_example_spec.rb +133 -25
  58. data/spec/rspec/core/rake_task_spec.rb +25 -32
  59. data/spec/rspec/core/subject_spec.rb +15 -0
  60. data/spec/rspec/core/world_spec.rb +72 -61
  61. data/spec/spec_helper.rb +0 -14
  62. metadata +25 -135
  63. data/features/hooks/halt.feature +0 -26
@@ -1,7 +1,7 @@
1
1
  module RSpec # :nodoc:
2
2
  module Core # :nodoc:
3
3
  module Version # :nodoc:
4
- STRING = '2.0.1'
4
+ STRING = '2.1.0'
5
5
  end
6
6
  end
7
7
  end
@@ -18,6 +18,11 @@ module RSpec
18
18
  }
19
19
  end
20
20
 
21
+ def register(example_group)
22
+ example_groups << example_group
23
+ example_group
24
+ end
25
+
21
26
  def inclusion_filter
22
27
  @configuration.filter
23
28
  end
@@ -39,13 +44,13 @@ module RSpec
39
44
  end
40
45
 
41
46
  def apply_inclusion_filters(examples, conditions={})
42
- examples.select(&all_apply?(conditions))
47
+ examples.select(&apply?(:any?, conditions))
43
48
  end
44
49
 
45
50
  alias_method :find, :apply_inclusion_filters
46
51
 
47
52
  def apply_exclusion_filters(examples, conditions={})
48
- examples.reject(&all_apply?(conditions))
53
+ examples.reject(&apply?(:any?, conditions))
49
54
  end
50
55
 
51
56
  def preceding_declaration_line(filter_line)
@@ -82,8 +87,8 @@ module RSpec
82
87
 
83
88
  private
84
89
 
85
- def all_apply?(conditions)
86
- lambda {|example| example.metadata.all_apply?(conditions)}
90
+ def apply?(predicate, conditions)
91
+ lambda {|example| example.metadata.apply?(predicate, conditions)}
87
92
  end
88
93
 
89
94
  def declaration_line_numbers
@@ -27,19 +27,12 @@ Gem::Specification.new do |s|
27
27
 
28
28
  Thank you for installing #{s.summary}
29
29
 
30
- Please be sure to look at Upgrade.markdown to see what might have changed
31
- since the last release.
30
+ Please be sure to look at the upgrade instructions to see what might have
31
+ changed since the last release:
32
+
33
+ http://github.com/rspec/rspec-core/blob/master/Upgrade.markdown
32
34
 
33
35
  **************************************************
34
36
  }
35
-
36
- s.add_development_dependency "rspec-expectations", "~> 2.0.1"
37
- s.add_development_dependency "rspec-mocks", "~> 2.0.1"
38
- s.add_development_dependency "cucumber", "~> 0.9.2"
39
- s.add_development_dependency "autotest", "~> 4.2.9"
40
- s.add_development_dependency "syntax", "~> 1.0.0"
41
- s.add_development_dependency "flexmock"
42
- s.add_development_dependency "mocha"
43
- s.add_development_dependency "rr"
44
37
  end
45
38
 
@@ -31,19 +31,30 @@ module RSpec::Core
31
31
  config_options
32
32
  end
33
33
 
34
- let(:command_line) do
35
- CommandLine.new(config_options, config)
36
- end
37
-
38
34
  let(:config) do
39
35
  RSpec::Core::Configuration.new
40
36
  end
41
37
 
42
- let(:err) { ::StringIO.new }
38
+ let(:world) do
39
+ RSpec::Core::World.new
40
+ end
41
+
42
+ let(:command_line) do
43
+ CommandLine.new(config_options, config, world)
44
+ end
45
+
43
46
  let(:out) { ::StringIO.new }
47
+ let(:err) { ::StringIO.new }
44
48
 
45
49
  before do
46
50
  config.stub(:run_hook)
51
+
52
+ config.should_receive(:load_spec_files)
53
+ config.should_receive(:configure_mock_framework)
54
+ config.should_receive(:configure_expectation_framework)
55
+
56
+ world.should_receive(:announce_inclusion_filter)
57
+ world.should_receive(:announce_exclusion_filter)
47
58
  end
48
59
 
49
60
  it "configures streams before command line options" do
@@ -215,6 +215,12 @@ describe RSpec::Core::ConfigurationOptions do
215
215
  end
216
216
  end
217
217
 
218
+ describe "--fail-fast" do
219
+ it "sets fail_fast on config" do
220
+ options_from_args("--fail-fast").should include(:fail_fast => true)
221
+ end
222
+ end
223
+
218
224
  describe "options file (override)" do
219
225
  let(:config) { OpenStruct.new }
220
226
 
@@ -14,7 +14,7 @@ module RSpec::Core
14
14
  end
15
15
  end
16
16
 
17
- describe "#mock_framework_class" do
17
+ describe "mock_framework" do
18
18
  before(:each) do
19
19
  config.stub(:require)
20
20
  end
@@ -46,6 +46,34 @@ module RSpec::Core
46
46
 
47
47
  end
48
48
 
49
+ describe "expectation_framework" do
50
+
51
+ it "defaults to :rspec" do
52
+ config.should_receive(:require).with('rspec/core/expecting/with_rspec')
53
+ config.require_expectation_framework_adapter
54
+ end
55
+
56
+ [:rspec].each do |framework|
57
+ it "uses #{framework.inspect} framework when set explicitly" do
58
+ config.should_receive(:require).with("rspec/core/expecting/with_#{framework}")
59
+ config.mock_framework = framework
60
+ config.require_expectation_framework_adapter
61
+ end
62
+ end
63
+
64
+ it "supports expect_with for backward compatibility with rspec-1.x" do
65
+ config.should_receive(:require).with('rspec/core/expecting/with_rspec')
66
+ config.mock_with :rspec
67
+ config.require_expectation_framework_adapter
68
+ end
69
+
70
+ it "raises ArgumentError if framework is not supported" do
71
+ config.expectation_framework = :not_supported
72
+ expect { config.require_expectation_framework_adapter }.to raise_error(ArgumentError)
73
+ end
74
+
75
+ end
76
+
49
77
  context "setting the files to run" do
50
78
 
51
79
  it "loads files not following pattern if named explicitly" do
@@ -128,6 +156,11 @@ module RSpec::Core
128
156
  end
129
157
 
130
158
  context "with full_description" do
159
+ it "overrides :focused" do
160
+ config.filter_run :focused => true
161
+ config.full_description = "foo"
162
+ config.filter.should_not have_key(:focused)
163
+ end
131
164
 
132
165
  it "assigns the example name as the filter on description" do
133
166
  config.full_description = "foo"
@@ -368,9 +401,17 @@ module RSpec::Core
368
401
  describe "#filter_run" do
369
402
  it "sets the filter" do
370
403
  config.filter_run :focus => true
371
- config.filter.should eq({:focus => true})
404
+ config.filter[:focus].should == true
372
405
  end
373
-
406
+
407
+ it "merges with existing filters" do
408
+ config.filter_run :filter1 => true
409
+ config.filter_run :filter2 => false
410
+
411
+ config.filter[:filter1].should == true
412
+ config.filter[:filter2].should == false
413
+ end
414
+
374
415
  it "warns if :line_number is already a filter" do
375
416
  config.filter_run :line_number => 100
376
417
  config.should_receive(:warn).with(
@@ -379,7 +420,7 @@ module RSpec::Core
379
420
  )
380
421
  config.filter_run :focus => true
381
422
  end
382
-
423
+
383
424
  it "warns if :full_description is already a filter" do
384
425
  config.filter_run :full_description => 'foo'
385
426
  config.should_receive(:warn).with(
@@ -393,13 +434,55 @@ module RSpec::Core
393
434
  describe "#filter_run_excluding" do
394
435
  it "sets the filter" do
395
436
  config.filter_run_excluding :slow => true
396
- config.exclusion_filter.should eq({:slow => true})
437
+ config.exclusion_filter[:slow].should == true
438
+ end
439
+
440
+ it "merges with existing filters" do
441
+ config.filter_run_excluding :filter1 => true
442
+ config.filter_run_excluding :filter2 => false
443
+
444
+ config.exclusion_filter[:filter1].should == true
445
+ config.exclusion_filter[:filter2].should == false
446
+ end
447
+ end
448
+
449
+ describe "#exclusion_filter" do
450
+ describe "the default :if filter" do
451
+ it "does not exclude a spec with no :if metadata" do
452
+ config.exclusion_filter[:if].call(nil, {}).should be_false
453
+ end
454
+
455
+ it "does not exclude a spec with { :if => true } metadata" do
456
+ config.exclusion_filter[:if].call(true, {:if => true}).should be_false
457
+ end
458
+
459
+ it "excludes a spec with { :if => false } metadata" do
460
+ config.exclusion_filter[:if].call(false, {:if => false}).should be_true
461
+ end
462
+
463
+ it "excludes a spec with { :if => nil } metadata" do
464
+ config.exclusion_filter[:if].call(false, {:if => nil}).should be_true
465
+ end
466
+ end
467
+
468
+ describe "the default :unless filter" do
469
+ it "excludes a spec with { :unless => true } metadata" do
470
+ config.exclusion_filter[:unless].call(true).should be_true
471
+ end
472
+
473
+ it "does not exclude a spec with { :unless => false } metadata" do
474
+ config.exclusion_filter[:unless].call(false).should be_false
475
+ end
476
+
477
+ it "does not exclude a spec with { :unless => nil } metadata" do
478
+ config.exclusion_filter[:unless].call(nil).should be_false
479
+ end
397
480
  end
398
481
  end
399
482
 
400
483
  describe "line_number=" do
401
484
  before { config.stub(:warn) }
402
-
485
+
403
486
  it "sets the line number" do
404
487
  config.line_number = '37'
405
488
  config.filter.should == {:line_number => 37}
@@ -16,7 +16,7 @@ describe "deprecations" do
16
16
  describe RSpec::Core::ExampleGroup do
17
17
  describe 'running_example' do
18
18
  it 'is deprecated' do
19
- RSpec.should_receive(:warn_deprecation).with(/running_example.*example/m)
19
+ RSpec.should_receive(:warn_deprecation)
20
20
  self.running_example
21
21
  end
22
22
 
@@ -26,4 +26,20 @@ describe "deprecations" do
26
26
  end
27
27
  end
28
28
  end
29
+
30
+ describe "Spec::Runner.configure" do
31
+ it "is deprecated" do
32
+ RSpec.stub(:warn_deprecation)
33
+ RSpec.should_receive(:deprecate)
34
+ Spec::Runner.configure
35
+ end
36
+ end
37
+
38
+ describe "Spec::Rake::SpecTask" do
39
+ it "is deprecated" do
40
+ RSpec.stub(:warn_deprecation)
41
+ RSpec.should_receive(:deprecate)
42
+ Spec::Rake::SpecTask
43
+ end
44
+ end
29
45
  end
@@ -70,16 +70,22 @@ module RSpec::Core
70
70
  end
71
71
 
72
72
  it "is not registered in world" do
73
+ world = RSpec::Core::World.new
73
74
  parent = ExampleGroup.describe
75
+ world.register(parent)
74
76
  child = parent.describe
75
- RSpec.world.example_groups.should == [parent]
77
+ world.example_groups.should == [parent]
76
78
  end
77
79
  end
78
80
 
79
81
  describe "filtering" do
82
+ let(:world) { World.new }
83
+
80
84
  it "includes all examples in an explicitly included group" do
81
- RSpec.world.stub(:inclusion_filter).and_return({ :awesome => true })
85
+ world.stub(:inclusion_filter).and_return({ :awesome => true })
82
86
  group = ExampleGroup.describe("does something", :awesome => true)
87
+ group.stub(:world) { world }
88
+
83
89
  examples = [
84
90
  group.example("first"),
85
91
  group.example("second")
@@ -88,16 +94,19 @@ module RSpec::Core
88
94
  end
89
95
 
90
96
  it "includes explicitly included examples" do
91
- RSpec.world.stub(:inclusion_filter).and_return({ :include_me => true })
97
+ world.stub(:inclusion_filter).and_return({ :include_me => true })
92
98
  group = ExampleGroup.describe
99
+ group.stub(:world) { world }
93
100
  example = group.example("does something", :include_me => true)
94
101
  group.example("don't run me")
95
102
  group.filtered_examples.should == [example]
96
103
  end
97
104
 
98
105
  it "excludes all examples in an excluded group" do
99
- RSpec.world.stub(:exclusion_filter).and_return({ :include_me => false })
106
+ world.stub(:exclusion_filter).and_return({ :include_me => false })
100
107
  group = ExampleGroup.describe("does something", :include_me => false)
108
+ group.stub(:world) { world }
109
+
101
110
  examples = [
102
111
  group.example("first"),
103
112
  group.example("second")
@@ -106,8 +115,10 @@ module RSpec::Core
106
115
  end
107
116
 
108
117
  it "filters out excluded examples" do
109
- RSpec.world.stub(:exclusion_filter).and_return({ :exclude_me => true })
118
+ world.stub(:exclusion_filter).and_return({ :exclude_me => true })
110
119
  group = ExampleGroup.describe("does something")
120
+ group.stub(:world) { world }
121
+
111
122
  examples = [
112
123
  group.example("first", :exclude_me => true),
113
124
  group.example("second")
@@ -118,6 +129,7 @@ module RSpec::Core
118
129
  context "with no filters" do
119
130
  it "returns all" do
120
131
  group = ExampleGroup.describe
132
+ group.stub(:world) { world }
121
133
  example = group.example("does something")
122
134
  group.filtered_examples.should == [example]
123
135
  end
@@ -125,8 +137,9 @@ module RSpec::Core
125
137
 
126
138
  context "with no examples or groups that match filters" do
127
139
  it "returns none" do
128
- RSpec.world.stub(:inclusion_filter).and_return({ :awesome => false })
140
+ world.stub(:inclusion_filter).and_return({ :awesome => false })
129
141
  group = ExampleGroup.describe
142
+ group.stub(:world) { world }
130
143
  example = group.example("does something")
131
144
  group.filtered_examples.should == []
132
145
  end
@@ -626,10 +639,13 @@ module RSpec::Core
626
639
  its([:another_attribute]) { should == 'another_value' }
627
640
  its([:another_attribute]) { should_not == 'value' }
628
641
  its(:keys) { should =~ ['another_attribute', :attribute] }
629
-
630
642
  context "when referring to an attribute without the proper array syntax" do
631
- it "raises a NoMethodError" do
632
- expect{ its(:attribute) }.to raise_error(NoMethodError)
643
+ context "it raises an error" do
644
+ its(:attribute) do
645
+ expect do
646
+ should eq('value')
647
+ end.to raise_error(NoMethodError)
648
+ end
633
649
  end
634
650
  end
635
651
  end
@@ -687,20 +703,20 @@ module RSpec::Core
687
703
  end
688
704
 
689
705
  context "with RSpec.wants_to_quit=true" do
706
+ let(:group) { RSpec::Core::ExampleGroup.describe }
707
+
690
708
  before do
691
- RSpec.world.stub(:example_groups) { [] }
692
- RSpec.world.stub(:wants_to_quit) { true }
709
+ RSpec.stub(:wants_to_quit) { true }
710
+ RSpec.stub(:clear_remaining_example_groups)
693
711
  end
694
712
 
695
713
  it "returns without starting the group" do
696
- group = RSpec::Core::ExampleGroup.describe
697
714
  reporter.should_not_receive(:example_group_started)
698
715
  group.run(reporter)
699
716
  end
700
717
 
701
718
  context "at top level" do
702
719
  it "purges remaining groups" do
703
- group = RSpec::Core::ExampleGroup.describe
704
720
  RSpec.should_receive(:clear_remaining_example_groups)
705
721
  group.run(reporter)
706
722
  end
@@ -708,7 +724,6 @@ module RSpec::Core
708
724
 
709
725
  context "in a nested group" do
710
726
  it "does not purge remaining groups" do
711
- group = RSpec::Core::ExampleGroup.describe
712
727
  nested_group = group.describe
713
728
  RSpec.should_not_receive(:clear_remaining_example_groups)
714
729
  nested_group.run(reporter)
@@ -9,13 +9,6 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
9
9
  example_group.example('example description')
10
10
  end
11
11
 
12
- describe "#behaviour" do
13
- it "is deprecated" do
14
- RSpec.should_receive(:deprecate)
15
- example_instance.behaviour
16
- end
17
- end
18
-
19
12
  describe '#described_class' do
20
13
  it "returns the class (if any) of the outermost example group" do
21
14
  described_class.should == RSpec::Core::Example
@@ -184,7 +184,7 @@ a {
184
184
  <dt id="example_group_1">pending spec with no implementation</dt>
185
185
  <script type="text/javascript">makeYellow('rspec-header');</script>
186
186
  <script type="text/javascript">makeYellow('example_group_1');</script>
187
- <script type="text/javascript">moveProgressBar('20.0');</script>
187
+ <script type="text/javascript">moveProgressBar('14.2');</script>
188
188
  <dd class="spec not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not Yet Implemented)</span></dd>
189
189
  </dl>
190
190
  </div>
@@ -198,7 +198,7 @@ a {
198
198
  <dt id="example_group_3">with content that would fail</dt>
199
199
  <script type="text/javascript">makeYellow('rspec-header');</script>
200
200
  <script type="text/javascript">makeYellow('example_group_3');</script>
201
- <script type="text/javascript">moveProgressBar('40.0');</script>
201
+ <script type="text/javascript">moveProgressBar('28.5');</script>
202
202
  <dd class="spec not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
203
203
  </dl>
204
204
  </div>
@@ -207,27 +207,23 @@ a {
207
207
  <dt id="example_group_4">with content that would pass</dt>
208
208
  <script type="text/javascript">makeRed('rspec-header');</script>
209
209
  <script type="text/javascript">makeRed('example_group_4');</script>
210
- <script type="text/javascript">moveProgressBar('60.0');</script>
210
+ <script type="text/javascript">moveProgressBar('42.8');</script>
211
211
  <dd class="spec pending_fixed">
212
212
  <span class="failed_spec_name">fails</span>
213
213
  <div class="failure" id="failure_0">
214
214
  <div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
215
- <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:19
216
- ./spec/rspec/core/formatters/html_formatter_spec.rb:23
217
- ./spec/rspec/core/formatters/html_formatter_spec.rb:43
218
- ./spec/rspec/core/formatters/html_formatter_spec.rb:43:in `open'
219
- ./spec/rspec/core/formatters/html_formatter_spec.rb:43
220
- ./spec/rspec/core/formatters/html_formatter_spec.rb:42:in `chdir'
221
- ./spec/rspec/core/formatters/html_formatter_spec.rb:42
222
- ./spec/spec_helper.rb:70:in `__instance_exec0'
223
- ./spec/spec_helper.rb:46:in `instance_eval'
224
- ./spec/spec_helper.rb:46:in `sandboxed'
225
- ./spec/spec_helper.rb:70:in `__instance_exec0'</pre></div>
226
- <pre class="ruby"><code><span class="linenum">11</span> <span class="keyword">rescue</span> <span class="constant">Exception</span> <span class="punct">=&gt;</span> <span class="ident">e</span>
227
- <span class="linenum">12</span> <span class="keyword">end</span>
228
- <span class="offending"><span class="linenum">13</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>
229
- <span class="linenum">14</span> <span class="keyword">end</span>
230
- <span class="linenum">15</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
215
+ <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18
216
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:24
217
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:46
218
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
219
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:46
220
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
221
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:45</pre></div>
222
+ <pre class="ruby"><code><span class="linenum">20</span> <span class="keyword">rescue</span> <span class="constant">Exception</span> <span class="punct">=&gt;</span> <span class="ident">e</span>
223
+ <span class="linenum">21</span> <span class="keyword">end</span>
224
+ <span class="offending"><span class="linenum">22</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>
225
+ <span class="linenum">23</span> <span class="keyword">end</span>
226
+ <span class="linenum">24</span> <span class="ident">throw</span> <span class="symbol">:pending_declared_in_example</span><span class="punct">,</span> <span class="ident">message</span></code></pre>
231
227
  </div>
232
228
  </dd>
233
229
  </dl>
@@ -235,7 +231,7 @@ a {
235
231
  <div class="example_group">
236
232
  <dl>
237
233
  <dt id="example_group_5">passing spec</dt>
238
- <script type="text/javascript">moveProgressBar('80.0');</script>
234
+ <script type="text/javascript">moveProgressBar('57.1');</script>
239
235
  <dd class="spec passed"><span class="passed_spec_name">passes</span></dd>
240
236
  </dl>
241
237
  </div>
@@ -243,7 +239,7 @@ a {
243
239
  <dl>
244
240
  <dt id="example_group_6">failing spec</dt>
245
241
  <script type="text/javascript">makeRed('example_group_6');</script>
246
- <script type="text/javascript">moveProgressBar('100.0');</script>
242
+ <script type="text/javascript">moveProgressBar('71.4');</script>
247
243
  <dd class="spec failed">
248
244
  <span class="failed_spec_name">fails</span>
249
245
  <div class="failure" id="failure_0">
@@ -253,17 +249,13 @@ expected 2
253
249
 
254
250
  (compared using ==)
255
251
  </pre></div>
256
- <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:34
257
- ./spec/rspec/core/formatters/html_formatter_spec.rb:23
258
- ./spec/rspec/core/formatters/html_formatter_spec.rb:43
259
- ./spec/rspec/core/formatters/html_formatter_spec.rb:43:in `open'
260
- ./spec/rspec/core/formatters/html_formatter_spec.rb:43
261
- ./spec/rspec/core/formatters/html_formatter_spec.rb:42:in `chdir'
262
- ./spec/rspec/core/formatters/html_formatter_spec.rb:42
263
- ./spec/spec_helper.rb:70:in `__instance_exec0'
264
- ./spec/spec_helper.rb:46:in `instance_eval'
265
- ./spec/spec_helper.rb:46:in `sandboxed'
266
- ./spec/spec_helper.rb:70:in `__instance_exec0'</pre></div>
252
+ <div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33
253
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:24
254
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:46
255
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `open'
256
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:46
257
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `chdir'
258
+ ./spec/rspec/core/formatters/html_formatter_spec.rb:45</pre></div>
267
259
  <pre class="ruby"><code><span class="linenum">27</span> <span class="keyword">end</span>
268
260
  <span class="linenum">28</span>
269
261
  <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>
@@ -272,8 +264,32 @@ expected 2
272
264
  </dd>
273
265
  </dl>
274
266
  </div>
267
+ <div class="example_group">
268
+ <dl>
269
+ <dt id="example_group_7">a failing spec with odd backtraces</dt>
270
+ <script type="text/javascript">makeRed('example_group_7');</script>
271
+ <script type="text/javascript">moveProgressBar('85.7');</script>
272
+ <dd class="spec failed">
273
+ <span class="failed_spec_name">fails with a backtrace that has no file</span>
274
+ <div class="failure" id="failure_0">
275
+ <div class="message"><pre>foo</pre></div>
276
+ <div class="backtrace"><pre>(erb):1</pre></div>
277
+ <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
278
+ </div>
279
+ </dd>
280
+ <script type="text/javascript">moveProgressBar('100.0');</script>
281
+ <dd class="spec failed">
282
+ <span class="failed_spec_name">fails with a backtrace containing an erb file</span>
283
+ <div class="failure" id="failure_0">
284
+ <div class="message"><pre>Exception</pre></div>
285
+ <div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
286
+ <pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
287
+ </div>
288
+ </dd>
289
+ </dl>
290
+ </div>
275
291
  <script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>x seconds</strong>";</script>
276
- <script type="text/javascript">document.getElementById('totals').innerHTML = "5 examples, 2 failures, 2 pending";</script>
292
+ <script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
277
293
  </div>
278
294
  </div>
279
295
  </body>