I''m trying to test a rails controller, but my mock isn''t working. Everything looks right to me. Can someone take a look at it and see if I''m missing something obvious http://pastie.caboo.se/33883 Domain.should_receive(:find_domain).once.and_return(domain) That line in the spec is failing but I don''t see why. If I comment out that line the test passes so it is running the controller method as far as I can tell. Thanks, Jay ____________________________________________________________________________________ Looking for earth-friendly autos? Browse Top Cars by "Green Rating" at Yahoo! Autos'' Green Center. http://autos.yahoo.com/green_center/
Jay Donnell wrote:> someone take a look at it and see if I''m missing > something obvious >> post ''search.rjs''Mmm... You''re posting to the action ''search.rjs'', but what you want to test is the action ''search'' bye, Tobias
"Mmm... You''re posting to the action ''search.rjs'', but what you want to test is the action ''search''" My understanding is that the new restful stuff in edge rails (i.e. the respond_to) method will use the extension to determine which output type to use. This code runs fine outside of the tests and I am using urls with extensions. What is the usual way to test various respond_to output types from rspec? ____________________________________________________________________________________ Do you Yahoo!? Everyone is raving about the all-new Yahoo! Mail beta. http://new.mail.yahoo.com
On 1/18/07, Jay Donnell <jaydonnell at yahoo.com> wrote:> "Mmm... You''re posting to the action ''search.rjs'', but > what you want to > test is the action ''search''" > > My understanding is that the new restful stuff in edge > rails (i.e. the respond_to) method will use the > extension to determine which output type to use. This > code runs fine outside of the tests and I am using > urls with extensions. > > What is the usual way to test various respond_to > output types from rspec?This bit looks odd: respond_to do |format| format.js { render :action => "search.rjs" } end I think you''d want to either render :template => ''seach.rjs'' or just say format.js (and the rjs template would be rendered implicitly, no?)> > > > ____________________________________________________________________________________ > Do you Yahoo!? > Everyone is raving about the all-new Yahoo! Mail beta. > http://new.mail.yahoo.com > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
I''ll try it without render :action as soon as I get a chance. I don''t know why that would be a problem though. --- David Chelimsky <dchelimsky at gmail.com> wrote:> On 1/18/07, Jay Donnell <jaydonnell at yahoo.com> > wrote: > > "Mmm... You''re posting to the action ''search.rjs'', > but > > what you want to > > test is the action ''search''" > > > > My understanding is that the new restful stuff in > edge > > rails (i.e. the respond_to) method will use the > > extension to determine which output type to use. > This > > code runs fine outside of the tests and I am using > > urls with extensions. > > > > What is the usual way to test various respond_to > > output types from rspec? > > This bit looks odd: > > respond_to do |format| > format.js { render :action => "search.rjs" } > end > > I think you''d want to either render :template => > ''seach.rjs'' or just > say format.js (and the rjs template would be > rendered implicitly, no?) > > > > > > > > > >____________________________________________________________________________________> > Do you Yahoo!? > > Everyone is raving about the all-new Yahoo! Mail > beta. > > http://new.mail.yahoo.com > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >____________________________________________________________________________________ Yahoo! Music Unlimited Access over 1 million songs. http://music.yahoo.com/unlimited