The well-known simple proof of RRT = Rational Root Test remains valid in a UFD or GCD domain. The sought result is simply the special case when $\:\!\rm f(x)\:\!$ is monic (lead coef $=1$).
Generalization: $ $ we prove RRT in a form that works for both $\rm\color{#0a0}{gcds}$ and cancellable $\rm\color{#c00}{ideals}$ by using only universal laws common to both (commutative, associative, distributive etc). Below we give such a universal proof for degree $3\,$ (to avoid notational obfuscation). It should be clear how this generalizes to any degree.
If $\rm\:D\:$ is a $\rm\color{#0a0}{gcd}$ domain and monic $\rm\:f(x)\in D[x]\:$ has root $\rm\:a/b,\ a,b\in D\,$ then
$\rm\qquad f(x)\, =\, c_0 + c_1 x + c_2 x^2 + x^3,\:$ and $\rm\:b^3\:\! f(a/b) = 0\:$ yields
$\rm\qquad c_0 b^3 + c_1 a b^2 + c_2 a^2 b\, =\, -a^3\ $
$\rm\qquad\qquad\ \ \,\Rightarrow\ (b^3, a b^2,\, a^2 b)\mid \color{#c00}{a^3},\ $ by the gcd divides LHS of above so also RHS
$\rm\qquad\ (b,a)^3 = \, (b^3,\, a b^2,\, a^2 b,\ \color{#c00}{a^3}),\ $ so, by the prior divisibility
$\rm\qquad\qquad\quad\:\! =\, (b^3,\, a b^2,\, a^2 b) $
$\rm\qquad\qquad\quad =\, b\, (b,a)^2,\ $ so cancelling $\rm\,(b,a)^2$ yields
$\rm\qquad\ \, (b,a) =\, b\:\Rightarrow\: b\:|\:a,\ $ i.e. $\rm\: a/b \in D.\ \ $ QED
The degree $\rm\:n> 1\:$ case has the same form: we cancel $\rm\:(b,a)^{n-1}$ from $\rm\,(b,a)^n = b\,(b,a)^{n-1}.$
The $\rm\color{#c00}{ideal}$ analog is the same, except replace "divides" by "contains", and assume that $\rm\,(a,b)\ne 0\,$ is invertible (so cancellable), e.g. in any Dedekind domain. Thus the above yields a uniform proof that PIDs, UFDs, GCD and Dedekind domains satisfy said monic case of the Rational Root Test, i.e. that they are integrally closed.
The proof is more concise using fractional gcds and ideals. Now, with $\rm\:r = a/b,\:$ we simply cancel $\rm\:(r,1)\:$ from $\rm\:(r,1)^n = (r,1)^{n-1}$ so $\rm\:(r,1) = (1),\:$ i.e. $\rm\:r \in D.\:$ See this answer for further details.