rspec-core 2.6.0 → 2.7.0.rc1
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/README.md +1 -1
- data/features/Upgrade.md +11 -0
- data/features/command_line/exit_status.feature +20 -3
- data/features/command_line/format_option.feature +8 -0
- data/features/command_line/line_number_appended_to_path.feature +35 -1
- data/features/command_line/line_number_option.feature +16 -3
- data/features/command_line/pattern_option.feature +31 -0
- data/features/command_line/rake_task.feature +1 -1
- data/features/command_line/ruby.feature +22 -0
- data/features/configuration/default_path.feature +38 -0
- data/features/example_groups/{shared_example_group.feature → shared_examples.feature} +49 -26
- data/features/expectation_framework_integration/configure_expectation_framework.feature +1 -1
- data/features/filtering/inclusion_filters.feature +4 -5
- data/features/formatters/text_formatter.feature +16 -13
- data/features/helper_methods/let.feature +4 -4
- data/features/hooks/around_hooks.feature +1 -1
- data/features/hooks/before_and_after_hooks.feature +3 -3
- data/features/hooks/filtering.feature +13 -6
- data/features/metadata/user_defined.feature +12 -10
- data/features/pending/pending_examples.feature +21 -8
- data/features/step_definitions/additional_cli_steps.rb +1 -1
- data/features/subject/attribute_of_subject.feature +2 -2
- data/features/support/env.rb +1 -2
- data/lib/rspec/core/backward_compatibility.rb +1 -1
- data/lib/rspec/core/configuration.rb +71 -16
- data/lib/rspec/core/configuration_options.rb +46 -16
- data/lib/rspec/core/{extensions/object.rb → dsl.rb} +2 -4
- data/lib/rspec/core/example.rb +10 -7
- data/lib/rspec/core/example_group.rb +34 -18
- data/lib/rspec/core/expecting/with_rspec.rb +0 -2
- data/lib/rspec/core/extensions.rb +0 -1
- data/lib/rspec/core/formatters/base_formatter.rb +8 -4
- data/lib/rspec/core/formatters/base_text_formatter.rb +38 -18
- data/lib/rspec/core/formatters/html_formatter.rb +3 -1
- data/lib/rspec/core/formatters/snippet_extractor.rb +9 -3
- data/lib/rspec/core/formatters/text_mate_formatter.rb +20 -6
- data/lib/rspec/core/hooks.rb +7 -6
- data/lib/rspec/core/let.rb +5 -5
- data/lib/rspec/core/metadata.rb +136 -94
- data/lib/rspec/core/metadata_hash_builder.rb +1 -1
- data/lib/rspec/core/option_parser.rb +11 -7
- data/lib/rspec/core/pending.rb +2 -1
- data/lib/rspec/core/rake_task.rb +26 -15
- data/lib/rspec/core/reporter.rb +5 -6
- data/lib/rspec/core/runner.rb +1 -1
- data/lib/rspec/core/shared_example_group.rb +4 -4
- data/lib/rspec/core/subject.rb +7 -7
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +9 -13
- data/lib/rspec/core.rb +14 -21
- data/spec/autotest/discover_spec.rb +2 -2
- data/spec/autotest/failed_results_re_spec.rb +29 -21
- data/spec/autotest/rspec_spec.rb +3 -3
- data/spec/rspec/core/command_line_spec.rb +1 -6
- data/spec/rspec/core/configuration_options_spec.rb +111 -27
- data/spec/rspec/core/configuration_spec.rb +161 -37
- data/spec/rspec/core/deprecations_spec.rb +2 -2
- data/spec/rspec/core/drb_command_line_spec.rb +6 -6
- data/spec/rspec/core/example_group_spec.rb +197 -61
- data/spec/rspec/core/example_spec.rb +33 -16
- data/spec/rspec/core/formatters/base_formatter_spec.rb +3 -3
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +222 -71
- data/spec/rspec/core/formatters/helpers_spec.rb +8 -8
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +90 -26
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +12 -11
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +12 -11
- data/spec/rspec/core/formatters/{html_formatted-1.9.1.html → html_formatted-1.9.3.html} +12 -11
- data/spec/rspec/core/formatters/html_formatter_spec.rb +5 -5
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +2 -2
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +2 -2
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +91 -27
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +13 -12
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +29 -28
- data/spec/rspec/core/formatters/{text_mate_formatted-1.9.1.html → text_mate_formatted-1.9.3.html} +29 -28
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +2 -2
- data/spec/rspec/core/hooks_filtering_spec.rb +18 -18
- data/spec/rspec/core/let_spec.rb +19 -6
- data/spec/rspec/core/metadata_spec.rb +146 -61
- data/spec/rspec/core/pending_example_spec.rb +4 -4
- data/spec/rspec/core/rake_task_spec.rb +71 -50
- data/spec/rspec/core/reporter_spec.rb +2 -2
- data/spec/rspec/core/ruby_project_spec.rb +2 -2
- data/spec/rspec/core/runner_spec.rb +4 -1
- data/spec/rspec/core/shared_example_group_spec.rb +15 -119
- data/spec/rspec/core/subject_spec.rb +13 -13
- data/spec/rspec/core/world_spec.rb +31 -22
- data/spec/rspec/core_spec.rb +1 -29
- data/spec/spec_helper.rb +51 -50
- data/spec/support/shared_example_groups.rb +3 -3
- data/spec/support/spec_files.rb +8 -8
- metadata +79 -94
- data/.document +0 -5
- data/.gitignore +0 -12
- data/.rspec +0 -0
- data/.travis.yml +0 -7
- data/Gemfile +0 -50
- data/Guardfile +0 -5
- data/License.txt +0 -23
- data/Rakefile +0 -89
- data/cucumber.yml +0 -2
- data/features/.nav +0 -57
- data/features/Changelog.md +0 -269
- data/rspec-core.gemspec +0 -24
- data/script/FullBuildRakeFile +0 -63
- data/script/console +0 -8
- data/script/cucumber +0 -1
- data/script/full_build +0 -1
- data/script/spec +0 -1
- data/spec/rspec/core/formatters/html_formatted-1.8.6.html +0 -398
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.6.html +0 -398
- data/spec.txt +0 -1126
- /data/{bin → exe}/autospec +0 -0
- /data/{bin → exe}/rspec +0 -0
|
@@ -8,7 +8,7 @@ describe RSpec::Core::Formatters::BaseFormatter do
|
|
|
8
8
|
|
|
9
9
|
describe "backtrace_line" do
|
|
10
10
|
it "trims current working directory" do
|
|
11
|
-
formatter.__send__(:backtrace_line, File.expand_path(__FILE__)).should
|
|
11
|
+
formatter.__send__(:backtrace_line, File.expand_path(__FILE__)).should eq("./spec/rspec/core/formatters/base_formatter_spec.rb")
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
it "leaves the original line intact" do
|
|
@@ -51,7 +51,7 @@ describe RSpec::Core::Formatters::BaseFormatter do
|
|
|
51
51
|
|
|
52
52
|
example = mock(:Example, :file_path => __FILE__)
|
|
53
53
|
formatter.send(:read_failed_line, exception, example).should
|
|
54
|
-
eql
|
|
54
|
+
eql(%Q{ exception = mock(:Exception, :backtrace => [ "\#{__FILE__}:\#{__LINE__}"])\n})
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
end
|
|
@@ -73,7 +73,7 @@ describe RSpec::Core::Formatters::BaseFormatter do
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
it "removes lines from rspec and lines that come before the invocation of the at_exit autorun hook" do
|
|
76
|
-
formatter.format_backtrace(backtrace, stub.as_null_object).should
|
|
76
|
+
formatter.format_backtrace(backtrace, stub.as_null_object).should eq(["./my_spec.rb:5"])
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
79
|
|
|
@@ -1,80 +1,221 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
require 'rspec/core/formatters/base_text_formatter'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
describe RSpec::Core::Formatters::BaseTextFormatter do
|
|
5
|
+
let(:output) { StringIO.new }
|
|
6
|
+
let(:formatter) { RSpec::Core::Formatters::BaseTextFormatter.new(output) }
|
|
5
7
|
|
|
6
|
-
describe
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
describe "#summary_line" do
|
|
9
|
+
it "with 0s outputs pluralized (excluding pending)" do
|
|
10
|
+
formatter.summary_line(0,0,0).should eq("0 examples, 0 failures")
|
|
11
|
+
end
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
it "with 1s outputs singular (including pending)" do
|
|
14
|
+
formatter.summary_line(1,1,1).should eq("1 example, 1 failure, 1 pending")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "with 2s outputs pluralized (including pending)" do
|
|
18
|
+
formatter.summary_line(2,2,2).should eq("2 examples, 2 failures, 2 pending")
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
describe "#dump_commands_to_rerun_failed_examples" do
|
|
23
|
+
it "includes command to re-run each failed example" do
|
|
24
|
+
group = RSpec::Core::ExampleGroup.describe("example group") do
|
|
25
|
+
it("fails") { fail }
|
|
26
|
+
end
|
|
27
|
+
line = __LINE__ - 2
|
|
28
|
+
group.run(formatter)
|
|
29
|
+
formatter.dump_commands_to_rerun_failed_examples
|
|
30
|
+
output.string.should include("rspec #{RSpec::Core::Formatters::BaseFormatter::relative_path("#{__FILE__}:#{line}")} # example group fails")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "#dump_failures" do
|
|
35
|
+
let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
|
|
36
|
+
|
|
37
|
+
before { RSpec.configuration.stub(:color_enabled?) { false } }
|
|
38
|
+
|
|
39
|
+
def run_all_and_dump_failures
|
|
40
|
+
group.run(formatter)
|
|
41
|
+
formatter.dump_failures
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it "preserves formatting" do
|
|
45
|
+
group.example("example name") { "this".should eq("that") }
|
|
46
|
+
|
|
47
|
+
run_all_and_dump_failures
|
|
48
|
+
|
|
49
|
+
output.string.should =~ /group name example name/m
|
|
50
|
+
output.string.should =~ /(\s+)expected: \"that\"\n\1 got: \"this\"/m
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context "with an exception without a message" do
|
|
54
|
+
it "does not throw NoMethodError" do
|
|
55
|
+
exception_without_message = Exception.new()
|
|
56
|
+
exception_without_message.stub(:message) { nil }
|
|
57
|
+
group.example("example name") { raise exception_without_message }
|
|
58
|
+
expect { run_all_and_dump_failures }.not_to raise_error(NoMethodError)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
context "with an exception class other than RSpec" do
|
|
63
|
+
it "does not show the error class" do
|
|
64
|
+
group.example("example name") { raise NameError.new('foo') }
|
|
65
|
+
run_all_and_dump_failures
|
|
66
|
+
output.string.should =~ /NameError/m
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
context "with a failed expectation (rspec-expectations)" do
|
|
71
|
+
it "does not show the error class" do
|
|
72
|
+
group.example("example name") { "this".should eq("that") }
|
|
73
|
+
run_all_and_dump_failures
|
|
74
|
+
output.string.should_not =~ /RSpec/m
|
|
15
75
|
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context "with a failed message expectation (rspec-mocks)" do
|
|
79
|
+
it "does not show the error class" do
|
|
80
|
+
group.example("example name") { "this".should_receive("that") }
|
|
81
|
+
run_all_and_dump_failures
|
|
82
|
+
output.string.should_not =~ /RSpec/m
|
|
83
|
+
end
|
|
84
|
+
end
|
|
16
85
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
86
|
+
context 'for #share_examples_for' do
|
|
87
|
+
it 'outputs the name and location' do
|
|
88
|
+
|
|
89
|
+
share_examples_for 'foo bar' do
|
|
90
|
+
it("example name") { "this".should eq("that") }
|
|
20
91
|
end
|
|
92
|
+
|
|
93
|
+
line = __LINE__.next
|
|
94
|
+
group.it_should_behave_like('foo bar')
|
|
95
|
+
|
|
96
|
+
run_all_and_dump_failures
|
|
97
|
+
|
|
98
|
+
output.string.should include(
|
|
99
|
+
'Shared Example Group: "foo bar" called from ' +
|
|
100
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
101
|
+
)
|
|
21
102
|
end
|
|
22
103
|
|
|
23
|
-
context
|
|
24
|
-
it
|
|
25
|
-
|
|
104
|
+
context 'that contains nested example groups' do
|
|
105
|
+
it 'outputs the name and location' do
|
|
106
|
+
share_examples_for 'foo bar' do
|
|
107
|
+
describe 'nested group' do
|
|
108
|
+
it("example name") { "this".should eq("that") }
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
line = __LINE__.next
|
|
113
|
+
group.it_should_behave_like('foo bar')
|
|
114
|
+
|
|
115
|
+
run_all_and_dump_failures
|
|
116
|
+
|
|
117
|
+
output.string.should include(
|
|
118
|
+
'Shared Example Group: "foo bar" called from ' +
|
|
119
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
120
|
+
)
|
|
26
121
|
end
|
|
27
122
|
end
|
|
28
123
|
end
|
|
29
124
|
|
|
30
|
-
|
|
31
|
-
|
|
125
|
+
context 'for #share_as' do
|
|
126
|
+
it 'outputs the name and location' do
|
|
32
127
|
|
|
33
|
-
|
|
128
|
+
share_as :FooBar do
|
|
129
|
+
it("example name") { "this".should eq("that") }
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
line = __LINE__.next
|
|
133
|
+
group.send(:include, FooBar)
|
|
134
|
+
|
|
135
|
+
run_all_and_dump_failures
|
|
136
|
+
|
|
137
|
+
output.string.should include(
|
|
138
|
+
'Shared Example Group: "FooBar" called from ' +
|
|
139
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
140
|
+
)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
context 'that contains nested example groups' do
|
|
144
|
+
it 'outputs the name and location' do
|
|
145
|
+
|
|
146
|
+
share_as :NestedFoo do
|
|
147
|
+
describe 'nested group' do
|
|
148
|
+
describe 'hell' do
|
|
149
|
+
it("example name") { "this".should eq("that") }
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
34
153
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
154
|
+
line = __LINE__.next
|
|
155
|
+
group.send(:include, NestedFoo)
|
|
156
|
+
|
|
157
|
+
run_all_and_dump_failures
|
|
158
|
+
|
|
159
|
+
output.string.should include(
|
|
160
|
+
'Shared Example Group: "NestedFoo" called from ' +
|
|
161
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
162
|
+
)
|
|
163
|
+
end
|
|
38
164
|
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
describe "#dump_pending" do
|
|
169
|
+
let(:group) { RSpec::Core::ExampleGroup.describe("group name") }
|
|
170
|
+
|
|
171
|
+
before { RSpec.configuration.stub(:color_enabled?) { false } }
|
|
172
|
+
|
|
173
|
+
def run_all_and_dump_pending
|
|
174
|
+
group.run(formatter)
|
|
175
|
+
formatter.dump_pending
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
context "with show_failures_in_pending_blocks setting enabled" do
|
|
179
|
+
before { RSpec.configuration.stub(:show_failures_in_pending_blocks?) { true } }
|
|
39
180
|
|
|
40
181
|
it "preserves formatting" do
|
|
41
|
-
group.example("example name") { "this".should eq("that") }
|
|
182
|
+
group.example("example name") { pending { "this".should eq("that") } }
|
|
42
183
|
|
|
43
|
-
|
|
184
|
+
run_all_and_dump_pending
|
|
44
185
|
|
|
45
186
|
output.string.should =~ /group name example name/m
|
|
46
|
-
output.string.should =~ /(\s+)expected \"that\"\n\1 got \"this\"/m
|
|
187
|
+
output.string.should =~ /(\s+)expected: \"that\"\n\1 got: \"this\"/m
|
|
47
188
|
end
|
|
48
189
|
|
|
49
190
|
context "with an exception without a message" do
|
|
50
191
|
it "does not throw NoMethodError" do
|
|
51
192
|
exception_without_message = Exception.new()
|
|
52
193
|
exception_without_message.stub(:message) { nil }
|
|
53
|
-
group.example("example name") { raise exception_without_message }
|
|
54
|
-
expect {
|
|
194
|
+
group.example("example name") { pending { raise exception_without_message } }
|
|
195
|
+
expect { run_all_and_dump_pending }.not_to raise_error(NoMethodError)
|
|
55
196
|
end
|
|
56
197
|
end
|
|
57
198
|
|
|
58
199
|
context "with an exception class other than RSpec" do
|
|
59
200
|
it "does not show the error class" do
|
|
60
|
-
group.example("example name") { raise NameError.new('foo') }
|
|
61
|
-
|
|
201
|
+
group.example("example name") { pending { raise NameError.new('foo') } }
|
|
202
|
+
run_all_and_dump_pending
|
|
62
203
|
output.string.should =~ /NameError/m
|
|
63
204
|
end
|
|
64
205
|
end
|
|
65
206
|
|
|
66
207
|
context "with a failed expectation (rspec-expectations)" do
|
|
67
208
|
it "does not show the error class" do
|
|
68
|
-
group.example("example name") { "this".should eq("that") }
|
|
69
|
-
|
|
209
|
+
group.example("example name") { pending { "this".should eq("that") } }
|
|
210
|
+
run_all_and_dump_pending
|
|
70
211
|
output.string.should_not =~ /RSpec/m
|
|
71
212
|
end
|
|
72
213
|
end
|
|
73
214
|
|
|
74
215
|
context "with a failed message expectation (rspec-mocks)" do
|
|
75
216
|
it "does not show the error class" do
|
|
76
|
-
group.example("example name") { "this".should_receive("that") }
|
|
77
|
-
|
|
217
|
+
group.example("example name") { pending { "this".should_receive("that") } }
|
|
218
|
+
run_all_and_dump_pending
|
|
78
219
|
output.string.should_not =~ /RSpec/m
|
|
79
220
|
end
|
|
80
221
|
end
|
|
@@ -83,17 +224,17 @@ module RSpec::Core::Formatters
|
|
|
83
224
|
it 'outputs the name and location' do
|
|
84
225
|
|
|
85
226
|
share_examples_for 'foo bar' do
|
|
86
|
-
it("example name") { "this".should eq("that") }
|
|
227
|
+
it("example name") { pending { "this".should eq("that") } }
|
|
87
228
|
end
|
|
88
229
|
|
|
89
230
|
line = __LINE__.next
|
|
90
231
|
group.it_should_behave_like('foo bar')
|
|
91
232
|
|
|
92
|
-
|
|
233
|
+
run_all_and_dump_pending
|
|
93
234
|
|
|
94
235
|
output.string.should include(
|
|
95
236
|
'Shared Example Group: "foo bar" called from ' +
|
|
96
|
-
|
|
237
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
97
238
|
)
|
|
98
239
|
end
|
|
99
240
|
|
|
@@ -101,18 +242,18 @@ module RSpec::Core::Formatters
|
|
|
101
242
|
it 'outputs the name and location' do
|
|
102
243
|
share_examples_for 'foo bar' do
|
|
103
244
|
describe 'nested group' do
|
|
104
|
-
it("example name") { "this".should eq("that") }
|
|
245
|
+
it("example name") { pending { "this".should eq("that") } }
|
|
105
246
|
end
|
|
106
247
|
end
|
|
107
248
|
|
|
108
249
|
line = __LINE__.next
|
|
109
250
|
group.it_should_behave_like('foo bar')
|
|
110
251
|
|
|
111
|
-
|
|
252
|
+
run_all_and_dump_pending
|
|
112
253
|
|
|
113
254
|
output.string.should include(
|
|
114
255
|
'Shared Example Group: "foo bar" called from ' +
|
|
115
|
-
|
|
256
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
116
257
|
)
|
|
117
258
|
end
|
|
118
259
|
end
|
|
@@ -121,73 +262,83 @@ module RSpec::Core::Formatters
|
|
|
121
262
|
context 'for #share_as' do
|
|
122
263
|
it 'outputs the name and location' do
|
|
123
264
|
|
|
124
|
-
share_as :
|
|
125
|
-
it("example name") { "this".should eq("that") }
|
|
265
|
+
share_as :FooBar2 do
|
|
266
|
+
it("example name") { pending { "this".should eq("that") } }
|
|
126
267
|
end
|
|
127
268
|
|
|
128
269
|
line = __LINE__.next
|
|
129
|
-
group.send(:include,
|
|
270
|
+
group.send(:include, FooBar2)
|
|
130
271
|
|
|
131
|
-
|
|
272
|
+
run_all_and_dump_pending
|
|
132
273
|
|
|
133
274
|
output.string.should include(
|
|
134
|
-
'Shared Example Group: "
|
|
135
|
-
|
|
275
|
+
'Shared Example Group: "FooBar2" called from ' +
|
|
276
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
136
277
|
)
|
|
137
278
|
end
|
|
138
279
|
|
|
139
280
|
context 'that contains nested example groups' do
|
|
140
281
|
it 'outputs the name and location' do
|
|
141
282
|
|
|
142
|
-
share_as :
|
|
283
|
+
share_as :NestedFoo2 do
|
|
143
284
|
describe 'nested group' do
|
|
144
285
|
describe 'hell' do
|
|
145
|
-
it("example name") { "this".should eq("that") }
|
|
286
|
+
it("example name") { pending { "this".should eq("that") } }
|
|
146
287
|
end
|
|
147
288
|
end
|
|
148
289
|
end
|
|
149
290
|
|
|
150
291
|
line = __LINE__.next
|
|
151
|
-
group.send(:include,
|
|
292
|
+
group.send(:include, NestedFoo2)
|
|
152
293
|
|
|
153
|
-
|
|
294
|
+
run_all_and_dump_pending
|
|
154
295
|
|
|
155
296
|
output.string.should include(
|
|
156
|
-
'Shared Example Group: "
|
|
157
|
-
|
|
297
|
+
'Shared Example Group: "NestedFoo2" called from ' +
|
|
298
|
+
"./spec/rspec/core/formatters/base_text_formatter_spec.rb:#{line}"
|
|
158
299
|
)
|
|
159
300
|
end
|
|
160
301
|
end
|
|
161
302
|
end
|
|
162
303
|
end
|
|
163
304
|
|
|
164
|
-
|
|
165
|
-
before
|
|
166
|
-
formatter.stub(:examples) do
|
|
167
|
-
group = RSpec::Core::ExampleGroup.describe("group") do
|
|
168
|
-
example("example")
|
|
169
|
-
end
|
|
170
|
-
group.run(double('reporter').as_null_object)
|
|
171
|
-
group.examples
|
|
172
|
-
end
|
|
173
|
-
end
|
|
305
|
+
context "with show_failures_in_pending_blocks setting disabled" do
|
|
306
|
+
before { RSpec.configuration.stub(:show_failures_in_pending_blocks?) { false } }
|
|
174
307
|
|
|
175
|
-
it "
|
|
176
|
-
|
|
177
|
-
|
|
308
|
+
it "does not output the failure information" do
|
|
309
|
+
group.example("example name") { pending { "this".should eq("that") } }
|
|
310
|
+
run_all_and_dump_pending
|
|
311
|
+
output.string.should_not =~ /(\s+)expected: \"that\"\n\1 got: \"this\"/m
|
|
178
312
|
end
|
|
313
|
+
end
|
|
314
|
+
end
|
|
179
315
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
316
|
+
describe "#dump_profile" do
|
|
317
|
+
before do
|
|
318
|
+
formatter.stub(:examples) do
|
|
319
|
+
group = RSpec::Core::ExampleGroup.describe("group") do
|
|
320
|
+
example("example")
|
|
321
|
+
end
|
|
322
|
+
group.run(double('reporter').as_null_object)
|
|
323
|
+
group.examples
|
|
183
324
|
end
|
|
325
|
+
end
|
|
184
326
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
327
|
+
it "names the example" do
|
|
328
|
+
formatter.dump_profile
|
|
329
|
+
output.string.should =~ /group example/m
|
|
330
|
+
end
|
|
188
331
|
|
|
189
|
-
|
|
190
|
-
|
|
332
|
+
it "prints the time" do
|
|
333
|
+
formatter.dump_profile
|
|
334
|
+
output.string.should =~ /0(\.\d+)? seconds/
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
it "prints the path" do
|
|
338
|
+
formatter.dump_profile
|
|
339
|
+
filename = __FILE__.split(File::SEPARATOR).last
|
|
340
|
+
|
|
341
|
+
output.string.should =~ /#{filename}\:#{__LINE__ - 21}/
|
|
191
342
|
end
|
|
192
343
|
end
|
|
193
344
|
end
|
|
@@ -7,22 +7,22 @@ describe RSpec::Core::Formatters::Helpers do
|
|
|
7
7
|
describe "format seconds" do
|
|
8
8
|
context "sub second times" do
|
|
9
9
|
it "returns 5 digits of precision" do
|
|
10
|
-
helper.format_seconds(0.000006).should
|
|
10
|
+
helper.format_seconds(0.000006).should eq("0.00001")
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
it "strips off trailing zeroes beyond sub-second precision" do
|
|
14
|
-
helper.format_seconds(0.020000).should
|
|
14
|
+
helper.format_seconds(0.020000).should eq("0.02")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
context "0" do
|
|
18
18
|
it "strips off trailing zeroes" do
|
|
19
|
-
helper.format_seconds(0.00000000001).should
|
|
19
|
+
helper.format_seconds(0.00000000001).should eq("0")
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
context "> 1" do
|
|
24
24
|
it "strips off trailing zeroes" do
|
|
25
|
-
helper.format_seconds(1.00000000001).should
|
|
25
|
+
helper.format_seconds(1.00000000001).should eq("1")
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -30,13 +30,13 @@ describe RSpec::Core::Formatters::Helpers do
|
|
|
30
30
|
context "second and greater times" do
|
|
31
31
|
|
|
32
32
|
it "returns 2 digits of precision" do
|
|
33
|
-
helper.format_seconds(50.330340).should
|
|
33
|
+
helper.format_seconds(50.330340).should eq("50.33")
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
it "returns human friendly elasped time" do
|
|
37
|
-
helper.format_seconds(50.1).should
|
|
38
|
-
helper.format_seconds(5).should
|
|
39
|
-
helper.format_seconds(5.0).should
|
|
37
|
+
helper.format_seconds(50.1).should eq("50.1")
|
|
38
|
+
helper.format_seconds(5).should eq("5")
|
|
39
|
+
helper.format_seconds(5.0).should eq("5")
|
|
40
40
|
end
|
|
41
41
|
|
|
42
42
|
end
|
|
@@ -312,18 +312,37 @@ a {
|
|
|
312
312
|
<span class="failed_spec_name">fails</span>
|
|
313
313
|
<div class="failure" id="failure_1">
|
|
314
314
|
<div class="message"><pre>RSpec::Core::PendingExampleFixedError</pre></div>
|
|
315
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
315
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:18:in `(root)'
|
|
316
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
317
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
318
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
319
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
320
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `Formatters'
|
|
321
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
322
|
+
org/jruby/RubyHash.java:1063:in `fetch'
|
|
323
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
324
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
|
|
325
|
+
org/jruby/RubyIO.java:1111:in `open'
|
|
326
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
|
|
327
|
+
org/jruby/RubyDir.java:335:in `chdir'
|
|
328
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `Formatters'
|
|
329
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
330
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
331
|
+
org/jruby/RubyProc.java:229:in `call'
|
|
332
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
333
|
+
org/jruby/RubyKernel.java:2078:in `instance_exec'
|
|
334
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
335
|
+
org/jruby/RubyProc.java:229:in `call'
|
|
336
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
337
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
338
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
339
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
340
|
+
org/jruby/RubyProc.java:233:in `call'</pre></div>
|
|
341
|
+
<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>
|
|
342
|
+
<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>
|
|
343
|
+
<span class="offending"><span class="linenum">18</span> <span class="ident">pending</span> <span class="keyword">do</span></span>
|
|
344
|
+
<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>
|
|
345
|
+
<span class="linenum">20</span> <span class="keyword">end</span></code></pre>
|
|
327
346
|
</div>
|
|
328
347
|
</dd>
|
|
329
348
|
</dl>
|
|
@@ -345,22 +364,41 @@ a {
|
|
|
345
364
|
<span class="failed_spec_name">fails</span>
|
|
346
365
|
<div class="failure" id="failure_2">
|
|
347
366
|
<div class="message"><pre>
|
|
348
|
-
expected 2
|
|
349
|
-
got 1
|
|
367
|
+
expected: 2
|
|
368
|
+
got: 1
|
|
350
369
|
|
|
351
370
|
(compared using ==)
|
|
352
371
|
</pre></div>
|
|
353
|
-
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
./spec/rspec/core/formatters/html_formatter_spec.rb:
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
372
|
+
<div class="backtrace"><pre>./spec/rspec/core/resources/formatter_specs.rb:33:in `(root)'
|
|
373
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
374
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
375
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
376
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `Formatters'
|
|
377
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
378
|
+
org/jruby/RubyHash.java:1063:in `fetch'
|
|
379
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
380
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
|
|
381
|
+
org/jruby/RubyIO.java:1111:in `open'
|
|
382
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
|
|
383
|
+
org/jruby/RubyDir.java:335:in `chdir'
|
|
384
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `Formatters'
|
|
385
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
386
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
387
|
+
org/jruby/RubyProc.java:229:in `call'
|
|
388
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
389
|
+
org/jruby/RubyKernel.java:2078:in `instance_exec'
|
|
390
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
391
|
+
org/jruby/RubyProc.java:229:in `call'
|
|
392
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
393
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
394
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
395
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
396
|
+
org/jruby/RubyProc.java:233:in `call'</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>
|
|
364
402
|
</div>
|
|
365
403
|
</dd>
|
|
366
404
|
</dl>
|
|
@@ -375,7 +413,33 @@ expected 2
|
|
|
375
413
|
<span class="failed_spec_name">fails with a backtrace that has no file</span>
|
|
376
414
|
<div class="failure" id="failure_3">
|
|
377
415
|
<div class="message"><pre>foo</pre></div>
|
|
378
|
-
<div class="backtrace"><pre>(erb):1
|
|
416
|
+
<div class="backtrace"><pre>(erb):1:in `result'
|
|
417
|
+
org/jruby/RubyKernel.java:1088:in `eval'
|
|
418
|
+
./spec/rspec/core/resources/formatter_specs.rb:41:in `(root)'
|
|
419
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
420
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
421
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
422
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:24:in `Formatters'
|
|
423
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
424
|
+
org/jruby/RubyHash.java:1063:in `fetch'
|
|
425
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
426
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
|
|
427
|
+
org/jruby/RubyIO.java:1111:in `open'
|
|
428
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:46:in `Formatters'
|
|
429
|
+
org/jruby/RubyDir.java:335:in `chdir'
|
|
430
|
+
./spec/rspec/core/formatters/html_formatter_spec.rb:45:in `Formatters'
|
|
431
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
432
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
433
|
+
org/jruby/RubyProc.java:229:in `call'
|
|
434
|
+
org/jruby/RubyKernel.java:2061:in `instance_eval'
|
|
435
|
+
org/jruby/RubyKernel.java:2078:in `instance_exec'
|
|
436
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
437
|
+
org/jruby/RubyProc.java:229:in `call'
|
|
438
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
439
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
440
|
+
org/jruby/RubyArray.java:2336:in `collect'
|
|
441
|
+
org/jruby/RubyProc.java:274:in `call'
|
|
442
|
+
org/jruby/RubyProc.java:233:in `call'</pre></div>
|
|
379
443
|
<pre class="ruby"><code><span class="linenum">-1</span><span class="comment"># Couldn't get snippet for (erb)</span></code></pre>
|
|
380
444
|
</div>
|
|
381
445
|
</dd>
|