Permalink
Browse files

Instalação do plugin de testes funcionais.

Alteração do relacionamento Professor - Turma para 1- N.
Controlador de PeriodoLetivo com scaffold = true.
Exemplo de teste funcional.
  • Loading branch information...
1 parent 2c19b21 commit 714791c1bdc786b0d59cda021f3cd6286e5572db @rodrigonn rodrigonn committed Apr 24, 2012
View
@@ -1,7 +1,8 @@
-#Grails Metadata file
-#Fri Apr 20 08:43:42 GMT-03:00 2012
-app.grails.version=2.0.1
-app.name=AlocadorHorarios
-app.servlet.version=2.5
-app.version=0.1
-plugins.jquery-ui=1.8.15
+#Grails Metadata file
+#Tue Apr 24 19:52:15 BRT 2012
+app.grails.version=2.0.3
+app.name=AlocadorHorarios
+app.servlet.version=2.5
+app.version=0.1
+plugins.functional-test=2.0.M2
+plugins.jquery-ui=1.8.15
@@ -0,0 +1,6 @@
+package alocadorhorarios
+
+class PeriodoLetivoController {
+
+ def scaffold = true
+}
@@ -9,8 +9,8 @@ class Professor {
static hasMany = [telefones:Telefone, turmas:Turma]
static belongsTo = [departamento:Departamento]
-
- static constraints = {
+
+ static constraints = {
matricula()
nome()
email(email:true)
@@ -2,7 +2,8 @@ package alocadorhorarios
class Turma {
- static hasMany = [professores:Professor]
+ Professor professor
+
static belongsTo = [periodoLetivo:PeriodoLetivo, disciplina:Disciplina]
static constraints = {
@@ -0,0 +1,45 @@
+package alocadorhorarios
+
+import com.grailsrocks.functionaltest.*
+
+class PeriodoLetivoFunctionalTests extends BrowserTestCase {
+ void testList() {
+ get('/periodoLetivo/list')
+ assertContentContains "List"
+ assertStatus 200
+
+ get('/periodoLetivo/create')
+ assertContentContains "Create"
+ assertStatus 200
+
+ form {
+ ano "11"
+ numero "1"
+ click "create"
+ }
+ assertContentContains "11"
+ assertContentContains "1"
+ assertContentContains "created"
+ assertStatus 200
+
+ click "Edit"
+ assertContentContains "Edit"
+ assertStatus 200
+
+ form {
+ ano "12"
+ numero "2"
+ click "_action_update"
+ }
+ assertContentContains "12"
+ assertContentContains "2"
+ assertContentContains "updated"
+ assertStatus 200
+
+ click "PeriodoLetivo List"
+ assertContentContains "12"
+ assertContentContains "2"
+ assertContentContains "List"
+ assertStatus 200
+ }
+}

0 comments on commit 714791c

Please sign in to comment.