Exemplo n.º 1
0
func (m *Mother) Registrar() services.Registrar {
	clientsRepo, kindsRepo := m.Repos()
	return services.NewRegistrar(clientsRepo, kindsRepo)
}
Exemplo n.º 2
0
	. "github.com/onsi/gomega"
)

var _ = Describe("Registrar", func() {
	var (
		registrar   services.Registrar
		clientsRepo *mocks.ClientsRepository
		kindsRepo   *mocks.KindsRepo
		conn        *mocks.Connection
		kinds       []models.Kind
	)

	BeforeEach(func() {
		clientsRepo = mocks.NewClientsRepository()
		kindsRepo = mocks.NewKindsRepo()
		registrar = services.NewRegistrar(clientsRepo, kindsRepo)
		conn = mocks.NewConnection()
	})

	Describe("Register", func() {
		It("stores the client and kind records in the database", func() {
			client := models.Client{
				ID:          "raptors",
				Description: "perimeter breech",
			}

			hungry := models.Kind{
				ID:          "hungry",
				Description: "these raptors are hungry",
				Critical:    true,
				ClientID:    "raptors",