{"action":"created","issue":{"url":"https://api.github.com/repos/blowmage/minitest-rails/issues/171","labels_url":"https://api.github.com/repos/blowmage/minitest-rails/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/blowmage/minitest-rails/issues/171/comments","events_url":"https://api.github.com/repos/blowmage/minitest-rails/issues/171/events","html_url":"https://github.com/blowmage/minitest-rails/issues/171","id":58487094,"number":171,"title":"run all tests against clean database after upgrade to 2.1.1","user":{"login":"abatko","id":231088,"avatar_url":"https://avatars.githubusercontent.com/u/231088?v=3","gravatar_id":"","url":"https://api.github.com/users/abatko","html_url":"https://github.com/abatko","followers_url":"https://api.github.com/users/abatko/followers","following_url":"https://api.github.com/users/abatko/following{/other_user}","gists_url":"https://api.github.com/users/abatko/gists{/gist_id}","starred_url":"https://api.github.com/users/abatko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abatko/subscriptions","organizations_url":"https://api.github.com/users/abatko/orgs","repos_url":"https://api.github.com/users/abatko/repos","events_url":"https://api.github.com/users/abatko/events{/privacy}","received_events_url":"https://api.github.com/users/abatko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-02-22T02:26:36Z","updated_at":"2015-02-22T19:16:16Z","closed_at":null,"body":"What configuration is necessary in order to be able to run each and every test against a clean test database?\r\n\r\nI keep seeing random behaviour (I believe tests run in random order - which is great), but I have been able to run the whole test suite successfully **only once**... otherwise there are failures and errors here and there due to an unclean test database (conflicting data). I thought all transactions are rolled back after each and every test, yet when I look into my test database after any given run there is a pileup of test relics.\r\n\r\nI have tried many combinations of `bundle exec rake test:all` and `bundle exec rake test:all:db` with the following:\r\n * with and without `database_cleaner` (though I am of the understanding that `database_cleaner` is unnecessary because all transactions are supposed to be rolled back)\r\n * with and without `ActiveRecord::Migration.maintain_test_schema!` (the new `rails 4.1` feature)\r\n * with and without first running the deprecated `rake db:test:prepare`"},"comment":{"url":"https://api.github.com/repos/blowmage/minitest-rails/issues/comments/75452006","html_url":"https://github.com/blowmage/minitest-rails/issues/171#issuecomment-75452006","issue_url":"https://api.github.com/repos/blowmage/minitest-rails/issues/171","id":75452006,"user":{"login":"abatko","id":231088,"avatar_url":"https://avatars.githubusercontent.com/u/231088?v=3","gravatar_id":"","url":"https://api.github.com/users/abatko","html_url":"https://github.com/abatko","followers_url":"https://api.github.com/users/abatko/followers","following_url":"https://api.github.com/users/abatko/following{/other_user}","gists_url":"https://api.github.com/users/abatko/gists{/gist_id}","starred_url":"https://api.github.com/users/abatko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abatko/subscriptions","organizations_url":"https://api.github.com/users/abatko/orgs","repos_url":"https://api.github.com/users/abatko/repos","events_url":"https://api.github.com/users/abatko/events{/privacy}","received_events_url":"https://api.github.com/users/abatko/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T19:16:16Z","updated_at":"2015-02-22T19:16:16Z","body":"Thanks for your response.\r\n\r\nI manually bisected to narrow the problem down to my policy tests.\r\n\r\n**test/policies/user_policy_test.rb:**\r\n```\r\nrequire 'test_helper'\r\nclass UserPolicyTest < Minitest::Test\r\n        def test_create\r\n            assert true\r\n        end\r\nend\r\n```\r\n\r\nThis was not a problem prior to this upgrade. Should I be subclassing from something other than `Minitest::Test`?\r\n\r\nAt https://github.com/seattlerb/minitest I keep seeing `require \"minitest/autorun\"` at the top of most test files... I don't know what it's for (I don't understand \"*the easy and explicit way to run all your tests*\" - all my tests already run via `rake test:all`)."}}