github.com/jbking/gohan@v0.0.0-20151217002006-b41ccf1c2a96/extension/extension_suite_test.go (about) 1 // Copyright (C) 2015 NTT Innovation Institute, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 // implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 16 package extension_test 17 18 import ( 19 "os" 20 "testing" 21 22 "github.com/cloudwan/gohan/db" 23 24 . "github.com/onsi/ginkgo" 25 . "github.com/onsi/gomega" 26 ) 27 28 var ( 29 testDB1 db.DB 30 testDB2 db.DB 31 ) 32 33 func TestExtension(t *testing.T) { 34 RegisterFailHandler(Fail) 35 RunSpecs(t, "Extension Suite") 36 } 37 38 var _ = Describe("Suite set up and tear down", func() { 39 const ( 40 testDBFile1 = "./extensionTest1.db" 41 testDBFile2 = "./extensionTest2.db" 42 ) 43 44 var _ = BeforeSuite(func() { 45 var err error 46 testDB1, err = db.ConnectDB("sqlite3", testDBFile1) 47 Expect(err).NotTo(HaveOccurred()) 48 testDB2, err = db.ConnectDB("sqlite3", testDBFile2) 49 Expect(err).NotTo(HaveOccurred()) 50 }) 51 52 var _ = AfterSuite(func() { 53 os.Remove(testDBFile1) 54 os.Remove(testDBFile2) 55 }) 56 })