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

    Still

    02/04/2022, 1:05 PM
    When we run our spec files, the contract is saved in 
    /spec/pacts
    , but we have to create the directory right, and how do we configure that the pacts are stored there?
    m
    • 2
    • 9
  • s

    Still

    02/11/2022, 1:38 PM
    Here
    require pact/consumer/rspec
    is a directory structure, or it should be configured in rake file. Is there specific document with the dependencies and keywords we use for Pact, so that I can go through it. Here for eg, I don't understand what `require pact/consumer/rspec`is doing
    b
    • 2
    • 4
  • s

    Still

    02/21/2022, 9:27 PM
    Do we have to explicitly specify the version of pact? If yes then in which file and how? Or just installing pact gem is enough?
    b
    • 2
    • 37
  • s

    Still

    02/23/2022, 7:01 PM
    How do we publish ruby pacts to Pactflow, using this command?
    Copy code
    pact-broker publish PACT_DIRS_OR_FILES ... -a, --consumer-app-version=CONSUMER_APP_VERSION -b, --broker-base-url=BROKER_BASE_URL
    https://github.com/pact-foundation/pact_broker-client Is that correct?
    b
    • 2
    • 2
  • j

    Jason Wang

    03/09/2022, 10:00 PM
    Hi! I have a question with respect to using pact-message-ruby. Is it possible to have both
    Pact.message_provider
    and
    Pact.service_provider
    in the same
    pact_helper.rb
    ? When trying to do so, whichever one comes first seems to get overriden by the second resulting in failures. If it's not possible, is there a known workaround? Maybe separate rake tasks, one for HTTP and one for messages? cc @Victor Lau
    v
    • 2
    • 1
  • j

    Jason Wang

    03/10/2022, 9:41 PM
    Is there a pattern to not include provider states if all provider states are
    no_op
    ?
    Copy code
    Pact.provider_states_for 'My Service' do
      provider_state 'some state that needs no setup' do
        no_op
      end
    
      provider_state 'some other state that needs no setup' do
        no_op
      end
    end
    b
    • 2
    • 4
  • s

    Still

    03/15/2022, 7:39 AM
    Is ruby 3 not supported for Pact?
    b
    • 2
    • 3
  • s

    Still

    03/16/2022, 10:35 AM
    I keep running into this error after running my spec. Could anyone point me in the right direction, why I am getting this error
    b
    • 2
    • 2
  • r

    Rachel Bingham

    03/23/2022, 10:33 AM
    Hi đź‘‹, We're just getting started using pact.io for api contracts between our frontend platform and ruby monolith. I'm having trouble as the provider state
    set_up
    method is not being called prior to the interaction being verified. Can anyone help? Here are some code snippets:
    Copy code
    from the contract:
      "interactions": [
        {
          "description": "a request to GET cards",
          "providerState": "user has cards", ...
    
    from the provider states files:
    
    Pact.provider_states_for "bloomandwild-frontend" do
      provider_state "user has cards" do
        # code reaches here
        set_up do
              # code doesn't reach here
    apart from that, the verification is working - ie I can successful verify an interaction that requires no set up. Any help or advice appreciated TIA
    b
    s
    • 3
    • 52
  • r

    Rachel Bingham

    03/25/2022, 4:08 PM
    đź‘‹ Hi @Beth (pactflow.io/Pact Broker/pact-ruby), me again I'm having trouble with authenticating the user in the pact. Something to do with the Warden middleware (I think). I found your gist https://gist.github.com/bethesque/203e9d2ec08f4a40d2df but am not sure what exactly I would put in
    RealApp
    Apparently we don't normally run a real server for our rspec tests (except for system/capybara ones). When I try to authenticate a user i get this
    Copy code
    # RuntimeError: Invalid strategy current_user
    # from /Users/rachelbingham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/warden-1.2.9/lib/warden/proxy.rb:385:in `_fetch_strategy'
    Just wondering if you have any insight on how I might configure this so I can authenticate requests realistically?
    b
    • 2
    • 7
  • a

    Alejandro Vélez-Calderón

    04/07/2022, 5:11 PM
    a little confused around
    ENV['CI_BUILD_URL']
    in this example in the docs https://docs.pact.io/implementation_guides/ruby/publishing_pacts is this supposed to be the Pact URI of the generated pact? In buildkite for example, this ENV will be auto populated with the url of the job, but the provider rake task needs the Pact URI if I’m not mistaken.
    b
    • 2
    • 2
  • j

    Jason Wang

    04/07/2022, 7:25 PM
    Hey team, I was wondering what the purpose of the assertion in the consumer spec if we're mocking the provider service. Example: https://github.com/pact-foundation/pact-ruby/blob/master/example/zoo-app/spec/service_providers/animal_service_client_spec.rb#L28
    b
    • 2
    • 5
  • y

    Yesi (she/her)

    05/03/2022, 7:03 PM
    Hello, with Pact v2, can we use the matchers in the unit test assertions?
    y
    • 2
    • 3
  • r

    Rafi Gemhar

    05/10/2022, 3:31 PM
    Is there a way to share data between some of provider states(not all), by data I mean common response hash in the form of variables or constants
    b
    • 2
    • 2
  • t

    Thomas

    06/01/2022, 8:39 AM
    Hello, the Readme states the currently version
    2
    of the pact specification is supported by
    pact-ruby
    . Are any GitHub issues or Milestones to track the progress towards the support of version
    3
    or
    4
    of the specification?
    y
    b
    • 3
    • 5
  • b

    Britton Sparks

    06/01/2022, 3:21 PM
    hi there! I have a question about the pact specification being used in the latest gem. what does this mean for multiple provider states? I am able to get my tests to enter the v3 interaction parser, when attempting multiple provider states, but pact complains with
    WARN: Currently only 1 provider state is supported. Ignoring
    additionally, despite that warning, both provider states do seem to run. am I missing something obvious?
    b
    • 2
    • 10
  • j

    Jean Paiva

    06/14/2022, 12:33 PM
    Hey I am very new to pact and sorry for just be dropping messages like this here but I’ve been trying to use: https://www.rubydoc.info/gems/pact-provider-verifier/1.11.0#setting-a-custom-authentication-header and while I do get to hit my endpoint and it seems like the expectations are actually running it seems like my provider is returning a body in a format different from what I am expecting, even though the content is what I intended… I am expecting a json on the contract response but it seems like I am getting the provider response with
    \
    on each time a quote appear. Is there a way to deal with a situation like this, maybe treat the response before comparing them? What I am expecting (example):
    {"foo":"bar"}
    what I am getting:
    {\"foo\":\"bar\"}
    Is this something I can fix with the pact-provider-verifier or I would need to fix with my provider?
    b
    • 2
    • 6
  • s

    Santiago MartĂ­

    06/15/2022, 6:35 PM
    Hello! Is it possible to run pact verify but as part of an Rspec test instead of running the rake task?
    b
    • 2
    • 4
  • s

    Santiago MartĂ­

    06/22/2022, 5:38 PM
    Are MatchersV3, from the JS library, supported when validating pacts via Ruby?
    b
    • 2
    • 2
  • m

    Massimiliano De Vivo

    08/02/2022, 12:14 PM
    hello everyone đź‘‹ I am getting more into pact these days and I might have a question for https://github.com/pact-foundation/pact-mock_service đź§µ
    t
    b
    • 3
    • 20
  • b

    Britton Sparks

    08/11/2022, 4:05 PM
    random question for anyone who might know the answer: is it possible to match keys in matchingRules in the contract? I know that jsonpath can return keys. but it’s not clear to me if the matching done in pact exactly follows jsonpath.
    b
    • 2
    • 3
  • a

    Alejandro Vélez-Calderón

    08/15/2022, 8:01 PM
    In providers that have many states, have people extracted out the provider states using lambdas (
    ->
    )? Would it be helpful to add examples of how to do that in here? https://github.com/pact-foundation/pact-ruby/wiki/FAQ I’m willing to help 🙂
    b
    • 2
    • 3
  • a

    Alejandro Vélez-Calderón

    08/23/2022, 6:27 PM
    is it possible to configure a service provider with both a
    honours_pact_with
    block that references local files and
    honours_pacts_from_pact_broker
    for CI/CD ? or is it preferred to abstract the local verification with a custom task like -> https://docs.pact.io/implementation_guides/ruby/verifying_pacts#using-a-custom-pactverify-task ?
    b
    • 2
    • 2
  • p

    Patrick Badley

    09/19/2022, 7:42 PM
    Crossposting for Ruby/gRPC exposure: https://pact-foundation.slack.com/archives/CEQBDD5U4/p1663616539124209
    b
    m
    • 3
    • 5
  • k

    Kellie Persson

    09/23/2022, 6:13 PM
    Hello Everyone đź‘‹ , I am testing out PACT w/ pact-swift and a docker image pact-broker. I have been able to publish my pact to the pact broker and now am trying to verify the pact from the provider side of things (ruby). On the provider side I am setting up my provider states but I am having a tough time getting any gem dependencies to load, i.e. using
    circumstance-1.0.0
    gem to setup state for me. Do I need to do any special setup to gain access to these gems inside the provider state files? Thank you for you helpful. Excited to get this POC going.
    b
    • 2
    • 9
  • s

    Slackbot

    10/24/2022, 4:13 PM
    This message was deleted.
    b
    p
    • 3
    • 4
  • p

    Patrick Badley

    10/26/2022, 3:04 PM
    Hello! I was wondering if there is guidance on best practices around things like contract test code organization? • Do you recommend putting your consumer contract unit tests in their own folder, or alongside other unit tests in your project? • Should they have their own spec_helper files? • Similarly on the provider side: best practices for organizing provider states. For example, should all of the states for a single consumer go in one file? Should states be able to be shared across consumers? We are just getting off the ground with pact and would like to leverage any learnings from those of you with experience. Thank you in advance!
    t
    b
    • 3
    • 6
  • k

    Kellie Persson

    11/14/2022, 11:51 PM
    Hello, I am building out a POC and I using provider states to set up my data. I am trying to setup up my api to work with provider states. I am a bit confused by the direction here.
    you will need to create a dev/test only HTTP endpoint that accepts a JSON document that looks like:
    ```{
    "consumer": "CONSUMER_NAME",
    "state": "PROVIDER_STATE"
    }```
    The following flag is required when running the CLI:
    •
    --provider-states-setup-url
    - the full url of the endpoint which sets the active consumer and provider state.
    Does my test only endpoint need to access a body in the request that I can pass in
    CONSUMER_NAME
    and
    PROVIDER_STATE
    or is the url just supposed to pass up those values as parameters in order to pass along w/
    --provider-states-setup-url
    ? Once I correctly parse the consumer and state, what do I need to do in my controller to properly load the provider state? Thank you in advance for any and all assistance.
    b
    • 2
    • 17
  • s

    Steve T

    11/16/2022, 4:32 AM
    Hello
  • s

    Steve T

    11/16/2022, 5:57 AM
    I am slt from github, I have been working on these pull requests https://github.com/pact-foundation/pact-ruby/pull/273 https://github.com/pact-foundation/pact-provider-verifier/pull/85 I just wanted to introduce myself and say hello
    b
    • 2
    • 2
12Latest