pact-foundation / pact-ruby

Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
https://pact.io
MIT License
2.17k stars 216 forks source link

Create pact init #34

Open bethesque opened 10 years ago

bethesque commented 10 years ago

Submit PRs to: https://github.com/bethesque/pact-init-consumer

pact-init-consumer --consumer "My Consumer" --provider "My Provider" should create spec/service_providers/pact_helper.rb

require 'pact/consumer/rspec'

Pact.service_consumer 'My Consumer' do
  has_pact_with 'My Provider' do
    mock_service :my_provider do
      port 1234
    end
  end
end

--consumer and --provider should be optional, and if no values are given use "My Consumer" and "My Provider".

Submit PRs to: https://github.com/bethesque/pact-init-provider pact-init-provider --provider "My Provider" --consumer "My Consumer" should create spec/service_consumers/pact_helper.rb

require 'pact/provider/rspec'
require "service_consumers/provider_states_for_my_consumer"

Pact.service_provider 'My Provider' do
  honours_pact_with 'My Consumer' do
    pact_uri ''
  end
end

spec/service_consumers/provider_states_for_my_consumer.rb

Pact.provider_states_for 'My Consumer' do
  provider_state 'there is a thing' do
    set_up do
      # Set up the provider state here (eg. insert record into a database)
    end
  end
end
bethesque commented 9 years ago

Please either use Thor or the default Ruby OptionsParser (I'd like to pull Thor out to reduce dependencies, so if you can get away with OptionsParser, then that's better).

joesustaric commented 9 years ago

Could someone use Clamp? I like it a little better for CLI stuff :)

bethesque commented 9 years ago

I'd rather not have both Clamp and Thor at the same time!

joesustaric commented 9 years ago

Hey Beth , You can assign this to @princyj and I. Thanks!

bethesque commented 9 years ago

I don't know how, it won't let me select your name.

joesustaric commented 9 years ago

Ah ok never mind :p Hello world - Princy and I are doing this.

Ch0ronomato commented 8 years ago

Is this still open for development?

bethesque commented 8 years ago

I never ended up releasing it, but yes.