Skip to content

Commit

Permalink
Simplified DB check.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonid Beder committed Feb 18, 2014
1 parent f0fc223 commit 2a10345
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/health_monitor/providers/database.rb
Expand Up @@ -5,8 +5,7 @@ class DatabaseException < StandardError; end
class Database
def check!
# Check connection to the DB:
query = 'SELECT version FROM schema_migrations'
ActiveRecord::Base.connection.select_value(query).to_i
ActiveRecord::Migrator.current_version
rescue Exception => e
raise DatabaseException.new(e.message)
end
Expand Down
2 changes: 1 addition & 1 deletion spec/support/providers.rb
Expand Up @@ -6,7 +6,7 @@ def stub_cache_failure
end

def stub_database_failure
ActiveRecord::Base.connection.stub(:select_value).and_raise(Exception)
ActiveRecord::Migrator.stub(:current_version).and_raise(Exception)
end

def stub_redis_failure
Expand Down

0 comments on commit 2a10345

Please sign in to comment.