Sha256: 0df45d2dffe8ad0043689a5f19ef688951adfe628d927bd3f06770a9062bc073

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

require 'spec_helper'
require 'active_record'

describe "active record health check" do
  let(:health_check) { HealthRails::HealthCheck.new }

  it "raise exception if connection is not active" do
    foo_bar_adapter = mock("ActiveRecord::ConnectionAdapters::FooBarAdapter", active?: false, adapter_name: "FooBar")
    ActiveRecord::Base.stub(:connection).and_return(foo_bar_adapter)
    health_check.process_check("ActiveRecord connection")
    health_check.errors.size.should be(1)
    health_check.errors.first.should eql("ActiveRecord connection: FooBar connection is gone from us!")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
health_rails-0.0.2 spec/health_checks/active_record_health_check_spec.rb
health_rails-0.0.1 spec/health_checks/active_record_health_check_spec.rb