context'when exception is ActiveRecord::StatementInvalid'do
let(:exception){ActiveRecord::StatementInvalid.new(sql:'SELECT "users".* FROM "users" WHERE "users"."id" = 1 AND "users"."foo" = $1')}
it'adds the normalized SQL query to payload'do
described_class.format!(exception,payload)
expect(payload['exception.sql']).toeq('SELECT "users".* FROM "users" WHERE "users"."id" = $2 AND "users"."foo" = $1')
end
end
context'when the ActiveRecord::StatementInvalid is wrapped in another exception'do
beforedo
allow(exception).toreceive(:cause).and_return(ActiveRecord::StatementInvalid.new(sql:'SELECT "users".* FROM "users" WHERE "users"."id" = 1 AND "users"."foo" = $1'))