Testing instance variables from controllers with rspec
Posted
by Thiago
on Stack Overflow
See other posts from Stack Overflow
or by Thiago
Published on 2010-05-14T19:50:04Z
Indexed on
2010/05/14
19:54 UTC
Read the original article
Hit count: 128
rspec
|ruby-on-rails
Hi,
I am trying to get the following spec to run:
describe BlacklistController, "GET index" do
it "should display the list of universally blocked numbers" do
get :index
debugger
assigns[:blocked_numbers].should contain "190"
end
end
Here's the action
def index
@blocked_numbers << "190"
respond_to do |format|
format.html
end
end
And the failure simply says that assigns[:blocked_numbers} is nil. Why's that?
© Stack Overflow or respective owner