Add packr travis-ci build step and remove packr file

This commit is contained in:
Jannis Mattheis 2018-03-10 11:24:44 +01:00 committed by Jannis Mattheis
parent 379ce58b29
commit a211656906
3 changed files with 6 additions and 27 deletions

View File

@ -30,6 +30,8 @@ install:
- dep ensure -v - dep ensure -v
script: script:
# packr builds a go file for all packr "boxes", this would be f.ex. the spec.json file.
- packr
- make test - make test
- make check - make check

File diff suppressed because one or more lines are too long

View File

@ -1,11 +1,11 @@
package docs package docs
import ( import (
"net/http/httptest"
"testing" "testing"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"net/http/httptest"
"io/ioutil"
) )
func TestServe(t *testing.T) { func TestServe(t *testing.T) {
@ -17,13 +17,6 @@ func TestServe(t *testing.T) {
Serve(ctx) Serve(ctx)
actualFileContent := getActualSpecFileContent(t) content := recorder.Body.String()
packrFileContent := recorder.Body.String() assert.NotEmpty(t, content)
assert.JSONEq(t, packrFileContent, actualFileContent, "packr and spec file are out of sync")
}
func getActualSpecFileContent(t *testing.T) string {
bytes, err := ioutil.ReadFile("spec.json")
assert.Nil(t, err)
return string(bytes)
} }