Spock




github
grails-spock-examples
geb-example-grails


grails test-app :spock



 import grails.plugin.spock.*
 @Grab('org.spockframework:spock-core:0.7-groovy-2.0')
 class ColorSpec extends UnitSpec {
   def 'ColorのcolorNameで検索できる'() {
       setup:
               mockDomain(Color)
       when: 'Colorの保存'
               new Color(colorName: colorName).save()
       then: 'mockDomainを使ってcolorNameで検索'
               def color = Color.findByTitle(colorName)
               color != null
               color.colorName == colorName
       where:
               colorName = 'Red!'
   }
 }


       def m_item = new gapp.M_item(name: 'aaaaa').save()
       new gapp.M_receipt(m_item: m_item, receipt: '001111').save()


       def sc = new StoryCategory( categoryName:"art") 
           sc.save() 
           new StoryComplete ( 
                  allowComments:true, 
                  body:"bootsrap story body", 
                  title:"1 - story title", 
                  createdOn: new Date(), 
                  modifiedOn: new Date(), 
                  storyCategory:sc 
          ).save() 




















最終更新:2013年06月04日 02:10