Corey Haines
2008-Mar-05 18:05 UTC
[rspec-users] Testing that a model helper method is called
So, I have a plugin that adds a method to ActiveRecord::Base, let''s call the method is_encrypted. class MyModel < ActiveRecord::Base is_encrypted end So, my question is, how do I write a spec to show that is_encrypted is called here? I would rather not write specs that say that the behavior is there, since I have tested the behavior already in my plugin. Thanks. -Corey -- http://www.coreyhaines.com The Internet''s Premiere source of information about Corey Haines -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080305/606e21ff/attachment.html
Pat Maddox
2008-Mar-05 18:10 UTC
[rspec-users] Testing that a model helper method is called
On Wed, Mar 5, 2008 at 10:05 AM, Corey Haines <coreyhaines at gmail.com> wrote:> So, I have a plugin that adds a method to ActiveRecord::Base, let''s call the > method is_encrypted. > > class MyModel < ActiveRecord::Base > > is_encrypted > > end > > So, my question is, how do I write a spec to show that is_encrypted is > called here? I would rather not write specs that say that the behavior is > there, since I have tested the behavior already in my plugin.MyModel.should_receive(:is_encrypted) load "my_model.rb" Pat
Corey Haines
2008-Mar-05 18:22 UTC
[rspec-users] Testing that a model helper method is called
Thanks, Pat, that appeared to work. -Corey On Wed, Mar 5, 2008 at 1:10 PM, Pat Maddox <pergesu at gmail.com> wrote:> On Wed, Mar 5, 2008 at 10:05 AM, Corey Haines <coreyhaines at gmail.com> > wrote: > > So, I have a plugin that adds a method to ActiveRecord::Base, let''s call > the > > method is_encrypted. > > > > class MyModel < ActiveRecord::Base > > > > is_encrypted > > > > end > > > > So, my question is, how do I write a spec to show that is_encrypted is > > called here? I would rather not write specs that say that the behavior > is > > there, since I have tested the behavior already in my plugin. > > MyModel.should_receive(:is_encrypted) > load "my_model.rb" > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- http://www.coreyhaines.com The Internet''s Premiere source of information about Corey Haines -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080305/0dafab7c/attachment.html