Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 37 lines (28 sloc) 1.092 kB
2aed3e2 @joshuaclayton Initial implementation of logger
joshuaclayton authored
1 require File.dirname(__FILE__) + '/helper'
a4dcaf5 @jferris Separating Rails functionality out more
jferris authored
2
3 require 'hoptoad_notifier/rails'
2aed3e2 @joshuaclayton Initial implementation of logger
joshuaclayton authored
4
4cac54c @joshuaclayton RailsInit => RailsInitializer
joshuaclayton authored
5 class RailsInitializerTest < Test::Unit::TestCase
2aed3e2 @joshuaclayton Initial implementation of logger
joshuaclayton authored
6 include DefinesConstants
7
8 should "trigger use of Rails' logger if logger isn't set and Rails' logger exists" do
9 rails = Module.new do
10 def self.logger
11 "RAILS LOGGER"
12 end
13 end
14 define_constant("Rails", rails)
a4dcaf5 @jferris Separating Rails functionality out more
jferris authored
15 HoptoadNotifier::Rails.initialize
2aed3e2 @joshuaclayton Initial implementation of logger
joshuaclayton authored
16 assert_equal "RAILS LOGGER", HoptoadNotifier.logger
17 end
18
19 should "trigger use of Rails' default logger if logger isn't set and Rails.logger doesn't exist" do
20 define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
21
a4dcaf5 @jferris Separating Rails functionality out more
jferris authored
22 HoptoadNotifier::Rails.initialize
2aed3e2 @joshuaclayton Initial implementation of logger
joshuaclayton authored
23 assert_equal "RAILS DEFAULT LOGGER", HoptoadNotifier.logger
24 end
d0c8d7b @joshuaclayton Fix test name and add the right require
joshuaclayton authored
25
26 should "allow overriding of the logger if already assigned" do
27 define_constant("RAILS_DEFAULT_LOGGER", "RAILS DEFAULT LOGGER")
a4dcaf5 @jferris Separating Rails functionality out more
jferris authored
28 HoptoadNotifier::Rails.initialize
d0c8d7b @joshuaclayton Fix test name and add the right require
joshuaclayton authored
29
30 HoptoadNotifier.configure(true) do |config|
31 config.logger = "OVERRIDDEN LOGGER"
32 end
33
34 assert_equal "OVERRIDDEN LOGGER", HoptoadNotifier.logger
35 end
2aed3e2 @joshuaclayton Initial implementation of logger
joshuaclayton authored
36 end
Something went wrong with that request. Please try again.