assign(:message, stub(“Message”))
In my view I can access the message, but…
<%= @message.to_s %>
expected the following element's content to include "Hello
world!":
#[RSpec::Mocks::Mock:0x81bbd81c @name=“Message”]
Finally after some trial and error I discovered the solution, an
option on the stub call to set the text message (content of the stub)
assign(:message, stub("Message", :text => "Hello world!"))
and in my view
<%= @message.text %>
Nice!