Permalink
Browse files

no need to match handle_event in detail

  • Loading branch information...
1 parent ded21f4 commit 2ca7fe99cac8882f04c9a2d4a3f60c94c0eb85d6 @martinrehfeld martinrehfeld committed Apr 24, 2012
Showing with 31 additions and 23 deletions.
  1. +1 −23 src/elli_basicauth.erl
  2. +30 −0 test/elli_basicauth_tests.erl
View
@@ -26,29 +26,7 @@ handle(Req, Config) ->
end.
-handle_event(request_complete, [_Req, _ResponseCode, _ResponseHeaders,
- _ResponseBody, _Timings], _Config) ->
- ok;
-
-handle_event(request_throw, _, _Config) ->
- ok;
-
-handle_event(request_exit, _, _Config) ->
- ok;
-
-handle_event(request_error, _, _Config) ->
- ok;
-
-handle_event(request_parse_error, [_Data], _Args) ->
- ok;
-
-handle_event(client_closed, [_When], _Config) ->
- ok;
-
-handle_event(client_timeout, [_When], _Config) ->
- ok;
-
-handle_event(elli_startup, [], _Config) ->
+handle_event(_, _, _) ->
ok.
@@ -58,6 +58,36 @@ invalid_credentials_test() ->
meck:unload(elli_request).
+elli_handler_behaviour_test() ->
+ ?assertEqual(ok, elli_basicauth:handle_event(request_complete,
+ [mock_request,
+ mock_response_code,
+ mock_response_headers,
+ mock_response_body,
+ mock_timings], mock_config)),
+
+ ?assertEqual(ok, elli_basicauth:handle_event(request_throw,
+ mock_dummy, mock_config)),
+
+ ?assertEqual(ok, elli_basicauth:handle_event(request_exit,
+ mock_dummy, mock_config)),
+
+ ?assertEqual(ok, elli_basicauth:handle_event(request_error,
+ mock_dummy, mock_config)),
+
+ ?assertEqual(ok, elli_basicauth:handle_event(request_parse_error,
+ [mock_data], mock_config)),
+
+ ?assertEqual(ok, elli_basicauth:handle_event(client_closed,
+ [mock_when], mock_config)),
+
+ ?assertEqual(ok, elli_basicauth:handle_event(client_timeout,
+ [mock_when], mock_config)),
+
+ ?assertEqual(ok, elli_basicauth:handle_event(elli_startup,
+ [], mock_config)).
+
+
%%
%% HELPERS
%%

0 comments on commit 2ca7fe9

Please sign in to comment.