Matt Deiters
2007-May-23 22:00 UTC
[rspec-users] rspec mocha and controller specs without integrated_views
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
David Chelimsky
2007-May-23 22:17 UTC
[rspec-users] rspec mocha and controller specs without integrated_views
On 5/23/07, Matt Deiters <mdeiters at msn.com> wrote:> 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?Sure. Go ahead and raise an RFE in the tracker (http://rubyforge.org/tracker/?group_id=797). If you want to see it happen fast, submit a patch. Now that users can use any mock framework, we should probably not use any mock framework for anything internal, so the method should just override the methods that are being mocked.> > Matt > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
aslak hellesoy
2007-May-23 22:19 UTC
[rspec-users] rspec mocha and controller specs without integrated_views
On 5/24/07, Matt Deiters <mdeiters at msn.com> wrote:> 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? >We didn''t know about it before you told us. If you want it fixed fast, send a patch, if not, wait for us to do it. In any case, a ticket with a failing spec would be great. Aslak> Matt > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Maybe Matching Threads
- Warning: integrate_views and nested description groups
- integrate_views is not executing my views
- Rails matcher render_template is wrong when using GetText, looking for flexible solution
- Using integrate_views for all controller specs
- render_to_string in a controller test?