rspec-core 2.12.2 → 2.13.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 +31 -0
- data/README.md +11 -10
- data/features/command_line/example_name_option.feature +6 -10
- data/features/command_line/tag.feature +15 -8
- data/features/configuration/backtrace_clean_patterns.feature +102 -0
- data/features/configuration/failure_exit_code.feature +36 -0
- data/features/configuration/order_and_seed.feature +3 -0
- data/features/configuration/output_stream.feature +24 -0
- data/features/configuration/pattern.feature +30 -0
- data/features/configuration/profile.feature +163 -0
- data/features/configuration/run_all_when_everything_filtered.feature +60 -0
- data/features/configuration/show_failures_in_pending_blocks.feature +61 -0
- data/features/configuration/treat_symbols_as_metadata_keys_with_true_values.feature +52 -0
- data/features/filtering/exclusion_filters.feature +1 -2
- data/features/formatters/configurable_colors.feature +31 -0
- data/features/step_definitions/additional_cli_steps.rb +21 -0
- data/features/subject/explicit_subject.feature +19 -0
- data/lib/autotest/rspec2.rb +1 -1
- data/lib/rspec/core.rb +1 -2
- data/lib/rspec/core/configuration.rb +33 -3
- data/lib/rspec/core/configuration_options.rb +5 -5
- data/lib/rspec/core/deprecation.rb +1 -1
- data/lib/rspec/core/example.rb +2 -2
- data/lib/rspec/core/example_group.rb +1 -3
- data/lib/rspec/core/formatters/base_text_formatter.rb +93 -27
- data/lib/rspec/core/formatters/documentation_formatter.rb +3 -3
- data/lib/rspec/core/formatters/progress_formatter.rb +3 -3
- data/lib/rspec/core/memoized_helpers.rb +425 -0
- data/lib/rspec/core/metadata.rb +6 -2
- data/lib/rspec/core/option_parser.rb +8 -2
- data/lib/rspec/core/pending.rb +7 -0
- data/lib/rspec/core/shared_context.rb +1 -1
- data/lib/rspec/core/version.rb +1 -1
- data/spec/autotest/failed_results_re_spec.rb +4 -4
- data/spec/autotest/rspec_spec.rb +25 -20
- data/spec/command_line/order_spec.rb +21 -21
- data/spec/rspec/core/command_line_spec.rb +6 -6
- data/spec/rspec/core/configuration_options_spec.rb +86 -72
- data/spec/rspec/core/configuration_spec.rb +161 -156
- data/spec/rspec/core/deprecations_spec.rb +4 -4
- data/spec/rspec/core/drb_command_line_spec.rb +9 -9
- data/spec/rspec/core/drb_options_spec.rb +46 -33
- data/spec/rspec/core/dsl_spec.rb +3 -3
- data/spec/rspec/core/example_group_spec.rb +156 -124
- data/spec/rspec/core/example_spec.rb +68 -52
- data/spec/rspec/core/filter_manager_spec.rb +36 -36
- data/spec/rspec/core/formatters/base_formatter_spec.rb +9 -9
- data/spec/rspec/core/formatters/base_text_formatter_spec.rb +104 -42
- data/spec/rspec/core/formatters/documentation_formatter_spec.rb +4 -4
- data/spec/rspec/core/formatters/helpers_spec.rb +13 -13
- data/spec/rspec/core/formatters/html_formatted-1.8.7-jruby.html +5 -17
- data/spec/rspec/core/formatters/html_formatted-1.8.7-rbx.html +159 -44
- data/spec/rspec/core/formatters/html_formatted-1.8.7.html +14 -14
- data/spec/rspec/core/formatters/html_formatted-1.9.2.html +20 -20
- data/spec/rspec/core/formatters/html_formatted-1.9.3-jruby.html +5 -5
- data/spec/rspec/core/formatters/html_formatted-1.9.3-rbx.html +159 -44
- data/spec/rspec/core/formatters/html_formatted-1.9.3.html +20 -20
- data/spec/rspec/core/formatters/{html_formatted-1.9.2-jruby.html → html_formatted-2.0.0.html} +24 -18
- data/spec/rspec/core/formatters/html_formatter_spec.rb +9 -5
- data/spec/rspec/core/formatters/json_formatter_spec.rb +9 -9
- data/spec/rspec/core/formatters/progress_formatter_spec.rb +4 -4
- data/spec/rspec/core/formatters/snippet_extractor_spec.rb +3 -3
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-jruby.html +5 -17
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7-rbx.html +159 -44
- data/spec/rspec/core/formatters/text_mate_formatted-1.8.7.html +16 -16
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.2.html +23 -23
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-jruby.html +5 -17
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3-rbx.html +159 -44
- data/spec/rspec/core/formatters/text_mate_formatted-1.9.3.html +23 -23
- data/spec/rspec/core/formatters/{text_mate_formatted-1.9.2-jruby.html → text_mate_formatted-2.0.0.html} +25 -19
- data/spec/rspec/core/formatters/text_mate_formatter_spec.rb +8 -4
- data/spec/rspec/core/hooks_filtering_spec.rb +16 -16
- data/spec/rspec/core/hooks_spec.rb +11 -11
- data/spec/rspec/core/kernel_extensions_spec.rb +1 -1
- data/spec/rspec/core/memoized_helpers_spec.rb +458 -0
- data/spec/rspec/core/metadata_spec.rb +74 -74
- data/spec/rspec/core/option_parser_spec.rb +27 -27
- data/spec/rspec/core/pending_example_spec.rb +32 -32
- data/spec/rspec/core/project_initializer_spec.rb +8 -8
- data/spec/rspec/core/rake_task_spec.rb +16 -16
- data/spec/rspec/core/reporter_spec.rb +3 -3
- data/spec/rspec/core/resources/formatter_specs.rb +4 -4
- data/spec/rspec/core/ruby_project_spec.rb +4 -2
- data/spec/rspec/core/shared_context_spec.rb +34 -7
- data/spec/rspec/core/shared_example_group_spec.rb +14 -14
- data/spec/rspec/core/world_spec.rb +9 -9
- data/spec/rspec/core_spec.rb +5 -5
- data/spec/spec_helper.rb +4 -0
- data/spec/support/shared_example_groups.rb +4 -4
- data/spec/support/spec_files.rb +2 -2
- metadata +158 -150
- data/lib/rspec/core/let.rb +0 -110
- data/lib/rspec/core/subject.rb +0 -223
- data/spec/rspec/core/let_spec.rb +0 -55
- data/spec/rspec/core/subject_spec.rb +0 -255
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
|
+
require 'pp'
|
|
3
|
+
require 'stringio'
|
|
2
4
|
|
|
3
5
|
describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
4
6
|
let(:example_group) do
|
|
@@ -16,24 +18,38 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
16
18
|
end
|
|
17
19
|
end
|
|
18
20
|
|
|
21
|
+
def capture_stdout
|
|
22
|
+
orig_stdout = $stdout
|
|
23
|
+
$stdout = StringIO.new
|
|
24
|
+
yield
|
|
25
|
+
$stdout.string
|
|
26
|
+
ensure
|
|
27
|
+
$stdout = orig_stdout
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'can be pretty printed' do
|
|
31
|
+
output = capture_stdout { pp example_instance }
|
|
32
|
+
expect(output).to include("RSpec::Core::Example")
|
|
33
|
+
end
|
|
34
|
+
|
|
19
35
|
describe "#exception" do
|
|
20
36
|
it "supplies the first exception raised, if any" do
|
|
21
37
|
example = example_group.example { raise "first" }
|
|
22
38
|
example_group.after { raise "second" }
|
|
23
39
|
example_group.run
|
|
24
|
-
example.exception.message.
|
|
40
|
+
expect(example.exception.message).to eq("first")
|
|
25
41
|
end
|
|
26
42
|
|
|
27
43
|
it "returns nil if there is no exception" do
|
|
28
44
|
example = example_group.example('example') { }
|
|
29
45
|
example_group.run
|
|
30
|
-
example.exception.
|
|
46
|
+
expect(example.exception).to be_nil
|
|
31
47
|
end
|
|
32
48
|
|
|
33
49
|
it "returns false for pending_fixed? if not pending fixed" do
|
|
34
50
|
example = example_group.example { fail }
|
|
35
51
|
example_group.run
|
|
36
|
-
example.exception.
|
|
52
|
+
expect(example.exception).not_to be_pending_fixed
|
|
37
53
|
end
|
|
38
54
|
|
|
39
55
|
it "returns true for pending_fixed? if pending fixed" do
|
|
@@ -41,7 +57,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
41
57
|
pending("fixed") {}
|
|
42
58
|
end
|
|
43
59
|
example_group.run
|
|
44
|
-
example.exception.
|
|
60
|
+
expect(example.exception).to be_pending_fixed
|
|
45
61
|
end
|
|
46
62
|
end
|
|
47
63
|
|
|
@@ -51,7 +67,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
51
67
|
RSpec.configuration.format_docstrings { |s| s.strip }
|
|
52
68
|
example = example_group.example(' an example with whitespace ') {}
|
|
53
69
|
example_group.run
|
|
54
|
-
example.description.
|
|
70
|
+
expect(example.description).to eql('an example with whitespace')
|
|
55
71
|
end
|
|
56
72
|
end
|
|
57
73
|
end
|
|
@@ -72,10 +88,10 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
72
88
|
context "when RSpec.configuration.format_docstrings is set to a block" do
|
|
73
89
|
it "formats the description using the block" do
|
|
74
90
|
RSpec.configuration.format_docstrings { |s| s.upcase }
|
|
75
|
-
example_group.example { 5.
|
|
91
|
+
example_group.example { expect(5).to eq(5) }
|
|
76
92
|
example_group.run
|
|
77
93
|
pattern = /EXAMPLE AT #{relative_path(__FILE__).upcase}:#{__LINE__ - 2}/
|
|
78
|
-
example_group.examples.first.description.
|
|
94
|
+
expect(example_group.examples.first.description).to match(pattern)
|
|
79
95
|
end
|
|
80
96
|
end
|
|
81
97
|
|
|
@@ -83,22 +99,22 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
83
99
|
before(:each) { expect_with :rspec }
|
|
84
100
|
|
|
85
101
|
it "uses the matcher-generated description" do
|
|
86
|
-
example_group.example { 5.
|
|
102
|
+
example_group.example { expect(5).to eq(5) }
|
|
87
103
|
example_group.run
|
|
88
|
-
example_group.examples.first.description.
|
|
104
|
+
expect(example_group.examples.first.description).to eq("should eq 5")
|
|
89
105
|
end
|
|
90
106
|
|
|
91
107
|
it "uses the file and line number if there is no matcher-generated description" do
|
|
92
108
|
example = example_group.example {}
|
|
93
109
|
example_group.run
|
|
94
|
-
example.description.
|
|
110
|
+
expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 2}/)
|
|
95
111
|
end
|
|
96
112
|
|
|
97
113
|
it "uses the file and line number if there is an error before the matcher" do
|
|
98
|
-
example = example_group.example { 5.
|
|
114
|
+
example = example_group.example { expect(5).to eq(5) }
|
|
99
115
|
example_group.before { raise }
|
|
100
116
|
example_group.run
|
|
101
|
-
example.description.
|
|
117
|
+
expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 3}/)
|
|
102
118
|
end
|
|
103
119
|
end
|
|
104
120
|
|
|
@@ -106,22 +122,22 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
106
122
|
before(:each) { expect_with :rspec, :stdlib }
|
|
107
123
|
|
|
108
124
|
it "uses the matcher-generated description" do
|
|
109
|
-
example_group.example { 5.
|
|
125
|
+
example_group.example { expect(5).to eq(5) }
|
|
110
126
|
example_group.run
|
|
111
|
-
example_group.examples.first.description.
|
|
127
|
+
expect(example_group.examples.first.description).to eq("should eq 5")
|
|
112
128
|
end
|
|
113
129
|
|
|
114
130
|
it "uses the file and line number if there is no matcher-generated description" do
|
|
115
131
|
example = example_group.example {}
|
|
116
132
|
example_group.run
|
|
117
|
-
example.description.
|
|
133
|
+
expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 2}/)
|
|
118
134
|
end
|
|
119
135
|
|
|
120
136
|
it "uses the file and line number if there is an error before the matcher" do
|
|
121
|
-
example = example_group.example { 5.
|
|
137
|
+
example = example_group.example { expect(5).to eq(5) }
|
|
122
138
|
example_group.before { raise }
|
|
123
139
|
example_group.run
|
|
124
|
-
example.description.
|
|
140
|
+
expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 3}/)
|
|
125
141
|
end
|
|
126
142
|
end
|
|
127
143
|
|
|
@@ -137,61 +153,61 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
137
153
|
it "uses the file and line number" do
|
|
138
154
|
example = example_group.example { assert 5 == 5 }
|
|
139
155
|
example_group.run
|
|
140
|
-
example.description.
|
|
156
|
+
expect(example.description).to match(/example at #{relative_path(__FILE__)}:#{__LINE__ - 2}/)
|
|
141
157
|
end
|
|
142
158
|
end
|
|
143
159
|
end
|
|
144
160
|
|
|
145
161
|
describe '#described_class' do
|
|
146
162
|
it "returns the class (if any) of the outermost example group" do
|
|
147
|
-
described_class.
|
|
163
|
+
expect(described_class).to eq(RSpec::Core::Example)
|
|
148
164
|
end
|
|
149
165
|
end
|
|
150
166
|
|
|
151
167
|
describe "accessing metadata within a running example" do
|
|
152
168
|
it "has a reference to itself when running" do
|
|
153
|
-
example.description.
|
|
169
|
+
expect(example.description).to eq("has a reference to itself when running")
|
|
154
170
|
end
|
|
155
171
|
|
|
156
172
|
it "can access the example group's top level metadata as if it were its own" do
|
|
157
|
-
example.example_group.metadata.
|
|
158
|
-
example.metadata.
|
|
173
|
+
expect(example.example_group.metadata).to include(:parent_metadata => 'sample')
|
|
174
|
+
expect(example.metadata).to include(:parent_metadata => 'sample')
|
|
159
175
|
end
|
|
160
176
|
end
|
|
161
177
|
|
|
162
178
|
describe "accessing options within a running example" do
|
|
163
179
|
it "can look up option values by key", :demo => :data do
|
|
164
|
-
example.metadata[:demo].
|
|
180
|
+
expect(example.metadata[:demo]).to eq(:data)
|
|
165
181
|
end
|
|
166
182
|
end
|
|
167
183
|
|
|
168
184
|
describe "#run" do
|
|
169
185
|
it "sets its reference to the example group instance to nil" do
|
|
170
186
|
group = RSpec::Core::ExampleGroup.describe do
|
|
171
|
-
example('example') { 1.
|
|
187
|
+
example('example') { expect(1).to eq(1) }
|
|
172
188
|
end
|
|
173
189
|
group.run
|
|
174
|
-
group.examples.first.instance_variable_get("@example_group_instance").
|
|
190
|
+
expect(group.examples.first.instance_variable_get("@example_group_instance")).to be_nil
|
|
175
191
|
end
|
|
176
192
|
|
|
177
193
|
it "runs after(:each) when the example passes" do
|
|
178
194
|
after_run = false
|
|
179
195
|
group = RSpec::Core::ExampleGroup.describe do
|
|
180
196
|
after(:each) { after_run = true }
|
|
181
|
-
example('example') { 1.
|
|
197
|
+
example('example') { expect(1).to eq(1) }
|
|
182
198
|
end
|
|
183
199
|
group.run
|
|
184
|
-
after_run.
|
|
200
|
+
expect(after_run).to be_true, "expected after(:each) to be run"
|
|
185
201
|
end
|
|
186
202
|
|
|
187
203
|
it "runs after(:each) when the example fails" do
|
|
188
204
|
after_run = false
|
|
189
205
|
group = RSpec::Core::ExampleGroup.describe do
|
|
190
206
|
after(:each) { after_run = true }
|
|
191
|
-
example('example') { 1.
|
|
207
|
+
example('example') { expect(1).to eq(2) }
|
|
192
208
|
end
|
|
193
209
|
group.run
|
|
194
|
-
after_run.
|
|
210
|
+
expect(after_run).to be_true, "expected after(:each) to be run"
|
|
195
211
|
end
|
|
196
212
|
|
|
197
213
|
it "runs after(:each) when the example raises an Exception" do
|
|
@@ -201,7 +217,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
201
217
|
example('example') { raise "this error" }
|
|
202
218
|
end
|
|
203
219
|
group.run
|
|
204
|
-
after_run.
|
|
220
|
+
expect(after_run).to be_true, "expected after(:each) to be run"
|
|
205
221
|
end
|
|
206
222
|
|
|
207
223
|
context "with an after(:each) that raises" do
|
|
@@ -210,20 +226,20 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
210
226
|
group = RSpec::Core::ExampleGroup.describe do
|
|
211
227
|
after(:each) { after_run = true }
|
|
212
228
|
after(:each) { raise "FOO" }
|
|
213
|
-
example('example') { 1.
|
|
229
|
+
example('example') { expect(1).to eq(1) }
|
|
214
230
|
end
|
|
215
231
|
group.run
|
|
216
|
-
after_run.
|
|
232
|
+
expect(after_run).to be_true, "expected after(:each) to be run"
|
|
217
233
|
end
|
|
218
234
|
|
|
219
235
|
it "stores the exception" do
|
|
220
236
|
group = RSpec::Core::ExampleGroup.describe
|
|
221
237
|
group.after(:each) { raise "FOO" }
|
|
222
|
-
example = group.example('example') { 1.
|
|
238
|
+
example = group.example('example') { expect(1).to eq(1) }
|
|
223
239
|
|
|
224
240
|
group.run
|
|
225
241
|
|
|
226
|
-
example.metadata[:execution_result][:exception].message.
|
|
242
|
+
expect(example.metadata[:execution_result][:exception].message).to eq("FOO")
|
|
227
243
|
end
|
|
228
244
|
end
|
|
229
245
|
|
|
@@ -241,7 +257,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
241
257
|
end
|
|
242
258
|
|
|
243
259
|
group.run
|
|
244
|
-
results.
|
|
260
|
+
expect(results).to eq([
|
|
245
261
|
"around (before)",
|
|
246
262
|
"before",
|
|
247
263
|
"example",
|
|
@@ -259,13 +275,13 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
259
275
|
after(:all) { @after_all = :after_all }
|
|
260
276
|
end
|
|
261
277
|
group.example("does something") do
|
|
262
|
-
@before_all.
|
|
263
|
-
@before_each.
|
|
278
|
+
expect(@before_all).to eq(:before_all)
|
|
279
|
+
expect(@before_each).to eq(:before_each)
|
|
264
280
|
end
|
|
265
|
-
group.run(double.as_null_object).
|
|
281
|
+
expect(group.run(double.as_null_object)).to be_true
|
|
266
282
|
group.new do |example|
|
|
267
283
|
%w[@before_all @before_each @after_each @after_all].each do |ivar|
|
|
268
|
-
example.instance_variable_get(ivar).
|
|
284
|
+
expect(example.instance_variable_get(ivar)).to be_nil
|
|
269
285
|
end
|
|
270
286
|
end
|
|
271
287
|
end
|
|
@@ -273,10 +289,10 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
273
289
|
it "does not impact the before_all_ivars which are copied to each example" do
|
|
274
290
|
group = RSpec::Core::ExampleGroup.describe do
|
|
275
291
|
before(:all) { @before_all = "abc" }
|
|
276
|
-
example("first") { @before_all.
|
|
277
|
-
example("second") { @before_all.
|
|
292
|
+
example("first") { expect(@before_all).not_to be_nil }
|
|
293
|
+
example("second") { expect(@before_all).not_to be_nil }
|
|
278
294
|
end
|
|
279
|
-
group.run.
|
|
295
|
+
expect(group.run).to be_true
|
|
280
296
|
end
|
|
281
297
|
end
|
|
282
298
|
|
|
@@ -298,7 +314,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
298
314
|
end
|
|
299
315
|
|
|
300
316
|
message = run_and_capture_reported_message(group)
|
|
301
|
-
message.
|
|
317
|
+
expect(message).to match /An error occurred in an around.* hook/i
|
|
302
318
|
end
|
|
303
319
|
|
|
304
320
|
it "prints any after hook errors rather than silencing them" do
|
|
@@ -308,7 +324,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
308
324
|
end
|
|
309
325
|
|
|
310
326
|
message = run_and_capture_reported_message(group)
|
|
311
|
-
message.
|
|
327
|
+
expect(message).to match /An error occurred in an after.* hook/i
|
|
312
328
|
end
|
|
313
329
|
|
|
314
330
|
it 'does not print mock expectation errors' do
|
|
@@ -321,7 +337,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
321
337
|
end
|
|
322
338
|
|
|
323
339
|
message = run_and_capture_reported_message(group)
|
|
324
|
-
message.
|
|
340
|
+
expect(message).to be_nil
|
|
325
341
|
end
|
|
326
342
|
end
|
|
327
343
|
end
|
|
@@ -333,7 +349,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
333
349
|
example { pending }
|
|
334
350
|
end
|
|
335
351
|
group.run
|
|
336
|
-
group.examples.first.
|
|
352
|
+
expect(group.examples.first).to be_pending
|
|
337
353
|
end
|
|
338
354
|
|
|
339
355
|
it "allows post-example processing in around hooks (see https://github.com/rspec/rspec-core/issues/322)" do
|
|
@@ -346,7 +362,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
346
362
|
example { pending }
|
|
347
363
|
end
|
|
348
364
|
group.run
|
|
349
|
-
blah.
|
|
365
|
+
expect(blah).to be(:success)
|
|
350
366
|
end
|
|
351
367
|
end
|
|
352
368
|
|
|
@@ -358,8 +374,8 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
358
374
|
example {}
|
|
359
375
|
end
|
|
360
376
|
group.run
|
|
361
|
-
group.examples.first.
|
|
362
|
-
group.examples.last.
|
|
377
|
+
expect(group.examples.first).to be_pending
|
|
378
|
+
expect(group.examples.last).to be_pending
|
|
363
379
|
end
|
|
364
380
|
end
|
|
365
381
|
|
|
@@ -371,8 +387,8 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
371
387
|
example {}
|
|
372
388
|
end
|
|
373
389
|
group.run
|
|
374
|
-
group.examples.first.
|
|
375
|
-
group.examples.last.
|
|
390
|
+
expect(group.examples.first).to be_pending
|
|
391
|
+
expect(group.examples.last).to be_pending
|
|
376
392
|
end
|
|
377
393
|
end
|
|
378
394
|
|
|
@@ -383,7 +399,7 @@ describe RSpec::Core::Example, :parent_metadata => 'sample' do
|
|
|
383
399
|
example {}
|
|
384
400
|
end
|
|
385
401
|
group.run
|
|
386
|
-
group.examples.first.
|
|
402
|
+
expect(group.examples.first).to be_pending
|
|
387
403
|
end
|
|
388
404
|
end
|
|
389
405
|
end
|
|
@@ -13,7 +13,7 @@ module RSpec::Core
|
|
|
13
13
|
filter_manager.exclusions.clear # defaults
|
|
14
14
|
filter_manager.send name, :foo => :bar
|
|
15
15
|
filter_manager.send name, :baz => :bam
|
|
16
|
-
filter_manager.send(type).
|
|
16
|
+
expect(filter_manager.send(type)).to eq(:foo => :bar, :baz => :bam)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
it "overrides previous #{type} with (via merge)" do
|
|
@@ -21,7 +21,7 @@ module RSpec::Core
|
|
|
21
21
|
filter_manager.exclusions.clear # defaults
|
|
22
22
|
filter_manager.send name, :foo => 1
|
|
23
23
|
filter_manager.send name, :foo => 2
|
|
24
|
-
filter_manager.send(type).
|
|
24
|
+
expect(filter_manager.send(type)).to eq(:foo => 2)
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
it "deletes matching opposites" do
|
|
@@ -29,8 +29,8 @@ module RSpec::Core
|
|
|
29
29
|
filter_manager.exclusions.clear # defaults
|
|
30
30
|
filter_manager.send opposite(name), :foo => 1
|
|
31
31
|
filter_manager.send name, :foo => 2
|
|
32
|
-
filter_manager.send(type).
|
|
33
|
-
filter_manager.send(opposite(type)).
|
|
32
|
+
expect(filter_manager.send(type)).to eq(:foo => 2)
|
|
33
|
+
expect(filter_manager.send(opposite(type))).to be_empty
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
if name == "include"
|
|
@@ -40,14 +40,14 @@ module RSpec::Core
|
|
|
40
40
|
filter_manager = FilterManager.new
|
|
41
41
|
filter_manager.include :foo => :bar
|
|
42
42
|
filter_manager.include filter => "value"
|
|
43
|
-
filter_manager.inclusions.
|
|
43
|
+
expect(filter_manager.inclusions).to eq({filter => "value"})
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it "does nothing when :#{filter} previously set" do
|
|
47
47
|
filter_manager = FilterManager.new
|
|
48
48
|
filter_manager.include filter => "a_value"
|
|
49
49
|
filter_manager.include :foo => :bar
|
|
50
|
-
filter_manager.inclusions.
|
|
50
|
+
expect(filter_manager.inclusions).to eq(filter => "a_value")
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
end
|
|
@@ -60,7 +60,7 @@ module RSpec::Core
|
|
|
60
60
|
filter_manager.exclusions.clear # defaults
|
|
61
61
|
filter_manager.send name, :foo => 1, :bar => 2
|
|
62
62
|
filter_manager.send "#{name}!", :foo => 3
|
|
63
|
-
filter_manager.send(type).
|
|
63
|
+
expect(filter_manager.send(type)).to eq(:foo => 3)
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
it "deletes matching opposites" do
|
|
@@ -68,8 +68,8 @@ module RSpec::Core
|
|
|
68
68
|
filter_manager.exclusions.clear # defaults
|
|
69
69
|
filter_manager.send opposite(name), :foo => 1
|
|
70
70
|
filter_manager.send "#{name}!", :foo => 2
|
|
71
|
-
filter_manager.send(type).
|
|
72
|
-
filter_manager.send(opposite(type)).
|
|
71
|
+
expect(filter_manager.send(type)).to eq(:foo => 2)
|
|
72
|
+
expect(filter_manager.send(opposite(type))).to be_empty
|
|
73
73
|
end
|
|
74
74
|
end
|
|
75
75
|
|
|
@@ -79,7 +79,7 @@ module RSpec::Core
|
|
|
79
79
|
filter_manager.exclusions.clear # defaults
|
|
80
80
|
filter_manager.send name, :foo => 1
|
|
81
81
|
filter_manager.send "#{name}_with_low_priority", :foo => 2
|
|
82
|
-
filter_manager.send(type).
|
|
82
|
+
expect(filter_manager.send(type)).to eq(:foo => 1)
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
it "ignores new #{type} if same key exists in opposite" do
|
|
@@ -87,8 +87,8 @@ module RSpec::Core
|
|
|
87
87
|
filter_manager.exclusions.clear # defaults
|
|
88
88
|
filter_manager.send opposite(name), :foo => 1
|
|
89
89
|
filter_manager.send "#{name}_with_low_priority", :foo => 1
|
|
90
|
-
filter_manager.send(type).
|
|
91
|
-
filter_manager.send(opposite(type)).
|
|
90
|
+
expect(filter_manager.send(type)).to be_empty
|
|
91
|
+
expect(filter_manager.send(opposite(type))).to eq(:foo => 1)
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it "keeps new #{type} if same key exists in opposite but values are different" do
|
|
@@ -96,8 +96,8 @@ module RSpec::Core
|
|
|
96
96
|
filter_manager.exclusions.clear # defaults
|
|
97
97
|
filter_manager.send opposite(name), :foo => 1
|
|
98
98
|
filter_manager.send "#{name}_with_low_priority", :foo => 2
|
|
99
|
-
filter_manager.send(type).
|
|
100
|
-
filter_manager.send(opposite(type)).
|
|
99
|
+
expect(filter_manager.send(type)).to eq(:foo => 2)
|
|
100
|
+
expect(filter_manager.send(opposite(type))).to eq(:foo => 1)
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
end
|
|
@@ -114,7 +114,7 @@ module RSpec::Core
|
|
|
114
114
|
excluded = filterable_object_with
|
|
115
115
|
filter_manager = FilterManager.new
|
|
116
116
|
filter_manager.include :foo => :bar
|
|
117
|
-
filter_manager.prune([included, excluded]).
|
|
117
|
+
expect(filter_manager.prune([included, excluded])).to eq([included])
|
|
118
118
|
end
|
|
119
119
|
|
|
120
120
|
it "excludes objects with tags matching exclusions" do
|
|
@@ -122,7 +122,7 @@ module RSpec::Core
|
|
|
122
122
|
excluded = filterable_object_with({:foo => :bar})
|
|
123
123
|
filter_manager = FilterManager.new
|
|
124
124
|
filter_manager.exclude :foo => :bar
|
|
125
|
-
filter_manager.prune([included, excluded]).
|
|
125
|
+
expect(filter_manager.prune([included, excluded])).to eq([included])
|
|
126
126
|
end
|
|
127
127
|
|
|
128
128
|
it "prefers exclusion when matches previously set inclusion" do
|
|
@@ -131,7 +131,7 @@ module RSpec::Core
|
|
|
131
131
|
filter_manager = FilterManager.new
|
|
132
132
|
filter_manager.include :foo => :bar
|
|
133
133
|
filter_manager.exclude :foo => :bar
|
|
134
|
-
filter_manager.prune([included, excluded]).
|
|
134
|
+
expect(filter_manager.prune([included, excluded])).to eq([included])
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
it "prefers inclusion when matches previously set exclusion" do
|
|
@@ -140,7 +140,7 @@ module RSpec::Core
|
|
|
140
140
|
filter_manager = FilterManager.new
|
|
141
141
|
filter_manager.exclude :foo => :bar
|
|
142
142
|
filter_manager.include :foo => :bar
|
|
143
|
-
filter_manager.prune([included, excluded]).
|
|
143
|
+
expect(filter_manager.prune([included, excluded])).to eq([included])
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
it "prefers previously set inclusion when exclusion matches but has lower priority" do
|
|
@@ -149,7 +149,7 @@ module RSpec::Core
|
|
|
149
149
|
filter_manager = FilterManager.new
|
|
150
150
|
filter_manager.include :foo => :bar
|
|
151
151
|
filter_manager.exclude_with_low_priority :foo => :bar
|
|
152
|
-
filter_manager.prune([included, excluded]).
|
|
152
|
+
expect(filter_manager.prune([included, excluded])).to eq([included])
|
|
153
153
|
end
|
|
154
154
|
|
|
155
155
|
it "prefers previously set exclusion when inclusion matches but has lower priority" do
|
|
@@ -158,50 +158,50 @@ module RSpec::Core
|
|
|
158
158
|
filter_manager = FilterManager.new
|
|
159
159
|
filter_manager.exclude :foo => :bar
|
|
160
160
|
filter_manager.include_with_low_priority :foo => :bar
|
|
161
|
-
filter_manager.prune([included, excluded]).
|
|
161
|
+
expect(filter_manager.prune([included, excluded])).to eq([included])
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
describe "#inclusions#description" do
|
|
166
166
|
it 'cleans up the description' do
|
|
167
167
|
project_dir = File.expand_path('.')
|
|
168
|
-
lambda { }.inspect.
|
|
169
|
-
lambda { }.inspect.
|
|
170
|
-
lambda { }.inspect.
|
|
168
|
+
expect(lambda { }.inspect).to include(project_dir)
|
|
169
|
+
expect(lambda { }.inspect).to include(' (lambda)') if RUBY_VERSION > '1.9'
|
|
170
|
+
expect(lambda { }.inspect).to include('0x')
|
|
171
171
|
|
|
172
172
|
filter_manager = FilterManager.new
|
|
173
173
|
filter_manager.include :foo => lambda { }
|
|
174
174
|
|
|
175
|
-
filter_manager.inclusions.description.
|
|
176
|
-
filter_manager.inclusions.description.
|
|
177
|
-
filter_manager.inclusions.description.
|
|
175
|
+
expect(filter_manager.inclusions.description).not_to include(project_dir)
|
|
176
|
+
expect(filter_manager.inclusions.description).not_to include(' (lambda)')
|
|
177
|
+
expect(filter_manager.inclusions.description).not_to include('0x')
|
|
178
178
|
end
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
describe "#exclusions#description" do
|
|
182
182
|
it 'cleans up the description' do
|
|
183
183
|
project_dir = File.expand_path('.')
|
|
184
|
-
lambda { }.inspect.
|
|
185
|
-
lambda { }.inspect.
|
|
186
|
-
lambda { }.inspect.
|
|
184
|
+
expect(lambda { }.inspect).to include(project_dir)
|
|
185
|
+
expect(lambda { }.inspect).to include(' (lambda)') if RUBY_VERSION > '1.9'
|
|
186
|
+
expect(lambda { }.inspect).to include('0x')
|
|
187
187
|
|
|
188
188
|
filter_manager = FilterManager.new
|
|
189
189
|
filter_manager.exclude :foo => lambda { }
|
|
190
190
|
|
|
191
|
-
filter_manager.exclusions.description.
|
|
192
|
-
filter_manager.exclusions.description.
|
|
193
|
-
filter_manager.exclusions.description.
|
|
191
|
+
expect(filter_manager.exclusions.description).not_to include(project_dir)
|
|
192
|
+
expect(filter_manager.exclusions.description).not_to include(' (lambda)')
|
|
193
|
+
expect(filter_manager.exclusions.description).not_to include('0x')
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
it 'returns `{}` when it only contains the default filters' do
|
|
197
197
|
filter_manager = FilterManager.new
|
|
198
|
-
filter_manager.exclusions.description.
|
|
198
|
+
expect(filter_manager.exclusions.description).to eq({}.inspect)
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
it 'includes other filters' do
|
|
202
202
|
filter_manager = FilterManager.new
|
|
203
203
|
filter_manager.exclude :foo => :bar
|
|
204
|
-
filter_manager.exclusions.description.
|
|
204
|
+
expect(filter_manager.exclusions.description).to eq({ :foo => :bar }.inspect)
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
it 'deprecates an overridden :if filter' do
|
|
@@ -232,14 +232,14 @@ module RSpec::Core
|
|
|
232
232
|
RSpec.stub(:warn_deprecation)
|
|
233
233
|
filter_manager = FilterManager.new
|
|
234
234
|
filter_manager.exclude :if => :custom_filter
|
|
235
|
-
filter_manager.exclusions.description.
|
|
235
|
+
expect(filter_manager.exclusions.description).to eq({ :if => :custom_filter }.inspect)
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
it 'includes an overriden :unless filter' do
|
|
239
239
|
RSpec.stub(:warn_deprecation)
|
|
240
240
|
filter_manager = FilterManager.new
|
|
241
241
|
filter_manager.exclude :unless => :custom_filter
|
|
242
|
-
filter_manager.exclusions.description.
|
|
242
|
+
expect(filter_manager.exclusions.description).to eq({ :unless => :custom_filter }.inspect)
|
|
243
243
|
end
|
|
244
244
|
end
|
|
245
245
|
end
|