rspec-core 2.11.1 → 2.12.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/Changelog.md +59 -0
- data/README.md +22 -0
- data/features/command_line/example_name_option.feature +5 -5
- data/features/command_line/exit_status.feature +6 -6
- data/features/command_line/format_option.feature +2 -2
- data/features/command_line/line_number_appended_to_path.feature +2 -2
- data/features/command_line/line_number_option.feature +2 -2
- data/features/command_line/pattern_option.feature +2 -2
- data/features/command_line/rake_task.feature +62 -8
- data/features/command_line/ruby.feature +1 -1
- data/features/command_line/tag.feature +1 -1
- data/features/configuration/alias_example_to.feature +2 -2
- data/features/configuration/custom_settings.feature +3 -3
- data/features/configuration/default_path.feature +3 -3
- data/features/configuration/fail_fast.feature +5 -5
- data/features/configuration/read_options_from_file.feature +4 -4
- data/features/example_groups/basic_structure.feature +2 -2
- data/features/example_groups/shared_context.feature +3 -3
- data/features/example_groups/shared_examples.feature +25 -7
- data/features/expectation_framework_integration/configure_expectation_framework.feature +6 -6
- data/features/filtering/exclusion_filters.feature +5 -5
- data/features/filtering/if_and_unless.feature +5 -5
- data/features/filtering/inclusion_filters.feature +5 -5
- data/features/filtering/run_all_when_everything_filtered.feature +3 -3
- data/features/formatters/custom_formatter.feature +2 -2
- data/features/formatters/json_formatter.feature +30 -0
- data/features/formatters/text_formatter.feature +5 -5
- data/features/helper_methods/arbitrary_methods.feature +2 -2
- data/features/helper_methods/let.feature +2 -2
- data/features/helper_methods/modules.feature +6 -6
- data/features/hooks/around_hooks.feature +11 -11
- data/features/hooks/before_and_after_hooks.feature +15 -11
- data/features/hooks/filtering.feature +6 -6
- data/features/metadata/current_example.feature +1 -1
- data/features/metadata/described_class.feature +1 -1
- data/features/metadata/user_defined.feature +4 -4
- data/features/mock_framework_integration/use_any_framework.feature +6 -6
- data/features/mock_framework_integration/use_flexmock.feature +5 -5
- data/features/mock_framework_integration/use_mocha.feature +5 -5
- data/features/mock_framework_integration/use_rr.feature +5 -5
- data/features/mock_framework_integration/use_rspec.feature +5 -5
- data/features/pending/pending_examples.feature +11 -11
- data/features/spec_files/arbitrary_file_suffix.feature +1 -1
- data/features/step_definitions/additional_cli_steps.rb +2 -0
- data/features/subject/attribute_of_subject.feature +5 -5
- data/features/subject/explicit_subject.feature +5 -5
- data/features/subject/implicit_receiver.feature +2 -2
- data/features/subject/implicit_subject.feature +3 -3
- data/lib/autotest/rspec2.rb +1 -1
- data/lib/rspec/core.rb +53 -32
- data/lib/rspec/core/configuration.rb +123 -15
- data/lib/rspec/core/configuration_options.rb +17 -2
- data/lib/rspec/core/example.rb +5 -4
- data/lib/rspec/core/example_group.rb +19 -9
- data/lib/rspec/core/extensions/ordered.rb +12 -6
- data/lib/rspec/core/formatters.rb +55 -0
- data/lib/rspec/core/formatters/base_formatter.rb +43 -38
- data/lib/rspec/core/formatters/base_text_formatter.rb +9 -5
- data/lib/rspec/core/formatters/documentation_formatter.rb +1 -1
- data/lib/rspec/core/formatters/helpers.rb +30 -5
- data/lib/rspec/core/formatters/html_formatter.rb +58 -368
- data/lib/rspec/core/formatters/html_printer.rb +407 -0
- data/lib/rspec/core/formatters/json_formatter.rb +73 -0
- data/lib/rspec/core/formatters/snippet_extractor.rb +3 -1
- data/lib/rspec/core/hooks.rb +4 -4
- data/lib/rspec/core/metadata.rb +14 -6
- data/lib/rspec/core/mocking/with_mocha.rb +25 -2
- data/lib/rspec/core/mocking/with_rspec.rb +6 -2
- data/lib/rspec/core/option_parser.rb +28 -7
- data/lib/rspec/core/project_initializer.rb +0 -1
- data/lib/rspec/core/rake_task.rb +49 -38
- data/lib/rspec/core/reporter.rb +2 -2
- data/lib/rspec/core/shared_example_group.rb +89 -41
- data/lib/rspec/core/subject.rb +6 -2
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +2 -2
- data/spec/autotest/rspec_spec.rb +6 -1
- data/spec/command_line/order_spec.rb +67 -0
- data/spec/rspec/core/configuration_options_spec.rb +45 -38
- data/spec/rspec/core/configuration_spec.rb +219 -44
- data/spec/rspec/core/deprecations_spec.rb +9 -0
- data/spec/rspec/core/drb_command_line_spec.rb +1 -7
- data/spec/rspec/core/drb_options_spec.rb +1 -1
- data/spec/rspec/core/dsl_spec.rb +17 -9
- data/spec/rspec/core/example_group_spec.rb +51 -5
- data/spec/rspec/core/example_spec.rb +39 -7
- data/spec/rspec/core/filter_manager_spec.rb +20 -30
- data/spec/rspec/core/formatters/base_formatter_spec.rb +29 -1
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +6 -2
- data/spec/rspec/core/formatters/helpers_spec.rb +12 -0
- data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +462 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.2-jruby.html +410 -0
- data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +462 -0
- data/spec/rspec/core/formatters/html_formatter_spec.rb +11 -3
- data/spec/rspec/core/formatters/json_formatter_spec.rb +110 -0
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +8 -0
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html +462 -0
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2-jruby.html +410 -0
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html +462 -0
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +11 -3
- data/spec/rspec/core/hooks_filtering_spec.rb +6 -6
- data/spec/rspec/core/metadata_spec.rb +29 -0
- data/spec/rspec/core/option_parser_spec.rb +42 -0
- data/spec/rspec/core/project_initializer_spec.rb +2 -2
- data/spec/rspec/core/rake_task_spec.rb +60 -17
- data/spec/rspec/core/reporter_spec.rb +17 -0
- data/spec/rspec/core/runner_spec.rb +1 -0
- data/spec/rspec/core/shared_example_group_spec.rb +17 -5
- data/spec/rspec/core/subject_spec.rb +11 -0
- data/spec/spec_helper.rb +32 -2
- data/spec/support/config_options_helper.rb +1 -10
- data/spec/support/helper_methods.rb +13 -0
- data/spec/support/isolated_directory.rb +10 -0
- data/spec/support/isolated_home_directory.rb +16 -0
- metadata +145 -148
- data/lib/rspec/core/extensions.rb +0 -4
@@ -37,6 +37,15 @@ describe "deprecations" do
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
describe RSpec::Core::SharedExampleGroup do
|
41
|
+
describe 'share_as' do
|
42
|
+
it 'is deprecated' do
|
43
|
+
RSpec.should_receive(:warn_deprecation)
|
44
|
+
RSpec::Core::SharedExampleGroup.share_as(:DeprecatedSharedConst) {}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
40
49
|
describe "Spec::Runner.configure" do
|
41
50
|
it "is deprecated" do
|
42
51
|
RSpec.stub(:warn_deprecation)
|
@@ -26,13 +26,7 @@ describe "::DRbCommandLine", :type => :drb, :unless => RUBY_PLATFORM == 'java' d
|
|
26
26
|
|
27
27
|
describe "--drb-port" do
|
28
28
|
def with_RSPEC_DRB_set_to(val)
|
29
|
-
|
30
|
-
ENV['RSPEC_DRB'] = val
|
31
|
-
begin
|
32
|
-
yield
|
33
|
-
ensure
|
34
|
-
ENV['RSPEC_DRB'] = original
|
35
|
-
end
|
29
|
+
with_env_vars('RSPEC_DRB' => val) { yield }
|
36
30
|
end
|
37
31
|
|
38
32
|
context "without RSPEC_DRB environment variable set" do
|
data/spec/rspec/core/dsl_spec.rb
CHANGED
@@ -1,17 +1,25 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
main = self
|
4
|
-
describe "The describe method" do
|
5
|
-
it 'is available on the main object' do
|
6
|
-
main.should respond_to(:describe)
|
7
|
-
end
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
describe "The RSpec DSL" do
|
6
|
+
methods = [
|
7
|
+
:describe,
|
8
|
+
:share_examples_for,
|
9
|
+
:shared_examples_for,
|
10
|
+
:shared_examples,
|
11
|
+
:shared_context,
|
12
|
+
:share_as
|
13
|
+
]
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
methods.each do |method_name|
|
16
|
+
describe "##{method_name}" do
|
17
|
+
it "is not added to every object in the system" do
|
18
|
+
main.should respond_to(method_name)
|
19
|
+
Module.new.should respond_to(method_name)
|
20
|
+
Object.new.should_not respond_to(method_name)
|
21
|
+
end
|
22
|
+
end
|
15
23
|
end
|
16
24
|
end
|
17
25
|
|
@@ -19,6 +19,14 @@ module RSpec::Core
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
context "when RSpec.configuration.format_docstrings is set to a block" do
|
23
|
+
it "formats the description with that block" do
|
24
|
+
RSpec.configuration.format_docstrings { |s| s.upcase }
|
25
|
+
group = ExampleGroup.describe(' an example ')
|
26
|
+
group.description.should eq(' AN EXAMPLE ')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
22
30
|
context 'when RSpec.configuration.treat_symbols_as_metadata_keys_with_true_values is set to false' do
|
23
31
|
before(:each) do
|
24
32
|
RSpec.configure { |c| c.treat_symbols_as_metadata_keys_with_true_values = false }
|
@@ -385,6 +393,15 @@ module RSpec::Core
|
|
385
393
|
order.should eq([1,2,3])
|
386
394
|
end
|
387
395
|
|
396
|
+
it "does not set RSpec.wants_to_quit in case of an error in before all (without fail_fast?)" do
|
397
|
+
group = ExampleGroup.describe
|
398
|
+
group.before(:all) { raise "error in before all" }
|
399
|
+
group.example("example") {}
|
400
|
+
|
401
|
+
group.run
|
402
|
+
RSpec.wants_to_quit.should be_false
|
403
|
+
end
|
404
|
+
|
388
405
|
it "runs the before eachs in order" do
|
389
406
|
group = ExampleGroup.describe
|
390
407
|
order = []
|
@@ -553,6 +570,24 @@ module RSpec::Core
|
|
553
570
|
example.metadata[:execution_result][:exception].message.should eq("error in before all")
|
554
571
|
end
|
555
572
|
|
573
|
+
it "exposes instance variables set in before(:all) from after(:all) even if a before(:all) error occurs" do
|
574
|
+
ivar_value_in_after_hook = nil
|
575
|
+
|
576
|
+
group = ExampleGroup.describe do
|
577
|
+
before(:all) do
|
578
|
+
@an_ivar = :set_in_before_all
|
579
|
+
raise "fail"
|
580
|
+
end
|
581
|
+
|
582
|
+
after(:all) { ivar_value_in_after_hook = @an_ivar }
|
583
|
+
|
584
|
+
it("has a spec") { }
|
585
|
+
end
|
586
|
+
|
587
|
+
group.run
|
588
|
+
ivar_value_in_after_hook.should eq(:set_in_before_all)
|
589
|
+
end
|
590
|
+
|
556
591
|
it "treats an error in before(:all) as a failure for a spec in a nested group" do
|
557
592
|
example = nil
|
558
593
|
group = ExampleGroup.describe do
|
@@ -696,7 +731,7 @@ module RSpec::Core
|
|
696
731
|
example.example_group.description.should eq('A sample nested group')
|
697
732
|
end
|
698
733
|
|
699
|
-
it "has top level metadata from the example_group and its
|
734
|
+
it "has top level metadata from the example_group and its parent groups" do
|
700
735
|
example.example_group.metadata.should include(:little_less_nested => 'yep', :nested_describe => 'yep')
|
701
736
|
end
|
702
737
|
|
@@ -716,7 +751,7 @@ module RSpec::Core
|
|
716
751
|
example('ex 1') { 1.should eq(1) }
|
717
752
|
example('ex 2') { 1.should eq(1) }
|
718
753
|
end
|
719
|
-
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered) }
|
754
|
+
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered::Examples) }
|
720
755
|
group.run(reporter).should be_true
|
721
756
|
end
|
722
757
|
|
@@ -725,7 +760,7 @@ module RSpec::Core
|
|
725
760
|
example('ex 1') { 1.should eq(1) }
|
726
761
|
example('ex 2') { 1.should eq(2) }
|
727
762
|
end
|
728
|
-
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered) }
|
763
|
+
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered::Examples) }
|
729
764
|
group.run(reporter).should be_false
|
730
765
|
end
|
731
766
|
|
@@ -734,7 +769,7 @@ module RSpec::Core
|
|
734
769
|
example('ex 1') { 1.should eq(2) }
|
735
770
|
example('ex 2') { 1.should eq(1) }
|
736
771
|
end
|
737
|
-
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered) }
|
772
|
+
group.stub(:filtered_examples) { group.examples.extend(Extensions::Ordered::Examples) }
|
738
773
|
group.filtered_examples.each do |example|
|
739
774
|
example.should_receive(:run)
|
740
775
|
end
|
@@ -820,9 +855,13 @@ module RSpec::Core
|
|
820
855
|
let(:reporter) { double("reporter").as_null_object }
|
821
856
|
|
822
857
|
context "with fail_fast? => true" do
|
823
|
-
|
858
|
+
let(:group) do
|
824
859
|
group = RSpec::Core::ExampleGroup.describe
|
825
860
|
group.stub(:fail_fast?) { true }
|
861
|
+
group
|
862
|
+
end
|
863
|
+
|
864
|
+
it "does not run examples after the failed example" do
|
826
865
|
examples_run = []
|
827
866
|
group.example('example 1') { examples_run << self }
|
828
867
|
group.example('example 2') { examples_run << self; fail; }
|
@@ -832,6 +871,13 @@ module RSpec::Core
|
|
832
871
|
|
833
872
|
examples_run.length.should eq(2)
|
834
873
|
end
|
874
|
+
|
875
|
+
it "sets RSpec.wants_to_quit flag if encountering an exception in before(:all)" do
|
876
|
+
group.before(:all) { raise "error in before all" }
|
877
|
+
example = group.example("equality") { 1.should eq(2) }
|
878
|
+
group.run.should be_false
|
879
|
+
RSpec.wants_to_quit.should be_true
|
880
|
+
end
|
835
881
|
end
|
836
882
|
|
837
883
|
context "with RSpec.wants_to_quit=true" do
|
@@ -45,6 +45,17 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
describe "when there is an explicit description" do
|
49
|
+
context "when RSpec.configuration.format_docstrings is set to a block" do
|
50
|
+
it "formats the description using the block" do
|
51
|
+
RSpec.configuration.format_docstrings { |s| s.strip }
|
52
|
+
example = example_group.example(' an example with whitespace ') {}
|
53
|
+
example_group.run
|
54
|
+
example.description.should eql('an example with whitespace')
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
48
59
|
describe "when there is no explicit description" do
|
49
60
|
def expect_with(*frameworks)
|
50
61
|
RSpec.configuration.stub(:expecting_with_rspec?).and_return(frameworks.include?(:rspec))
|
@@ -58,6 +69,16 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
58
69
|
end
|
59
70
|
end
|
60
71
|
|
72
|
+
context "when RSpec.configuration.format_docstrings is set to a block" do
|
73
|
+
it "formats the description using the block" do
|
74
|
+
RSpec.configuration.format_docstrings { |s| s.upcase }
|
75
|
+
example_group.example { 5.should eq(5) }
|
76
|
+
example_group.run
|
77
|
+
pattern = /EXAMPLE AT #{relative_path(__FILE__).upcase}:#{__LINE__ - 2}/
|
78
|
+
example_group.examples.first.description.should match(pattern)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
61
82
|
context "when `expect_with :rspec` is configured" do
|
62
83
|
before(:each) { expect_with :rspec }
|
63
84
|
|
@@ -221,12 +242,12 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
221
242
|
|
222
243
|
group.run
|
223
244
|
results.should eq([
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
245
|
+
"around (before)",
|
246
|
+
"before",
|
247
|
+
"example",
|
248
|
+
"after",
|
249
|
+
"around (after)"
|
250
|
+
])
|
230
251
|
end
|
231
252
|
|
232
253
|
context "clearing ivars" do
|
@@ -328,7 +349,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
328
349
|
blah.should be(:success)
|
329
350
|
end
|
330
351
|
end
|
331
|
-
|
352
|
+
|
332
353
|
context "in before(:each)" do
|
333
354
|
it "sets each example to pending" do
|
334
355
|
group = RSpec::Core::ExampleGroup.describe do
|
@@ -365,6 +386,17 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
365
386
|
group.examples.first.should be_pending
|
366
387
|
end
|
367
388
|
end
|
389
|
+
end
|
368
390
|
|
391
|
+
describe "timing" do
|
392
|
+
it "uses RSpec::Core::Time as to not be affected by changes to time in examples" do
|
393
|
+
reporter = double(:reporter).as_null_object
|
394
|
+
group = RSpec::Core::ExampleGroup.describe
|
395
|
+
example = group.example
|
396
|
+
example.__send__ :start, reporter
|
397
|
+
Time.stub(:now => Time.utc(2012, 10, 1))
|
398
|
+
example.__send__ :finish, reporter
|
399
|
+
expect(example.metadata[:execution_result][:run_time]).to be < 0.2
|
400
|
+
end
|
369
401
|
end
|
370
402
|
end
|
@@ -32,6 +32,26 @@ module RSpec::Core
|
|
32
32
|
filter_manager.send(type).should eq(:foo => 2)
|
33
33
|
filter_manager.send(opposite(type)).should be_empty
|
34
34
|
end
|
35
|
+
|
36
|
+
if name == "include"
|
37
|
+
[:locations, :line_numbers, :full_description].each do |filter|
|
38
|
+
context "with :#{filter}" do
|
39
|
+
it "clears previous inclusions" do
|
40
|
+
filter_manager = FilterManager.new
|
41
|
+
filter_manager.include :foo => :bar
|
42
|
+
filter_manager.include filter => "value"
|
43
|
+
filter_manager.inclusions.should eq({filter => "value"})
|
44
|
+
end
|
45
|
+
|
46
|
+
it "does nothing when :#{filter} previously set" do
|
47
|
+
filter_manager = FilterManager.new
|
48
|
+
filter_manager.include filter => "a_value"
|
49
|
+
filter_manager.include :foo => :bar
|
50
|
+
filter_manager.inclusions.should eq(filter => "a_value")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
35
55
|
end
|
36
56
|
|
37
57
|
describe "##{name}!" do
|
@@ -222,35 +242,5 @@ module RSpec::Core
|
|
222
242
|
filter_manager.exclusions.description.should eq({ :unless => :custom_filter }.inspect)
|
223
243
|
end
|
224
244
|
end
|
225
|
-
|
226
|
-
it "clears the inclusion filter on include :line_numbers" do
|
227
|
-
filter_manager = FilterManager.new
|
228
|
-
filter_manager.include :foo => :bar
|
229
|
-
filter_manager.include :line_numbers => [100]
|
230
|
-
filter_manager.inclusions.should eq(:line_numbers => [100])
|
231
|
-
end
|
232
|
-
|
233
|
-
it "clears the inclusion filter on include :locations" do
|
234
|
-
filter_manager = FilterManager.new
|
235
|
-
filter_manager.include :foo => :bar
|
236
|
-
filter_manager.include :locations => { "path/to/file.rb" => [37] }
|
237
|
-
filter_manager.inclusions.should eq(:locations => { "path/to/file.rb" => [37] })
|
238
|
-
end
|
239
|
-
|
240
|
-
it "clears the inclusion filter on include :full_description" do
|
241
|
-
filter_manager = FilterManager.new
|
242
|
-
filter_manager.include :foo => :bar
|
243
|
-
filter_manager.include :full_description => "this and that"
|
244
|
-
filter_manager.inclusions.should eq(:full_description => "this and that")
|
245
|
-
end
|
246
|
-
|
247
|
-
[:locations, :line_numbers, :full_description].each do |filter|
|
248
|
-
it "does nothing on include if already set standalone filter #{filter}" do
|
249
|
-
filter_manager = FilterManager.new
|
250
|
-
filter_manager.include filter => "a_value"
|
251
|
-
filter_manager.include :foo => :bar
|
252
|
-
filter_manager.inclusions.should eq(filter => "a_value")
|
253
|
-
end
|
254
|
-
end
|
255
245
|
end
|
256
246
|
end
|
@@ -16,6 +16,14 @@ describe RSpec::Core::Formatters::BaseFormatter do
|
|
16
16
|
formatter.__send__(:backtrace_line, original_line)
|
17
17
|
original_line.should eq(File.expand_path(__FILE__))
|
18
18
|
end
|
19
|
+
|
20
|
+
it "deals gracefully with a security error" do
|
21
|
+
safely do
|
22
|
+
formatter.__send__(:backtrace_line, __FILE__)
|
23
|
+
# on some rubies, this doesn't raise a SecurityError; this test just
|
24
|
+
# assures that if it *does* raise an error, the error is caught inside
|
25
|
+
end
|
26
|
+
end
|
19
27
|
end
|
20
28
|
|
21
29
|
describe "read_failed_line" do
|
@@ -32,6 +40,26 @@ describe RSpec::Core::Formatters::BaseFormatter do
|
|
32
40
|
}.should_not raise_error
|
33
41
|
end
|
34
42
|
|
43
|
+
it "deals gracefully with a security error" do
|
44
|
+
exception = mock(:Exception, :backtrace => [ "#{__FILE__}:#{__LINE__}"])
|
45
|
+
example = mock(:Example, :file_path => __FILE__)
|
46
|
+
safely do
|
47
|
+
lambda {
|
48
|
+
formatter.send(:read_failed_line, exception, example)
|
49
|
+
}.should_not raise_error
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context "when ruby reports a bogus line number in the stack trace" do
|
54
|
+
it "reports the filename and that it was unable to find the matching line" do
|
55
|
+
exception = mock(:Exception, :backtrace => [ "#{__FILE__}:10000000" ])
|
56
|
+
example = mock(:Example, :file_path => __FILE__)
|
57
|
+
|
58
|
+
msg = formatter.send(:read_failed_line, exception, example)
|
59
|
+
expect(msg).to include("Unable to find matching line")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
35
63
|
context "when String alias to_int to_i" do
|
36
64
|
before do
|
37
65
|
String.class_eval do
|
@@ -73,7 +101,7 @@ describe RSpec::Core::Formatters::BaseFormatter do
|
|
73
101
|
end
|
74
102
|
|
75
103
|
it "removes lines from rspec and lines that come before the invocation of the at_exit autorun hook" do
|
76
|
-
formatter.format_backtrace(backtrace
|
104
|
+
formatter.format_backtrace(backtrace).should eq(["./my_spec.rb:5"])
|
77
105
|
end
|
78
106
|
end
|
79
107
|
|
@@ -61,12 +61,12 @@ describe RSpec::Core::Formatters::BaseTextFormatter do
|
|
61
61
|
it "preserves ancestry" do
|
62
62
|
example = group.example("example name") { raise "something" }
|
63
63
|
run_all_and_dump_failures
|
64
|
-
example.example_group.
|
64
|
+
example.example_group.parent_groups.size.should == 1
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
68
|
context "with an exception that has an exception instance as its message" do
|
69
|
-
it "
|
69
|
+
it "does not raise NoMethodError" do
|
70
70
|
gonzo_exception = RuntimeError.new
|
71
71
|
gonzo_exception.stub(:message) { gonzo_exception }
|
72
72
|
group.example("example name") { raise gonzo_exception }
|
@@ -138,6 +138,8 @@ describe RSpec::Core::Formatters::BaseTextFormatter do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
context 'for #share_as' do
|
141
|
+
before { RSpec.stub(:warn) }
|
142
|
+
|
141
143
|
it 'outputs the name and location' do
|
142
144
|
|
143
145
|
share_as :FooBar do
|
@@ -275,6 +277,8 @@ describe RSpec::Core::Formatters::BaseTextFormatter do
|
|
275
277
|
end
|
276
278
|
|
277
279
|
context 'for #share_as' do
|
280
|
+
before { RSpec.stub(:warn) }
|
281
|
+
|
278
282
|
it 'outputs the name and location' do
|
279
283
|
|
280
284
|
share_as :FooBar2 do
|
@@ -22,6 +22,18 @@ describe RSpec::Core::Formatters::Helpers do
|
|
22
22
|
helper.format_duration(45.5).should eq("45.5 seconds")
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
context '= 61' do
|
27
|
+
it "returns 'x minute x second' formatted string" do
|
28
|
+
helper.format_duration(61).should eq("1 minute 1 second")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context '= 1' do
|
33
|
+
it "returns 'x second' formatted string" do
|
34
|
+
helper.format_duration(1).should eq("1 second")
|
35
|
+
end
|
36
|
+
end
|
25
37
|
end
|
26
38
|
|
27
39
|
describe "format seconds" do
|
@@ -0,0 +1,462 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<title>RSpec results</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
9
|
+
<meta http-equiv="Expires" content="-1" />
|
10
|
+
<meta http-equiv="Pragma" content="no-cache" />
|
11
|
+
<style type="text/css">
|
12
|
+
body {
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
background: #fff;
|
16
|
+
font-size: 80%;
|
17
|
+
}
|
18
|
+
</style>
|
19
|
+
<script type="text/javascript">
|
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
|
+
|
32
|
+
function moveProgressBar(percentDone) {
|
33
|
+
document.getElementById("rspec-header").style.width = percentDone +"%";
|
34
|
+
}
|
35
|
+
|
36
|
+
function makeRed(element_id) {
|
37
|
+
removeClass(element_id, 'passed');
|
38
|
+
removeClass(element_id, 'not_implemented');
|
39
|
+
addClass(element_id,'failed');
|
40
|
+
}
|
41
|
+
|
42
|
+
function makeYellow(element_id) {
|
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';
|
70
|
+
}
|
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
|
+
}
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
// ]]>
|
97
|
+
</script>
|
98
|
+
<style type="text/css">
|
99
|
+
#rspec-header {
|
100
|
+
background: #65C400; color: #fff; height: 4em;
|
101
|
+
}
|
102
|
+
|
103
|
+
.rspec-report h1 {
|
104
|
+
margin: 0px 10px 0px 10px;
|
105
|
+
padding: 10px;
|
106
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
107
|
+
font-size: 1.8em;
|
108
|
+
position: absolute;
|
109
|
+
}
|
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
|
+
|
121
|
+
#summary {
|
122
|
+
float:right;
|
123
|
+
padding: 5px 10px;
|
124
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
125
|
+
text-align: right;
|
126
|
+
}
|
127
|
+
|
128
|
+
#summary p {
|
129
|
+
margin: 0 0 0 2px;
|
130
|
+
}
|
131
|
+
|
132
|
+
#summary #totals {
|
133
|
+
font-size: 1.2em;
|
134
|
+
}
|
135
|
+
|
136
|
+
.example_group {
|
137
|
+
margin: 0 10px 5px;
|
138
|
+
background: #fff;
|
139
|
+
}
|
140
|
+
|
141
|
+
dl {
|
142
|
+
margin: 0; padding: 0 0 5px;
|
143
|
+
font: normal 11px "Lucida Grande", Helvetica, sans-serif;
|
144
|
+
}
|
145
|
+
|
146
|
+
dt {
|
147
|
+
padding: 3px;
|
148
|
+
background: #65C400;
|
149
|
+
color: #fff;
|
150
|
+
font-weight: bold;
|
151
|
+
}
|
152
|
+
|
153
|
+
dd {
|
154
|
+
margin: 5px 0 5px 5px;
|
155
|
+
padding: 3px 3px 3px 18px;
|
156
|
+
}
|
157
|
+
|
158
|
+
dd .duration {
|
159
|
+
padding-left: 5px;
|
160
|
+
text-align: right;
|
161
|
+
right: 0px;
|
162
|
+
float:right;
|
163
|
+
}
|
164
|
+
|
165
|
+
dd.example.passed {
|
166
|
+
border-left: 5px solid #65C400;
|
167
|
+
border-bottom: 1px solid #65C400;
|
168
|
+
background: #DBFFB4; color: #3D7700;
|
169
|
+
}
|
170
|
+
|
171
|
+
dd.example.not_implemented {
|
172
|
+
border-left: 5px solid #FAF834;
|
173
|
+
border-bottom: 1px solid #FAF834;
|
174
|
+
background: #FCFB98; color: #131313;
|
175
|
+
}
|
176
|
+
|
177
|
+
dd.example.pending_fixed {
|
178
|
+
border-left: 5px solid #0000C2;
|
179
|
+
border-bottom: 1px solid #0000C2;
|
180
|
+
color: #0000C2; background: #D3FBFF;
|
181
|
+
}
|
182
|
+
|
183
|
+
dd.example.failed {
|
184
|
+
border-left: 5px solid #C20000;
|
185
|
+
border-bottom: 1px solid #C20000;
|
186
|
+
color: #C20000; background: #FFFBD3;
|
187
|
+
}
|
188
|
+
|
189
|
+
|
190
|
+
dt.not_implemented {
|
191
|
+
color: #000000; background: #FAF834;
|
192
|
+
}
|
193
|
+
|
194
|
+
dt.pending_fixed {
|
195
|
+
color: #FFFFFF; background: #C40D0D;
|
196
|
+
}
|
197
|
+
|
198
|
+
dt.failed {
|
199
|
+
color: #FFFFFF; background: #C40D0D;
|
200
|
+
}
|
201
|
+
|
202
|
+
|
203
|
+
#rspec-header.not_implemented {
|
204
|
+
color: #000000; background: #FAF834;
|
205
|
+
}
|
206
|
+
|
207
|
+
#rspec-header.pending_fixed {
|
208
|
+
color: #FFFFFF; background: #C40D0D;
|
209
|
+
}
|
210
|
+
|
211
|
+
#rspec-header.failed {
|
212
|
+
color: #FFFFFF; background: #C40D0D;
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
.backtrace {
|
217
|
+
color: #000;
|
218
|
+
font-size: 12px;
|
219
|
+
}
|
220
|
+
|
221
|
+
a {
|
222
|
+
color: #BE5C00;
|
223
|
+
}
|
224
|
+
|
225
|
+
/* Ruby code, style similar to vibrant ink */
|
226
|
+
.ruby {
|
227
|
+
font-size: 12px;
|
228
|
+
font-family: monospace;
|
229
|
+
color: white;
|
230
|
+
background-color: black;
|
231
|
+
padding: 0.1em 0 0.2em 0;
|
232
|
+
}
|
233
|
+
|
234
|
+
.ruby .keyword { color: #FF6600; }
|
235
|
+
.ruby .constant { color: #339999; }
|
236
|
+
.ruby .attribute { color: white; }
|
237
|
+
.ruby .global { color: white; }
|
238
|
+
.ruby .module { color: white; }
|
239
|
+
.ruby .class { color: white; }
|
240
|
+
.ruby .string { color: #66FF00; }
|
241
|
+
.ruby .ident { color: white; }
|
242
|
+
.ruby .method { color: #FFCC00; }
|
243
|
+
.ruby .number { color: white; }
|
244
|
+
.ruby .char { color: white; }
|
245
|
+
.ruby .comment { color: #9933CC; }
|
246
|
+
.ruby .symbol { color: white; }
|
247
|
+
.ruby .regex { color: #44B4CC; }
|
248
|
+
.ruby .punct { color: white; }
|
249
|
+
.ruby .escape { color: white; }
|
250
|
+
.ruby .interp { color: white; }
|
251
|
+
.ruby .expr { color: white; }
|
252
|
+
|
253
|
+
.ruby .offending { background-color: gray; }
|
254
|
+
.ruby .linenum {
|
255
|
+
width: 75px;
|
256
|
+
padding: 0.1em 1em 0.2em 0;
|
257
|
+
color: #000000;
|
258
|
+
background-color: #FFFBD3;
|
259
|
+
}
|
260
|
+
|
261
|
+
</style>
|
262
|
+
</head>
|
263
|
+
<body>
|
264
|
+
<div class="rspec-report">
|
265
|
+
|
266
|
+
<div id="rspec-header">
|
267
|
+
<div id="label">
|
268
|
+
<h1>RSpec Code Examples</h1>
|
269
|
+
</div>
|
270
|
+
|
271
|
+
<div id="display-filters">
|
272
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
|
273
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
|
274
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
|
275
|
+
</div>
|
276
|
+
|
277
|
+
<div id="summary">
|
278
|
+
<p id="totals"> </p>
|
279
|
+
<p id="duration"> </p>
|
280
|
+
</div>
|
281
|
+
</div>
|
282
|
+
|
283
|
+
|
284
|
+
<div class="results">
|
285
|
+
<div id="div_group_1" class="example_group passed">
|
286
|
+
<dl style="margin-left: 0px;">
|
287
|
+
<dt id="example_group_1" class="passed">pending spec with no implementation</dt>
|
288
|
+
<script type="text/javascript">makeYellow('rspec-header');</script>
|
289
|
+
<script type="text/javascript">makeYellow('div_group_1');</script>
|
290
|
+
<script type="text/javascript">makeYellow('example_group_1');</script>
|
291
|
+
<script type="text/javascript">moveProgressBar('14.2');</script>
|
292
|
+
<dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: Not yet implemented)</span></dd>
|
293
|
+
</dl>
|
294
|
+
</div>
|
295
|
+
<div id="div_group_2" class="example_group passed">
|
296
|
+
<dl style="margin-left: 0px;">
|
297
|
+
<dt id="example_group_2" class="passed">pending command with block format</dt>
|
298
|
+
</dl>
|
299
|
+
</div>
|
300
|
+
<div id="div_group_3" class="example_group passed">
|
301
|
+
<dl style="margin-left: 15px;">
|
302
|
+
<dt id="example_group_3" class="passed">with content that would fail</dt>
|
303
|
+
<script type="text/javascript">makeYellow('rspec-header');</script>
|
304
|
+
<script type="text/javascript">makeYellow('div_group_3');</script>
|
305
|
+
<script type="text/javascript">makeYellow('example_group_3');</script>
|
306
|
+
<script type="text/javascript">moveProgressBar('28.5');</script>
|
307
|
+
<dd class="example not_implemented"><span class="not_implemented_spec_name">is pending (PENDING: No reason given)</span></dd>
|
308
|
+
</dl>
|
309
|
+
</div>
|
310
|
+
<div id="div_group_4" class="example_group passed">
|
311
|
+
<dl style="margin-left: 15px;">
|
312
|
+
<dt id="example_group_4" class="passed">with content that would pass</dt>
|
313
|
+
<script type="text/javascript">makeRed('rspec-header');</script>
|
314
|
+
<script type="text/javascript">makeRed('div_group_4');</script>
|
315
|
+
<script type="text/javascript">makeRed('example_group_4');</script>
|
316
|
+
<script type="text/javascript">moveProgressBar('42.8');</script>
|
317
|
+
<dd class="example pending_fixed">
|
318
|
+
<span class="failed_spec_name">fails</span>
|
319
|
+
<span class="duration">n.nnnns</span>
|
320
|
+
<div class="failure" id="failure_1">
|
321
|
+
<div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
|
322
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `__script__'
|
323
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
324
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
325
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
326
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
327
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:31:in `Formatters'
|
328
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
329
|
+
kernel/common/hash18.rb:196:in `fetch'
|
330
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'
|
331
|
+
kernel/common/io.rb:255:in `open'
|
332
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'
|
333
|
+
kernel/common/dir.rb:70:in `chdir'
|
334
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:52:in `Formatters'
|
335
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
336
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
337
|
+
kernel/common/eval18.rb:106:in `instance_exec'
|
338
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
339
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
340
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
341
|
+
kernel/loader.rb:696:in `run_at_exits'
|
342
|
+
kernel/loader.rb:716:in `epilogue'
|
343
|
+
kernel/loader.rb:849:in `main'</pre></div>
|
344
|
+
<pre class="ruby"><code><span class="linenum">16</span> <span class="ident">context</span> <span class="punct">"</span><span class="string">with content that would pass</span><span class="punct">"</span> <span class="keyword">do</span>
|
345
|
+
<span class="linenum">17</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
|
346
|
+
<span class="offending"><span class="linenum">18</span> <span class="ident">pending</span> <span class="keyword">do</span></span>
|
347
|
+
<span class="linenum">19</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">1</span><span class="punct">)</span>
|
348
|
+
<span class="linenum">20</span> <span class="keyword">end</span></code></pre>
|
349
|
+
</div>
|
350
|
+
</dd>
|
351
|
+
</dl>
|
352
|
+
</div>
|
353
|
+
<div id="div_group_5" class="example_group passed">
|
354
|
+
<dl style="margin-left: 0px;">
|
355
|
+
<dt id="example_group_5" class="passed">passing spec</dt>
|
356
|
+
<script type="text/javascript">moveProgressBar('57.1');</script>
|
357
|
+
<dd class="example passed"><span class="passed_spec_name">passes</span><span class='duration'>n.nnnns</span></dd>
|
358
|
+
</dl>
|
359
|
+
</div>
|
360
|
+
<div id="div_group_6" class="example_group passed">
|
361
|
+
<dl style="margin-left: 0px;">
|
362
|
+
<dt id="example_group_6" class="passed">failing spec</dt>
|
363
|
+
<script type="text/javascript">makeRed('div_group_6');</script>
|
364
|
+
<script type="text/javascript">makeRed('example_group_6');</script>
|
365
|
+
<script type="text/javascript">moveProgressBar('71.4');</script>
|
366
|
+
<dd class="example failed">
|
367
|
+
<span class="failed_spec_name">fails</span>
|
368
|
+
<span class="duration">n.nnnns</span>
|
369
|
+
<div class="failure" id="failure_2">
|
370
|
+
<div class="message"><pre>
|
371
|
+
expected: 2
|
372
|
+
got: 1
|
373
|
+
|
374
|
+
(compared using ==)
|
375
|
+
</pre></div>
|
376
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `__script__'
|
377
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
378
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
379
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
380
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:31:in `Formatters'
|
381
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
382
|
+
kernel/common/hash18.rb:196:in `fetch'
|
383
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'
|
384
|
+
kernel/common/io.rb:255:in `open'
|
385
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'
|
386
|
+
kernel/common/dir.rb:70:in `chdir'
|
387
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:52:in `Formatters'
|
388
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
389
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
390
|
+
kernel/common/eval18.rb:106:in `instance_exec'
|
391
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
392
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
393
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
394
|
+
kernel/loader.rb:696:in `run_at_exits'
|
395
|
+
kernel/loader.rb:716:in `epilogue'
|
396
|
+
kernel/loader.rb:849:in `main'</pre></div>
|
397
|
+
<pre class="ruby"><code><span class="linenum">31</span><span class="ident">describe</span> <span class="punct">"</span><span class="string">failing spec</span><span class="punct">"</span> <span class="keyword">do</span>
|
398
|
+
<span class="linenum">32</span> <span class="ident">it</span> <span class="punct">"</span><span class="string">fails</span><span class="punct">"</span> <span class="keyword">do</span>
|
399
|
+
<span class="offending"><span class="linenum">33</span> <span class="number">1</span><span class="punct">.</span><span class="ident">should</span> <span class="ident">eq</span><span class="punct">(</span><span class="number">2</span><span class="punct">)</span></span>
|
400
|
+
<span class="linenum">34</span> <span class="keyword">end</span>
|
401
|
+
<span class="linenum">35</span><span class="keyword">end</span></code></pre>
|
402
|
+
</div>
|
403
|
+
</dd>
|
404
|
+
</dl>
|
405
|
+
</div>
|
406
|
+
<div id="div_group_7" class="example_group passed">
|
407
|
+
<dl style="margin-left: 0px;">
|
408
|
+
<dt id="example_group_7" class="passed">a failing spec with odd backtraces</dt>
|
409
|
+
<script type="text/javascript">makeRed('div_group_7');</script>
|
410
|
+
<script type="text/javascript">makeRed('example_group_7');</script>
|
411
|
+
<script type="text/javascript">moveProgressBar('85.7');</script>
|
412
|
+
<dd class="example failed">
|
413
|
+
<span class="failed_spec_name">fails with a backtrace that has no file</span>
|
414
|
+
<span class="duration">n.nnnns</span>
|
415
|
+
<div class="failure" id="failure_3">
|
416
|
+
<div class="message"><pre>foo</pre></div>
|
417
|
+
<div class="backtrace"><pre>(erb):1:in `__script__'
|
418
|
+
kernel/common/block_environment.rb:75:in `call_on_instance'
|
419
|
+
kernel/common/eval.rb:75:in `eval'
|
420
|
+
/Users/alindeman/.rvm/rubies/rbx-head/lib/18/erb.rb:719:in `result'
|
421
|
+
./spec/rspec/core/resources/formatter_specs.rb:41:in `__script__'
|
422
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
423
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
424
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
425
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:31:in `Formatters'
|
426
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
427
|
+
kernel/common/hash18.rb:196:in `fetch'
|
428
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'
|
429
|
+
kernel/common/io.rb:255:in `open'
|
430
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:53:in `Formatters'
|
431
|
+
kernel/common/dir.rb:70:in `chdir'
|
432
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:52:in `Formatters'
|
433
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
434
|
+
kernel/common/eval18.rb:45:in `instance_eval'
|
435
|
+
kernel/common/eval18.rb:106:in `instance_exec'
|
436
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
437
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
438
|
+
kernel/bootstrap/array18.rb:18:in `map'
|
439
|
+
kernel/loader.rb:696:in `run_at_exits'
|
440
|
+
kernel/loader.rb:716:in `epilogue'
|
441
|
+
kernel/loader.rb:849:in `main'</pre></div>
|
442
|
+
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
443
|
+
</div>
|
444
|
+
</dd>
|
445
|
+
<script type="text/javascript">moveProgressBar('100.0');</script>
|
446
|
+
<dd class="example failed">
|
447
|
+
<span class="failed_spec_name">fails with a backtrace containing an erb file</span>
|
448
|
+
<span class="duration">n.nnnns</span>
|
449
|
+
<div class="failure" id="failure_4">
|
450
|
+
<div class="message"><pre>Exception</pre></div>
|
451
|
+
<div class="backtrace"><pre>/foo.html.erb:1:in `<main>': foo (RuntimeError)</pre></div>
|
452
|
+
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
|
453
|
+
</div>
|
454
|
+
</dd>
|
455
|
+
</dl>
|
456
|
+
</div>
|
457
|
+
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
|
458
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 2 pending";</script>
|
459
|
+
</div>
|
460
|
+
</div>
|
461
|
+
</body>
|
462
|
+
</html>
|