Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Sample Buffalo Test
package actions
// this is a test method. It needs to have the prefix "Test"
func (a *ActionSuite) TestSomething() {
// this gives you one of these:
// you can also use a.Assert() to get one of these:
r := a.Require()
// this gets you a completely empty DB with all the schemas and migrations already run on it.
// tests are executed in series so nobody else will be using it
db := a.DB
// now do a GET request to the "/abc" endpoint
// you can also do .Post() etc...
resp := as.HTML("/abc").Get()
// make sure that the response has a 200 code.
// the response type is here:
r.Equal(200, resp.Code)
// now write the rest of your test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment