expect(event.extra).toinclude(sql: 'SELECT "users".* FROM "users" WHERE "users"."id" = $2 AND "users"."foo" = $1')
end
track_exception
expect(sentry_event.dig('extra','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
let(:exception){RuntimeError.new(cause: ActiveRecord::StatementInvalid.new(sql: 'SELECT "users".* FROM "users" WHERE "users"."id" = 1 AND "users"."foo" = $1'))}
expect(event.extra).toinclude(sql: 'SELECT "users".* FROM "users" WHERE "users"."id" = $2 AND "users"."foo" = $1')
end
allow(exception).toreceive(:cause).and_return(ActiveRecord::StatementInvalid.new(sql: 'SELECT "users".* FROM "users" WHERE "users"."id" = 1 AND "users"."foo" = $1'))
track_exception
expect(sentry_event.dig('extra','sql')).toeq('SELECT "users".* FROM "users" WHERE "users"."id" = $2 AND "users"."foo" = $1')