Skip to content
This repository was archived by the owner on May 31, 2023. It is now read-only.

intermittent rspec failure on accessing GCR.cassette #4

@zben

Description

@zben

Do you have some clue of how I can fix this error? Have you ever seen this? It's not failing on CI and sometimes fail locally.

NoMethodError:
       undefined method `reqs' for nil:NilClass
     # /Users/benz/.rvm/gems/ruby-2.3.1/gems/gcr-1.0.1/lib/gcr/cassette.rb:109:in `request_response'
  def start_playing
    load

    GCR.stub.class.class_eval do
      alias_method :orig_request_response, :request_response

      def request_response(*args)
        req = GCR::Request.from_proto(*args)
        GCR.cassette.reqs.each do |other_req, resp|
          return resp.to_proto if req == other_req
        end
        raise GCR::NoRecording
      end
    end
  end

I think the class_eval magic might have something to do with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions