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.57.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.7 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.6 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.5 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.4 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.3 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.56.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.55.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.55.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.54.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.54.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.53.4 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.53.3 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.53.2 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.53.1 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.53.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.52.0 spec_app/spec/javascripts/up/log_spec.js.coffee
unpoly-rails-0.51.1 spec_app/spec/javascripts/up/log_spec.js.coffee