you can use:

```ruby
e = assert_raises(ActiveRecord::StatementInvalid) do

end
assert_instance_of PG::LockNotAvailable, e.original_exception
```