Hi, How do I override the value of a controller variable in a controller spec. For ex, if I have an action with an array, I want to have examples with different variables in the array def testing my_array = [1,2,4] end How do I test this with diff vals for my array? Thanks -- Posted via http://www.ruby-forum.com/.
On Jul 9, 2008, at 3:08 PM, Tim Stevens wrote:> > How do I override the value of a controller variable in a controller > spec. For ex, if I have an action with an array, I want to have > examples > with different variables in the array > > def testing > my_array = [1,2,4] > end > > How do I test this with diff vals for my array?This should do the trick: stub!("my_array").and_return([2,3,4])
Can you provide more information about what you are spec''ing? Zach On Wed, Jul 9, 2008 at 3:08 PM, Tim Stevens <lists at ruby-forum.com> wrote:> Hi, > > How do I override the value of a controller variable in a controller > spec. For ex, if I have an action with an array, I want to have examples > with different variables in the array > > def testing > my_array = [1,2,4] > end > > How do I test this with diff vals for my array? > > > > Thanks > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Zach Dennis http://www.continuousthinking.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20080709/bfbe65ea/attachment.html>