Hi everybody,<br><br>I run into an issue with the "class" method of a mocked model. The following expectation fails:<br><br><span style="font-family: courier new,monospace;">@user = mock_model(Author</span>)<br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">is_author(user).should == true</span><br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">def is_author(user)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> case user</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> when Author</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> return true</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> else <br> return false</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> end</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">end</span><br><br>However, it works well when running the app. I guess that the problem comes from the mock as it compares the mocked-model.class with the real-model.class. Do you have any idea to fix that?<br>
<br>For now, I use "<span style="font-family: courier new,monospace;">Author.class.to_s</span>" but I don't like to make my code ugly for the mock to work. :)<br><br>Cheers,<br><br>φ<br><a href="http://pcreux.com">http://pcreux.com</a><br>
<br>