gorma.GormaDesign = nil
		InitDesign()
		RandomPayload = Type("UserPayload", func() {
			Attribute("first_name", String)
			Attribute("last_name", String)
		})

	})

	JustBeforeEach(func() {
		gdsl.StorageGroup(sgname, func() {
			gdsl.Store(storename, gorma.MySQL, func() {
				gdsl.Model(modelname, func() {
					gdsl.BuiltFrom(RandomPayload)
					gdsl.Field(name, ft, dsl)
					gdsl.Field("id", gorma.PKInteger, dsl) // use lowercase "id" to test sanitizer
					gdsl.Field("CreatedAt", gorma.Timestamp)
					gdsl.Field("UpdatedAt", gorma.Timestamp)
					gdsl.Field("DeletedAt", gorma.NullableTimestamp)
				})
			})
		})
		Run()

	})

	Context("with no DSL", func() {
		BeforeEach(func() {
			name = "FirstName"
		})

		It("produces a valid Relational Field definition", func() {
	BeforeEach(func() {
		Design = nil
		Errors = nil
		sgname = "production"
		dsl = nil
		name = ""
		gorma.GormaDesign = nil
		InitDesign()

	})

	JustBeforeEach(func() {

		gdsl.StorageGroup(sgname, func() {
			gdsl.Store(name, gorma.MySQL, dsl)
		})

		Run()

	})

	Context("with no DSL", func() {
		BeforeEach(func() {
			name = "mysql"
		})

		It("produces a valid Relational Store definition", func() {
			Ω(Design.Validate()).ShouldNot(HaveOccurred())
			sg := gorma.GormaDesign
			Ω(sg.RelationalStores[name].Name).Should(Equal(name))
Example #3
0
	JustBeforeEach(func() {

		modeldsl = func() {
			//gdsl.BuildsFrom(RandomPayload)
			gdsl.Field(name, ft, dsl)
			gdsl.Field("id", gorma.Integer, dsl) // use lowercase "id" to test sanitizer
			gdsl.Field("MiddleName", gorma.String)
			gdsl.Field("CreatedAt", gorma.Timestamp)
			gdsl.Field("UpdatedAt", gorma.Timestamp)
			gdsl.Field("DeletedAt", gorma.NullableTimestamp)

		}
		gdsl.StorageGroup(sgname, func() {
			gdsl.Store(storename, gorma.MySQL, func() {
				gdsl.Model(modelname, modeldsl)
			})
		})
		Run()

	})

	Context("with no DSL", func() {
		BeforeEach(func() {
			name = "FirstName"
		})

		It("produces a valid Relational Field definition", func() {
			Ω(Design.Validate()).ShouldNot(HaveOccurred())
			sg := gorma.GormaDesign
			rs := sg.RelationalStores[storename]
			Attribute("first_name", String)
			Attribute("last_name", String)
		})

	})

	JustBeforeEach(func() {
		gdsl.StorageGroup(sgname, func() {
			gdsl.Store(storename, gorma.MySQL, func() {
				gdsl.Model(name, dsl)
				gdsl.Model("Child", func() {
					gdsl.BuiltFrom(ChildPayload)
					gdsl.BelongsTo(name)
				})
				gdsl.Model("One", func() {
					gdsl.BuiltFrom(HasOnePayload)
					gdsl.HasOne("Child")
				})
				gdsl.Model("Many", func() {
					gdsl.BuiltFrom(HasManyPayload)
					gdsl.HasMany("Children", "Child")
				})

			})
		})

		Run()

	})

	Context("with no DSL", func() {
		BeforeEach(func() {
Example #5
0
	var storetype gorma.RelationalStorageType
	var dsl, storedsl func()
	var store *gorma.RelationalStoreDefinition

	BeforeEach(func() {
		Reset()
		sgname = "production"
		storedsl = nil
		dsl = nil
		name = ""
	})

	JustBeforeEach(func() {

		gdsl.StorageGroup(sgname, func() {
			gdsl.Store(name, storetype, dsl)
		})

		Run()

		store = gorma.GormaDesign.RelationalStores[name]
	})

	Context("with no name", func() {
		BeforeEach(func() {
			name = ""
		})

		It("does not produce a valid Relational Store definition", func() {
			Ω(Design.Validate()).ShouldNot(HaveOccurred())
			sg := gorma.GormaDesign