Skip to content

unit_record does not work correct with postgresql adapter. #1

@jarl-dk

Description

@jarl-dk

Hi. I am using postgresql.

Now I wanted to use unit_record to speed up my tests. However I realise that it fails with
NoMethodError: undefined method `indexes' for #ActiveRecord::ConnectionAdapters::UnitRecordAdapter:0x7fa18f27ba90

It seems like the postgresql_adapter implements this method, and it is called when invoking ActiveRecord::Base#Count

However If I monkeypatch like this (in unit_test_helper.rb)
class ActiveRecord::ConnectionAdapters::UnitRecordAdapter
def indexes(table_name, name = nil)
[]
end
end

I get the correct behaviour "RuntimeError: ActiveRecord is disconnected; database access is unavailable in unit tests."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions