On Feb 13, 2012, at 1:16 PM, Patrick J. Collins wrote:
> Hi,
>
> I was writing an integration test for my user signup form (with
> capybara), and found that my test was failing due to a validation error:
> "email is already taken". I'm a bit confused because I thought when I
> run "rspec spec/some_spec.rb", the test database would be wiped clear?
>
> Is that not the case?
>
> Patrick J. Collins
> http://collinatorstudios.com
>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
You basically have two options to ensure a clean database:
1.) Transactional examples:
RSpec.configuration.use_transactional_examples = true
2.) DatabaseCleaner:
RSpec.configure do |config|
config.before { DatabaseCleaner.start }
config.after { DatabaseCleaner.clean }
end
Look into what those do. Let us know if you get stuck.
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users