コード例 #1
0
	var dbName string
	var request *http.Request
	var recorder *httptest.ResponseRecorder
	var session *mgo.Session
	var err error
	var testServer *martini.ClassicMartini

	BeforeEach(func() {
		// Set up a new server, connected to a test database,
		// before each test.
		dbName = "thingstodo_test"
		session, err = mgo.Dial("mongodb://localhost")
		if err != nil {
			panic(err)
		}
		testServer = server.NewServer(dbName)

		// Record HTTP responses.
		recorder = httptest.NewRecorder()
	})

	AfterEach(func() {
		// Clear the database after each test.
		session.DB(dbName).DropDatabase()
	})

	Describe("GET /events", func() {

		// Set up a new GET request before every test
		// in this describe block.
		BeforeEach(func() {
コード例 #2
0
ファイル: main.go プロジェクト: rolandjudd/thingstodo
func main() {
	//Create a new server object and run it
	server := server.NewServer("thingstodo")
	server.Run()
}