Navigation Menu

Skip to content

Commit

Permalink
make notes_test_server a bit nicer
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespharaoh committed Apr 7, 2012
1 parent 62d8f26 commit d4da7a6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
12 changes: 10 additions & 2 deletions test/misc/notes_openid_test.erl
Expand Up @@ -28,9 +28,13 @@ prepare_test () ->
"session id",
"open id url",
true },
em:any (),
em:any () ],

{ return, ok }),
{ function,
fun ([ _Message, _From, State ]) ->
{ reply, ok, State }
end }),

?REPLAY,

Expand Down Expand Up @@ -66,9 +70,13 @@ verify_test () ->
"session id",
"return to",
Params },
em:any (),
em:any () ],

{ return, ok }),
{ function,
fun ([ _Message, _From, State ]) ->
{ reply, ok, State }
end }),

?REPLAY,

Expand Down
26 changes: 22 additions & 4 deletions test/misc/notes_server_test.erl
Expand Up @@ -20,13 +20,22 @@ call_new_process_test () ->
?EXPECT,

em:strict (Em, ?STUB, handle_call,
[ Message, em:any () ],
{ return, ok }),

[ Message,
em:any (),
em:any () ],

{ function,
fun ([ _Message, _From, State ]) ->
{ reply, ok, State }
end }),

?REPLAY,

?assertEqual (

ok,

?TARGET:call (
?SERVER,
?STUB,
Expand All @@ -49,13 +58,22 @@ call_existing_process_test () ->
?EXPECT,

em:strict (Em, ?STUB, handle_call,
[ Message, em:any () ],
{ return, ok }),

[ Message,
em:any (),
em:any () ],

{ function,
fun ([ _Message, _From, State ]) ->
{ reply, ok, State }
end }),

?REPLAY,

?assertEqual (

ok,

?TARGET:call (
?SERVER,
?STUB,
Expand Down
7 changes: 1 addition & 6 deletions test/misc/notes_test_server.erl
Expand Up @@ -46,12 +46,7 @@ handle_call (stop, _From, Target) ->

handle_call (Request, From, Target) ->

case Target:handle_call (Request, From) of

ok ->
{ reply, ok, Target }

end.
Target:handle_call (Request, From, Target).

handle_cast (Message, Target) ->

Expand Down

0 comments on commit d4da7a6

Please sign in to comment.