aboutsummaryrefslogtreecommitdiffstats
path: root/test/controllers/ingresses/mandrill
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-11-05 09:11:01 -0500
committerGeorge Claghorn <george@basecamp.com>2018-11-05 09:11:01 -0500
commit7755f9b381c007ce98e0858473a9f29f1cd25311 (patch)
tree9130fccc00bf2602cdcf92eda572deec911f6302 /test/controllers/ingresses/mandrill
parentcb041ddc7e94da15e2db72188545f78da6cadb53 (diff)
downloadrails-7755f9b381c007ce98e0858473a9f29f1cd25311.tar.gz
rails-7755f9b381c007ce98e0858473a9f29f1cd25311.tar.bz2
rails-7755f9b381c007ce98e0858473a9f29f1cd25311.zip
Read ingress passwords/API keys from encrypted credentials
Fall back to ENV for people who prefer that approach.
Diffstat (limited to 'test/controllers/ingresses/mandrill')
-rw-r--r--test/controllers/ingresses/mandrill/inbound_emails_controller_test.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/controllers/ingresses/mandrill/inbound_emails_controller_test.rb b/test/controllers/ingresses/mandrill/inbound_emails_controller_test.rb
index 1658d85104..c8a8e731d6 100644
--- a/test/controllers/ingresses/mandrill/inbound_emails_controller_test.rb
+++ b/test/controllers/ingresses/mandrill/inbound_emails_controller_test.rb
@@ -1,9 +1,10 @@
require "test_helper"
-ActionMailbox::Ingresses::Mandrill::InboundEmailsController::Authenticator.key = "1l9Qf7lutEf7h73VXfBwhw"
+ENV["MANDRILL_INGRESS_API_KEY"] = "1l9Qf7lutEf7h73VXfBwhw"
class ActionMailbox::Ingresses::Mandrill::InboundEmailsControllerTest < ActionDispatch::IntegrationTest
setup do
+ ActionMailbox.ingress = :mandrill
@events = JSON.generate([{ event: "inbound", msg: { raw_msg: file_fixture("../files/welcome.eml").read } }])
end
@@ -48,12 +49,10 @@ class ActionMailbox::Ingresses::Mandrill::InboundEmailsControllerTest < ActionDi
end
private
- delegate :key, :key=, to: ActionMailbox::Ingresses::Mandrill::InboundEmailsController::Authenticator
-
def switch_key_to(new_key)
- previous_key, self.key = key, new_key
+ previous_key, ENV["MANDRILL_INGRESS_API_KEY"] = ENV["MANDRILL_INGRESS_API_KEY"], new_key
yield
ensure
- self.key = previous_key
+ ENV["MANDRILL_INGRESS_API_KEY"] = previous_key
end
end