https://pact.io logo
Join Slack
Powered by
# pact-ruby
  • p

    PK

    06/04/2024, 3:45 AM
    @PK has left the channel
  • s

    Stephen Bell

    06/13/2024, 11:08 PM
    Hello, team! I'm trying to verify that a pact between our go client and ruby backend returns an integer value rather than a float. Is it possible to configure the pact-ruby side to verify this given pact-ruby only supports v2 of the pact specification?
    y
    • 2
    • 3
  • g

    Graham Pederson

    06/14/2024, 6:55 PM
    I have a rails application that uses cookies for session management. In the consumer pact we don't really care about sending the cookie, and on the provider side we use that to specify an account to authorize with. I'm pretty lost with how this should work - in the provider state should I somehow login as a user so I can pass authorization / authentication checks, or how do you all manage an authenticated endpoint?
    s
    • 2
    • 1
  • p

    Paolo Laurenti

    06/17/2024, 6:53 AM
    @Paolo Laurenti has left the channel
  • j

    Jocelyn Lecomte

    07/25/2024, 9:23 AM
    @Jocelyn Lecomte has left the channel
  • d

    Diego Betancur

    07/29/2024, 4:44 PM
    @Diego Betancur has left the channel
  • m

    Megan Honig

    07/30/2024, 6:56 PM
    @Megan Honig has left the channel
  • y

    Yousaf Nabi (pactflow.io)

    08/19/2024, 10:22 AM
    hello pact rubyists! I’ve been doing more work on integrating the pact ffi with ruby but i have a few questions 1. is anyone using pact with test frameworks other than rspec ( minitest / test-unit / others? 2. Does anyone test non rack based apps? 3. Are any ruby users, using the pact-provider-verifier rather than the pact gem, which spins up your rack app automatically 4. we need your provider app to be running, with an endpoint when running provider verifications. we didn’t before as we used rack-test. how does anyone deal with this today in other types of test. would you run in a sep process or thread say with webrick loading your app?
    🤔 2
  • c

    Cyrus Devnomad

    08/21/2024, 8:25 AM
    Hello, I have a problem with pact-cli docker image. I'm not sure to which channel this would belong, so I'm not sure whether I'm positing this in the right channel. I'm trying to send a request to a Pact broker server using the following powershell script:
    Copy code
    ...
    docker pull pactfoundation/pact-cli:latest
    docker run pactfoundation/pact-cli:latest pact-broker list-latest-pact-versions --output=json --broker-base-url=$PactBrokerBaseUrl --broker-username=$PactBrokerUsername --broker-password=$PactBrokerPassword
    But I get the following error:
    Copy code
    <internal:/usr/local/lib/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require': cannot load such file -- pact_broker/client/pacts/list_latest_versions (LoadError)
            from <internal:/usr/local/lib/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
            from /usr/lib/ruby/gems/3.3.0/gems/pact_broker-client-1.76.0/lib/pact_broker/client/cli/pact_commands.rb:44:in `list_latest_pact_versions'
            from /usr/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
            from /usr/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
            from /usr/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
            from /usr/lib/ruby/gems/3.3.0/gems/thor-1.3.1/lib/thor/base.rb:584:in `start'
            from /usr/lib/ruby/gems/3.3.0/gems/pact_broker-client-1.76.0/lib/pact_broker/client/cli/custom_thor.rb:34:in `start'
            from /usr/lib/ruby/gems/3.3.0/gems/pact_broker-client-1.76.0/bin/pact-broker:10:in `<top (required)>'
            from /usr/bin/pact-broker:25:in `load'
            from /usr/bin/pact-broker:25:in `<main>'
    Am I using the pact-cli command wrongly or is something wrong with that docker image?
    y
    • 2
    • 6
  • d

    Dilip Punna

    08/21/2024, 10:16 PM
    Hi, can someone suggest the following issues i'm currently facing for the provider verification contracts in Ruby. Right now I have 5 consumers which are on
    provider_state
    and defined under
    pact_helper_message.rb
    for the event message driven contracts. My config for the
    pact-helper_message.rb
    as follows below
    Copy code
    require_relative "provider_states_responses_tracker_service"
    require_relative "provider_states_participant_study_service"
    require_relative "provider_states_participant_test_plan_service"
    require_relative "provider_states_permissions_service"
    require_relative "provider_states_test_plan_logic_service"
    
    require File.expand_path("../../../../config/environment", __FILE__)
    require "pact/provider/rspec"
    require "environment_helpers"
    
    # Set verify variables
    pact_base_url = ENV["PACT_BROKER_URL"]
    token = ENV["PACT_BROKER_TOKEN"]
    
    # Set variables
    provider_version = ENV["GIT_SHA"]
    provider_branch = ENV["GIT_BRANCH"] || "main" 
    publish_flag = ENV.boolean("CI", default: false)
    
    CONFIG = [
      MyMessageProvider.messages,
      StudyServiceProviderMessage.messages,
      TestPlanServiceMessageProvider.messages,
      PermissionsServiceProviderMessage.messages,
      TestPlanLogicServiceMessageProvider.messages
    ].reduce(&:merge)
    
    # Debugging: Print CONFIG keys
    puts "CONFIG keys: #{CONFIG.keys}"
    
    Pact.message_provider "orders-message" do
      if ENV["PACT_URL"]
        honours_pact_with ENV["CONSUMER_NAME"] do
          pact_uri ENV["PACT_URL"], {token: token}
        end
      else
        honours_pacts_from_pact_broker do
          pact_broker_base_url pact_base_url, {token: token}
          consumer_version_selectors [
            { mainBranch: true }
          ]
        end
      end
    
      app_version provider_version
      app_version_tags [provider_branch]
      publish_verification_results publish_flag
    
      builder do |message_description|
        CONFIG[message_description].call
      end
    end
    s
    y
    • 3
    • 229
  • d

    Dilip Punna

    08/21/2024, 10:19 PM
    For some reaosn when i run the tests, I only see fetching from main for the
    StudyServiceProviderMessage, PermissionsServiceProviderMessage, TestPlanLogicServiceMessageProvider
    . Missing other 2 . So far I checked following below • Check pactflow has the run from latest main ✅ • Check by changing consumer_version_selectors , tried all of them ✅ Not sure what else i can try? Please suggest what could be the reason here? thanks
  • b

    Bertold Kolics

    09/08/2024, 8:12 PM
    @Bertold Kolics has left the channel
  • r

    Roma Abrosimov

    09/12/2024, 3:45 PM
    Hi. I started experiencing issue with publish verification. It's used to work but today I noticed that after performing rake task locally like bundle exec rake pactverifyat[spec/pacts/contract.json] I get
    Cannot publish verification for member_homepage as there is no link named pb:publish-verification-results in the pact JSON. If you are using a pact broker, please upgrade to version 2.0.0 or later
    Please help with it or give an advice of what to do. Thanks P.S. I configured to send verification after performing test
    Copy code
    publish_verification_results true
    y
    • 2
    • 2
  • d

    Dilip Punna

    09/13/2024, 10:16 AM
    @Yousaf Nabi (pactflow.io) - I was trying to use
    npm run pact:publish --if-present -- --auto-detect-version-properties --broker-base-url ${{ env.PACT_BROKER_BASE_URL }} --broker-token ${{ env.PACT_BROKER_TOKEN }}
    , without any
    --consumer-app-version
    this is actually causing issues when we publish the pacts on
    main
    and complaining about unique consumer versions
    y
    • 2
    • 8
  • t

    Tom Linford

    09/16/2024, 4:22 PM
    Hi, my team uses the pact-ruby-standalone to run provider verification:
    Copy code
    pact-provider-verifier
      --consumer-version-selector "{\"mainBranch\":true}"
      --consumer-version-selector "{\"deployedOrReleased\":true}"
      --enable-pending
      ...
    We have a consumer for which we have never successfully verified their pact, making the pact we have with them "pending". When we run provider verification, the failures are correctly suppressed because of the
    --enable-pending
    flag. Today a new version of this consumer's pact was published to their main branch with a new request matcher rule in one of the interactions:
    Copy code
    "path": {
      "combine": "AND",
      "matchers": [
        {
          "match": "regex",
          "regex": ".*([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2}).*"
        }
      ]
    }
    However, in their request they do not provide a
    path
    , meaning that the regex will never match. When we next ran provider verification as part of our CI/CD, this exception was thrown by the
    pact-provider-verifier
    and caused our build to exit and fail:
    Copy code
    .../pact/lib/vendor/ruby/3.3.0/gems/pact-support-1.20.0/lib/pact/term.rb:32:in `initialize': Value to generate "" does not match regular expression /.*([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2}).*/ (Pact::Error)
    from .../pact/lib/vendor/ruby/3.3.0/gems/pact-support-1.20.0/lib/pact/matching_rules/v3/merge.rb:105:in `new'
    from .../pact/lib/vendor/ruby/3.3.0/gems/pact-support-1.20.0/lib/pact/matching_rules/v3/merge.rb:105:in `handle_regex'
    from .../pact/lib/vendor/ruby/3.3.0/gems/pact-support-1.20.0/lib/pact/matching_rules/v3/merge.rb:91:in `wrap'
    ...
    Is there some reason why this exception was not caught and suppressed? The issue is with the request, which we (as the provider) have no control over. Any advice would be appreciated! 😄
    y
    • 2
    • 5
  • v

    Val Kolovos

    09/19/2024, 10:40 PM
    @Val Kolovos has left the channel
  • y

    Yousaf Nabi (pactflow.io)

    10/02/2024, 11:56 AM
    There is a surprise inside the latest Pact Blog for Rubyists ruby https://docs.pact.io/blog/2024/09/30/pact-open-source-update-sept-2024#sbmt-pact---pact-v3v4--plugin-support
  • r

    Roma Abrosimov

    10/02/2024, 3:15 PM
    Hi. Perhaps someone knows if it possible to switch from new UI design Pact broker to previous one? thanks
  • m

    Marcus Couto

    10/04/2024, 4:16 PM
    @Marcus Couto has left the channel
  • s

    Stanislav Vodetskyi

    10/08/2024, 11:38 PM
    Hey folks, I've installed the latest pact-ruby-standalone and it prints the following warning when I run `can-i-deploy`:
    <path>/pact/lib/ruby/lib/ruby/3.3.0/json/common.rb:3: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
    m
    • 2
    • 4
  • s

    Siim Mardus

    10/24/2024, 12:56 PM
    @Yousaf Nabi (pactflow.io) Hi! I see from: • Your last message above • This Draft PR here • Tracking issues for V3 and V4 ... that we can soon expect support for generators in pact-ruby, am I right? We have implemented multiple Elixir services over to Pact with our pact_erlang fork, and I am now introducing contract testing to the first Ruby service using pact-ruby. I got stuck at Authorization, because for Elixir we used the generators to provide
    Bearer ${authToken}
    on Consumer side, and then pact verifier would replace it with a real token based on provider state when replaying the request. Was surprised to find that pact-ruby doesn't have it yet, but pleased to see that this has recently picked up attention again. 1. When can we expect those to come into latest version of pact-ruby? 2. Can you recommend a good branch/fork we could use for the time being, so that when the official release comes, we can switch over with minimal friction?
    y
    • 2
    • 4
  • d

    Dilip Punna

    11/06/2024, 2:04 PM
    👋 What is ruby equivalent flag for the
    failIfNoPactsFound: false,
    to pass for the pact provider verification when the verification is not implemented we want to skip the failure?
  • d

    Dilip Punna

    11/18/2024, 11:40 AM
    👋 Can someone help me here thanks
    m
    • 2
    • 1
  • r

    RAELISON Zo Nofinidy

    11/18/2024, 12:57 PM
    Hello ! 👋 Has anyone here ever used Pact along with Cucumber to write BDD tests, or even thought about it ? Could you share your experience please ? (Is it a good idea ? What were the difficulties ? etc.)
    m
    • 2
    • 2
  • s

    Shakil Riyad

    11/25/2024, 9:56 PM
    @Shakil Riyad has left the channel
  • p

    Pietro Di Bello

    12/17/2024, 11:23 AM
    @Pietro Di Bello has left the channel
  • t

    Tom Lopez

    01/22/2025, 4:04 PM
    @Tom Lopez has left the channel
  • s

    Spencer

    02/11/2025, 3:34 PM
    @Spencer has left the channel
  • d

    Dominik Krichbaum

    02/26/2025, 2:22 PM
    @Dominik Krichbaum has left the channel
  • m

    Martin Mineo

    03/07/2025, 1:16 PM
    @Martin Mineo has left the channel