Skip to content

Commit

Permalink
Added StoreVM
Browse files Browse the repository at this point in the history
  • Loading branch information
uris77 committed May 9, 2012
1 parent e2166ce commit 520600c
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions grails-app/conf/BuildConfig.groovy
Expand Up @@ -51,6 +51,7 @@ grails.project.dependency.resolution = {
test ":cucumber:0.4.0"
test ":build-test-data:2.0.2"

compile ":zkui:0.5"
compile ":fixtures:1.1-SNAPSHOT"
}
}
16 changes: 16 additions & 0 deletions grails-app/vms/org/wherecaniget/StoreVM.groovy
@@ -0,0 +1,16 @@
package org.wherecaniget

import org.zkoss.bind.annotation.Command
import org.zkoss.bind.annotation.NotifyChange


class StoreVM {
def storeService
def store

@Command @NotifyChange(['store'])
def save(){
store = storeService.create(store)
}
}

27 changes: 27 additions & 0 deletions test/unit/org/wherecaniget/StoreVMTests.groovy
@@ -0,0 +1,27 @@
package org.wherecaniget

import static org.junit.Assert.*

import grails.test.mixin.*
import grails.test.mixin.support.*
import org.junit.*

@TestMixin(GrailsUnitTestMixin)
@Mock([Store])
class StoreVMTests {

@Before
void setUp() {
}


@Test
void create_new_store() {
StoreVM vm = new StoreVM()
vm.storeService = [create: {[id: 1, name: 'Test Store']}]
vm.save()

assertNotNull vm.store.id
assertEquals 'Test Store', vm.store.name
}
}

0 comments on commit 520600c

Please sign in to comment.