[rspec-devel] [ rspec-Bugs-8241 ] "no id given" if controller method does not exist

noreply at rubyforge.org noreply at rubyforge.org
Fri Feb 2 07:04:00 EST 2007


Bugs item #8241, was opened at 2007-01-29 03:37
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8241&group_id=797

Category: rails plugin
Group: None
Status: Open
>Resolution: Postponed
Priority: 3
Submitted By: François Beausoleil (fbos)
>Assigned to: David Chelimsky (dchelimsky)
>Summary: "no id given" if controller method does not exist

Initial Comment:
Given this controller:
class RolesController < ApplicationController
end

And this specification:
context "A project owner" do
  controller_name :roles

  specify "can assign roles to other users" do
    post :create, :project_id => 27, :role => {:name => "user"}, :user => {:email => "jim at teksol.info"}
    response.should_redirect_to dashboard_url
  end
end

The spec fails like this:
1)
ArgumentError in 'A project owner can assign roles to other users'
no id given
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/expectations/sugar.rb:13:in `method_missing'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/expectations/sugar.rb:13:in `_method_missing'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/expectations/sugar.rb:9:in `method_missing'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/base.rb:1098:in `perform_action_without_filters'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:632:in `call_filter'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:638:in `call_filter'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:438:in `call'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:637:in `call_filter'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:619:in `perform_action_without_benchmark'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/benchmarking.rb:66:in `perform_action_without_rescue'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/rescue.rb:83:in `perform_action'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/base.rb:430:in `process_without_filters'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/filters.rb:624:in `process_without_session_management_support'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/session_management.rb:114:in `process_without_test'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:15:in `process'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:382:in `process'
/home/francois/src/smrty2/config/../vendor/rails/actionpack/lib/action_controller/test_process.rb:353:in `post'
./spec/controllers/roles_spec.rb:26:
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/specification.rb:55:in `execute_spec'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/specification.rb:30:in `run'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/context.rb:57:in `run'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/context.rb:54:in `run'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/context_runner.rb:23:in `run'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/context_runner.rb:22:in `run'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/lib/spec/runner/command_line.rb:26:in `run'
/usr/lib/ruby/gems/1.8/gems/rspec-0.7.5.1/bin/spec:4:
/usr/bin/spec:16:

I resolved my issue by creating the method.  I would have expected rspec to complain that "the action does not exist".

Thanks !
François Beausoleil


----------------------------------------------------------------------

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-02-02 12:03

Message:
This is a conflict between RSpec's use of method_missing and Rails' use of the same. This will go away in 0.9 when we remove the syntax sugar, at which point you'll get the message you'll expect:

No action responded to create

I'll leave this open for tracking, but setting it to postponed.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=8241&group_id=797


More information about the rspec-devel mailing list