@@ -50,6 +50,14 @@ defmodule Sentry.PlugCaptureTest do
5050 end
5151 end
5252
53+ setup_all do
54+ Application . put_env ( :sentry , PhoenixEndpoint ,
55+ render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
56+ )
57+
58+ :ok
59+ end
60+
5361 test "sends error to Sentry" do
5462 bypass = Bypass . open ( )
5563
@@ -61,7 +69,7 @@ defmodule Sentry.PlugCaptureTest do
6169 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
6270 end )
6371
64- modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
72+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
6573
6674 assert_raise ( Plug.Conn.WrapperError , "** (RuntimeError) Error" , fn ->
6775 conn ( :get , "/error_route" )
@@ -80,7 +88,7 @@ defmodule Sentry.PlugCaptureTest do
8088 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
8189 end )
8290
83- modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
91+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
8492
8593 catch_throw (
8694 conn ( :get , "/throw_route" )
@@ -99,7 +107,7 @@ defmodule Sentry.PlugCaptureTest do
99107 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
100108 end )
101109
102- modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
110+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
103111
104112 catch_exit (
105113 conn ( :get , "/exit_route" )
@@ -122,7 +130,7 @@ defmodule Sentry.PlugCaptureTest do
122130 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
123131 end )
124132
125- modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
133+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
126134
127135 assert_raise ( Plug.Conn.WrapperError , "** (RuntimeError) Error" , fn ->
128136 conn ( :get , "/error_route" )
@@ -141,7 +149,7 @@ defmodule Sentry.PlugCaptureTest do
141149 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
142150 end )
143151
144- modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
152+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
145153
146154 assert_raise ( Plug.Conn.WrapperError , "** (RuntimeError) Error" , fn ->
147155 conn ( :get , "/error_route" )
@@ -175,12 +183,7 @@ defmodule Sentry.PlugCaptureTest do
175183 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
176184 end )
177185
178- modify_app_env (
179- dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
180- "#{ __MODULE__ . PhoenixEndpoint } ": [
181- render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
182- ]
183- )
186+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
184187
185188 { :ok , _ } = PhoenixEndpoint . start_link ( )
186189
@@ -205,12 +208,7 @@ defmodule Sentry.PlugCaptureTest do
205208 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
206209 end )
207210
208- modify_app_env (
209- dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
210- "#{ __MODULE__ . PhoenixEndpoint } ": [
211- render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
212- ]
213- )
211+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
214212
215213 { :ok , _ } = PhoenixEndpoint . start_link ( )
216214
@@ -232,12 +230,7 @@ defmodule Sentry.PlugCaptureTest do
232230 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
233231 end )
234232
235- modify_app_env (
236- dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
237- "#{ __MODULE__ . PhoenixEndpoint } ": [
238- render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
239- ]
240- )
233+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
241234
242235 { :ok , _ } = PhoenixEndpoint . start_link ( )
243236
@@ -269,7 +262,7 @@ defmodule Sentry.PlugCaptureTest do
269262 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
270263 end )
271264
272- modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
265+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
273266
274267 start_supervised! ( PhoenixEndpoint )
275268
@@ -300,12 +293,7 @@ defmodule Sentry.PlugCaptureTest do
300293 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
301294 end )
302295
303- modify_app_env (
304- dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
305- "#{ __MODULE__ . PhoenixEndpoint } ": [
306- render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
307- ]
308- )
296+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
309297
310298 { :ok , _ } = PhoenixEndpoint . start_link ( )
311299
@@ -337,7 +325,7 @@ defmodule Sentry.PlugCaptureTest do
337325 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
338326 end )
339327
340- modify_app_env ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
328+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
341329
342330 conn = conn ( :get , "/error_route" )
343331
@@ -363,12 +351,7 @@ defmodule Sentry.PlugCaptureTest do
363351 Plug.Conn . resp ( conn , 200 , ~s< {"id": "340"}> )
364352 end )
365353
366- modify_app_env (
367- dsn: "http://public:secret@localhost:#{ bypass . port } /1" ,
368- "#{ __MODULE__ . PhoenixEndpoint } ": [
369- render_errors: [ view: Sentry.ErrorView , accepts: ~w( html) ]
370- ]
371- )
354+ put_test_config ( dsn: "http://public:secret@localhost:#{ bypass . port } /1" )
372355
373356 { :ok , _ } = PhoenixEndpoint . start_link ( )
374357
0 commit comments