Hi Kristian,
The new rspec 2 way of doing assigns is assign(variable_name,
whats_being_assigned). So your example becomes:
assign(:message, stub("Message"))
That should get rid of your deprecation message.
Cheers,
Trey
On Wed, Jun 9, 2010 at 10:56 AM, Kristian Mandrup <[email protected]>wrote:
> 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}"
> render
> rendered.should contain("Hello world!")
> end
> end
>
> --
> $ 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.
>
> /Users/kristianconsult/Development/Languages/Ruby/Apps/Web-apps/Rails/
> Rails-3/Experimental/views_example/spec/views/messages/
> 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
> updated?
>
> _______________________________________________
> rspec-users mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users