File tree Expand file tree Collapse file tree 4 files changed +9
-5
lines changed
lib/rspec/rails/extensions/active_record Expand file tree Collapse file tree 4 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
1
RSpec . configure do |rspec |
2
2
# Delay this in order to give users a chance to configure `expect_with`...
3
3
rspec . before ( :suite ) do
4
- if defined? ( RSpec ::Matchers ) && RSpec ::Matchers . configuration . syntax . include? ( :should ) && defined? ( ActiveRecord ::Associations )
4
+ if defined? ( RSpec ::Matchers ) &&
5
+ RSpec ::Matchers . configuration . respond_to? ( :syntax ) && # RSpec 4 dropped support for monkey-patching `should` syntax
6
+ RSpec ::Matchers . configuration . syntax . include? ( :should ) &&
7
+ defined? ( ActiveRecord ::Associations )
5
8
RSpec ::Matchers . configuration . add_should_and_should_not_to ActiveRecord ::Associations ::CollectionProxy
6
9
end
7
10
end
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ def self.run_all(reporter = nil)
55
55
56
56
config . shared_context_metadata_behavior = :apply_to_host_groups
57
57
58
- config . disable_monkey_patching!
58
+ # Zero monkey patching mode is the default and only mode in RSpec 4
59
+ config . disable_monkey_patching! if config . respond_to? ( :disable_monkey_patching! )
59
60
60
61
config . warnings = true
61
62
config . raise_on_warning = true
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def self.included(klass)
20
20
klass . include ( RSpec ::Rails ::FeatureCheck )
21
21
end
22
22
23
- shared_examples_for 'a model generator with fixtures' do |name , class_name |
23
+ RSpec . shared_examples_for 'a model generator with fixtures' do |name , class_name |
24
24
before { run_generator [ name , '--fixture' ] }
25
25
26
26
describe 'the spec' do
@@ -38,7 +38,7 @@ def self.included(klass)
38
38
end
39
39
end
40
40
41
- shared_examples_for "a request spec generator" do
41
+ RSpec . shared_examples_for "a request spec generator" do
42
42
describe 'generated with flag `--no-request-specs`' do
43
43
before do
44
44
run_generator %w[ posts --no-request-specs ]
Original file line number Diff line number Diff line change 1
1
require 'pathname'
2
2
3
- shared_examples_for "an rspec-rails example group mixin" do |type , *paths |
3
+ RSpec . shared_examples_for "an rspec-rails example group mixin" do |type , *paths |
4
4
let ( :mixin ) { described_class }
5
5
6
6
def define_group_in ( path , group_definition )
You can’t perform that action at this time.
0 commit comments