Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try switching from
let
to method to prevent leaking double
In theory, a `let` should create a new variable each time, but we're seeing errors like: ``` GitHubRepoFetcher#repo fetches a repo from GitHub if it doesn't exist in the cache Failure/Error: all_alphagov_repos.find { |repo| repo.name == repo_name } || raise("alphagov/#{repo_name} not found") #<Double "Public repo"> was originally created in one example but has leaked into another example and can no longer be used. rspec-mocks' doubles are designed to only last for one example, and you need to create a new one in each example you wish to use it for. # ./app/github_repo_fetcher.rb:8:in `block in repo' # ./app/github_repo_fetcher.rb:8:in `each' # ./app/github_repo_fetcher.rb:8:in `find' # ./app/github_repo_fetcher.rb:8:in `repo' # ./spec/app/github_repo_fetcher_spec.rb:27:in `block (3 levels) in <top (required)>' ``` We'll try switching to a method call so that it creates a new one every time. See discussion: #2918 (comment)
- Loading branch information