Fix rspec deprecation
Fix rspec deprecation

Referencing a variable created using `let` within a `before`/`before(:all)` block is deprecated, so moved it to a method.

travis-ci/travis-api,travis-ci/travis-api,travis-ci/travis-api