should_assign_to raises ScriptError "No action was performed or declared."

5 views
Skip to first unread message

Wayne Conrad

unread,
Aug 27, 2010, 1:03:05 PM8/27/10
to Remarkable
Hello. Remarkable newbie, writing tests for some very old, very
crusty rails code. I'm stumped by a strange exception, "No action was
performed or declared," when using the should_assign_to matcher.

(Part of) the controller:

class IndexController < ApplicationController

def initialize
...
@title = 'Welcome'
...
end

...
end

(Part of) the spec:

describe IndexController do

it 'should have a welcoming title' do
should assign_to(:title, :with=>'Welcome')
end

...
end

The backtrace when I run it:

ScriptError in 'IndexController should have a welcoming title'
No action was performed or declared.
/var/lib/gems/1.8/gems/remarkable_rails-3.1.13/lib/remarkable_rails/
action_controller/macro_stubs.rb:553:in `run_action!'
/var/lib/gems/1.8/gems/remarkable_rails-3.1.13/lib/remarkable_rails/
action_controller/base.rb:16:in `send'
/var/lib/gems/1.8/gems/remarkable_rails-3.1.13/lib/remarkable_rails/
action_controller/base.rb:16:in `perform_action_with_macro_stubs'
/var/lib/gems/1.8/gems/remarkable-3.1.13/lib/remarkable/dsl/
callbacks.rb:65:in `send'
/var/lib/gems/1.8/gems/remarkable-3.1.13/lib/remarkable/dsl/
callbacks.rb:65:in `run_before_assert_callbacks'
/var/lib/gems/1.8/gems/remarkable-3.1.13/lib/remarkable/dsl/
callbacks.rb:61:in `each'
/var/lib/gems/1.8/gems/remarkable-3.1.13/lib/remarkable/dsl/
callbacks.rb:61:in `run_before_assert_callbacks'
/var/lib/gems/1.8/gems/remarkable-3.1.13/lib/remarkable/dsl/
assertions.rb:283:in `matches?'
/home/devel/production/main/portal/spec/controllers/
index_controller_spec.rb:14:

Versions:
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
rspec (1.3.0)
rspec-rails (1.3.2)
remarkable (3.1.13)
remarkable_activerecord (3.1.13)
remarkable_rails (3.1.13)
rails (2.2.3)

Being new to this, I'm sure I'm goofing something up. Do you know
what I'm doing wrong? Thanks.

Sébastien Nicouleaud

unread,
Aug 28, 2010, 3:53:31 AM8/28/10
to remarka...@googlegroups.com
You must indicate which action is supposed to assign to @title :

describe IndexController do
describe :get => :index do
should_assign_to :title, :with => 'Welcome'
end
end


Cheers
Seb

Wayne Conrad

unread,
Sep 7, 2010, 3:51:56 PM9/7/10
to Remarkable
That was it. Thank you for your help.

On Aug 28, 12:53 am, Sébastien Nicouleaud
Reply all
Reply to author
Forward
0 new messages