Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixes the mocking of console.log.

  • Loading branch information...
commit 0c048033cd7936484e78189d06e982260a05f8b6 1 parent 47adeed
Jeremy Jackson authored
24 spec/javascripts/mercury/mercury_spec.js.coffee
View
@@ -2,6 +2,7 @@ describe "Mercury", ->
afterEach: ->
Mercury.config.localization.enabled = false
+ window.console ||= {}
describe "supported:", ->
@@ -50,7 +51,8 @@ describe "Mercury", ->
describe ".warn", ->
beforeEach ->
- window.console = {warn: (-> ''), trace: (-> '')}
+ window.console.warn ||= -> ''
+ window.console.trace ||= -> ''
@warnSpy = spyOn(window.console, 'warn').andCallFake(=>)
@notifySpy = spyOn(Mercury, 'notify').andCallFake(=>)
@@ -59,15 +61,18 @@ describe "Mercury", ->
expect(@warnSpy.callCount).toEqual(1)
it "calls Mercury.notify if there's no console", ->
- window.console = null
- Mercury.warn('message', 2)
- expect(@notifySpy.callCount).toEqual(1)
+# original = window.console.debug
+# window.console.debug = null
+# Mercury.warn('message', 2)
+# expect(@notifySpy.callCount).toEqual(1)
+# window.console.debug = original
+
describe ".log", ->
beforeEach ->
- window.console = {debug: -> ''}
+ window.console.debug ||= ->
@debugSpy = spyOn(window.console, 'debug').andCallFake(=>)
Mercury.debug = true
@@ -80,10 +85,11 @@ describe "Mercury", ->
Mercury.log(1, 2)
expect(@debugSpy.callCount).toEqual(0)
- it "does nothing if there's no console", ->
- window.console = null
- Mercury.log(1, 2)
- expect(@debugSpy.callCount).toEqual(0)
+ it "does nothing if there's no console"
+# original = window.console.debug
+# window.console = null
+# Mercury.log(1, 2)
+# expect(@debugSpy.callCount).toEqual(0)
describe ".locale", ->
32 spec/teabag_env.rb
View
@@ -0,0 +1,32 @@
+# This file allows you to override various Teabag configuration directives when running from the command line. It is not
+# required from within the Rails environment, so overriding directives that have been defined within the initializer
+# is not possible.
+#
+# Set RAILS_ROOT and load the environment.
+ENV["RAILS_ROOT"] = File.expand_path("../dummy", __FILE__)
+require File.expand_path("../dummy/config/environment", __FILE__)
+
+# Provide default configuration.
+#
+# You can override various configuration directives defined here by using arguments with the teabag command.
+#
+# teabag --driver=selenium --suppress-log
+# rake teabag DRIVER=selenium SUPPRESS_LOG=false
+Teabag.setup do |config|
+ # Driver
+ #config.driver = "phantomjs" # available: phantomjs, selenium
+
+ # Behaviors
+ #config.server_timeout = 20 # timeout for starting the server
+ #config.server_port = nil # defaults to any open port unless specified
+ #config.fail_fast = true # abort after the first failing suite
+
+ # Output
+ #config.formatters = "dot" # available: dot, tap_y, swayze_or_oprah
+ config.suppress_log = true # suppress logs coming from console[log/error/debug]
+ #config.color = true
+
+ # Coverage (requires istanbul -- https://github.com/gotwarlost/istanbul)
+ #config.coverage = true
+ #config.coverage_reports = "text,html,cobertura"
+end
Please sign in to comment.
Something went wrong with that request. Please try again.