Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dancannon committed Jul 12, 2016
1 parent b1cbac6 commit d970d3c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions example_connect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@ package gorethink_test

import (
"log"
"os"

r "github.com/dancannon/gorethink"
)

var session *r.Session
var url string

func init() {
// If the test is being run by wercker look for the rethink url
url = os.Getenv("RETHINKDB_URL")
if url == "" {
url = "localhost:28015"
}
}

func ExampleConnect() {
var err error
Expand Down
6 changes: 3 additions & 3 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import (
)

func Example() {
session, err := r.Connect(ConnectOpts{
session, err := r.Connect(r.ConnectOpts{
Address: url,
})
if err != nil {
log.Fatalln(err)
}

res, err := Expr("Hello World").Run(session)
res, err := r.Expr("Hello World").Run(session)
if err != nil {
log.Fatalln(err)
}

var response string
err = res.One(&response)
if err != nil {
Log.Fatalln(err)
log.Fatalln(err)
}

fmt.Println(response)
Expand Down

0 comments on commit d970d3c

Please sign in to comment.