{"action":"created","issue":{"url":"https://api.github.com/repos/lotus/model/issues/256","labels_url":"https://api.github.com/repos/lotus/model/issues/256/labels{/name}","comments_url":"https://api.github.com/repos/lotus/model/issues/256/comments","events_url":"https://api.github.com/repos/lotus/model/issues/256/events","html_url":"https://github.com/lotus/model/pull/256","id":112137536,"number":256,"title":"database busy exception test","user":{"login":"aderyabin","id":88676,"avatar_url":"https://avatars.githubusercontent.com/u/88676?v=3","gravatar_id":"","url":"https://api.github.com/users/aderyabin","html_url":"https://github.com/aderyabin","followers_url":"https://api.github.com/users/aderyabin/followers","following_url":"https://api.github.com/users/aderyabin/following{/other_user}","gists_url":"https://api.github.com/users/aderyabin/gists{/gist_id}","starred_url":"https://api.github.com/users/aderyabin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aderyabin/subscriptions","organizations_url":"https://api.github.com/users/aderyabin/orgs","repos_url":"https://api.github.com/users/aderyabin/repos","events_url":"https://api.github.com/users/aderyabin/events{/privacy}","received_events_url":"https://api.github.com/users/aderyabin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lotus/model/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/lotus/model/milestones/11","html_url":"https://github.com/lotus/model/milestones/v0.6.0","labels_url":"https://api.github.com/repos/lotus/model/milestones/11/labels","id":1330838,"number":11,"title":"v0.6.0","description":"","creator":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":3,"state":"open","created_at":"2015-09-30T10:23:08Z","updated_at":"2015-10-20T03:53:07Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-10-19T12:49:49Z","updated_at":"2015-10-20T13:00:53Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/lotus/model/pulls/256","html_url":"https://github.com/lotus/model/pull/256","diff_url":"https://github.com/lotus/model/pull/256.diff","patch_url":"https://github.com/lotus/model/pull/256.patch"},"body":"I've tried to fix #250 by repeating steps, but it has very informative output (`lotus-model` from `master`):\r\n```\r\n/Users/ad/code/tmp/model/lib/lotus/model/migrator/postgres_adapter.rb:51:in `block in drop': dropdb: database removal failed: ERROR:  database \"bookshelf_development\" is being accessed by other users (Lotus::Model::MigrationError)\r\nDETAIL:  There is 1 other session using the database.\r\n```\r\n\r\nSo #250 could be closed without PR, I just added only test that exception has message from database."},"comment":{"url":"https://api.github.com/repos/lotus/model/issues/comments/149560988","html_url":"https://github.com/lotus/model/pull/256#issuecomment-149560988","issue_url":"https://api.github.com/repos/lotus/model/issues/256","id":149560988,"user":{"login":"jodosha","id":5089,"avatar_url":"https://avatars.githubusercontent.com/u/5089?v=3","gravatar_id":"","url":"https://api.github.com/users/jodosha","html_url":"https://github.com/jodosha","followers_url":"https://api.github.com/users/jodosha/followers","following_url":"https://api.github.com/users/jodosha/following{/other_user}","gists_url":"https://api.github.com/users/jodosha/gists{/gist_id}","starred_url":"https://api.github.com/users/jodosha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jodosha/subscriptions","organizations_url":"https://api.github.com/users/jodosha/orgs","repos_url":"https://api.github.com/users/jodosha/repos","events_url":"https://api.github.com/users/jodosha/events{/privacy}","received_events_url":"https://api.github.com/users/jodosha/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T13:00:53Z","updated_at":"2015-10-20T13:00:53Z","body":"@aderyabin LGTM :+1: \r\n\r\n@joneslee85 \r\n> wondering if this change would affect other tests because it might not release the session\r\n\r\nWe can use this trick as an `after` block to run for each test: `::Sequel::DATABASES.each(&:disconnect)`. Unfortunately, MiniTest doesn't have a global configuration like RSpec. For instance:\r\n\r\n```ruby\r\nRSpec.configure do |config|\r\n  config.after { disconnect_database } # This is ran after each example\r\nend\r\n```\r\n\r\n@aderyabin Would you love to make this possible? Here's something useful that could make this possible: http://ruby-doc.org/stdlib-2.0.0/libdoc/minitest/rdoc/MiniTest/Unit/LifecycleHooks.html"}}