Sha256: b6da977ca6f9e941b66045a340d3449fffcbe2c2d806f639ad180716aa00a221

Contents?: true

Size: 1.35 KB

Versions: 15

Compression:

Stored size: 1.35 KB

Contents

describe 'up.log', ->

  describe 'Javascript functions', ->

    describe 'up.log.puts', ->

      it 'sends a log message to the developer console iff the log is enabled', ->
        spyOn(up.browser, 'puts')

        up.log.disable()
        up.log.puts('message')
        expect(up.browser.puts).not.toHaveBeenCalled()

        up.log.enable()
        up.log.puts('message')
        expect(up.browser.puts).toHaveBeenCalledWith('log', '[UP] message')

    describe 'up.log.debug', ->

      it 'sends a debug message to the developer console iff the log is enabled', ->
        spyOn(up.browser, 'puts')

        up.log.disable()
        up.log.debug('message')
        expect(up.browser.puts).not.toHaveBeenCalled()

        up.log.enable()
        up.log.debug('message')
        expect(up.browser.puts).toHaveBeenCalledWith('debug', '[UP] message')

    describe 'up.log.error', ->

      it 'sends an error message to the developer console regardless whether the log is enabled or not', ->
        spyOn(up.browser, 'puts')

        up.log.disable()
        up.log.error('message1')
        expect(up.browser.puts).toHaveBeenCalledWith('error', '[UP] message1')

        up.log.enable()
        up.log.error('message2')
        expect(up.browser.puts.calls.allArgs()).toEqual [
          ['error', '[UP] message1'],
          ['error', '[UP] message2']
        ]
        

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
unpoly-rails-0.31.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.31.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.31.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.30.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.30.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.29.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.28.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.28.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.27.3 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.27.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.27.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.27.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.26.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.26.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.26.0 spec_app/spec/javascripts/up/log_spec.js.coffee