-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
} | ||
} |