I'm getting the following deprecation warning when running the tests against Rails 5.0.0.beta2:
DEPRECATION WARNING: use_transactional_fixtures= is deprecated and will be removed from Rails 5.1 (use use_transactional_tests= instead).
I'm using:
gem "rspec-core", :github => "rspec/rspec-core"
gem "rspec-expectations", :github => "rspec/rspec-expectations"
gem "rspec-mocks", :github => "rspec/rspec-mocks"
gem "rspec-support", :github => "rspec/rspec-support"
gem "rspec-rails", :github => "rspec/rspec-rails"
and I have:
config.use_transactional_fixtures = true
in spec_helper.rb.
Did you follow the deprecation warning's suggestion?
Please check you are using an up to date version of master, or the recently released beta version of rspec and rspec-rails, failing that check that ::Rails::VERSION::STRING > '5' returns true as this has already been fixed in master and the beta.
That's my mistake - I didn't correctly update the dependencies. Sorry for that!
Using master and having config.use_transactional_fixtures = true triggers no deprecation.
However, when I change it to config.use_transactional_tests = true I get undefined methoduse_transactional_tests=' for #
Hi @adamniedzielski! Did you manage to fix it? I'm struggling with the same error now. I mean with undefined method 'use_transactional_tests=' for #<RSpec::Core::Configuration
@adamniedzielski I was able to resolve this using 3.5.0beta in Gemfile.
- gem 'rspec-rails'
+ gem 'rspec-rails', '~> 3.5.0.beta'
and in rails_helper.rb
RSpec.configure do |config|
config.use_transactional_fixtures = true
@lacostenycoder All versions of 3.5.0 support the config snipper you've used, you should use ~> 3.5.0 given there are actual released versions.
I'm using 5.1.1 and rspec-rails 3.6.0 and still getting this issue. Any one else able to fix it?
@andrewdang17 did you try removing the version from your Gemfile and then do
bundle update rspec ?
@lacostenycoder yeah just tried it and still getting the same errors
Still getting undefined method 'use_transactional_tests=' for #<RSpec::Core::Configuration with rspec 3.8.1 馃檱
@aadityataparia yes thats correct, its still use_transactional_fixtures= we map it to the correct Rails method under the hood.
@JonRowe what do you think about adding an alias to avoid confusion? 馃 maybe here https://github.com/rspec/rspec-rails/blob/master/lib/rspec/rails/configuration.rb#L65
@aadityataparia Our method name hasn't changed and is documented, you are the first person to tell us you were confused by it so I'd prefer not to add it.
Nope. It's confusing.
Configuration uses _fixtures_:
RSpec.configure do |config|
config.use_transactional_fixtures = true
end
But ExampleGroup only works with _tests_:
describe "transactions" do
self.use_transactional_tests = false
end
ExampleGroup defines both attributes, but they start with independent values:
use_transactional_tests #=> true
use_transactional_fixtures #=> nil
There is also a configuration alias for use_transactional_examples... so that's three ways to set it right now.
It might be best to alias all of these options together: because the example group options can have different values (and only one of them works), it is indeed very confusing as it is now.
EDIT: Ok, I see there is an explanation in #2008 that the _tests_ one comes from Rails namespace pollution.
I think a lot of the confusion on this thread stems from adding config.use_transactional_fixtures = false to the spec_helper instead of the rails_helper. Make sure you add it to rails_helper and it won't throw an undefined.
Most helpful comment
That's my mistake - I didn't correctly update the dependencies. Sorry for that!
Using
masterand havingconfig.use_transactional_fixtures = truetriggers no deprecation.However, when I change it to (NoMethodError)` so it's not possible to follow the deprecation warning's suggestion.
config.use_transactional_tests = trueI getundefined methoduse_transactional_tests=' for #