Refactored purgeInactive, better test suite setup

This commit is contained in:
Deluan
2020-01-10 19:20:29 -05:00
committed by Deluan Quintão
parent ef79f6342f
commit 9ccd9545e8
7 changed files with 47 additions and 48 deletions
+1 -11
View File
@@ -8,24 +8,14 @@ import (
var _ = Describe("AlbumRepository", func() {
var repo domain.AlbumRepository
var data domain.Albums
BeforeEach(func() {
Db().Drop(&_Album{})
repo = NewAlbumRepository()
data = domain.Albums{
{ID: "1", Name: "Sgt Peppers", Artist: "The Beatles", ArtistID: "1"},
{ID: "2", Name: "Abbey Road", Artist: "The Beatles", ArtistID: "1"},
{ID: "3", Name: "Radioactivity", Artist: "Kraftwerk", ArtistID: "2", Starred: true},
}
for _, a := range data {
repo.Put(&a)
}
})
Describe("GetAll", func() {
It("returns all records", func() {
Expect(repo.GetAll(domain.QueryOptions{})).To(Equal(data))
Expect(repo.GetAll(domain.QueryOptions{})).To(Equal(testAlbums))
})
It("returns all records sorted", func() {