Sha256: cb85b13508eb77724d49607f654f92543b61d396be62210838957e01fc7fd776

Contents?: true

Size: 1.35 KB

Versions: 36

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

36 entries across 36 versions & 1 rubygems

Version Path
unpoly-rails-0.51.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.50.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.50.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.50.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.37.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.36.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.36.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.36.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.35.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.35.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.35.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.34.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.34.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.34.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.33.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.32.0 spec_app/spec/javascripts/up/log_spec.js.coffee