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 @@ -54,7 +54,8 @@ def self.run_all(reporter = nil)
54
54
55
55
config . shared_context_metadata_behavior = :apply_to_host_groups
56
56
57
- config . disable_monkey_patching!
57
+ # Zero monkey patching mode is the default and only mode in RSpec 4
58
+ config . disable_monkey_patching! if config . respond_to? ( :disable_monkey_patching! )
58
59
59
60
config . warnings = true
60
61
config . raise_on_warning = true
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ def self.included(klass)
19
19
klass . extend ( Macros )
20
20
end
21
21
22
- shared_examples_for 'a model generator with fixtures' do |name , class_name |
22
+ RSpec . shared_examples_for 'a model generator with fixtures' do |name , class_name |
23
23
before { run_generator [ name , '--fixture' ] }
24
24
25
25
describe 'the spec' do
@@ -37,7 +37,7 @@ def self.included(klass)
37
37
end
38
38
end
39
39
40
- shared_examples_for "a request spec generator" do
40
+ RSpec . shared_examples_for "a request spec generator" do
41
41
describe 'generated with flag `--no-request-specs`' do
42
42
before do
43
43
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