Skip to content
Browse files

lighthouse #538 - deprecated Config#environment_filters

  • Loading branch information...
1 parent fb45e83 commit 7a9c2e02e54064ca0739d4c944771b7b7ecb2f5d Jared Carroll committed Dec 22, 2009
Showing with 19 additions and 14 deletions.
  1. +8 −6 lib/hoptoad_notifier/configuration.rb
  2. +11 −8 test/configuration_test.rb
View
14 lib/hoptoad_notifier/configuration.rb
@@ -3,7 +3,7 @@ module HoptoadNotifier
class Configuration
OPTIONS = [:api_key, :backtrace_filters, :development_environments,
- :development_lookup, :environment_filters, :environment_name, :host,
+ :development_lookup, :environment_name, :host,
:http_open_timeout, :http_read_timeout, :ignore, :ignore_by_filters,
:ignore_user_agent, :notifier_name, :notifier_url, :notifier_version,
:params_filters, :project_root, :port, :protocol, :proxy_host,
@@ -44,10 +44,6 @@ class Configuration
# By default, all "password" attributes will have their contents replaced.
attr_reader :params_filters
- # A list of environment keys that should be filtered out of what is send to Hoptoad.
- # Empty by default.
- attr_reader :environment_filters
-
# A list of filters for cleaning and pruning the backtrace. See #filter_backtrace.
attr_reader :backtrace_filters
@@ -120,7 +116,6 @@ def initialize
@http_open_timeout = 2
@http_read_timeout = 5
@params_filters = DEFAULT_PARAMS_FILTERS.dup
- @environment_filters = []
@backtrace_filters = DEFAULT_BACKTRACE_FILTERS.dup
@ignore_by_filters = []
@ignore = IGNORE_DEFAULT.dup
@@ -214,6 +209,13 @@ def protocol
end
end
+ # A list of environment keys that should be filtered out of what is send to Hoptoad.
+ # Deprecated and has no effect.
+ def environment_filters
+ warn 'config.environment_filters has been deprecated and has no effect.'
+ []
+ end
+
private
def default_port
View
19 test/configuration_test.rb
@@ -22,7 +22,6 @@ class ConfigurationTest < Test::Unit::TestCase
assert_config_default :ignore_user_agent, []
assert_config_default :params_filters,
HoptoadNotifier::Configuration::DEFAULT_PARAMS_FILTERS
- assert_config_default :environment_filters, []
assert_config_default :backtrace_filters,
HoptoadNotifier::Configuration::DEFAULT_BACKTRACE_FILTERS
assert_config_default :ignore,
@@ -78,11 +77,11 @@ class ConfigurationTest < Test::Unit::TestCase
config = HoptoadNotifier::Configuration.new
hash = config.to_hash
[:api_key, :backtrace_filters, :development_environments,
- :environment_filters, :environment_name, :host, :http_open_timeout,
- :http_read_timeout, :ignore, :ignore_by_filters, :ignore_user_agent,
- :notifier_name, :notifier_url, :notifier_version, :params_filters,
- :project_root, :port, :protocol, :proxy_host, :proxy_pass, :proxy_port,
- :proxy_user, :secure, :development_lookup].each do |option|
+ :environment_name, :host, :http_open_timeout,
+ :http_read_timeout, :ignore, :ignore_by_filters, :ignore_user_agent,
+ :notifier_name, :notifier_url, :notifier_version, :params_filters,
+ :project_root, :port, :protocol, :proxy_host, :proxy_pass, :proxy_port,
+ :proxy_user, :secure, :development_lookup].each do |option|
assert_equal config[option], hash[option], "Wrong value for #{option}"
end
end
@@ -97,8 +96,12 @@ class ConfigurationTest < Test::Unit::TestCase
assert_appends_value :params_filters
end
- should "allow environment filters to be appended" do
- assert_appends_value :environment_filters
+ should "warn when attempting to read environment filters" do
+ config = HoptoadNotifier::Configuration.new
+ config.
+ expects(:warn).
+ with(regexp_matches(/deprecated/i))
+ assert_equal [], config.environment_filters
end
should "allow ignored user agents to be appended" do

0 comments on commit 7a9c2e0

Please sign in to comment.
Something went wrong with that request. Please try again.