Closed JESii closed 10 years ago
Can you share your DatabaseCleaner configuration? Ours typically looks like this:
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:deletion)
end
config.before(:each) do
DatabaseCleaner.strategy = :transaction
end
config.before(:each, js: true) do
DatabaseCleaner.strategy = :deletion
end
config.before(:each) do
DatabaseCleaner.start
end
config.after(:each) do
DatabaseCleaner.clean
end
end
Sure... here's what I have now in spec/spec_helper.rb: require 'database_cleaner'
RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.before(:suite) do DatabaseCleaner.strategy = :truncation DatabaseCleaner.clean_with(:truncation) end
config.before(:each) do DatabaseCleaner.start end
config.after(:each) do DatabaseCleaner.clean end
I switched from transaction strategy to truncation a short while back in an effort to resolve the problem, and finally just added a DatabaseCleaner.clean to the spec that was giving me problems.
...jon
On Tue, 10 Sep 2013 13:20:58 -0700 Dan Croak notifications@github.com wrote:
Can you share your DatabaseCleaner configuration? Ours typically looks like this:
RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with(:deletion) end config.before(:each) do DatabaseCleaner.strategy = :transaction end config.before(:each, js: true) do DatabaseCleaner.strategy = :deletion end config.before(:each) do DatabaseCleaner.start end config.after(:each) do DatabaseCleaner.clean end end
Reply to this email directly or view it on GitHub: https://github.com/thoughtbot/clearance/issues/356#issuecomment-24191115
Cool. Looks pretty close to ours. Are your features using JavaScript?
Have you tried the DatabaseCleaner
configuration settings for config.before(:suite)
, config.before(:each)
, and config.before(:each, js: true)
as shown in my comment?
No JavaScript. In fact, the features I was having problems with were the ones included from Clearance.
I'll give those a whirl tomorrow; thanks...jon
On Tue, 10 Sep 2013 16:26:13 -0700 Dan Croak notifications@github.com wrote:
Cool. Looks pretty close to ours. Are your features using JavaScript?
Have you tried the
DatabaseCleaner
configuration settings forconfig.before(:suite)
,config.before(:each)
, andconfig.before(:each, js: true)
as shown in my comment?
Reply to this email directly or view it on GitHub: https://github.com/thoughtbot/clearance/issues/356#issuecomment-24202747
Just tried it with your DatabaseCleaner configuration settings and still have the problem. When I run
rspec ./spec/features/clearance/visitor_signs_up_spec.rb
the "with valid email and password" spec fails due to email already exists, whereas if I run that spec individually, it passes.
@JESii , is this still an issue? It does appear as though it is an issue with the spec or database cleaner (though the configurations seem similar). If it's still an issue, would you be able to post a reproduction of it somewhere?
Don’t know, Derek, but I’ll try to check back in on it. Just starting my new assignment so time is short at the moment.
cheers…jn
Jon Seidel, CMC® EDP Consulting, Inc. / www.edpci.com / www.4mypasswords.com Effective Decisions... Priceless! LinkedIn Profile Technology that means Business - Since 1979 phone: 510-530-6314 fax: 510-531-1522
Results that Make the Difference! The Certified Management Consultant (CMC) mark is awarded to consultants who meet the strict standards defined by the Institute of Management Consultants USA (an ISO/IEC 17024:2003 Certifying Body), including examination by their peers, client evaluations, and a written examination evidencing their understanding of the IMC USA's Code of Ethics. The CMC is the only consulting certification that has been ISO-accredited and recognized by the insurance industry as reducing risk. Check out IMC USA for more information.
On Feb 4, 2014, at 8:16 PM, Derek Prior notifications@github.com wrote:
@JESii , is this still an issue? It does appear as though it is an issue with the spec or database cleaner (though the configurations seem similar). If it's still an issue, would you be able to post a reproduction of it somewhere?
— Reply to this email directly or view it on GitHub.
Going to close this for now. Re-open, or make a new issue if you still experience problems.
I've installed Clearance in my app and also generated the feature specs (rails g clearance:specs), but when I run them, the test database is not properly cleaned up.
I've got database_cleaner installed & configured and all my other tests run just fine, but the specs, for example:
fails because there's data left over from a previous test. Same thing for all the other specs. If I run them individually, they pass.
Any ideas as to why that is?