They created a job for me but gave it to someone else because I was pregnant

I had worked for the same company for 5 years and my boss told me he was going to create a role for me within the company that would be a promotion. He said I would have to go through an application and interview process but that this was just a formality. Two days before the interview I found out I was pregnant and told my boss, he seemed very happy for me. I went through the interview process but did;t get the job. When I asked my boss why I was;t given the promotion he had promised me he said that after I had told him I was pregnant he had discussed things with his wife and they had decided that my priorities would change.