Rabbi Chama in the name of Rabbi Yose: not necessarily three complete months, but the greater part of the first and the greater part of the last and the middle one whole. And not necessarily even "and behold, she is with child by harlotry," but that she would strike upon her belly and say: "With kings I am pregnant; with redeemers I am pregnant."
Tamar Strikes Her Belly Crying I Carry Kings and Redeemers
Yalkut Shimoni on Torah 145:6
רַבִּי חָמָא בְּשֵׁם רַבִּי יוֹסִי, לֹא סוֹף דָּבָר שְׁלֹשָׁה שְׁלֵמִים אֶלָּא רֻבּוֹ שֶׁל רִאשׁוֹן וְרֻבּוֹ שֶׁל אַחֲרוֹן וְאֶמְצָעִי שָׁלֵם. וְלֹא סוֹף דָּבָר (ג' שְׁלֵמִים) וְגַם הִנֵּה הָרָה לִזְנוּנִים אֶלָּא שֶׁהָיְתָה מְטַפַּחַת עַל כְּרֵסָהּ וְאָמְרָה, מְלָכִים אֲנִי מְעֻבֶּרֶת, גּוֹאֲלִים אֲנִי מְעֻבֶּרֶת.