[rspec-users] rspec mocha and controller specs without integrated_views

Matt Deiters mdeiters at msn.com
Wed May 23 18:00:33 EDT 2007


The ability to choose a mocking framework is great as I prefer mocha, but I 
am have problems.

On my controller specs, I am forced to 'integrate_views' as the following 
code below shows you, the mocking of views is rspec specific. See stub! 
versus mocha's stub

          unless block_given?
            unless integrate_views?
              @template.stub!(:file_exists?).and_return(true)
              
@template.should_receive(:render_template).any_number_of_times.and_return(true) 
{ |*args|
                @first_render ||= args[2]
              }
              
@template.stub!(:find_template_extension_for).and_return("rhtml")
              @template.stub!(:read_template_file).and_return("this is fake 
content generated by rspec")
            end
          end

I am getting the following error: undefined method `stub!'
Any plans on fixing this?

Matt




More information about the rspec-users mailing list