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
|
@@ -43,12 +43,12 @@ module RSpec::Core
|
|
|
43
43
|
|
|
44
44
|
describe "#treat_symbols_as_metadata_keys_with_true_values?" do
|
|
45
45
|
it 'defaults to false' do
|
|
46
|
-
config.treat_symbols_as_metadata_keys_with_true_values
|
|
46
|
+
expect(config.treat_symbols_as_metadata_keys_with_true_values?).to be_false
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
it 'can be set to true' do
|
|
50
50
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
51
|
-
config.treat_symbols_as_metadata_keys_with_true_values
|
|
51
|
+
expect(config.treat_symbols_as_metadata_keys_with_true_values?).to be_true
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
|
|
@@ -76,16 +76,16 @@ module RSpec::Core
|
|
|
76
76
|
mod_config.custom_setting = true
|
|
77
77
|
end
|
|
78
78
|
|
|
79
|
-
custom_config.custom_setting.
|
|
79
|
+
expect(custom_config.custom_setting).to be_true
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
it "raises if framework module doesn't support configuration" do
|
|
83
83
|
mod = Module.new
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
expect {
|
|
86
86
|
config.send m, mod do |mod_config|
|
|
87
87
|
end
|
|
88
|
-
|
|
88
|
+
}.to raise_error(/must respond to `configuration`/)
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
|
|
@@ -117,7 +117,7 @@ module RSpec::Core
|
|
|
117
117
|
it "sets the mock_framework_adapter to that module" do
|
|
118
118
|
mod = Module.new
|
|
119
119
|
config.mock_with mod
|
|
120
|
-
config.mock_framework.
|
|
120
|
+
expect(config.mock_framework).to eq(mod)
|
|
121
121
|
end
|
|
122
122
|
end
|
|
123
123
|
|
|
@@ -187,14 +187,14 @@ module RSpec::Core
|
|
|
187
187
|
it "supports multiple calls" do
|
|
188
188
|
config.expect_with :rspec
|
|
189
189
|
config.expect_with :stdlib
|
|
190
|
-
config.expectation_frameworks.
|
|
190
|
+
expect(config.expectation_frameworks).to eq [RSpec::Matchers, Test::Unit::Assertions]
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
it "raises if block given with multiple args" do
|
|
194
|
-
|
|
194
|
+
expect {
|
|
195
195
|
config.expect_with :rspec, :stdlib do |mod_config|
|
|
196
196
|
end
|
|
197
|
-
|
|
197
|
+
}.to raise_error(/expect_with only accepts/)
|
|
198
198
|
end
|
|
199
199
|
|
|
200
200
|
it "raises ArgumentError if framework is not supported" do
|
|
@@ -234,76 +234,76 @@ module RSpec::Core
|
|
|
234
234
|
end
|
|
235
235
|
|
|
236
236
|
it "returns false by default" do
|
|
237
|
-
config.
|
|
237
|
+
expect(config).not_to be_expecting_with_rspec
|
|
238
238
|
end
|
|
239
239
|
|
|
240
240
|
it "returns true when `expect_with :rspec` has been configured" do
|
|
241
241
|
config.expect_with :rspec
|
|
242
|
-
config.
|
|
242
|
+
expect(config).to be_expecting_with_rspec
|
|
243
243
|
end
|
|
244
244
|
|
|
245
245
|
it "returns true when `expect_with :rspec, :stdlib` has been configured" do
|
|
246
246
|
config.expect_with :rspec, :stdlib
|
|
247
|
-
config.
|
|
247
|
+
expect(config).to be_expecting_with_rspec
|
|
248
248
|
end
|
|
249
249
|
|
|
250
250
|
it "returns true when `expect_with :stdlib, :rspec` has been configured" do
|
|
251
251
|
config.expect_with :stdlib, :rspec
|
|
252
|
-
config.
|
|
252
|
+
expect(config).to be_expecting_with_rspec
|
|
253
253
|
end
|
|
254
254
|
|
|
255
255
|
it "returns false when `expect_with :stdlib` has been configured" do
|
|
256
256
|
config.expect_with :stdlib
|
|
257
|
-
config.
|
|
257
|
+
expect(config).not_to be_expecting_with_rspec
|
|
258
258
|
end
|
|
259
259
|
end
|
|
260
260
|
|
|
261
261
|
describe "#files_to_run" do
|
|
262
262
|
it "loads files not following pattern if named explicitly" do
|
|
263
263
|
config.files_or_directories_to_run = "spec/rspec/core/resources/a_bar.rb"
|
|
264
|
-
config.files_to_run.
|
|
264
|
+
expect(config.files_to_run).to eq([ "spec/rspec/core/resources/a_bar.rb"])
|
|
265
265
|
end
|
|
266
266
|
|
|
267
267
|
it "prevents repetition of dir when start of the pattern" do
|
|
268
268
|
config.pattern = "spec/**/a_spec.rb"
|
|
269
269
|
config.files_or_directories_to_run = "spec"
|
|
270
|
-
config.files_to_run.
|
|
270
|
+
expect(config.files_to_run).to eq(["spec/rspec/core/resources/a_spec.rb"])
|
|
271
271
|
end
|
|
272
272
|
|
|
273
273
|
it "does not prevent repetition of dir when later of the pattern" do
|
|
274
274
|
config.pattern = "rspec/**/a_spec.rb"
|
|
275
275
|
config.files_or_directories_to_run = "spec"
|
|
276
|
-
config.files_to_run.
|
|
276
|
+
expect(config.files_to_run).to eq(["spec/rspec/core/resources/a_spec.rb"])
|
|
277
277
|
end
|
|
278
278
|
|
|
279
279
|
context "with <path>:<line_number>" do
|
|
280
280
|
it "overrides inclusion filters set on config" do
|
|
281
281
|
config.filter_run_including :foo => :bar
|
|
282
282
|
config.files_or_directories_to_run = "path/to/file.rb:37"
|
|
283
|
-
config.inclusion_filter.size.
|
|
284
|
-
config.inclusion_filter[:locations].keys.first.
|
|
285
|
-
config.inclusion_filter[:locations].values.first.
|
|
283
|
+
expect(config.inclusion_filter.size).to eq(1)
|
|
284
|
+
expect(config.inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
|
|
285
|
+
expect(config.inclusion_filter[:locations].values.first).to eq([37])
|
|
286
286
|
end
|
|
287
287
|
|
|
288
288
|
it "overrides inclusion filters set before config" do
|
|
289
289
|
config.force(:inclusion_filter => {:foo => :bar})
|
|
290
290
|
config.files_or_directories_to_run = "path/to/file.rb:37"
|
|
291
|
-
config.inclusion_filter.size.
|
|
292
|
-
config.inclusion_filter[:locations].keys.first.
|
|
293
|
-
config.inclusion_filter[:locations].values.first.
|
|
291
|
+
expect(config.inclusion_filter.size).to eq(1)
|
|
292
|
+
expect(config.inclusion_filter[:locations].keys.first).to match(/path\/to\/file\.rb$/)
|
|
293
|
+
expect(config.inclusion_filter[:locations].values.first).to eq([37])
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
it "clears exclusion filters set on config" do
|
|
297
297
|
config.exclusion_filter = { :foo => :bar }
|
|
298
298
|
config.files_or_directories_to_run = "path/to/file.rb:37"
|
|
299
|
-
config.exclusion_filter.
|
|
299
|
+
expect(config.exclusion_filter).to be_empty,
|
|
300
300
|
"expected exclusion filter to be empty:\n#{config.exclusion_filter}"
|
|
301
301
|
end
|
|
302
302
|
|
|
303
303
|
it "clears exclusion filters set before config" do
|
|
304
304
|
config.force(:exclusion_filter => { :foo => :bar })
|
|
305
305
|
config.files_or_directories_to_run = "path/to/file.rb:37"
|
|
306
|
-
config.exclusion_filter.
|
|
306
|
+
expect(config.exclusion_filter).to be_empty,
|
|
307
307
|
"expected exclusion filter to be empty:\n#{config.exclusion_filter}"
|
|
308
308
|
end
|
|
309
309
|
end
|
|
@@ -311,17 +311,17 @@ module RSpec::Core
|
|
|
311
311
|
context "with default pattern" do
|
|
312
312
|
it "loads files named _spec.rb" do
|
|
313
313
|
config.files_or_directories_to_run = "spec/rspec/core/resources"
|
|
314
|
-
config.files_to_run.
|
|
314
|
+
expect(config.files_to_run).to eq([ "spec/rspec/core/resources/a_spec.rb"])
|
|
315
315
|
end
|
|
316
316
|
|
|
317
317
|
it "loads files in Windows", :if => RSpec.windows_os? do
|
|
318
318
|
config.files_or_directories_to_run = "C:\\path\\to\\project\\spec\\sub\\foo_spec.rb"
|
|
319
|
-
config.files_to_run.
|
|
319
|
+
expect(config.files_to_run).to eq([ "C:/path/to/project/spec/sub/foo_spec.rb"])
|
|
320
320
|
end
|
|
321
321
|
|
|
322
322
|
it "loads files in Windows when directory is specified", :if => RSpec.windows_os? do
|
|
323
323
|
config.files_or_directories_to_run = "spec\\rspec\\core\\resources"
|
|
324
|
-
config.files_to_run.
|
|
324
|
+
expect(config.files_to_run).to eq([ "spec/rspec/core/resources/a_spec.rb"])
|
|
325
325
|
end
|
|
326
326
|
end
|
|
327
327
|
|
|
@@ -329,20 +329,20 @@ module RSpec::Core
|
|
|
329
329
|
it "loads files in the default path when run by rspec" do
|
|
330
330
|
config.stub(:command) { 'rspec' }
|
|
331
331
|
config.files_or_directories_to_run = []
|
|
332
|
-
config.files_to_run.
|
|
332
|
+
expect(config.files_to_run).not_to be_empty
|
|
333
333
|
end
|
|
334
334
|
|
|
335
335
|
it "loads files in the default path when run with DRB (e.g., spork)" do
|
|
336
336
|
config.stub(:command) { 'spork' }
|
|
337
337
|
RSpec::Core::Runner.stub(:running_in_drb?) { true }
|
|
338
338
|
config.files_or_directories_to_run = []
|
|
339
|
-
config.files_to_run.
|
|
339
|
+
expect(config.files_to_run).not_to be_empty
|
|
340
340
|
end
|
|
341
341
|
|
|
342
342
|
it "does not load files in the default path when run by ruby" do
|
|
343
343
|
config.stub(:command) { 'ruby' }
|
|
344
344
|
config.files_or_directories_to_run = []
|
|
345
|
-
config.files_to_run.
|
|
345
|
+
expect(config.files_to_run).to be_empty
|
|
346
346
|
end
|
|
347
347
|
end
|
|
348
348
|
|
|
@@ -359,7 +359,7 @@ module RSpec::Core
|
|
|
359
359
|
config.files_to_run
|
|
360
360
|
end
|
|
361
361
|
|
|
362
|
-
orderings.uniq.size.
|
|
362
|
+
expect(orderings.uniq.size).to eq(1)
|
|
363
363
|
end
|
|
364
364
|
|
|
365
365
|
context 'when the given directories match the pattern' do
|
|
@@ -403,19 +403,19 @@ module RSpec::Core
|
|
|
403
403
|
it "loads files following pattern" do
|
|
404
404
|
file = File.expand_path(File.dirname(__FILE__) + "/resources/a_foo.rb")
|
|
405
405
|
config.files_or_directories_to_run = file
|
|
406
|
-
config.files_to_run.
|
|
406
|
+
expect(config.files_to_run).to include(file)
|
|
407
407
|
end
|
|
408
408
|
|
|
409
409
|
it "loads files in directories following pattern" do
|
|
410
410
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
411
411
|
config.files_or_directories_to_run = dir
|
|
412
|
-
config.files_to_run.
|
|
412
|
+
expect(config.files_to_run).to include("#{dir}/a_foo.rb")
|
|
413
413
|
end
|
|
414
414
|
|
|
415
415
|
it "does not load files in directories not following pattern" do
|
|
416
416
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
417
417
|
config.files_or_directories_to_run = dir
|
|
418
|
-
config.files_to_run.
|
|
418
|
+
expect(config.files_to_run).not_to include("#{dir}/a_bar.rb")
|
|
419
419
|
end
|
|
420
420
|
end
|
|
421
421
|
|
|
@@ -424,16 +424,16 @@ module RSpec::Core
|
|
|
424
424
|
config.send(setter, "**/*_foo.rb,**/*_bar.rb")
|
|
425
425
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
426
426
|
config.files_or_directories_to_run = dir
|
|
427
|
-
config.files_to_run.
|
|
428
|
-
config.files_to_run.
|
|
427
|
+
expect(config.files_to_run).to include("#{dir}/a_foo.rb")
|
|
428
|
+
expect(config.files_to_run).to include("#{dir}/a_bar.rb")
|
|
429
429
|
end
|
|
430
430
|
|
|
431
431
|
it "supports comma separated values with spaces" do
|
|
432
432
|
config.send(setter, "**/*_foo.rb, **/*_bar.rb")
|
|
433
433
|
dir = File.expand_path(File.dirname(__FILE__) + "/resources")
|
|
434
434
|
config.files_or_directories_to_run = dir
|
|
435
|
-
config.files_to_run.
|
|
436
|
-
config.files_to_run.
|
|
435
|
+
expect(config.files_to_run).to include("#{dir}/a_foo.rb")
|
|
436
|
+
expect(config.files_to_run).to include("#{dir}/a_bar.rb")
|
|
437
437
|
end
|
|
438
438
|
end
|
|
439
439
|
end
|
|
@@ -442,7 +442,7 @@ module RSpec::Core
|
|
|
442
442
|
describe "path with line number" do
|
|
443
443
|
it "assigns the line number as a location filter" do
|
|
444
444
|
config.files_or_directories_to_run = "path/to/a_spec.rb:37"
|
|
445
|
-
config.filter.
|
|
445
|
+
expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
|
|
446
446
|
end
|
|
447
447
|
end
|
|
448
448
|
|
|
@@ -450,7 +450,7 @@ module RSpec::Core
|
|
|
450
450
|
it "overrides filters" do
|
|
451
451
|
config.filter_run :focused => true
|
|
452
452
|
config.full_description = "foo"
|
|
453
|
-
config.filter.
|
|
453
|
+
expect(config.filter).not_to have_key(:focused)
|
|
454
454
|
end
|
|
455
455
|
end
|
|
456
456
|
|
|
@@ -458,41 +458,41 @@ module RSpec::Core
|
|
|
458
458
|
|
|
459
459
|
it "assigns the file and line number as a location filter" do
|
|
460
460
|
config.files_or_directories_to_run = "path/to/a_spec.rb:37"
|
|
461
|
-
config.filter.
|
|
461
|
+
expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37]}})
|
|
462
462
|
end
|
|
463
463
|
|
|
464
464
|
it "assigns multiple files with line numbers as location filters" do
|
|
465
465
|
config.files_or_directories_to_run = "path/to/a_spec.rb:37", "other_spec.rb:44"
|
|
466
|
-
config.filter.
|
|
466
|
+
expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37],
|
|
467
467
|
File.expand_path("other_spec.rb") => [44]}})
|
|
468
468
|
end
|
|
469
469
|
|
|
470
470
|
it "assigns files with multiple line numbers as location filters" do
|
|
471
471
|
config.files_or_directories_to_run = "path/to/a_spec.rb:37", "path/to/a_spec.rb:44"
|
|
472
|
-
config.filter.
|
|
472
|
+
expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [37, 44]}})
|
|
473
473
|
end
|
|
474
474
|
end
|
|
475
475
|
|
|
476
476
|
context "with multiple line numbers" do
|
|
477
477
|
it "assigns the file and line numbers as a location filter" do
|
|
478
478
|
config.files_or_directories_to_run = "path/to/a_spec.rb:1:3:5:7"
|
|
479
|
-
config.filter.
|
|
479
|
+
expect(config.filter).to eq({:locations => {File.expand_path("path/to/a_spec.rb") => [1,3,5,7]}})
|
|
480
480
|
end
|
|
481
481
|
end
|
|
482
482
|
|
|
483
483
|
it "assigns the example name as the filter on description" do
|
|
484
484
|
config.full_description = "foo"
|
|
485
|
-
config.filter.
|
|
485
|
+
expect(config.filter).to eq({:full_description => /foo/})
|
|
486
486
|
end
|
|
487
487
|
|
|
488
488
|
it "assigns the example names as the filter on description if description is an array" do
|
|
489
489
|
config.full_description = [ "foo", "bar" ]
|
|
490
|
-
config.filter.
|
|
490
|
+
expect(config.filter).to eq({:full_description => Regexp.union(/foo/, /bar/)})
|
|
491
491
|
end
|
|
492
492
|
|
|
493
493
|
describe "#default_path" do
|
|
494
494
|
it 'defaults to "spec"' do
|
|
495
|
-
config.default_path.
|
|
495
|
+
expect(config.default_path).to eq('spec')
|
|
496
496
|
end
|
|
497
497
|
end
|
|
498
498
|
|
|
@@ -518,8 +518,8 @@ module RSpec::Core
|
|
|
518
518
|
end
|
|
519
519
|
|
|
520
520
|
group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
|
|
521
|
-
group.
|
|
522
|
-
group.new.you_call_this_a_blt
|
|
521
|
+
expect(group).not_to respond_to(:you_call_this_a_blt?)
|
|
522
|
+
expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
|
|
523
523
|
end
|
|
524
524
|
end
|
|
525
525
|
|
|
@@ -530,8 +530,8 @@ module RSpec::Core
|
|
|
530
530
|
end
|
|
531
531
|
|
|
532
532
|
group = ExampleGroup.describe('does like, stuff and junk', :magic_key => :include) { }
|
|
533
|
-
group.
|
|
534
|
-
group.new.you_call_this_a_blt
|
|
533
|
+
expect(group).not_to respond_to(:you_call_this_a_blt?)
|
|
534
|
+
expect(group.new.you_call_this_a_blt?).to eq("egad man, where's the mayo?!?!?")
|
|
535
535
|
end
|
|
536
536
|
end
|
|
537
537
|
|
|
@@ -557,7 +557,7 @@ module RSpec::Core
|
|
|
557
557
|
end
|
|
558
558
|
|
|
559
559
|
group = ExampleGroup.describe(ThatThingISentYou, :magic_key => :extend) { }
|
|
560
|
-
group.
|
|
560
|
+
expect(group).to respond_to(:that_thing)
|
|
561
561
|
end
|
|
562
562
|
|
|
563
563
|
end
|
|
@@ -565,12 +565,12 @@ module RSpec::Core
|
|
|
565
565
|
describe "#run_all_when_everything_filtered?" do
|
|
566
566
|
|
|
567
567
|
it "defaults to false" do
|
|
568
|
-
config.run_all_when_everything_filtered
|
|
568
|
+
expect(config.run_all_when_everything_filtered?).to be_false
|
|
569
569
|
end
|
|
570
570
|
|
|
571
571
|
it "can be queried with question method" do
|
|
572
572
|
config.run_all_when_everything_filtered = true
|
|
573
|
-
config.run_all_when_everything_filtered
|
|
573
|
+
expect(config.run_all_when_everything_filtered?).to be_true
|
|
574
574
|
end
|
|
575
575
|
end
|
|
576
576
|
|
|
@@ -587,8 +587,8 @@ module RSpec::Core
|
|
|
587
587
|
config.tty = true
|
|
588
588
|
config.output_stream.stub :tty? => true
|
|
589
589
|
|
|
590
|
-
config.send(color_option).
|
|
591
|
-
config.send(color_option, output).
|
|
590
|
+
expect(config.send(color_option)).to be_true
|
|
591
|
+
expect(config.send(color_option, output)).to be_true
|
|
592
592
|
end
|
|
593
593
|
end
|
|
594
594
|
|
|
@@ -600,8 +600,8 @@ module RSpec::Core
|
|
|
600
600
|
config.tty = true
|
|
601
601
|
config.output_stream.stub :tty? => false
|
|
602
602
|
|
|
603
|
-
config.send(color_option).
|
|
604
|
-
config.send(color_option, output).
|
|
603
|
+
expect(config.send(color_option)).to be_true
|
|
604
|
+
expect(config.send(color_option, output)).to be_true
|
|
605
605
|
end
|
|
606
606
|
end
|
|
607
607
|
|
|
@@ -613,8 +613,8 @@ module RSpec::Core
|
|
|
613
613
|
config.tty = false
|
|
614
614
|
config.output_stream.stub :tty? => true
|
|
615
615
|
|
|
616
|
-
config.send(color_option).
|
|
617
|
-
config.send(color_option, output).
|
|
616
|
+
expect(config.send(color_option)).to be_true
|
|
617
|
+
expect(config.send(color_option, output)).to be_true
|
|
618
618
|
end
|
|
619
619
|
end
|
|
620
620
|
|
|
@@ -626,8 +626,8 @@ module RSpec::Core
|
|
|
626
626
|
config.tty = false
|
|
627
627
|
config.output_stream.stub :tty? => false
|
|
628
628
|
|
|
629
|
-
config.send(color_option).
|
|
630
|
-
config.send(color_option, output).
|
|
629
|
+
expect(config.send(color_option)).to be_false
|
|
630
|
+
expect(config.send(color_option, output)).to be_false
|
|
631
631
|
end
|
|
632
632
|
end
|
|
633
633
|
|
|
@@ -650,7 +650,7 @@ module RSpec::Core
|
|
|
650
650
|
config.output_stream = StringIO.new
|
|
651
651
|
config.output_stream.stub :tty? => true
|
|
652
652
|
config.send "#{color_option}=", true
|
|
653
|
-
config.send(color_option).
|
|
653
|
+
expect(config.send(color_option)).to be_true
|
|
654
654
|
end
|
|
655
655
|
|
|
656
656
|
it "leaves output stream intact" do
|
|
@@ -659,7 +659,7 @@ module RSpec::Core
|
|
|
659
659
|
config.output_stream = 'foo' if what =~ /Win32/
|
|
660
660
|
end
|
|
661
661
|
config.send "#{color_option}=", true
|
|
662
|
-
config.output_stream.
|
|
662
|
+
expect(config.output_stream).to eq($stdout)
|
|
663
663
|
end
|
|
664
664
|
end
|
|
665
665
|
|
|
@@ -675,7 +675,7 @@ module RSpec::Core
|
|
|
675
675
|
config.stub(:require) { raise LoadError }
|
|
676
676
|
config.send "#{color_option}=", true
|
|
677
677
|
config.color_enabled = true
|
|
678
|
-
config.send(color_option).
|
|
678
|
+
expect(config.send(color_option)).to be_false
|
|
679
679
|
end
|
|
680
680
|
end
|
|
681
681
|
end
|
|
@@ -687,7 +687,7 @@ module RSpec::Core
|
|
|
687
687
|
config.output_stream.stub :tty? => true
|
|
688
688
|
config.force :color => true
|
|
689
689
|
config.color = false
|
|
690
|
-
config.color.
|
|
690
|
+
expect(config.color).to be_true
|
|
691
691
|
end
|
|
692
692
|
end
|
|
693
693
|
|
|
@@ -702,35 +702,35 @@ module RSpec::Core
|
|
|
702
702
|
|
|
703
703
|
it "adds to the list of formatters" do
|
|
704
704
|
config.add_formatter :documentation
|
|
705
|
-
config.formatters.first.
|
|
705
|
+
expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
|
|
706
706
|
end
|
|
707
707
|
|
|
708
708
|
it "finds a formatter by name (w/ Symbol)" do
|
|
709
709
|
config.add_formatter :documentation
|
|
710
|
-
config.formatters.first.
|
|
710
|
+
expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
|
|
711
711
|
end
|
|
712
712
|
|
|
713
713
|
it "finds a formatter by name (w/ String)" do
|
|
714
714
|
config.add_formatter 'documentation'
|
|
715
|
-
config.formatters.first.
|
|
715
|
+
expect(config.formatters.first).to be_an_instance_of(Formatters::DocumentationFormatter)
|
|
716
716
|
end
|
|
717
717
|
|
|
718
718
|
it "finds a formatter by class" do
|
|
719
719
|
formatter_class = Class.new(Formatters::BaseTextFormatter)
|
|
720
720
|
config.add_formatter formatter_class
|
|
721
|
-
config.formatters.first.
|
|
721
|
+
expect(config.formatters.first).to be_an_instance_of(formatter_class)
|
|
722
722
|
end
|
|
723
723
|
|
|
724
724
|
it "finds a formatter by class name" do
|
|
725
725
|
stub_const("CustomFormatter", Class.new(Formatters::BaseFormatter))
|
|
726
726
|
config.add_formatter "CustomFormatter"
|
|
727
|
-
config.formatters.first.
|
|
727
|
+
expect(config.formatters.first).to be_an_instance_of(CustomFormatter)
|
|
728
728
|
end
|
|
729
729
|
|
|
730
730
|
it "finds a formatter by class fully qualified name" do
|
|
731
731
|
stub_const("RSpec::CustomFormatter", Class.new(Formatters::BaseFormatter))
|
|
732
732
|
config.add_formatter "RSpec::CustomFormatter"
|
|
733
|
-
config.formatters.first.
|
|
733
|
+
expect(config.formatters.first).to be_an_instance_of(RSpec::CustomFormatter)
|
|
734
734
|
end
|
|
735
735
|
|
|
736
736
|
it "requires a formatter file based on its fully qualified name" do
|
|
@@ -738,24 +738,24 @@ module RSpec::Core
|
|
|
738
738
|
stub_const("RSpec::CustomFormatter", Class.new(Formatters::BaseFormatter))
|
|
739
739
|
end
|
|
740
740
|
config.add_formatter "RSpec::CustomFormatter"
|
|
741
|
-
config.formatters.first.
|
|
741
|
+
expect(config.formatters.first).to be_an_instance_of(RSpec::CustomFormatter)
|
|
742
742
|
end
|
|
743
743
|
|
|
744
744
|
it "raises NameError if class is unresolvable" do
|
|
745
745
|
config.should_receive(:require).with('rspec/custom_formatter3')
|
|
746
|
-
lambda { config.add_formatter "RSpec::CustomFormatter3" }.
|
|
746
|
+
expect(lambda { config.add_formatter "RSpec::CustomFormatter3" }).to raise_error(NameError)
|
|
747
747
|
end
|
|
748
748
|
|
|
749
749
|
it "raises ArgumentError if formatter is unknown" do
|
|
750
|
-
lambda { config.add_formatter :progresss }.
|
|
750
|
+
expect(lambda { config.add_formatter :progresss }).to raise_error(ArgumentError)
|
|
751
751
|
end
|
|
752
752
|
|
|
753
753
|
context "with a 2nd arg defining the output" do
|
|
754
754
|
it "creates a file at that path and sets it as the output" do
|
|
755
755
|
path = File.join(Dir.tmpdir, 'output.txt')
|
|
756
756
|
config.add_formatter('doc', path)
|
|
757
|
-
config.formatters.first.output.
|
|
758
|
-
config.formatters.first.output.path.
|
|
757
|
+
expect(config.formatters.first.output).to be_a(File)
|
|
758
|
+
expect(config.formatters.first.output.path).to eq(path)
|
|
759
759
|
end
|
|
760
760
|
end
|
|
761
761
|
end
|
|
@@ -770,21 +770,21 @@ module RSpec::Core
|
|
|
770
770
|
|
|
771
771
|
it "sets the filter with a hash" do
|
|
772
772
|
config.filter_run_including :foo => true
|
|
773
|
-
config.inclusion_filter[:foo].
|
|
773
|
+
expect(config.inclusion_filter[:foo]).to be(true)
|
|
774
774
|
end
|
|
775
775
|
|
|
776
776
|
it "sets the filter with a symbol" do
|
|
777
777
|
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
|
|
778
778
|
config.filter_run_including :foo
|
|
779
|
-
config.inclusion_filter[:foo].
|
|
779
|
+
expect(config.inclusion_filter[:foo]).to be(true)
|
|
780
780
|
end
|
|
781
781
|
|
|
782
782
|
it "merges with existing filters" do
|
|
783
783
|
config.filter_run_including :foo => true
|
|
784
784
|
config.filter_run_including :bar => false
|
|
785
785
|
|
|
786
|
-
config.inclusion_filter[:foo].
|
|
787
|
-
config.inclusion_filter[:bar].
|
|
786
|
+
expect(config.inclusion_filter[:foo]).to be(true)
|
|
787
|
+
expect(config.inclusion_filter[:bar]).to be(false)
|
|
788
788
|
end
|
|
789
789
|
end
|
|
790
790
|
|
|
@@ -798,28 +798,28 @@ module RSpec::Core
|
|
|
798
798
|
|
|
799
799
|
it "sets the filter" do
|
|
800
800
|
config.filter_run_excluding :foo => true
|
|
801
|
-
config.exclusion_filter[:foo].
|
|
801
|
+
expect(config.exclusion_filter[:foo]).to be(true)
|
|
802
802
|
end
|
|
803
803
|
|
|
804
804
|
it "sets the filter using a symbol" do
|
|
805
805
|
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
|
|
806
806
|
config.filter_run_excluding :foo
|
|
807
|
-
config.exclusion_filter[:foo].
|
|
807
|
+
expect(config.exclusion_filter[:foo]).to be(true)
|
|
808
808
|
end
|
|
809
809
|
|
|
810
810
|
it "merges with existing filters" do
|
|
811
811
|
config.filter_run_excluding :foo => true
|
|
812
812
|
config.filter_run_excluding :bar => false
|
|
813
813
|
|
|
814
|
-
config.exclusion_filter[:foo].
|
|
815
|
-
config.exclusion_filter[:bar].
|
|
814
|
+
expect(config.exclusion_filter[:foo]).to be(true)
|
|
815
|
+
expect(config.exclusion_filter[:bar]).to be(false)
|
|
816
816
|
end
|
|
817
817
|
end
|
|
818
818
|
|
|
819
819
|
describe "#inclusion_filter" do
|
|
820
820
|
it "returns {} even if set to nil" do
|
|
821
821
|
config.inclusion_filter = nil
|
|
822
|
-
config.inclusion_filter.
|
|
822
|
+
expect(config.inclusion_filter).to eq({})
|
|
823
823
|
end
|
|
824
824
|
end
|
|
825
825
|
|
|
@@ -827,47 +827,47 @@ module RSpec::Core
|
|
|
827
827
|
it "treats symbols as hash keys with true values when told to" do
|
|
828
828
|
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
|
|
829
829
|
config.inclusion_filter = :foo
|
|
830
|
-
config.inclusion_filter.
|
|
830
|
+
expect(config.inclusion_filter).to eq({:foo => true})
|
|
831
831
|
end
|
|
832
832
|
|
|
833
833
|
it "overrides any inclusion filters set on the command line or in configuration files" do
|
|
834
834
|
config.force(:inclusion_filter => { :foo => :bar })
|
|
835
835
|
config.inclusion_filter = {:want => :this}
|
|
836
|
-
config.inclusion_filter.
|
|
836
|
+
expect(config.inclusion_filter).to eq({:want => :this})
|
|
837
837
|
end
|
|
838
838
|
end
|
|
839
839
|
|
|
840
840
|
describe "#exclusion_filter" do
|
|
841
841
|
it "returns {} even if set to nil" do
|
|
842
842
|
config.exclusion_filter = nil
|
|
843
|
-
config.exclusion_filter.
|
|
843
|
+
expect(config.exclusion_filter).to eq({})
|
|
844
844
|
end
|
|
845
845
|
|
|
846
846
|
describe "the default :if filter" do
|
|
847
847
|
it "does not exclude a spec with { :if => true } metadata" do
|
|
848
|
-
config.exclusion_filter[:if].call(true).
|
|
848
|
+
expect(config.exclusion_filter[:if].call(true)).to be_false
|
|
849
849
|
end
|
|
850
850
|
|
|
851
851
|
it "excludes a spec with { :if => false } metadata" do
|
|
852
|
-
config.exclusion_filter[:if].call(false).
|
|
852
|
+
expect(config.exclusion_filter[:if].call(false)).to be_true
|
|
853
853
|
end
|
|
854
854
|
|
|
855
855
|
it "excludes a spec with { :if => nil } metadata" do
|
|
856
|
-
config.exclusion_filter[:if].call(nil).
|
|
856
|
+
expect(config.exclusion_filter[:if].call(nil)).to be_true
|
|
857
857
|
end
|
|
858
858
|
end
|
|
859
859
|
|
|
860
860
|
describe "the default :unless filter" do
|
|
861
861
|
it "excludes a spec with { :unless => true } metadata" do
|
|
862
|
-
config.exclusion_filter[:unless].call(true).
|
|
862
|
+
expect(config.exclusion_filter[:unless].call(true)).to be_true
|
|
863
863
|
end
|
|
864
864
|
|
|
865
865
|
it "does not exclude a spec with { :unless => false } metadata" do
|
|
866
|
-
config.exclusion_filter[:unless].call(false).
|
|
866
|
+
expect(config.exclusion_filter[:unless].call(false)).to be_false
|
|
867
867
|
end
|
|
868
868
|
|
|
869
869
|
it "does not exclude a spec with { :unless => nil } metadata" do
|
|
870
|
-
config.exclusion_filter[:unless].call(nil).
|
|
870
|
+
expect(config.exclusion_filter[:unless].call(nil)).to be_false
|
|
871
871
|
end
|
|
872
872
|
end
|
|
873
873
|
end
|
|
@@ -876,13 +876,13 @@ module RSpec::Core
|
|
|
876
876
|
it "treats symbols as hash keys with true values when told to" do
|
|
877
877
|
RSpec.configuration.stub(:treat_symbols_as_metadata_keys_with_true_values? => true)
|
|
878
878
|
config.exclusion_filter = :foo
|
|
879
|
-
config.exclusion_filter.
|
|
879
|
+
expect(config.exclusion_filter).to eq({:foo => true})
|
|
880
880
|
end
|
|
881
881
|
|
|
882
882
|
it "overrides any exclusion filters set on the command line or in configuration files" do
|
|
883
883
|
config.force(:exclusion_filter => { :foo => :bar })
|
|
884
884
|
config.exclusion_filter = {:want => :this}
|
|
885
|
-
config.exclusion_filter.
|
|
885
|
+
expect(config.exclusion_filter).to eq({:want => :this})
|
|
886
886
|
end
|
|
887
887
|
end
|
|
888
888
|
|
|
@@ -891,19 +891,19 @@ module RSpec::Core
|
|
|
891
891
|
|
|
892
892
|
it "sets the line numbers" do
|
|
893
893
|
config.line_numbers = ['37']
|
|
894
|
-
config.filter.
|
|
894
|
+
expect(config.filter).to eq({:line_numbers => [37]})
|
|
895
895
|
end
|
|
896
896
|
|
|
897
897
|
it "overrides filters" do
|
|
898
898
|
config.filter_run :focused => true
|
|
899
899
|
config.line_numbers = ['37']
|
|
900
|
-
config.filter.
|
|
900
|
+
expect(config.filter).to eq({:line_numbers => [37]})
|
|
901
901
|
end
|
|
902
902
|
|
|
903
903
|
it "prevents subsequent filters" do
|
|
904
904
|
config.line_numbers = ['37']
|
|
905
905
|
config.filter_run :focused => true
|
|
906
|
-
config.filter.
|
|
906
|
+
expect(config.filter).to eq({:line_numbers => [37]})
|
|
907
907
|
end
|
|
908
908
|
end
|
|
909
909
|
|
|
@@ -911,14 +911,14 @@ module RSpec::Core
|
|
|
911
911
|
context "given true" do
|
|
912
912
|
it "clears the backtrace clean patterns" do
|
|
913
913
|
config.full_backtrace = true
|
|
914
|
-
config.backtrace_clean_patterns.
|
|
914
|
+
expect(config.backtrace_clean_patterns).to eq([])
|
|
915
915
|
end
|
|
916
916
|
end
|
|
917
917
|
|
|
918
918
|
context "given false" do
|
|
919
919
|
it "restores backtrace clean patterns" do
|
|
920
920
|
config.full_backtrace = false
|
|
921
|
-
config.backtrace_clean_patterns.
|
|
921
|
+
expect(config.backtrace_clean_patterns).to eq(RSpec::Core::Configuration::DEFAULT_BACKTRACE_PATTERNS)
|
|
922
922
|
end
|
|
923
923
|
end
|
|
924
924
|
|
|
@@ -927,24 +927,29 @@ module RSpec::Core
|
|
|
927
927
|
config_2 = Configuration.new
|
|
928
928
|
|
|
929
929
|
config_1.full_backtrace = true
|
|
930
|
-
config_2.backtrace_clean_patterns.
|
|
930
|
+
expect(config_2.backtrace_clean_patterns).not_to be_empty
|
|
931
931
|
end
|
|
932
932
|
end
|
|
933
933
|
|
|
934
934
|
describe "#cleaned_from_backtrace? defaults" do
|
|
935
935
|
it "returns true for rspec files" do
|
|
936
|
-
config.cleaned_from_backtrace?("lib/rspec/core.rb").
|
|
937
|
-
should be_true
|
|
936
|
+
expect(config.cleaned_from_backtrace?("lib/rspec/core.rb")).to be_true
|
|
938
937
|
end
|
|
939
938
|
|
|
940
939
|
it "returns true for spec_helper" do
|
|
941
|
-
config.cleaned_from_backtrace?("spec/spec_helper.rb").
|
|
942
|
-
should be_true
|
|
940
|
+
expect(config.cleaned_from_backtrace?("spec/spec_helper.rb")).to be_true
|
|
943
941
|
end
|
|
944
942
|
|
|
945
943
|
it "returns true for java files (for JRuby)" do
|
|
946
|
-
config.cleaned_from_backtrace?("org/jruby/RubyArray.java:2336").
|
|
947
|
-
|
|
944
|
+
expect(config.cleaned_from_backtrace?("org/jruby/RubyArray.java:2336")).to be_true
|
|
945
|
+
end
|
|
946
|
+
|
|
947
|
+
it "returns true for files within installed gems" do
|
|
948
|
+
expect(config.cleaned_from_backtrace?('ruby-1.8.7-p334/gems/mygem-2.3.0/lib/mygem.rb')).to be_true
|
|
949
|
+
end
|
|
950
|
+
|
|
951
|
+
it "returns false for files in projects containing 'gems' in the name" do
|
|
952
|
+
expect(config.cleaned_from_backtrace?('code/my-gems-plugin/lib/plugin.rb')).to be_false
|
|
948
953
|
end
|
|
949
954
|
end
|
|
950
955
|
|
|
@@ -989,7 +994,7 @@ module RSpec::Core
|
|
|
989
994
|
it "sets the output" do
|
|
990
995
|
output = mock("output")
|
|
991
996
|
config.output = output
|
|
992
|
-
config.output.
|
|
997
|
+
expect(config.output).to equal(output)
|
|
993
998
|
end
|
|
994
999
|
end
|
|
995
1000
|
|
|
@@ -1015,16 +1020,16 @@ module RSpec::Core
|
|
|
1015
1020
|
end
|
|
1016
1021
|
|
|
1017
1022
|
it "defaults to nil" do
|
|
1018
|
-
config.custom_option.
|
|
1023
|
+
expect(config.custom_option).to be_nil
|
|
1019
1024
|
end
|
|
1020
1025
|
|
|
1021
1026
|
it "adds a predicate" do
|
|
1022
|
-
config.custom_option
|
|
1027
|
+
expect(config.custom_option?).to be_false
|
|
1023
1028
|
end
|
|
1024
1029
|
|
|
1025
1030
|
it "can be overridden" do
|
|
1026
1031
|
config.custom_option = "a value"
|
|
1027
|
-
config.custom_option.
|
|
1032
|
+
expect(config.custom_option).to eq("a value")
|
|
1028
1033
|
end
|
|
1029
1034
|
end
|
|
1030
1035
|
|
|
@@ -1034,26 +1039,26 @@ module RSpec::Core
|
|
|
1034
1039
|
end
|
|
1035
1040
|
|
|
1036
1041
|
it "defaults to 'a value'" do
|
|
1037
|
-
config.custom_option.
|
|
1042
|
+
expect(config.custom_option).to eq("a value")
|
|
1038
1043
|
end
|
|
1039
1044
|
|
|
1040
1045
|
it "returns true for the predicate" do
|
|
1041
|
-
config.custom_option
|
|
1046
|
+
expect(config.custom_option?).to be_true
|
|
1042
1047
|
end
|
|
1043
1048
|
|
|
1044
1049
|
it "can be overridden with a truthy value" do
|
|
1045
1050
|
config.custom_option = "a new value"
|
|
1046
|
-
config.custom_option.
|
|
1051
|
+
expect(config.custom_option).to eq("a new value")
|
|
1047
1052
|
end
|
|
1048
1053
|
|
|
1049
1054
|
it "can be overridden with nil" do
|
|
1050
1055
|
config.custom_option = nil
|
|
1051
|
-
config.custom_option.
|
|
1056
|
+
expect(config.custom_option).to eq(nil)
|
|
1052
1057
|
end
|
|
1053
1058
|
|
|
1054
1059
|
it "can be overridden with false" do
|
|
1055
1060
|
config.custom_option = false
|
|
1056
|
-
config.custom_option.
|
|
1061
|
+
expect(config.custom_option).to eq(false)
|
|
1057
1062
|
end
|
|
1058
1063
|
end
|
|
1059
1064
|
end
|
|
@@ -1073,17 +1078,17 @@ module RSpec::Core
|
|
|
1073
1078
|
|
|
1074
1079
|
it "delegates the getter to the other option" do
|
|
1075
1080
|
config.another_custom_option = "this value"
|
|
1076
|
-
config.custom_option.
|
|
1081
|
+
expect(config.custom_option).to eq("this value")
|
|
1077
1082
|
end
|
|
1078
1083
|
|
|
1079
1084
|
it "delegates the setter to the other option" do
|
|
1080
1085
|
config.custom_option = "this value"
|
|
1081
|
-
config.another_custom_option.
|
|
1086
|
+
expect(config.another_custom_option).to eq("this value")
|
|
1082
1087
|
end
|
|
1083
1088
|
|
|
1084
1089
|
it "delegates the predicate to the other option" do
|
|
1085
1090
|
config.custom_option = true
|
|
1086
|
-
config.another_custom_option
|
|
1091
|
+
expect(config.another_custom_option?).to be_true
|
|
1087
1092
|
end
|
|
1088
1093
|
end
|
|
1089
1094
|
end
|
|
@@ -1095,7 +1100,7 @@ module RSpec::Core
|
|
|
1095
1100
|
|
|
1096
1101
|
config.extend(mod, :foo => :bar)
|
|
1097
1102
|
config.configure_group(group)
|
|
1098
|
-
group.
|
|
1103
|
+
expect(group).to be_a(mod)
|
|
1099
1104
|
end
|
|
1100
1105
|
|
|
1101
1106
|
it "extends with 'module'" do
|
|
@@ -1104,7 +1109,7 @@ module RSpec::Core
|
|
|
1104
1109
|
|
|
1105
1110
|
config.include(mod, :foo => :bar)
|
|
1106
1111
|
config.configure_group(group)
|
|
1107
|
-
group.included_modules.
|
|
1112
|
+
expect(group.included_modules).to include(mod)
|
|
1108
1113
|
end
|
|
1109
1114
|
|
|
1110
1115
|
it "requires only one matching filter" do
|
|
@@ -1113,7 +1118,7 @@ module RSpec::Core
|
|
|
1113
1118
|
|
|
1114
1119
|
config.include(mod, :foo => :bar, :baz => :bam)
|
|
1115
1120
|
config.configure_group(group)
|
|
1116
|
-
group.included_modules.
|
|
1121
|
+
expect(group.included_modules).to include(mod)
|
|
1117
1122
|
end
|
|
1118
1123
|
|
|
1119
1124
|
it "includes each one before deciding whether to include the next" do
|
|
@@ -1129,8 +1134,8 @@ module RSpec::Core
|
|
|
1129
1134
|
config.include(mod1)
|
|
1130
1135
|
config.include(mod2, :foo => :bar)
|
|
1131
1136
|
config.configure_group(group)
|
|
1132
|
-
group.included_modules.
|
|
1133
|
-
group.included_modules.
|
|
1137
|
+
expect(group.included_modules).to include(mod1)
|
|
1138
|
+
expect(group.included_modules).to include(mod2)
|
|
1134
1139
|
end
|
|
1135
1140
|
|
|
1136
1141
|
module IncludeOrExtendMeOnce
|
|
@@ -1186,15 +1191,15 @@ module RSpec::Core
|
|
|
1186
1191
|
|
|
1187
1192
|
describe "#reset" do
|
|
1188
1193
|
it "clears the reporter" do
|
|
1189
|
-
config.reporter.
|
|
1194
|
+
expect(config.reporter).not_to be_nil
|
|
1190
1195
|
config.reset
|
|
1191
|
-
config.instance_variable_get("@reporter").
|
|
1196
|
+
expect(config.instance_variable_get("@reporter")).to be_nil
|
|
1192
1197
|
end
|
|
1193
1198
|
|
|
1194
1199
|
it "clears the formatters" do
|
|
1195
1200
|
config.add_formatter "doc"
|
|
1196
1201
|
config.reset
|
|
1197
|
-
config.formatters.
|
|
1202
|
+
expect(config.formatters).to be_empty
|
|
1198
1203
|
end
|
|
1199
1204
|
end
|
|
1200
1205
|
|
|
@@ -1202,21 +1207,21 @@ module RSpec::Core
|
|
|
1202
1207
|
it "forces order" do
|
|
1203
1208
|
config.force :order => "default"
|
|
1204
1209
|
config.order = "rand"
|
|
1205
|
-
config.order.
|
|
1210
|
+
expect(config.order).to eq("default")
|
|
1206
1211
|
end
|
|
1207
1212
|
|
|
1208
1213
|
it "forces order and seed with :order => 'rand:37'" do
|
|
1209
1214
|
config.force :order => "rand:37"
|
|
1210
1215
|
config.order = "default"
|
|
1211
|
-
config.order.
|
|
1212
|
-
config.seed.
|
|
1216
|
+
expect(config.order).to eq("rand")
|
|
1217
|
+
expect(config.seed).to eq(37)
|
|
1213
1218
|
end
|
|
1214
1219
|
|
|
1215
1220
|
it "forces order and seed with :seed => '37'" do
|
|
1216
1221
|
config.force :seed => "37"
|
|
1217
1222
|
config.order = "default"
|
|
1218
|
-
config.seed.
|
|
1219
|
-
config.order.
|
|
1223
|
+
expect(config.seed).to eq(37)
|
|
1224
|
+
expect(config.order).to eq("rand")
|
|
1220
1225
|
end
|
|
1221
1226
|
|
|
1222
1227
|
it 'can set random ordering' do
|
|
@@ -1224,24 +1229,24 @@ module RSpec::Core
|
|
|
1224
1229
|
RSpec.stub(:configuration => config)
|
|
1225
1230
|
list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
|
|
1226
1231
|
Kernel.should_receive(:rand).and_return(3, 1, 4, 2)
|
|
1227
|
-
list.ordered.
|
|
1232
|
+
expect(list.ordered).to eq([2, 4, 1, 3])
|
|
1228
1233
|
end
|
|
1229
1234
|
|
|
1230
1235
|
it "forces 'false' value" do
|
|
1231
1236
|
config.add_setting :custom_option
|
|
1232
1237
|
config.custom_option = true
|
|
1233
|
-
config.custom_option
|
|
1238
|
+
expect(config.custom_option?).to be_true
|
|
1234
1239
|
config.force :custom_option => false
|
|
1235
|
-
config.custom_option
|
|
1240
|
+
expect(config.custom_option?).to be_false
|
|
1236
1241
|
config.custom_option = true
|
|
1237
|
-
config.custom_option
|
|
1242
|
+
expect(config.custom_option?).to be_false
|
|
1238
1243
|
end
|
|
1239
1244
|
end
|
|
1240
1245
|
|
|
1241
1246
|
describe '#seed' do
|
|
1242
1247
|
it 'returns the seed as an int' do
|
|
1243
1248
|
config.seed = '123'
|
|
1244
|
-
config.seed.
|
|
1249
|
+
expect(config.seed).to eq(123)
|
|
1245
1250
|
end
|
|
1246
1251
|
end
|
|
1247
1252
|
|
|
@@ -1250,7 +1255,7 @@ module RSpec::Core
|
|
|
1250
1255
|
before { config.order = :random }
|
|
1251
1256
|
|
|
1252
1257
|
it 'returns true' do
|
|
1253
|
-
config.randomize
|
|
1258
|
+
expect(config.randomize?).to be_true
|
|
1254
1259
|
end
|
|
1255
1260
|
end
|
|
1256
1261
|
|
|
@@ -1258,7 +1263,7 @@ module RSpec::Core
|
|
|
1258
1263
|
before { config.order = nil }
|
|
1259
1264
|
|
|
1260
1265
|
it 'returns false' do
|
|
1261
|
-
config.randomize
|
|
1266
|
+
expect(config.randomize?).to be_false
|
|
1262
1267
|
end
|
|
1263
1268
|
end
|
|
1264
1269
|
end
|
|
@@ -1268,18 +1273,18 @@ module RSpec::Core
|
|
|
1268
1273
|
before { config.order = 'random:123' }
|
|
1269
1274
|
|
|
1270
1275
|
it 'sets order to "random"' do
|
|
1271
|
-
config.order.
|
|
1276
|
+
expect(config.order).to eq('random')
|
|
1272
1277
|
end
|
|
1273
1278
|
|
|
1274
1279
|
it 'sets seed to 123' do
|
|
1275
|
-
config.seed.
|
|
1280
|
+
expect(config.seed).to eq(123)
|
|
1276
1281
|
end
|
|
1277
1282
|
|
|
1278
1283
|
it 'sets up random ordering' do
|
|
1279
1284
|
RSpec.stub(:configuration => config)
|
|
1280
1285
|
list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
|
|
1281
1286
|
Kernel.should_receive(:rand).and_return(3, 1, 4, 2)
|
|
1282
|
-
list.ordered.
|
|
1287
|
+
expect(list.ordered).to eq([2, 4, 1, 3])
|
|
1283
1288
|
end
|
|
1284
1289
|
end
|
|
1285
1290
|
|
|
@@ -1290,18 +1295,18 @@ module RSpec::Core
|
|
|
1290
1295
|
end
|
|
1291
1296
|
|
|
1292
1297
|
it "sets the order to nil" do
|
|
1293
|
-
config.order.
|
|
1298
|
+
expect(config.order).to be_nil
|
|
1294
1299
|
end
|
|
1295
1300
|
|
|
1296
1301
|
it "sets the seed to nil" do
|
|
1297
|
-
config.seed.
|
|
1302
|
+
expect(config.seed).to be_nil
|
|
1298
1303
|
end
|
|
1299
1304
|
|
|
1300
1305
|
it 'clears the random ordering' do
|
|
1301
1306
|
RSpec.stub(:configuration => config)
|
|
1302
1307
|
list = [1, 2, 3, 4].extend(Extensions::Ordered::Examples)
|
|
1303
1308
|
Kernel.should_not_receive(:rand)
|
|
1304
|
-
list.ordered.
|
|
1309
|
+
expect(list.ordered).to eq([1, 2, 3, 4])
|
|
1305
1310
|
end
|
|
1306
1311
|
end
|
|
1307
1312
|
end
|
|
@@ -1313,18 +1318,18 @@ module RSpec::Core
|
|
|
1313
1318
|
examples = [1, 2, 3, 4]
|
|
1314
1319
|
examples.extend Extensions::Ordered::Examples
|
|
1315
1320
|
config.order_examples { |examples| examples.reverse }
|
|
1316
|
-
examples.ordered.
|
|
1321
|
+
expect(examples.ordered).to eq([4, 3, 2, 1])
|
|
1317
1322
|
end
|
|
1318
1323
|
|
|
1319
1324
|
it 'sets #order to "custom"' do
|
|
1320
1325
|
config.order_examples { |examples| examples.reverse }
|
|
1321
|
-
config.order.
|
|
1326
|
+
expect(config.order).to eq("custom")
|
|
1322
1327
|
end
|
|
1323
1328
|
end
|
|
1324
1329
|
|
|
1325
1330
|
describe "#example_ordering_block" do
|
|
1326
1331
|
it 'defaults to a block that returns the passed argument' do
|
|
1327
|
-
config.example_ordering_block.call([1, 2, 3]).
|
|
1332
|
+
expect(config.example_ordering_block.call([1, 2, 3])).to eq([1, 2, 3])
|
|
1328
1333
|
end
|
|
1329
1334
|
end
|
|
1330
1335
|
|
|
@@ -1335,18 +1340,18 @@ module RSpec::Core
|
|
|
1335
1340
|
groups = [1, 2, 3, 4]
|
|
1336
1341
|
groups.extend Extensions::Ordered::ExampleGroups
|
|
1337
1342
|
config.order_groups { |groups| groups.reverse }
|
|
1338
|
-
groups.ordered.
|
|
1343
|
+
expect(groups.ordered).to eq([4, 3, 2, 1])
|
|
1339
1344
|
end
|
|
1340
1345
|
|
|
1341
1346
|
it 'sets #order to "custom"' do
|
|
1342
1347
|
config.order_groups { |groups| groups.reverse }
|
|
1343
|
-
config.order.
|
|
1348
|
+
expect(config.order).to eq("custom")
|
|
1344
1349
|
end
|
|
1345
1350
|
end
|
|
1346
1351
|
|
|
1347
1352
|
describe "#group_ordering_block" do
|
|
1348
1353
|
it 'defaults to a block that returns the passed argument' do
|
|
1349
|
-
config.group_ordering_block.call([1, 2, 3]).
|
|
1354
|
+
expect(config.group_ordering_block.call([1, 2, 3])).to eq([1, 2, 3])
|
|
1350
1355
|
end
|
|
1351
1356
|
end
|
|
1352
1357
|
|
|
@@ -1360,11 +1365,11 @@ module RSpec::Core
|
|
|
1360
1365
|
end
|
|
1361
1366
|
|
|
1362
1367
|
it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::Examples' do
|
|
1363
|
-
examples.ordered.
|
|
1368
|
+
expect(examples.ordered).to eq([4, 3, 2, 1])
|
|
1364
1369
|
end
|
|
1365
1370
|
|
|
1366
1371
|
it 'sets a block that determines the ordering of a collection extended with Extensions::Ordered::ExampleGroups' do
|
|
1367
|
-
groups.ordered.
|
|
1372
|
+
expect(groups.ordered).to eq([4, 3, 2, 1])
|
|
1368
1373
|
end
|
|
1369
1374
|
end
|
|
1370
1375
|
end
|