summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2019-12-25 11:31:03 -0600
committerPaul J. Davis <paul.joseph.davis@gmail.com>2019-12-25 11:45:20 -0600
commitbe2d14d46643b9053a3595faabb626cc66ff7983 (patch)
treed1ad346f6db0be4f150a302256f3ef75cbfe77c4
parentce2020c607e255b166680a8dd7419d4f017ef7e3 (diff)
downloadcouchdb-be2d14d46643b9053a3595faabb626cc66ff7983.tar.gz
Speedup eunit: chttpd_xframe_test
-rw-r--r--src/chttpd/test/eunit/chttpd_xframe_test.erl29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/chttpd/test/eunit/chttpd_xframe_test.erl b/src/chttpd/test/eunit/chttpd_xframe_test.erl
index 1272c198c..f3e6165bb 100644
--- a/src/chttpd/test/eunit/chttpd_xframe_test.erl
+++ b/src/chttpd/test/eunit/chttpd_xframe_test.erl
@@ -4,13 +4,19 @@
-include_lib("couch/include/couch_db.hrl").
-include_lib("eunit/include/eunit.hrl").
-setup() ->
+setup_all() ->
ok = meck:new(config),
ok = meck:expect(config, get, fun(_, _, _) -> "X-Forwarded-Host" end),
ok.
+teardown_all(_) ->
+ meck:unload().
+
+setup() ->
+ meck:reset([config]).
+
teardown(_) ->
- meck:unload(config).
+ ok.
mock_request() ->
Headers = mochiweb_headers:make([{"Host", "examples.com"}]),
@@ -62,12 +68,19 @@ xframe_host_test_() ->
{
"xframe host tests",
{
- foreach, fun setup/0, fun teardown/1,
- [
- fun allow_with_wildcard_host/1,
- fun allow_with_specific_host/1,
- fun deny_with_different_host/1
- ]
+ setup,
+ fun setup_all/0,
+ fun teardown_all/1,
+ {
+ foreach,
+ fun setup/0,
+ fun teardown/1,
+ [
+ fun allow_with_wildcard_host/1,
+ fun allow_with_specific_host/1,
+ fun deny_with_different_host/1
+ ]
+ }
}
}.