(#16752) Refactor spec test

Previously, the spec test replicated logic for how pkgadd is invoked,
and did so inconsistently  -- whenever the resource's source ends in a
slash, the get_version method gets called which invokes `pkginfo -I
bash`, and the corresponding expectation was only sometimes set.

This commit moves to two types of install expectations to helper
methods, converts the test to use `let` blocks, and sets the parameters
on the resource directly, instead of needing to define a `package`
method. It also adds a test to ensure the source parameter is updated.