rspec-core 3.0.0.beta1 → 3.0.0.beta2
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.tar.gz.sig +0 -0
- data/Changelog.md +137 -0
- data/README.md +2 -2
- data/exe/rspec +2 -23
- data/features/README.md +1 -5
- data/features/command_line/README.md +7 -10
- data/features/command_line/exit_status.feature +1 -1
- data/features/command_line/format_option.feature +1 -1
- data/features/command_line/init.feature +40 -1
- data/features/command_line/line_number_option.feature +2 -2
- data/features/command_line/ruby.feature +5 -4
- data/features/configuration/enable_global_dsl.feature +54 -0
- data/features/example_groups/aliasing.feature +48 -0
- data/features/example_groups/basic_structure.feature +1 -1
- data/features/expectation_framework_integration/configure_expectation_framework.feature +1 -1
- data/features/filtering/if_and_unless.feature +0 -30
- data/features/formatters/custom_formatter.feature +32 -0
- data/features/formatters/regression_tests.feature +95 -0
- data/features/hooks/around_hooks.feature +1 -0
- data/features/hooks/before_and_after_hooks.feature +2 -2
- data/features/mock_framework_integration/use_flexmock.feature +11 -13
- data/features/mock_framework_integration/use_mocha.feature +11 -13
- data/features/mock_framework_integration/use_rr.feature +11 -13
- data/features/mock_framework_integration/use_rspec.feature +11 -13
- data/features/pending_and_skipped_examples/README.md +3 -0
- data/features/pending_and_skipped_examples/pending_examples.feature +118 -0
- data/features/pending_and_skipped_examples/skipped_examples.feature +106 -0
- data/features/step_definitions/additional_cli_steps.rb +34 -0
- data/features/subject/explicit_subject.feature +1 -1
- data/features/subject/one_liner_syntax.feature +71 -0
- data/lib/rspec/core.rb +6 -14
- data/lib/rspec/core/backtrace_formatter.rb +16 -4
- data/lib/rspec/core/command_line.rb +2 -3
- data/lib/rspec/core/configuration.rb +114 -125
- data/lib/rspec/core/configuration_options.rb +32 -18
- data/lib/rspec/core/dsl.rb +80 -18
- data/lib/rspec/core/example.rb +84 -33
- data/lib/rspec/core/example_group.rb +95 -43
- data/lib/rspec/core/filter_manager.rb +31 -40
- data/lib/rspec/core/formatters.rb +137 -0
- data/lib/rspec/core/formatters/base_formatter.rb +28 -41
- data/lib/rspec/core/formatters/base_text_formatter.rb +26 -37
- data/lib/rspec/core/formatters/deprecation_formatter.rb +48 -27
- data/lib/rspec/core/formatters/documentation_formatter.rb +27 -22
- data/lib/rspec/core/formatters/html_formatter.rb +48 -56
- data/lib/rspec/core/formatters/html_printer.rb +11 -18
- data/lib/rspec/core/formatters/json_formatter.rb +18 -22
- data/lib/rspec/core/formatters/legacy_formatter.rb +227 -0
- data/lib/rspec/core/formatters/progress_formatter.rb +7 -10
- data/lib/rspec/core/hooks.rb +250 -217
- data/lib/rspec/core/memoized_helpers.rb +43 -9
- data/lib/rspec/core/mocking_adapters/flexmock.rb +29 -0
- data/lib/rspec/core/{mocking/with_mocha.rb → mocking_adapters/mocha.rb} +19 -16
- data/lib/rspec/core/mocking_adapters/null.rb +12 -0
- data/lib/rspec/core/mocking_adapters/rr.rb +28 -0
- data/lib/rspec/core/mocking_adapters/rspec.rb +30 -0
- data/lib/rspec/core/notifications.rb +100 -0
- data/lib/rspec/core/option_parser.rb +11 -18
- data/lib/rspec/core/pending.rb +78 -47
- data/lib/rspec/core/project_initializer.rb +2 -49
- data/lib/rspec/core/project_initializer/dot_rspec +3 -0
- data/lib/rspec/core/project_initializer/spec_helper.rb +82 -0
- data/lib/rspec/core/rake_task.rb +5 -14
- data/lib/rspec/core/reporter.rb +24 -32
- data/lib/rspec/core/ruby_project.rb +1 -1
- data/lib/rspec/core/runner.rb +14 -4
- data/lib/rspec/core/shared_example_group.rb +40 -13
- data/lib/rspec/core/version.rb +1 -1
- data/spec/command_line/order_spec.rb +15 -15
- data/spec/rspec/core/backtrace_formatter_spec.rb +15 -1
- data/spec/rspec/core/command_line_spec.rb +18 -17
- data/spec/rspec/core/configuration_options_spec.rb +57 -34
- data/spec/rspec/core/configuration_spec.rb +162 -184
- data/spec/rspec/core/drb_command_line_spec.rb +5 -7
- data/spec/rspec/core/drb_options_spec.rb +2 -2
- data/spec/rspec/core/dsl_spec.rb +79 -15
- data/spec/rspec/core/example_group_spec.rb +253 -39
- data/spec/rspec/core/example_spec.rb +149 -33
- data/spec/rspec/core/filter_manager_spec.rb +9 -26
- data/spec/rspec/core/formatters/base_formatter_spec.rb +2 -5
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +42 -145
- data/spec/rspec/core/formatters/deprecation_formatter_spec.rb +64 -34
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +15 -28
- data/spec/rspec/core/formatters/helpers_spec.rb +2 -2
- data/spec/rspec/core/formatters/{html_formatted-1.8.7.html → html_formatted-2.1.0.html} +22 -44
- data/spec/rspec/core/formatters/{html_formatted-1.8.7-jruby.html → html_formatted.html} +30 -49
- data/spec/rspec/core/formatters/html_formatter_spec.rb +35 -19
- data/spec/rspec/core/formatters/json_formatter_spec.rb +42 -40
- data/spec/rspec/core/formatters/legacy_formatter_spec.rb +137 -0
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +38 -25
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +1 -1
- data/spec/rspec/core/formatters_spec.rb +120 -0
- data/spec/rspec/core/hooks_filtering_spec.rb +1 -1
- data/spec/rspec/core/hooks_spec.rb +13 -2
- data/spec/rspec/core/memoized_helpers_spec.rb +17 -8
- data/spec/rspec/core/metadata_spec.rb +3 -3
- data/spec/rspec/core/option_parser_spec.rb +53 -46
- data/spec/rspec/core/ordering_spec.rb +4 -4
- data/spec/rspec/core/pending_example_spec.rb +23 -126
- data/spec/rspec/core/pending_spec.rb +8 -0
- data/spec/rspec/core/project_initializer_spec.rb +8 -41
- data/spec/rspec/core/rake_task_spec.rb +15 -4
- data/spec/rspec/core/random_spec.rb +1 -1
- data/spec/rspec/core/reporter_spec.rb +50 -37
- data/spec/rspec/core/resources/formatter_specs.rb +9 -11
- data/spec/rspec/core/rspec_matchers_spec.rb +1 -1
- data/spec/rspec/core/ruby_project_spec.rb +3 -3
- data/spec/rspec/core/runner_spec.rb +65 -23
- data/spec/rspec/core/shared_context_spec.rb +4 -4
- data/spec/rspec/core/shared_example_group/collection_spec.rb +1 -1
- data/spec/rspec/core/shared_example_group_spec.rb +20 -11
- data/spec/rspec/core/warnings_spec.rb +1 -1
- data/spec/rspec/core/world_spec.rb +10 -10
- data/spec/rspec/core_spec.rb +2 -2
- data/spec/spec_helper.rb +12 -24
- data/spec/support/config_options_helper.rb +1 -3
- data/spec/support/formatter_support.rb +83 -0
- data/spec/support/isolate_load_path_mutation.rb +1 -2
- data/spec/support/isolated_directory.rb +1 -1
- data/spec/support/isolated_home_directory.rb +1 -1
- data/spec/support/legacy_formatter_using_sub_classing_example.rb +87 -0
- data/spec/support/matchers.rb +20 -0
- data/spec/support/mathn_integration_support.rb +2 -2
- data/spec/support/old_style_formatter_example.rb +69 -0
- data/spec/support/shared_example_groups.rb +1 -1
- data/spec/support/spec_files.rb +3 -3
- metadata +192 -69
- metadata.gz.sig +3 -1
- checksums.yaml +0 -15
- checksums.yaml.gz.sig +0 -2
- data/features/configuration/show_failures_in_pending_blocks.feature +0 -61
- data/features/pending/pending_examples.feature +0 -229
- data/features/subject/implicit_receiver.feature +0 -29
- data/lib/rspec/core/mocking/with_absolutely_nothing.rb +0 -11
- data/lib/rspec/core/mocking/with_flexmock.rb +0 -27
- data/lib/rspec/core/mocking/with_rr.rb +0 -27
- data/lib/rspec/core/mocking/with_rspec.rb +0 -27
- data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +0 -477
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +0 -425
- data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +0 -416
- data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +0 -477
- data/spec/rspec/core/formatters/html_formatted-1.9.3.html +0 -419
- data/spec/rspec/core/formatters/html_formatted-2.0.0.html +0 -425
- data/spec/support/in_sub_process.rb +0 -37
- data/spec/support/sandboxed_mock_space.rb +0 -100
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
|
+
require 'rspec/core/reporter'
|
|
2
3
|
require 'rspec/core/formatters/deprecation_formatter'
|
|
3
4
|
require 'tempfile'
|
|
4
5
|
|
|
5
6
|
module RSpec::Core::Formatters
|
|
6
|
-
describe DeprecationFormatter do
|
|
7
|
+
RSpec.describe DeprecationFormatter do
|
|
8
|
+
include FormatterSupport
|
|
9
|
+
|
|
10
|
+
let(:summary_stream) { StringIO.new }
|
|
11
|
+
|
|
12
|
+
def notification(hash)
|
|
13
|
+
::RSpec::Core::Notifications::DeprecationNotification.from_hash(hash)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
before do
|
|
17
|
+
setup_reporter deprecation_stream, summary_stream
|
|
18
|
+
end
|
|
19
|
+
|
|
7
20
|
describe "#deprecation" do
|
|
8
|
-
let(:formatter) { DeprecationFormatter.new(deprecation_stream, summary_stream) }
|
|
9
|
-
let(:summary_stream) { StringIO.new }
|
|
10
21
|
|
|
11
|
-
context "with a File deprecation_stream" do
|
|
22
|
+
context "with a File deprecation_stream", :slow do
|
|
12
23
|
let(:deprecation_stream) { File.open("#{Dir.tmpdir}/deprecation_summary_example_output", "w+") }
|
|
13
24
|
|
|
14
25
|
it "prints a message if provided, ignoring other data" do
|
|
15
|
-
|
|
26
|
+
send_notification :deprecation, notification(:message => "this message", :deprecated => "x", :replacement => "y", :call_site => "z")
|
|
16
27
|
deprecation_stream.rewind
|
|
17
28
|
expect(deprecation_stream.read).to eq "this message\n"
|
|
18
29
|
end
|
|
19
30
|
|
|
20
31
|
it "includes the method" do
|
|
21
|
-
|
|
32
|
+
send_notification :deprecation, notification(:deprecated => "i_am_deprecated")
|
|
22
33
|
deprecation_stream.rewind
|
|
23
34
|
expect(deprecation_stream.read).to match(/i_am_deprecated is deprecated/)
|
|
24
35
|
end
|
|
25
36
|
|
|
26
37
|
it "includes the replacement" do
|
|
27
|
-
|
|
38
|
+
send_notification :deprecation, notification(:replacement => "use_me")
|
|
28
39
|
deprecation_stream.rewind
|
|
29
40
|
expect(deprecation_stream.read).to match(/Use use_me instead/)
|
|
30
41
|
end
|
|
31
42
|
|
|
32
43
|
it "includes the call site if provided" do
|
|
33
|
-
|
|
44
|
+
send_notification :deprecation, notification(:call_site => "somewhere")
|
|
34
45
|
deprecation_stream.rewind
|
|
35
46
|
expect(deprecation_stream.read).to match(/Called from somewhere/)
|
|
36
47
|
end
|
|
@@ -40,60 +51,79 @@ module RSpec::Core::Formatters
|
|
|
40
51
|
let(:deprecation_stream) { StringIO.new }
|
|
41
52
|
|
|
42
53
|
it "prints nothing" do
|
|
43
|
-
5.times {
|
|
54
|
+
5.times { send_notification :deprecation, notification(:deprecated => 'i_am_deprecated') }
|
|
44
55
|
expect(deprecation_stream.string).to eq ""
|
|
45
56
|
end
|
|
46
57
|
end
|
|
47
58
|
end
|
|
48
59
|
|
|
49
60
|
describe "#deprecation_summary" do
|
|
50
|
-
let(:
|
|
51
|
-
let(:summary_stream) { StringIO.new }
|
|
61
|
+
let(:summary) { double }
|
|
52
62
|
|
|
53
|
-
context "with a File deprecation_stream" do
|
|
63
|
+
context "with a File deprecation_stream", :slow do
|
|
54
64
|
let(:deprecation_stream) { File.open("#{Dir.tmpdir}/deprecation_summary_example_output", "w") }
|
|
55
65
|
|
|
56
66
|
it "prints a count of the deprecations" do
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
send_notification :deprecation, notification(:deprecated => 'i_am_deprecated')
|
|
68
|
+
send_notification :deprecation_summary, null_notification
|
|
59
69
|
expect(summary_stream.string).to match(/1 deprecation logged to .*deprecation_summary_example_output/)
|
|
60
70
|
end
|
|
61
71
|
|
|
62
72
|
it "pluralizes the reported deprecation count for more than one deprecation" do
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
send_notification :deprecation, notification(:deprecated => 'i_am_deprecated')
|
|
74
|
+
send_notification :deprecation, notification(:deprecated => 'i_am_deprecated_also')
|
|
75
|
+
send_notification :deprecation_summary, null_notification
|
|
66
76
|
expect(summary_stream.string).to match(/2 deprecations/)
|
|
67
77
|
end
|
|
68
78
|
|
|
69
79
|
it "is not printed when there are no deprecations" do
|
|
70
|
-
|
|
80
|
+
send_notification :deprecation_summary, null_notification
|
|
71
81
|
expect(summary_stream.string).to eq ""
|
|
72
82
|
end
|
|
73
83
|
|
|
74
84
|
it 'uses synchronized/non-buffered output to work around odd duplicate output behavior we have observed' do
|
|
75
85
|
expect {
|
|
76
|
-
|
|
86
|
+
send_notification :deprecation, notification(:deprecated => 'foo')
|
|
77
87
|
}.to change { deprecation_stream.sync }.from(false).to(true)
|
|
78
88
|
end
|
|
79
89
|
|
|
80
90
|
it 'does not print duplicate messages' do
|
|
81
|
-
3.times {
|
|
82
|
-
|
|
91
|
+
3.times { send_notification :deprecation, notification(:deprecated => 'foo') }
|
|
92
|
+
send_notification :deprecation_summary, null_notification
|
|
83
93
|
|
|
84
94
|
expect(summary_stream.string).to match(/1 deprecation/)
|
|
85
95
|
expect(File.read(deprecation_stream.path)).to eq("foo is deprecated.\n#{DeprecationFormatter::RAISE_ERROR_CONFIG_NOTICE}")
|
|
86
96
|
end
|
|
87
97
|
end
|
|
88
98
|
|
|
99
|
+
context "with an Error deprecation_stream" do
|
|
100
|
+
let(:deprecation_stream) { DeprecationFormatter::RaiseErrorStream.new }
|
|
101
|
+
|
|
102
|
+
it 'prints a summary of the number of deprecations found' do
|
|
103
|
+
expect { send_notification :deprecation, notification(:deprecated => 'foo') }.to raise_error(RSpec::Core::DeprecationError)
|
|
104
|
+
send_notification :deprecation_summary, null_notification
|
|
105
|
+
|
|
106
|
+
expect(summary_stream.string).to eq("\n1 deprecation found.\n")
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it 'pluralizes the count when it is greater than 1' do
|
|
110
|
+
expect { send_notification :deprecation, notification(:deprecated => 'foo') }.to raise_error(RSpec::Core::DeprecationError)
|
|
111
|
+
expect { send_notification :deprecation, notification(:deprecated => 'bar') }.to raise_error(RSpec::Core::DeprecationError)
|
|
112
|
+
|
|
113
|
+
send_notification :deprecation_summary, null_notification
|
|
114
|
+
|
|
115
|
+
expect(summary_stream.string).to eq("\n2 deprecations found.\n")
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
89
119
|
context "with an IO deprecation_stream" do
|
|
90
120
|
let(:deprecation_stream) { StringIO.new }
|
|
91
121
|
|
|
92
122
|
it "groups similar deprecations together" do
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
123
|
+
send_notification :deprecation, notification(:deprecated => 'i_am_deprecated', :call_site => "foo.rb:1")
|
|
124
|
+
send_notification :deprecation, notification(:deprecated => 'i_am_a_different_deprecation')
|
|
125
|
+
send_notification :deprecation, notification(:deprecated => 'i_am_deprecated', :call_site => "foo.rb:2")
|
|
126
|
+
send_notification :deprecation_summary, null_notification
|
|
97
127
|
|
|
98
128
|
expected = <<-EOS.gsub(/^\s+\|/, '')
|
|
99
129
|
|
|
|
@@ -110,8 +140,8 @@ module RSpec::Core::Formatters
|
|
|
110
140
|
end
|
|
111
141
|
|
|
112
142
|
it "limits the deprecation warnings after 3 calls" do
|
|
113
|
-
5.times { |i|
|
|
114
|
-
|
|
143
|
+
5.times { |i| send_notification :deprecation, notification(:deprecated => 'i_am_deprecated', :call_site => "foo.rb:#{i + 1}") }
|
|
144
|
+
send_notification :deprecation_summary, null_notification
|
|
115
145
|
expected = <<-EOS.gsub(/^\s+\|/, '')
|
|
116
146
|
|
|
|
117
147
|
|Deprecation Warnings:
|
|
@@ -129,9 +159,9 @@ module RSpec::Core::Formatters
|
|
|
129
159
|
it "limits :message deprecation warnings with different callsites after 3 calls" do
|
|
130
160
|
5.times do |n|
|
|
131
161
|
message = "This is a long string with some callsite info: /path/#{n}/to/some/file.rb:2#{n}3. And some more stuff can come after."
|
|
132
|
-
|
|
162
|
+
send_notification :deprecation, notification(:message => message)
|
|
133
163
|
end
|
|
134
|
-
|
|
164
|
+
send_notification :deprecation_summary, null_notification
|
|
135
165
|
expected = <<-EOS.gsub(/^\s+\|/, '')
|
|
136
166
|
|
|
|
137
167
|
|Deprecation Warnings:
|
|
@@ -147,17 +177,17 @@ module RSpec::Core::Formatters
|
|
|
147
177
|
end
|
|
148
178
|
|
|
149
179
|
it "prints the true deprecation count to the summary_stream" do
|
|
150
|
-
5.times { |i|
|
|
180
|
+
5.times { |i| send_notification :deprecation, notification(:deprecated => 'i_am_deprecated', :call_site => "foo.rb:#{i + 1}") }
|
|
151
181
|
5.times do |n|
|
|
152
|
-
|
|
182
|
+
send_notification :deprecation, notification(:message => "callsite info: /path/#{n}/to/some/file.rb:2#{n}3. And some more stuff")
|
|
153
183
|
end
|
|
154
|
-
|
|
184
|
+
send_notification :deprecation_summary, null_notification
|
|
155
185
|
expect(summary_stream.string).to match(/10 deprecation warnings total/)
|
|
156
186
|
end
|
|
157
187
|
|
|
158
188
|
it 'does not print duplicate messages' do
|
|
159
|
-
3.times {
|
|
160
|
-
|
|
189
|
+
3.times { send_notification :deprecation, notification(:deprecated => 'foo') }
|
|
190
|
+
send_notification :deprecation_summary, null_notification
|
|
161
191
|
|
|
162
192
|
expect(summary_stream.string).to match(/1 deprecation/)
|
|
163
193
|
|
|
@@ -2,37 +2,29 @@ require 'spec_helper'
|
|
|
2
2
|
require 'rspec/core/formatters/documentation_formatter'
|
|
3
3
|
|
|
4
4
|
module RSpec::Core::Formatters
|
|
5
|
-
describe DocumentationFormatter do
|
|
6
|
-
|
|
5
|
+
RSpec.describe DocumentationFormatter do
|
|
6
|
+
include FormatterSupport
|
|
7
|
+
|
|
8
|
+
before do
|
|
9
|
+
send_notification :start, count_notification(2)
|
|
10
|
+
allow(formatter).to receive(:color_enabled?).and_return(false)
|
|
11
|
+
end
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
it "numbers the failures" do
|
|
14
|
+
send_notification :example_failed, example_notification( double("example 1",
|
|
10
15
|
:description => "first example",
|
|
11
16
|
:execution_result => {:status => 'failed', :exception => Exception.new }
|
|
12
|
-
)
|
|
13
|
-
|
|
17
|
+
))
|
|
18
|
+
send_notification :example_failed, example_notification( double("example 2",
|
|
14
19
|
:description => "second example",
|
|
15
20
|
:execution_result => {:status => 'failed', :exception => Exception.new }
|
|
16
|
-
)
|
|
17
|
-
]
|
|
18
|
-
|
|
19
|
-
output = StringIO.new
|
|
20
|
-
RSpec.configuration.stub(:color_enabled?) { false }
|
|
21
|
-
|
|
22
|
-
formatter = RSpec::Core::Formatters::DocumentationFormatter.new(output)
|
|
23
|
-
|
|
24
|
-
examples.each {|e| formatter.example_failed(e) }
|
|
21
|
+
))
|
|
25
22
|
|
|
26
23
|
expect(output.string).to match(/first example \(FAILED - 1\)/m)
|
|
27
24
|
expect(output.string).to match(/second example \(FAILED - 2\)/m)
|
|
28
25
|
end
|
|
29
26
|
|
|
30
27
|
it "represents nested group using hierarchy tree" do
|
|
31
|
-
output = StringIO.new
|
|
32
|
-
RSpec.configuration.stub(:color_enabled?) { false }
|
|
33
|
-
|
|
34
|
-
formatter = RSpec::Core::Formatters::DocumentationFormatter.new(output)
|
|
35
|
-
|
|
36
28
|
group = RSpec::Core::ExampleGroup.describe("root")
|
|
37
29
|
context1 = group.describe("context 1")
|
|
38
30
|
context1.example("nested example 1.1"){}
|
|
@@ -46,7 +38,7 @@ module RSpec::Core::Formatters
|
|
|
46
38
|
context2.example("nested example 2.1"){}
|
|
47
39
|
context2.example("nested example 2.2"){}
|
|
48
40
|
|
|
49
|
-
group.run(
|
|
41
|
+
group.run(reporter)
|
|
50
42
|
|
|
51
43
|
expect(output.string).to eql("
|
|
52
44
|
root
|
|
@@ -63,18 +55,13 @@ root
|
|
|
63
55
|
end
|
|
64
56
|
|
|
65
57
|
it "strips whitespace for each row" do
|
|
66
|
-
output = StringIO.new
|
|
67
|
-
RSpec.configuration.stub(:color_enabled?) { false }
|
|
68
|
-
|
|
69
|
-
formatter = RSpec::Core::Formatters::DocumentationFormatter.new(output)
|
|
70
|
-
|
|
71
58
|
group = RSpec::Core::ExampleGroup.describe(" root ")
|
|
72
59
|
context1 = group.describe(" nested ")
|
|
73
60
|
context1.example(" example 1 ") {}
|
|
74
|
-
context1.example(" example 2 ", :pending => true){}
|
|
61
|
+
context1.example(" example 2 ", :pending => true){ fail }
|
|
75
62
|
context1.example(" example 3 ") { fail }
|
|
76
63
|
|
|
77
|
-
group.run(
|
|
64
|
+
group.run(reporter)
|
|
78
65
|
|
|
79
66
|
expect(output.string).to eql("
|
|
80
67
|
root
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
require 'rspec/core/formatters/helpers'
|
|
3
3
|
|
|
4
|
-
describe RSpec::Core::Formatters::Helpers do
|
|
4
|
+
RSpec.describe RSpec::Core::Formatters::Helpers do
|
|
5
5
|
let(:helper) { Object.new.extend(RSpec::Core::Formatters::Helpers) }
|
|
6
6
|
|
|
7
7
|
describe "format duration" do
|
|
@@ -50,7 +50,7 @@ describe RSpec::Core::Formatters::Helpers do
|
|
|
50
50
|
context 'with mathn loaded' do
|
|
51
51
|
include MathnIntegrationSupport
|
|
52
52
|
|
|
53
|
-
it "returns 'x minutes xx.x seconds' formatted string" do
|
|
53
|
+
it "returns 'x minutes xx.x seconds' formatted string", :slow do
|
|
54
54
|
with_mathn_loaded do
|
|
55
55
|
expect(helper.format_duration(133.7)).to eq("2 minutes 13.7 seconds")
|
|
56
56
|
end
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
<html lang='en'>
|
|
1
|
+
<html lang="en">
|
|
3
2
|
<head>
|
|
4
3
|
<title>RSpec results</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"
|
|
6
|
-
<meta http-equiv="Expires" content="-1"
|
|
7
|
-
<meta http-equiv="Pragma" content="no-cache"
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
+
<meta http-equiv="Expires" content="-1">
|
|
6
|
+
<meta http-equiv="Pragma" content="no-cache">
|
|
8
7
|
<style type="text/css">
|
|
9
8
|
body {
|
|
10
9
|
margin: 0;
|
|
@@ -266,14 +265,14 @@ a {
|
|
|
266
265
|
</div>
|
|
267
266
|
|
|
268
267
|
<div id="display-filters">
|
|
269
|
-
<input id="passed_checkbox"
|
|
270
|
-
<input id="failed_checkbox"
|
|
271
|
-
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked
|
|
268
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
|
|
269
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
|
|
270
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
|
|
272
271
|
</div>
|
|
273
272
|
|
|
274
273
|
<div id="summary">
|
|
275
|
-
<p id="totals"
|
|
276
|
-
<p id="duration"
|
|
274
|
+
<p id="totals"> </p>
|
|
275
|
+
<p id="duration"> </p>
|
|
277
276
|
</div>
|
|
278
277
|
</div>
|
|
279
278
|
|
|
@@ -297,11 +296,8 @@ a {
|
|
|
297
296
|
<div id="div_group_3" class="example_group passed">
|
|
298
297
|
<dl style="margin-left: 15px;">
|
|
299
298
|
<dt id="example_group_3" class="passed">with content that would fail</dt>
|
|
300
|
-
<script type="text/javascript">makeYellow('rspec-header');</script>
|
|
301
|
-
<script type="text/javascript">makeYellow('div_group_3');</script>
|
|
302
|
-
<script type="text/javascript">makeYellow('example_group_3');</script>
|
|
303
299
|
<script type="text/javascript">moveProgressBar('28.5');</script>
|
|
304
|
-
<dd class="example
|
|
300
|
+
<dd class="example passed"><span class="passed_spec_name">is pending</span><span class='duration'>n.nnnns</span></dd>
|
|
305
301
|
</dl>
|
|
306
302
|
</div>
|
|
307
303
|
<div id="div_group_4" class="example_group passed">
|
|
@@ -316,19 +312,9 @@ a {
|
|
|
316
312
|
<span class="duration">n.nnnns</span>
|
|
317
313
|
<div class="failure" id="failure_1">
|
|
318
314
|
<div class="message"><pre>RSpec::Core::Pending::PendingExampleFixedError</pre></div>
|
|
319
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
./spec/support/sandboxed_mock_space.rb:32:in `run'
|
|
323
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `generated_html'
|
|
324
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:59
|
|
325
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
|
|
326
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:59
|
|
327
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
|
|
328
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:58
|
|
329
|
-
./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
|
|
330
|
-
<pre class="ruby"><code><span class="linenum">16</span> context <span class="string"><span class="delimiter">"</span><span class="content">with content that would pass</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
331
|
-
<span class="linenum">17</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
315
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18</pre></div>
|
|
316
|
+
<pre class="ruby"><code><span class="linenum">16</span> context <span class="string"><span class="delimiter">"</span><span class="content">with content that would pass</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
317
|
+
<span class="linenum">17</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
332
318
|
<span class="offending"><span class="linenum">18</span> pending <span class="keyword">do</span></span>
|
|
333
319
|
<span class="linenum">19</span> expect(<span class="integer">1</span>).to eq(<span class="integer">1</span>)
|
|
334
320
|
<span class="linenum">20</span> <span class="keyword">end</span></code></pre>
|
|
@@ -340,7 +326,9 @@ a {
|
|
|
340
326
|
<dl style="margin-left: 0px;">
|
|
341
327
|
<dt id="example_group_5" class="passed">passing spec</dt>
|
|
342
328
|
<script type="text/javascript">moveProgressBar('57.1');</script>
|
|
343
|
-
<dd class="example passed"
|
|
329
|
+
<dd class="example passed">
|
|
330
|
+
<span class="passed_spec_name">passes</span><span class="duration">n.nnnns</span>
|
|
331
|
+
</dd>
|
|
344
332
|
</dl>
|
|
345
333
|
</div>
|
|
346
334
|
<div id="div_group_6" class="example_group passed">
|
|
@@ -359,19 +347,9 @@ expected: 2
|
|
|
359
347
|
|
|
360
348
|
(compared using ==)
|
|
361
349
|
</pre></div>
|
|
362
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
./spec/support/sandboxed_mock_space.rb:32:in `run'
|
|
366
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `generated_html'
|
|
367
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:59
|
|
368
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:59:in `open'
|
|
369
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:59
|
|
370
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:58:in `chdir'
|
|
371
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:58
|
|
372
|
-
./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
|
|
373
|
-
<pre class="ruby"><code><span class="linenum">31</span>describe <span class="string"><span class="delimiter">"</span><span class="content">failing spec</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
374
|
-
<span class="linenum">32</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
350
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33</pre></div>
|
|
351
|
+
<pre class="ruby"><code><span class="linenum">31</span><span class="constant">RSpec</span>.describe <span class="string"><span class="delimiter">"</span><span class="content">failing spec</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
352
|
+
<span class="linenum">32</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
375
353
|
<span class="offending"><span class="linenum">33</span> expect(<span class="integer">1</span>).to eq(<span class="integer">2</span>)</span>
|
|
376
354
|
<span class="linenum">34</span> <span class="keyword">end</span>
|
|
377
355
|
<span class="linenum">35</span><span class="keyword">end</span></code></pre>
|
|
@@ -390,7 +368,7 @@ expected: 2
|
|
|
390
368
|
<span class="duration">n.nnnns</span>
|
|
391
369
|
<div class="failure" id="failure_3">
|
|
392
370
|
<div class="message"><pre>foo</pre></div>
|
|
393
|
-
<div class="backtrace"><pre
|
|
371
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:41</pre></div>
|
|
394
372
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
|
395
373
|
</div>
|
|
396
374
|
</dd>
|
|
@@ -400,14 +378,14 @@ expected: 2
|
|
|
400
378
|
<span class="duration">n.nnnns</span>
|
|
401
379
|
<div class="failure" id="failure_4">
|
|
402
380
|
<div class="message"><pre>Exception</pre></div>
|
|
403
|
-
<div class="backtrace"><pre
|
|
381
|
+
<div class="backtrace"><pre></pre></div>
|
|
404
382
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
|
|
405
383
|
</div>
|
|
406
384
|
</dd>
|
|
407
385
|
</dl>
|
|
408
386
|
</div>
|
|
409
387
|
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>n.nnnn seconds</strong>";</script>
|
|
410
|
-
<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures,
|
|
388
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "7 examples, 4 failures, 1 pending";</script>
|
|
411
389
|
</div>
|
|
412
390
|
</div>
|
|
413
391
|
</body>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
<html lang='en'>
|
|
1
|
+
<html lang="en">
|
|
3
2
|
<head>
|
|
4
3
|
<title>RSpec results</title>
|
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"
|
|
6
|
-
<meta http-equiv="Expires" content="-1"
|
|
7
|
-
<meta http-equiv="Pragma" content="no-cache"
|
|
4
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
5
|
+
<meta http-equiv="Expires" content="-1">
|
|
6
|
+
<meta http-equiv="Pragma" content="no-cache">
|
|
8
7
|
<style type="text/css">
|
|
9
8
|
body {
|
|
10
9
|
margin: 0;
|
|
@@ -266,14 +265,14 @@ a {
|
|
|
266
265
|
</div>
|
|
267
266
|
|
|
268
267
|
<div id="display-filters">
|
|
269
|
-
<input id="passed_checkbox"
|
|
270
|
-
<input id="failed_checkbox"
|
|
271
|
-
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked
|
|
268
|
+
<input id="passed_checkbox" name="passed_checkbox" type="checkbox" checked onchange="apply_filters()" value="1"> <label for="passed_checkbox">Passed</label>
|
|
269
|
+
<input id="failed_checkbox" name="failed_checkbox" type="checkbox" checked onchange="apply_filters()" value="2"> <label for="failed_checkbox">Failed</label>
|
|
270
|
+
<input id="pending_checkbox" name="pending_checkbox" type="checkbox" checked onchange="apply_filters()" value="3"> <label for="pending_checkbox">Pending</label>
|
|
272
271
|
</div>
|
|
273
272
|
|
|
274
273
|
<div id="summary">
|
|
275
|
-
<p id="totals"
|
|
276
|
-
<p id="duration"
|
|
274
|
+
<p id="totals"> </p>
|
|
275
|
+
<p id="duration"> </p>
|
|
277
276
|
</div>
|
|
278
277
|
</div>
|
|
279
278
|
|
|
@@ -315,20 +314,15 @@ a {
|
|
|
315
314
|
<span class="failed_spec_name">fails</span>
|
|
316
315
|
<span class="duration">n.nnnns</span>
|
|
317
316
|
<div class="failure" id="failure_1">
|
|
318
|
-
<div class="message"><pre>
|
|
319
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:
|
|
320
|
-
./spec/
|
|
321
|
-
./spec/
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
<pre class="ruby"><code><span class="linenum">16</span> context <span class="string"><span class="delimiter">"</span><span class="content">with content that would pass</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
328
|
-
<span class="linenum">17</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
329
|
-
<span class="offending"><span class="linenum">18</span> pending <span class="keyword">do</span></span>
|
|
330
|
-
<span class="linenum">19</span> expect(<span class="integer">1</span>).to eq(<span class="integer">1</span>)
|
|
331
|
-
<span class="linenum">20</span> <span class="keyword">end</span></code></pre>
|
|
317
|
+
<div class="message"><pre>Expected example to fail since it is pending, but it passed.</pre></div>
|
|
318
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:16
|
|
319
|
+
./spec/rspec/core/resources/formatter_specs.rb:15
|
|
320
|
+
./spec/rspec/core/resources/formatter_specs.rb:7</pre></div>
|
|
321
|
+
<pre class="ruby"><code><span class="linenum">14</span>
|
|
322
|
+
<span class="linenum">15</span> context <span class="string"><span class="delimiter">"</span><span class="content">with content that would pass</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
323
|
+
<span class="offending"><span class="linenum">16</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span></span>
|
|
324
|
+
<span class="linenum">17</span> pending
|
|
325
|
+
<span class="linenum">18</span> expect(<span class="integer">1</span>).to eq(<span class="integer">1</span>)</code></pre>
|
|
332
326
|
</div>
|
|
333
327
|
</dd>
|
|
334
328
|
</dl>
|
|
@@ -337,7 +331,9 @@ a {
|
|
|
337
331
|
<dl style="margin-left: 0px;">
|
|
338
332
|
<dt id="example_group_5" class="passed">passing spec</dt>
|
|
339
333
|
<script type="text/javascript">moveProgressBar('57.1');</script>
|
|
340
|
-
<dd class="example passed"
|
|
334
|
+
<dd class="example passed">
|
|
335
|
+
<span class="passed_spec_name">passes</span><span class="duration">n.nnnns</span>
|
|
336
|
+
</dd>
|
|
341
337
|
</dl>
|
|
342
338
|
</div>
|
|
343
339
|
<div id="div_group_6" class="example_group passed">
|
|
@@ -356,19 +352,12 @@ expected: 2
|
|
|
356
352
|
|
|
357
353
|
(compared using ==)
|
|
358
354
|
</pre></div>
|
|
359
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:72:in `Formatters'
|
|
366
|
-
./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
|
|
367
|
-
<pre class="ruby"><code><span class="linenum">31</span>describe <span class="string"><span class="delimiter">"</span><span class="content">failing spec</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
368
|
-
<span class="linenum">32</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
369
|
-
<span class="offending"><span class="linenum">33</span> expect(<span class="integer">1</span>).to eq(<span class="integer">2</span>)</span>
|
|
370
|
-
<span class="linenum">34</span> <span class="keyword">end</span>
|
|
371
|
-
<span class="linenum">35</span><span class="keyword">end</span></code></pre>
|
|
355
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:31</pre></div>
|
|
356
|
+
<pre class="ruby"><code><span class="linenum">29</span><span class="constant">RSpec</span>.describe <span class="string"><span class="delimiter">"</span><span class="content">failing spec</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
357
|
+
<span class="linenum">30</span> it <span class="string"><span class="delimiter">"</span><span class="content">fails</span><span class="delimiter">"</span></span> <span class="keyword">do</span>
|
|
358
|
+
<span class="offending"><span class="linenum">31</span> expect(<span class="integer">1</span>).to eq(<span class="integer">2</span>)</span>
|
|
359
|
+
<span class="linenum">32</span> <span class="keyword">end</span>
|
|
360
|
+
<span class="linenum">33</span><span class="keyword">end</span></code></pre>
|
|
372
361
|
</div>
|
|
373
362
|
</dd>
|
|
374
363
|
</dl>
|
|
@@ -384,15 +373,7 @@ expected: 2
|
|
|
384
373
|
<span class="duration">n.nnnns</span>
|
|
385
374
|
<div class="failure" id="failure_3">
|
|
386
375
|
<div class="message"><pre>foo</pre></div>
|
|
387
|
-
<div class="backtrace"><pre>
|
|
388
|
-
./spec/rspec/core/resources/formatter_specs.rb:41:in `(root)'
|
|
389
|
-
./spec/support/sandboxed_mock_space.rb:33:in `run'
|
|
390
|
-
./spec/support/sandboxed_mock_space.rb:72:in `sandboxed'
|
|
391
|
-
./spec/support/sandboxed_mock_space.rb:32:in `run'
|
|
392
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:37:in `generated_html'
|
|
393
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:73:in `Formatters'
|
|
394
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:72:in `Formatters'
|
|
395
|
-
./spec/support/sandboxed_mock_space.rb:38:in `sandboxed'</pre></div>
|
|
376
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:39</pre></div>
|
|
396
377
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
|
397
378
|
</div>
|
|
398
379
|
</dd>
|
|
@@ -402,7 +383,7 @@ expected: 2
|
|
|
402
383
|
<span class="duration">n.nnnns</span>
|
|
403
384
|
<div class="failure" id="failure_4">
|
|
404
385
|
<div class="message"><pre>Exception</pre></div>
|
|
405
|
-
<div class="backtrace"><pre
|
|
386
|
+
<div class="backtrace"><pre></pre></div>
|
|
406
387
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for /foo.html.erb</span></code></pre>
|
|
407
388
|
</div>
|
|
408
389
|
</dd>
|
|
@@ -413,4 +394,4 @@ expected: 2
|
|
|
413
394
|
</div>
|
|
414
395
|
</div>
|
|
415
396
|
</body>
|
|
416
|
-
</html>
|
|
397
|
+
</html>
|