I know that I shouldn't be coding to specific ids, but sometimes it just makes life a lot easier. I am using DatabaseCleaner with RSpec and Postgres and I am wondering if it is possible to reset ids in between specs when using the transaction strategy?
Here is my current spec_helper
:
RSpec.configure do |config|
config.expect_with :rspec do |c|
c.syntax = [:should, :expect]
end
config.before(:suite) do
DatabaseCleaner.clean_with(:truncation)
DatabaseCleaner.strategy = :transaction
load_seed_data
end
config.before(:all) do
DatabaseCleaner.start
end
config.after(:all) do
DatabaseCleaner.clean
end
config.example_status_persistence_file_path = "./spec/failures.txt"
config.use_transactional_fixtures = true
config.infer_base_class_for_anonymous_controllers = false
config.order = "random"
config.include FactoryGirl::Syntax::Methods
config.include RSpec::Rails::RequestExampleGroup
config.include Requests::JsonHelpers
config.include Requests::Extensions
end