@@ -355,28 +355,10 @@ def mod.configuration; @config ||= Struct.new(:custom_setting).new; end
355
355
context 'when there are already some example groups defined' do
356
356
before { allow ( RSpec ::Support ) . to receive ( :require_rspec_core ) }
357
357
358
- it 'raises an error since this setting must be applied before any groups are defined ' do
358
+ it 'does not raise an error ' do
359
359
allow ( RSpec . world ) . to receive ( :example_groups ) . and_return ( [ double . as_null_object ] )
360
360
class_double ( "RSpec::Core::MockingAdapters::Mocha" , :framework_name => :mocha ) . as_stubbed_const
361
361
362
- expect {
363
- config . mock_with :mocha
364
- } . to raise_error ( /must be configured before any example groups are defined/ )
365
- end
366
-
367
- it 'does not raise an error if the default `mock_with :rspec` is re-configured' do
368
- config . mock_framework # called by RSpec when configuring the first example group
369
- allow ( RSpec . world ) . to receive ( :example_groups ) . and_return ( [ double . as_null_object ] )
370
- config . mock_with :rspec
371
- end
372
-
373
- it 'does not raise an error if re-setting the same config' do
374
- class_double ( "RSpec::Core::MockingAdapters::Mocha" , :framework_name => :mocha ) . as_stubbed_const
375
-
376
- groups = [ ]
377
- allow ( RSpec . world ) . to receive_messages ( :example_groups => groups )
378
- config . mock_with :mocha
379
- groups << double . as_null_object
380
362
config . mock_with :mocha
381
363
end
382
364
end
@@ -487,26 +469,10 @@ def stub_expectation_adapters
487
469
end
488
470
489
471
context 'when there are already some example groups defined' do
490
- it 'raises an error since this setting must be applied before any groups are defined' do
491
- allow ( RSpec . world ) . to receive ( :example_groups ) . and_return ( [ double . as_null_object ] )
492
- expect {
493
- config . expect_with :rspec
494
- } . to raise_error ( /must be configured before any example groups are defined/ )
495
- end
496
-
497
- it 'does not raise an error if the default `expect_with :rspec` is re-configured' do
498
- config . expectation_frameworks # called by RSpec when configuring the first example group
472
+ it 'does not raise an error' do
499
473
allow ( RSpec . world ) . to receive ( :example_groups ) . and_return ( [ double . as_null_object ] )
500
474
config . expect_with :rspec
501
475
end
502
-
503
- it 'does not raise an error if re-setting the same config' do
504
- groups = [ ]
505
- allow ( RSpec . world ) . to receive_messages ( :example_groups => groups )
506
- config . expect_with :minitest
507
- groups << double . as_null_object
508
- config . expect_with :minitest
509
- end
510
476
end
511
477
end
512
478
@@ -2768,52 +2734,6 @@ def in_fully_monkey_patched_rspec_environment
2768
2734
} . to change { Marshal . respond_to? ( :dump_with_rspec_mocks ) } . from ( true ) . to ( false )
2769
2735
end
2770
2736
end
2771
-
2772
- context 'when user did not configure mock framework' do
2773
- def emulate_not_configured_mock_framework
2774
- in_fully_monkey_patched_rspec_environment do
2775
- allow ( config ) . to receive ( :rspec_mocks_loaded? ) . and_return ( false , true )
2776
- config . instance_variable_set :@mock_framework , nil
2777
- ExampleGroup . send :remove_class_variable , :@@example_groups_configured
2778
-
2779
- yield
2780
- end
2781
- end
2782
-
2783
- it 'disables monkey patching after example groups being configured' do
2784
- emulate_not_configured_mock_framework do
2785
- obj = Object . new
2786
- config . disable_monkey_patching!
2787
-
2788
- expect {
2789
- ExampleGroup . ensure_example_groups_are_configured
2790
- } . to change { obj . respond_to? ( :should_receive ) } . from ( true ) . to ( false )
2791
- end
2792
- end
2793
- end
2794
-
2795
- context 'when user did not configure expectation framework' do
2796
- def emulate_not_configured_expectation_framework
2797
- in_fully_monkey_patched_rspec_environment do
2798
- allow ( config ) . to receive ( :rspec_expectations_loaded? ) . and_return ( false , true )
2799
- config . instance_variable_set :@expectation_frameworks , [ ]
2800
- ExampleGroup . send :remove_class_variable , :@@example_groups_configured
2801
-
2802
- yield
2803
- end
2804
- end
2805
-
2806
- it 'disables monkey patching after example groups being configured' do
2807
- emulate_not_configured_expectation_framework do
2808
- obj = Object . new
2809
- config . disable_monkey_patching!
2810
-
2811
- expect {
2812
- ExampleGroup . ensure_example_groups_are_configured
2813
- } . to change { obj . respond_to? ( :should ) } . from ( true ) . to ( false )
2814
- end
2815
- end
2816
- end
2817
2737
end
2818
2738
2819
2739
describe 'recording spec start time (for measuring load)' do
0 commit comments