Skip to content

Specs using VCR broken on forks #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ndonald2 opened this issue Jun 2, 2017 · 0 comments
Open

Specs using VCR broken on forks #53

ndonald2 opened this issue Jun 2, 2017 · 0 comments

Comments

@ndonald2
Copy link

ndonald2 commented Jun 2, 2017

Summary

Any of the specs using VCR fixtures are hard-coded to match github API paths for wireframe/gitx. When these specs are run on a fork of the gitx repo, the username portion of the github API request will no longer be wireframe, so VCR fails to match appropriate the response fixture and the specs fail.

Repro Steps

  1. Fork the gitx repo
  2. Checkout the fork
  3. bundle install
  4. bundle exec rake

Expected Result

Specs should pass.

Actual Result

Several specs fail with VCR errors, ex:

  1) Gitx::Cli::ReleaseCommand#release when target_branch is not nil and user confirms release and pull request exists with success status runs expected commands
     Failure/Error: pull_requests = github_client.pull_requests(github_slug, params)

     VCR::Errors::UnhandledHTTPRequestError:


       ================================================================================
       An HTTP request has been made that VCR does not know how to handle:
         GET https://api.github.com/repos/ndonald2/gitx/pulls?head=ndonald2:feature-branch&state=open

       VCR is currently using the following cassette:
         - /Users/nick/Developer/gitx/spec/fixtures/vcr_cassettes/pull_request_does_exist_with_success_status.yml
           - :record => :once
           - :match_requests_on => [:method, :uri]

       Under the current configuration VCR can not find a suitable HTTP interaction
       to replay and is prevented from recording new requests. There are a few ways
       you can deal with this:

         * If you're surprised VCR is raising this error
           and want insight about how VCR attempted to handle the request,
           you can use the debug_logger configuration option to log more details [1].
         * You can use the :new_episodes record mode to allow VCR to
           record this new request to the existing cassette [2].
         * If you want VCR to ignore this request (and others like it), you can
           set an `ignore_request` callback [3].
         * The current record mode (:once) does not allow new requests to be recorded
           to a previously recorded cassette. You can delete the cassette file and re-run
           your tests to allow the cassette to be recorded with this request [4].
         * The cassette contains 2 HTTP interactions that have not been
           played back. If your request is non-deterministic, you may need to
           change your :match_requests_on cassette option to be more lenient
           or use a custom request matcher to allow it to match [5].

       [1] https://www.relishapp.com/vcr/vcr/v/3-0-3/docs/configuration/debug-logging
       [2] https://www.relishapp.com/vcr/vcr/v/3-0-3/docs/record-modes/new-episodes
       [3] https://www.relishapp.com/vcr/vcr/v/3-0-3/docs/configuration/ignore-request
       [4] https://www.relishapp.com/vcr/vcr/v/3-0-3/docs/record-modes/once
       [5] https://www.relishapp.com/vcr/vcr/v/3-0-3/docs/request-matching
       ================================================================================
     # ./lib/gitx/github.rb:43:in `find_pull_request'
     # ./lib/gitx/github.rb:22:in `find_or_create_pull_request'
     # ./lib/gitx/cli/release_command.rb:21:in `release'
     # ./spec/gitx/cli/release_command_spec.rb:125:in `block (5 levels) in <top (required)>'
     # ./spec/gitx/cli/release_command_spec.rb:124:in `block (4 levels) in <top (required)>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant