That is true
Joshua 6
22 But Joshua had said unto the two men that had spied out the country, Go into the harlot’s house, and bring out thence the woman, and all that she hath, as ye sware unto her.
23 And the young men that were spies went in, and brought out Rahab, and her father, and her mother, and her brethren, and all that she had; and they brought out all her kindred, and left them without the camp of Israel.
There is not any doubt God knew the Woman`s faith but these men of Israel could only see it in her works, so she and all of her family were saved.
Her faith was in the God of the Israelites so she did the works required.
A most excellent example! And we have the examples of Ruth, and Esther, also.