Skip to content

Commit

Permalink
fix(verify) prevent crash when calling VerifyProvider()
Browse files Browse the repository at this point in the history
Closes #24
  • Loading branch information
TimothyJones committed May 2, 2017
1 parent 0f47366 commit e89585e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dsl/pact.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ func (p *Pact) Setup(startMockServer bool) *Pact {
p.SpecificationVersion = 2
}

client := &PactClient{Port: p.Port, Network: p.Network, Address: p.Host}
p.pactClient = client

if p.Server == nil && startMockServer {
args := []string{
"--pact-specification-version",
Expand All @@ -114,8 +117,6 @@ func (p *Pact) Setup(startMockServer bool) *Pact {
"--provider",
p.Provider,
}
client := &PactClient{Port: p.Port, Network: p.Network, Address: p.Host}
p.pactClient = client
p.Server = client.StartServer(args)
}

Expand Down
3 changes: 3 additions & 0 deletions dsl/pact_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ func TestPact_Setup(t *testing.T) {
if pact.Server != nil {
t.Fatalf("Expected server to be nil")
}
if pact.pactClient == nil {
t.Fatalf("Needed to still have a client")
}
}

func TestPact_Teardown(t *testing.T) {
Expand Down

0 comments on commit e89585e

Please sign in to comment.