Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Commit de Marcia! #41

Closed
wants to merge 1 commit into from

2 participants

@PauloLira

No description provided.

@rodrigovilar rodrigovilar commented on the diff
grails-app/domain/alocadorhorarios/Horario.groovy
@@ -0,0 +1,15 @@
+package alocadorhorarios
+
+class Horario {
+
+ String hora_inicio
+ String hora_fim
+ static hasMany = [turma: Turma]
@rodrigovilar Owner

Um horário não tem muitas turma, é o contrário.
Alias, é bom consertar esse belongsTo para
belongsTo = [turma:Turma]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@rodrigovilar
Owner

Conflito

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 27, 2012
  1. @PauloLira
This page is out of date. Refresh to see the latest.
View
16 application.properties
@@ -1,8 +1,8 @@
-#Grails Metadata file
-#Wed Apr 25 11:00:06 GMT-03:00 2012
-app.grails.version=2.0.1
-app.name=AlocadorHorarios
-app.servlet.version=2.5
-app.version=0.1
-plugins.functional-test=2.0.M2
-plugins.jquery-ui=1.8.15
+#Grails Metadata file
+#Fri Apr 27 11:49:39 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
View
6 grails-app/controllers/alocadorhorarios/HorarioController.groovy
@@ -0,0 +1,6 @@
+package alocadorhorarios
+
+class HorarioController {
+
+ def scaffold = true
+}
View
15 grails-app/domain/alocadorhorarios/Horario.groovy
@@ -0,0 +1,15 @@
+package alocadorhorarios
+
+class Horario {
+
+ String hora_inicio
+ String hora_fim
+ static hasMany = [turma: Turma]
@rodrigovilar Owner

Um horário não tem muitas turma, é o contrário.
Alias, é bom consertar esse belongsTo para
belongsTo = [turma:Turma]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+ static belongsTo = Turma
+ static constraints = {
+
+ hora_inicio inList : ["7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22"]
+ hora_fim inList : ["7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22"]
+ }
+}
View
17 test/unit/alocadorhorarios/HorarioControllerTests.groovy
@@ -0,0 +1,17 @@
+package alocadorhorarios
+
+
+
+import grails.test.mixin.*
+import org.junit.*
+
+/**
+ * See the API for {@link grails.test.mixin.web.ControllerUnitTestMixin} for usage instructions
+ */
+@TestFor(HorarioController)
+class HorarioControllerTests {
+
+ void testSomething() {
+ fail "Implement me"
+ }
+}
View
55 test/unit/alocadorhorarios/HorarioTests.groovy
@@ -0,0 +1,55 @@
+package alocadorhorarios
+
+
+
+import org.junit.*
+
+/**
+ * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
+ */
+@TestFor(Horario)
+class HorarioTests {
+
+ void testValidacaoHorario (){
+
+
+ Horario hora_inicioInvalido = new Horario ()
+
+ assert !hora_inicioInvalido.validate()
+
+
+
+ Horario hora_fimInvalido = new Horario ()
+
+ assert !hora_fimInvalido.validate()
+
+
+ }
+
+
+
+ void testCRUD(){
+
+ Horario horario = new Horario (hora_inicio:"7",hora_fim:"10")
+
+ horario.save()
+
+
+
+ def horarios = Horario.list()
+ assert horarios.size()==1
+
+ def horarioAdicionado = horarios [0]
+ assertEquals horario.hora_inicio,horarioAdicionado.hora_inicio
+ assertEquals horario.hora_fim,horarioAdicionado.hora_fim
+
+ horarioAdicionado = horarios[0]
+ assertEquals horario.hora_inicio,horarioAdicionado.hora_inicio
+ assertEquals horario.hora_fim,horarioAdicionado.hora_fim
+ horario.delete()
+ }
+
+
+}
+
+
Something went wrong with that request. Please try again.