[rspec-users] assigns in RSpec 2 - deprecation warning on rendered?

Kristian Mandrup kmandrup at gmail.com
Wed Jun 9 12:56:48 EDT 2010

I have come to the views_example in the RSpec book, using RSpec 2 all
the way.
Now I have this spec:
describe "messages/show.html.erb" do
  it "displays the text attribute of the message" do
    assigns[:message] = stub("Message", :text => "Hello world!")
    puts "assigns @message: #{@message}"
    @message = stub("Message", :text => "Hello world!")
    puts "@message: #{@message}"
    rendered.should contain("Hello world!")

$ rspec spec/views/messages/show.html.erb_spec.rb

assigns @message:
@message: #[RSpec::Mocks::Mock:0x8244a124 @name="Message"]

DEPRECATION WARNING: you are using deprecated behaviour that will
be removed from a future version of RSpec.

show.html.erb_spec.rb:10:in `block (2 levels) in <top (required)>'

* response is deprecated.
* please use rendered instead.

1) I notice that the assigns doesn't seem to work with RSpec 2. An
easy fix is to set the instance var directly. Is this the new way?

2) I changed 'response' to 'rendered' as the variable I get back from
calling 'render', but I still get a deprecation warning! Has it been
changed to a new name again without the deprecation check having been

More information about the rspec-users mailing list