Skip to content

Commit

Permalink
added a DBDelta function
Browse files Browse the repository at this point in the history
  • Loading branch information
markbates committed Dec 9, 2017
1 parent 985d7ac commit 560c7ac
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions model.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ func (m *Model) SetupTest() {

func (m *Model) TearDownTest() {}

func (m *Model) DBDelta(delta int, name string, fn func()) {
sc, err := m.DB.Count(name)
m.NoError(err)
fn()
ec, err := m.DB.Count(name)
m.NoError(err)
m.Equal(ec, sc+delta)
}

func NewModel() *Model {
m := &Model{}
c, err := pop.Connect(envy.Get("GO_ENV", "test"))
Expand Down

0 comments on commit 560c7ac

Please sign in to comment.