On Thu, Jul 31, 2008 at 5:21 PM, aslak hellesoy <[EMAIL PROTECTED]> wrote: > On Thu, Jul 31, 2008 at 4:06 PM, Bastien <[EMAIL PROTECTED]> wrote: >> I can't figure out what I do wrong there, I have a nested controller >> which is defined as a singular resource, the routing works properly, >> but inside my specs the request never goes through the show action. >> >> I keep on getting this error : >> >> Spec::Mocks::MockExpectationError in 'Surveys::ReportController should >> return the survey corresponding to the report' >> Mock 'Class' expected :find with (any args) once, but received it 0 >> times >> >> In my specs : >> require File.expand_path(File.dirname(__FILE__) + '/../../ >> spec_helper') >> describe Surveys::ReportController do >> >> it "should return the survey corresponding to the report" do >> Survey.should_receive(:find) >> get :show, :survey_id=>"34" > > Try: > > get :show, :id=>"34" >
Sorry, I was too quick. It sounds like your params don't match the routes you want. Try rake routes, and also try to spec the routing in the associated routing_spec.rb. Aslak > Aslak > >> end >> >> end >> >> In route.rb : >> map.resources :surveys do |survey| >> survey.resource :report, :controller =>'surveys/report' >> end >> >> In controller/surveys/report_controller.rb : >> class Surveys::ReportController < ApplicationController >> >> def show >> @survey = Survey.find(params[:survey_id]) >> >> respond_to do |format| >> format.html >> format.xml >> end >> end >> >> end >> _______________________________________________ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users