Skip to content
This repository has been archived by the owner on Nov 11, 2017. It is now read-only.

Commit

Permalink
lighthouse #538 - deprecated Config#environment_filters
Browse files Browse the repository at this point in the history
  • Loading branch information
Jared Carroll committed Dec 22, 2009
1 parent fb45e83 commit 7a9c2e0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
14 changes: 8 additions & 6 deletions lib/hoptoad_notifier/configuration.rb
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions test/configuration_test.rb
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 7a9c2e0

Please sign in to comment.