Skip to content

Instantly share code, notes, and snippets.

@azbshiri azbshiri/main.go
Last active Mar 27, 2018

What would you like to do?
Go already has RSpec!
package main
import (
func TestMain(m *testing.M) {
// before spec
err := m.Run()
// after spec
func TestGetBook(t *testing.T) {
t.Run("ok", func (t *testing.T) {
// ....
assert.Equal(t, http.StatusOK, res.Code)
t.Run("unauthorized", func (t *testing.T) {
// ....
assert.Equal(t, http.StatusUnauthorized, res.Code)
// etc

This comment has been minimized.

Copy link

mdwhatcott commented Mar 26, 2018

BTW, the before spec is only run once before all specs/tests, not before each.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.