Skip to content

Pact 2.0 RSpec integration conflicts with pact-support 1.26.1 (latest) #399

Description

@soulcutter

Both pact 2.0 and pact-support (latest, 1.21.6) have a pact/rspec defined.

Which one do you get when you require "pact/rspec"? It depends on bundler load path ordering. In most cases it seems to load pact-support's and NOT pact's, and that means that pact's rspec integration is never loaded.

Example irb session:

>> $:.select { _1.include? "pact" }
=> 
["/Users/bradleyschaefer/.local/share/mise/installs/ruby/3.4.9/lib/ruby/gems/3.4.0/gems/pact-support-1.21.6/lib",
 "/Users/bradleyschaefer/.local/share/mise/installs/ruby/3.4.9/lib/ruby/gems/3.4.0/gems/pact-2.0.0/lib",
 "/Users/bradleyschaefer/.local/share/mise/installs/ruby/3.4.9/lib/ruby/gems/3.4.0/gems/pact-ffi-0.4.28.0-arm64-darwin/lib"]

>> require "pact/rspec"
=> true

>> PactConsumerDsl # pact/rspec from pact would have loaded this
/Users/bradleyschaefer/Projects/domain-insight-service/spec/service_providers/pact_helper.rb(irb):3:in '<main>': uninitialized constant PactConsumerDsl (NameError)

The consequence is that you won't get things you need like http_pact_provider in an RSpec.describe tagged with pact: true, pact_entity: :provider

Solution

Unsure.

Is pact-support known/intentionally incompatible with 2.0?
Should pact-support be removed from projects that had been using it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions