So, you are using Double Ruby as mocking framework instead of Rspec’s default mocking framewok, and you want to mock a method which ends with the equal sign(=). Normally, if your method ends with other special characters such as “!” or “?”, you can safely mock those methods as below:
However, this doesn’t work if your method ends with the “=” sign. Here comes the solution:
Now, in your controller, you can expect the following:
But, why did I use send instead of the simple send ? Take a look at this