Skip to content

Commit

Permalink
Messages correctly sent are returned to caller
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo D'Incau committed Dec 24, 2014
1 parent a725e3b commit 879366b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/gcm.erl
Expand Up @@ -95,7 +95,7 @@ parse_result(Result, RegId) ->
error_logger:info_msg("Error: ~p for registered id: ~p~n", [Error, RegId]),
{RegId, Error};
{undefined, MessageId, undefined} when MessageId =/= undefined ->
ok;
{RegId, ok};
{undefined, MessageId, NewRegId} when MessageId =/= undefined andalso NewRegId =/= undefined ->
error_logger:info_msg("Message sent. Update id ~p with new id ~p.~n", [RegId, NewRegId]),
{RegId, {<<"NewRegistrationId">>, NewRegId}}
Expand Down
2 changes: 1 addition & 1 deletion test/gcm_test.erl
Expand Up @@ -26,7 +26,7 @@ receive_results_from_sync_push(_) ->

Actual = gcm:sync_push(test, RegIds, Message),

Expected = [ok, {<<"RegId1">>, <<"InvalidRegistration">>},
Expected = [{<<"RegId0">>, ok}, {<<"RegId1">>, <<"InvalidRegistration">>},
{<<"RegId2">>, {<<"NewRegistrationId">>, <<"NewRegId">>}}],
[
{"Results are passed to the caller", ?_assertMatch(Expected, Actual)},
Expand Down

0 comments on commit 879366b

Please sign in to comment.