Skip to content

Commit

Permalink
fix: remove randexp dependency (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
naresh-hopin authored Sep 30, 2021
1 parent 431733c commit 794fd4e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/pact/reification.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'randexp'
require 'expgen'
require 'pact/term'
require 'pact/something_like'
require 'pact/array_like'
Expand All @@ -13,8 +13,10 @@ module Reification

def self.from_term(term)
case term
when Pact::Term, Regexp, Pact::SomethingLike, Pact::ArrayLike
when Pact::Term, Pact::SomethingLike, Pact::ArrayLike
from_term(term.generate)
when Regexp
from_term(Expgen.gen(term))
when Hash
term.inject({}) do |mem, (key,t)|
mem[key] = from_term(t)
Expand Down
2 changes: 1 addition & 1 deletion pact-support.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
spec.files = `git ls-files lib CHANGELOG.md LICENSE.txt README.md`.split($RS)
spec.require_paths = ["lib"]

spec.add_runtime_dependency "randexp", "~> 0.1.7"
spec.add_runtime_dependency "term-ansicolor", "~> 1.0"
spec.add_runtime_dependency "awesome_print", "~> 1.9"
spec.add_runtime_dependency "diff-lcs", "~> 1.4"

spec.add_development_dependency 'expgen', '~> 0.1.1'
spec.add_development_dependency "rspec", ">= 2.14", "< 4.0"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "webmock", "~> 3.3"
Expand Down

3 comments on commit 794fd4e

@awadhwana
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above change is actually preventing me to run the consumer pact tests from the github.com/pact-workshop-go
2021/09/30 22:32:50 [ERROR] service: /Users/ankit/code/go/src/github.com/pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.16.9/lib/pact/reification.rb:1:in `require': cannot load such file -- expgen (LoadError)

This is the error trace:
[ERROR] service: pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.16.9/lib/pact/reification.rb:1:in require': cannot load such file -- expgen (LoadError) [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.16.9/lib/pact/reification.rb:1:in <top (required)>'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.16.9/lib/pact/matchers/matchers.rb:16:in require' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.16.9/lib/pact/matchers/matchers.rb:16:in <top (required)>'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.16.9/lib/pact/matchers.rb:1:in require' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-support-1.16.9/lib/pact/matchers.rb:1:in <top (required)>'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/request_handlers/interaction_replay.rb:1:in require' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/request_handlers/interaction_replay.rb:1:in <top (required)>'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/request_handlers.rb:5:in require' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/request_handlers.rb:5:in <top (required)>'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/app.rb:6:in require' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/app.rb:6:in <top (required)>'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/run.rb:2:in require' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/run.rb:2:in <top (required)>'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/cli.rb:31:in require' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/pact-mock_service-3.9.0/lib/pact/mock_service/cli.rb:31:in service'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor/command.rb:27:in run' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in invoke_command'
[ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor.rb:392:in dispatch' [ERROR] service: from pact-workshop-go/pact/lib/vendor/ruby/2.2.0/gems/thor-1.1.0/lib/thor/base.rb:485:in start'
[ERROR] service: from pact-workshop-go/pact/lib/app/pact-mock-service.rb:15:in `

'
[ERROR] Expected server to start < 10s. Timed out waiting for Mock Server to start on port 50307 - are you sure it's running?
--- FAIL: TestClientPact_GetUser (0.01s)
--- FAIL: TestClientPact_GetUser/the_user_exists (0.00s)
client_pact_test.go:83: Error on Verify: Post http://localhost:50307/interactions: dial tcp [::1]:50307: connect: connection refused

@bethesque
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expgen gem needed to be a runtime dependency, not a development dependency. I've put out a new release with the fix. My bad for missing that in the PR.

@awadhwana
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expgen gem needed to be a runtime dependency, not a development dependency. I've put out a new release with the fix. My bad for missing that in the PR.

Thanks for adding the quick fix. I can verify that it's fixed.

Please sign in to comment.