Skip to content

Commit

Permalink
Merge pull request #25 from TimothyJones/master
Browse files Browse the repository at this point in the history
fix(verify): prevent crash when calling VerifyProvider()
  • Loading branch information
mefellows authored May 2, 2017
2 parents 0f47366 + e89585e commit e321432
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 e321432

Please sign in to comment.