I need to call user.invite! as part of my tests. This is using Devise invitable and so should both send an invitation to the user and also create an invitation token for them and save them to the database.

Unfortunately, in the test environment nothing happens and calling user.invite! simply returns nil and makes no changes to the user object.

How can I remedy this?

有帮助吗?

解决方案

I'm an idiot. I stubbed the invite! method so it didn't do anything.

As you were.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top