I am using rails
, mongoid
, spork
, rspec
.
While running tests via rspec
I see increasing number of records in my database. Neither purge!
nor database_cleaner
didn't help.
My test is:
describe MyConvertor do
context 'working with my model'
before(:each) do
FactoryGirl.create :my_model
end
# examples go here
end
end
And my spec helper is:
Spork.each_run do
RSpec.configure do |config|
# ...
config.before(:each) do
Mongoid.purge!
end
# ...
end
end
As I mentioned before I also tried database_cleaner
as well but things didn't change:
Spork.prefork do
RSpec.configure do |config|
config.order = "random"
config.use_transactional_fixtures = false
end
end
Spork.each_run do
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner[:mongoid].strategy = :truncation
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
end
So I have a couple of questions at once: why purge!
does not do anything and why DatabaseCleaner
does not work.
I have found a database cleaner issue, but there is no any helpful solution.
I am using
rails 3.2.11
mongoid 3.0.23
I had this on Mac OSX el capitain:
on terminal:
it showed me this warning:
Then i needed to change the order in /etc/paths, making "usr/local/bin" and "/usr/local/sbin" to be on top.
on terminal again:
This solved the problem when I had it.