I am using selenium and Rails3 Rspec to do a test for an app that uses some Ajax.
A form is submitted using Ajax. Say an email and password field.
The test runs perfectly if I submit the form without validation for uniqueness.
However if I submit the form using a uniqueness validation the test fails saying the email already exists.
However this only fails if I do the test using selenium. If i fill out the form by hand and submit it, it works.
I clear out the database and run the test and the same problem.
Any ideas?
I figured it out.
Selenium tests take place in the actual browser so they write to the development database. I had to clear out my development database between tests using rake db:reset and then the tests passed.