Sha256: 5ad74874141239bdecf0cf4bb32caf978df040eacc0108a8e71213a988b52bda

Contents?: true

Size: 683 Bytes

Versions: 9

Compression:

Stored size: 683 Bytes

Contents

describe "Hippo.Models.EnumMap", ->
    model = null

    beforeEach ->
        model = Hippo.Test.makeModel({
            enums:
                state:
                    open: 1
                    complete: 5
                    canceled: 9

            props:
                state: {"type":"integer"}

        },{ id: 123 })

    it "sets up enums", ->
        expect(model.is_open).toEqual(false)
        model.state = 1
        expect(model.is_open).toEqual(true)
        model.is_open="some crazy value"
        expect(model.is_open).toEqual(true)

    it "reads the enum's value from the field", ->
        model.state = 1
        expect(model.state_value).toEqual("open")

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hippo-fw-0.9.9 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.8 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.7 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.6 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.5 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.4 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.3 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.2 spec/hippo/models/EnumMapSpec.coffee
hippo-fw-0.9.1 spec/hippo/models/EnumMapSpec.coffee