Skip to content

Commit

Permalink
rewrote the Where In test to use UUID
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Jun 19, 2017
1 parent b27c4ce commit 7ec8a9f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"testing"

"github.com/markbates/pop"
"github.com/markbates/pop/nulls"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -33,19 +32,19 @@ func Test_Where(t *testing.T) {
func Test_Where_In(t *testing.T) {
r := require.New(t)
transaction(func(tx *pop.Connection) {
u1 := &User{Name: nulls.NewString("A")}
u2 := &User{Name: nulls.NewString("B")}
u3 := &User{Name: nulls.NewString("C")}
u1 := &Song{Title: "A"}
u2 := &Song{Title: "B"}
u3 := &Song{Title: "C"}
err := tx.Create(u1)
r.NoError(err)
err = tx.Create(u2)
r.NoError(err)
err = tx.Create(u3)
r.NoError(err)

users := []User{}
err = tx.Where("id in (?)", u1.ID, u3.ID).All(&users)
r.Len(users, 2)
songs := []Song{}
err = tx.Where("id in (?)", u1.ID, u3.ID).All(&songs)
r.Len(songs, 2)
})
}

Expand Down

0 comments on commit 7ec8a9f

Please sign in to comment.