Created
January 14, 2012 00:52
-
-
Save jtrim/1609642 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| it 'creates a participant after clicking `confirm' do | |
| load_page | |
| click_on '10:00 am' | |
| # Not sure why the ActiveRecord connection is becoming | |
| # stale...probably something to do with the way capybara runs tests | |
| # with selenium. | |
| # | |
| # Symptom that led to the change: | |
| # Running this in isolation without refreshing the connection would | |
| # yield a passing test. Running it with errbody else caused it to | |
| # fail. When I changed Participant.count to something like: | |
| # | |
| # ActiveRecord::Base.connection.execute('select count(*) from participants').first["count"].to_i | |
| # | |
| # ...the test passed when ran with all other tests, so this led me | |
| # to believe the connection was becoming stale. Re-establishing the | |
| # connection fixes the problem. | |
| expect { | |
| click_on 'Confirm' | |
| }.to change { ActiveRecord::Base.establish_connection; Participant.count }.by(1) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment