Do we have to explicitly specify the version of pa...
# pact-ruby
s
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
In what situation?
You specify the consumer version (ideally the git sha) when you publish the pact. The Pact Broker versions the content for you.
Please read the versioning docs above.
I think they'll make things clear to you.
s
Um sorry I meant to ask specification https://github.com/pact-foundation/pact-specification
b
it doesn't hurt, though ruby only supports version 2.0
s
Okay but it is not necessary to add right? and if yes then in which file do we add this specification.
b
it defaults to 2.0
it will probably be in the consumer definition dsl, but it's been a while since I looked.
message has been deleted
s
In pact_helper then?
b
yes, where you specify the port.
for the mock server
as you can see from the example, it's right underneath the port.
s
and for storing pact files do we have explicitly configure as well like this, or not required?
Copy code
Pact.service_consumer "Nxt_Clients" do
    has_pact_with "Application Service" do
      mock_service :application_service do
        port 1234
        pact_specification_version '2'
      end
    end
  end

Pact.configure do | config |
  config.pact_dir = './spec/pacts'
end
b
storing them?
s
yes
b
I don't understand what you mean by storing them
do you mean, publishing them to the pact broker?
s
What is meant when its said that the pact files are automatically stored in
spec/pacts
And do we require this configuration to be coded somewhere in the ruby project?
Copy code
Pact.configure do | config |
  config.pact_dir = './spec/pacts'
end
b
Can I ask, are you a developer or a tester?
s
tester, my task right now is to change the vcr test to pact test
b
Is there a developer you can pair with in your organisation? Pact is a developer tool, not a tester one, so it requires a lot of general developer knowledge.
I'm not sure I can give you the support you need over Slack.
I think there may be some misunderstanding in your organisation about the skillset required to use Pact.
s
Okay, but my point of asking this question was , I am running my unit tests, and the error I am getting is application_service( which is my object here to access the mock server) is not defined, and I think maybe its a configuration issue
Copy code
Pact.service_consumer "Nxt_Clients" do
    has_pact_with "Application Service" do
      mock_service :application_service do
        port 1234
        pact_specification_version '2'
      end
    end
  end
Can it be a configuration issue?
b
have you tagged your test with
pact: true
?
s
yes
So basically my specs are not run, and pact files not generated
b
unless you can share your entire codebase, I don't know if I can help you.
this is why you need a developer to help you.
see if you can get that running locally