ssmithstone
2010-Dec-07 16:46 UTC
[rspec-users] specing a model to make sure it implements act_as_authentic
Is it possible to spec that a model should acts_as_authentic which is from the authlogic gem? I''m using rspec-1.3.x Cheers Stephen
J. B. Rainsberger
2010-Dec-08 02:19 UTC
[rspec-users] specing a model to make sure it implements act_as_authentic
On Wed, Dec 8, 2010 at 02:46, ssmithstone <stephen.smithstone at gmail.com>wrote: Is it possible to spec that a model should acts_as_authentic which is> from the authlogic gem? > > I''m using rspec-1.3.x >Whenever I don''t know how to spec something -- or whether to spec something -- I ask, "If the thing I''m worried about failed, how would I know?" Then I try writing a spec to check that. So let me ask you, if your model failed to acts_as_authentic from the authlogic gem, what would go wrong? Could you write a test that fails when that wrong thing happens? -- J. B. (Joe) Rainsberger :: http://www.jbrains.ca :: http://blog.thecodewhisperer.com Diaspar Software Services :: http://www.diasparsoftware.com Author, JUnit Recipes 2005 Gordon Pask Award for contribution to Agile practice :: Agile 2010: Learn. Practice. Explore. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20101208/2755f142/attachment-0001.html>
Neha J.
2010-Dec-16 06:22 UTC
[rspec-users] specing a model to make sure it implements act_as_authentic
Hello Stephen, I came across same problem few days back. Its very simple. You need not spec a model to check if the model acts_as_authentic. I am using RSpec with Factory_girl. So when I create factory for my respective model, Factory does the checking for the model. Try creating a Factory for respective model in before (:each) block. And for cross-checking, just comment out the acts_as_authentic line from your model file. You should be able to see the error message onscreen when spec runs. And when you uncomment the line, spec runs with 0 errors. Hope this helps. --Neha Jain -- Posted via http://www.ruby-forum.com/.