Skip to content

Commit b8bd527

Browse files
JonRoweSam Phippen
authored andcommitted
remove deprecation warning for fixtures
1 parent ec76356 commit b8bd527

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lib/rspec/rails/fixture_support.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ module FixtureSupport
2222
# /TODO
2323

2424
self.fixture_path = RSpec.configuration.fixture_path
25-
self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
25+
if ::Rails::VERSION::STRING > '5'
26+
self.use_transactional_tests = RSpec.configuration.use_transactional_fixtures
27+
else
28+
self.use_transactional_fixtures = RSpec.configuration.use_transactional_fixtures
29+
end
2630
self.use_instantiated_fixtures = RSpec.configuration.use_instantiated_fixtures
2731
fixtures RSpec.configuration.global_fixtures if RSpec.configuration.global_fixtures
2832
end

spec/rspec/rails/configuration_spec.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,11 @@ def in_inferring_type_from_location_environment
196196

197197
it "metadata `:type => :request` sets up request example groups" do
198198
a_rails_app = double("Rails application")
199-
the_rails_module = double("Rails module", :application => a_rails_app)
199+
the_rails_module = Module.new
200+
allow(the_rails_module).to receive(:application) { a_rails_app }
201+
version = ::Rails::VERSION
200202
stub_const "Rails", the_rails_module
203+
stub_const 'Rails::VERSION', version
201204

202205
group = RSpec.describe("Some Request API", :type => :request)
203206

@@ -227,8 +230,11 @@ def in_inferring_type_from_location_environment
227230

228231
it "metadata `:type => :feature` sets up feature example groups" do
229232
a_rails_app = double("Rails application")
230-
the_rails_module = double("Rails module", :application => a_rails_app)
233+
the_rails_module = Module.new
234+
allow(the_rails_module).to receive(:application) { a_rails_app }
235+
version = ::Rails::VERSION
231236
stub_const "Rails", the_rails_module
237+
stub_const 'Rails::VERSION', version
232238

233239
group = RSpec.describe("Some feature description", :type => :feature)
234240
example = group.new

0 commit comments

Comments
 (0)