[rspec-users] Can't access actions of a singular nested resource
aslak.hellesoy at gmail.com
Thu Jul 31 11:21:24 EDT 2008
On Thu, Jul 31, 2008 at 4:06 PM, Bastien <bastien.vaucher at gmail.com> 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
> In my specs :
> require File.expand_path(File.dirname(__FILE__) + '/../../
> describe Surveys::ReportController do
> it "should return the survey corresponding to the report" do
> get :show, :survey_id=>"34"
get :show, :id=>"34"
> In route.rb :
> map.resources :surveys do |survey|
> survey.resource :report, :controller =>'surveys/report'
> In controller/surveys/report_controller.rb :
> class Surveys::ReportController < ApplicationController
> def show
> @survey = Survey.find(params[:survey_id])
> respond_to do |format|
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users