Skip to content

Commit 27f5669

Browse files
committed
Fixed tests
1 parent 0d0c58f commit 27f5669

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

example_query_select_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func ExampleRqlTerm_Get() {
1515
}
1616

1717
sess, err := r.Connect(map[string]interface{}{
18-
"address": "localhost:28015",
18+
"address": url,
1919
})
2020

2121
// Setup table
@@ -54,7 +54,7 @@ func ExampleRqlTerm_GetAll_compound() {
5454
}
5555

5656
sess, err := r.Connect(map[string]interface{}{
57-
"address": "localhost:28015",
57+
"address": url,
5858
})
5959

6060
// Setup table

example_query_table_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88

99
func ExampleRqlTerm_TableCreate() {
1010
sess, err := r.Connect(map[string]interface{}{
11-
"address": "localhost:28015",
11+
"address": url,
1212
})
1313

1414
// Setup database
@@ -27,7 +27,7 @@ func ExampleRqlTerm_TableCreate() {
2727

2828
func ExampleRqlTerm_IndexCreate() {
2929
sess, err := r.Connect(map[string]interface{}{
30-
"address": "localhost:28015",
30+
"address": url,
3131
})
3232

3333
// Setup database
@@ -47,7 +47,7 @@ func ExampleRqlTerm_IndexCreate() {
4747

4848
func ExampleRqlTerm_IndexCreate_compound() {
4949
sess, err := r.Connect(map[string]interface{}{
50-
"address": "localhost:28015",
50+
"address": url,
5151
})
5252

5353
// Setup database

example_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ import (
44
"fmt"
55
r "github.com/dancannon/gorethink"
66
"log"
7+
"os"
78
)
89

910
var session *r.Session
11+
var url string
12+
13+
func init() {
14+
// Needed for wercker. By default url is "localhost:28015"
15+
url = os.Getenv("WERCKER_RETHINKDB_URL")
16+
if url == "" {
17+
url = "localhost:28015"
18+
}
19+
}
1020

1121
func Example() {
1222
session, err := r.Connect(map[string]interface{}{
13-
"address": "localhost:28015",
23+
"address": url,
1424
})
1525
if err != nil {
1626
log.Fatalln(err.Error())

0 commit comments

Comments
 (0)