Sha256: 7daf7a6a559c08266ebf3e1bcb3377945c6ede3248247ec801ec8058c32b65a3

Contents?: true

Size: 799 Bytes

Versions: 3

Compression:

Stored size: 799 Bytes

Contents

describe 'Joosy.Modules.Resources.Function', ->

  it 'works', ->
    class Generic extends Joosy.Module
      @extend Joosy.Modules.Resources.Function

      constructor: (@bar) ->
        @foo = 'bar'

      __call: -> '123'

    generic = Generic.build 'foo'

    expect(typeof generic).toEqual 'function'
    expect(generic.foo).toEqual 'bar'
    expect(generic.bar).toEqual 'foo'
    expect(generic()).toEqual '123'

  describe 'Hash', ->
    it 'works', ->
      class Hash extends Joosy.Resources.Hash
        @extend Joosy.Modules.Resources.Function

        constructor: (data) ->
          data.bar = 'foo'
          super data

      hash = Hash.build {foo: 'bar'}

      expect(typeof hash).toEqual 'function'
      expect(hash 'foo').toEqual 'bar'
      expect(hash 'bar').toEqual 'foo'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
joosy-1.2.0.beta.4 spec/joosy/resources/modules/function_spec.coffee
joosy-1.2.0.beta.3 spec/joosy/resources/modules/function_spec.coffee
joosy-1.2.0.beta.2 spec/joosy/resources/modules/function_spec.coffee