Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
pipibabe committed Nov 27, 2013
2 parents 1f4c873 + cf41e91 commit 340c37b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 89 deletions.
9 changes: 7 additions & 2 deletions grails-app/conf/spring/resources.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,17 @@ beans = {
s3Service = ref("s3Service")
imageModiService = ref("imageModiService")
fileLocation = application.config.grails.aws.root
blankImg = application.parentContext.getResource('/images/blank.gif').file

if(Environment.current == Environment.TEST)
blankImg = new File("web-app/imapges/blank.gif");
else blankImg = application.parentContext.getResource('/images/blank.gif').file
}
}else {
attachmentService(LocalAttachmentService){
fileLocation = application.config.grails.upload.location.local.path
blankImg = application.parentContext.getResource('/images/blank.gif').file
if(Environment.current == Environment.TEST)
blankImg = new File("web-app/imapges/blank.gif");
else blankImg = application.parentContext.getResource('/images/blank.gif').file
}
}

Expand Down
87 changes: 0 additions & 87 deletions src/templates/war/web.xml

This file was deleted.

27 changes: 27 additions & 0 deletions test/unit/foodprint/BatchSpec.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package foodprint

import grails.test.mixin.TestMixin
import grails.test.mixin.support.GrailsUnitTestMixin
import spock.lang.Specification

/**
* See the API for {@link grails.test.mixin.support.GrailsUnitTestMixin} for usage instructions
*/
@TestMixin(GrailsUnitTestMixin)
@TestFor(Batch)
@Mock([Item])
class BatchSpec extends Specification {

void "測試新增批號與取得清單"() {
given: '產生一個測試批號 domain'
def item = new Item(name:'item').save()
new Batch(name: 'batch', item:item).save()

when: '要求取得批號清單'
def batchList = Batch.list()

then: '清單中要有一個批號資訊'
batchList.size() == 1

}
}

0 comments on commit 340c37b

Please sign in to comment.