Skip to content

Commit 1131734

Browse files
author
Sam Phippen
committed
Fix RSpec mocks load order with system test
1 parent 49398a5 commit 1131734

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lib/rspec/rails/active_record.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def self.initialize_activerecord_configuration(config)
88
config.before :suite do
99
# This allows dynamic columns etc to be used on ActiveRecord models when creating instance_doubles
1010
if defined?(ActiveRecord) && defined?(ActiveRecord::Base) && defined?(::RSpec::Mocks)
11+
require 'rspec/mocks'
1112
::RSpec::Mocks.configuration.when_declaring_verifying_double do |possible_model|
1213
target = possible_model.target
1314

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
require "spec_helper"
2-
3-
if defined?(RSpec::Rails::SystemExampleGroup)
4-
RSpec.describe RSpec::Rails::SystemExampleGroup do
5-
it_behaves_like "an rspec-rails example group mixin", :system,
6-
'./spec/system/', '.\\spec\\system\\'
2+
module RSpec::Rails
3+
if defined?(SystemExampleGroup)
4+
RSpec.describe SystemExampleGroup do
5+
it_behaves_like "an rspec-rails example group mixin", :system,
6+
'./spec/system/', '.\\spec\\system\\'
7+
end
78
end
89
end

0 commit comments

Comments
 (0)