[rspec-users] Failing View Spec, rspec-rails 2.2.1

David Chelimsky dchelimsky at gmail.com
Thu Dec 9 07:59:15 EST 2010

On Thu, Dec 9, 2010 at 6:43 AM, Sid W. <lists at ruby-forum.com> wrote:
> I'm running into this issue as well. Surely someone has a solution?
> Seems to be Rails 3.0.3.

Please be sure to quote relevant parts of the thread to provide
context for people who are reading on phones, etc, that don't make it
easy to see an entire thread.

Here's a snip from the original post:

I had a passing view spec using >= rspec-rails2. Then after updating
to 2.1.0-2.2.1 it always fails. Thinking I was crazy I built the
example in the rspec book, and I get the same thing. Here is the full
source: https://github.com/matthewcalebsmith/rspec_issue.git

If I switch out the message.stub(:title => "the title") in "it
'renders a text field for the message title' do" with assign(:message,
mock_model("Message",:title => "the title").as_new_record), everything
passes. Why does the stub not work anymore?

Using the stub gives this:
  1) messages/new.html.erb renders a text field for the message title
     Failure/Error: form.should have_selector("input",
     expected following output to contain a <input type='text'
name='message[title]' value='the title'/> tag:
     <form accept-charset="UTF-8" action="/messages"
class="new_message" id="new_message" method="post">
     <div style="margin:0;padding:0;display:inline"><input name="utf8"
type="hidden" value="&#10003;"></div>
       <input id="message_title" name="message[title]" size="30"
type="text" value="Message_#&lt;RSpec::Core::ExampleGroup::Nested_1:0x0000010312db68&gt;"><input
id="message_submit" name="commit" type="submit" value="Save">

This is a regression that was introduced by an enhancement in
rspec-mocks-2.2. It has been reported, identified, and fixed, but not
yet released:


I'll try to get an rspec-rails-2.2.2 release out this weekend with
this fix. In the mean time, you can point your Gemfile to the branch
on github and get the fix right now:

gem "rspec-rails", :git => "git://github.com/rspec/rspec-rails",
:branch => "2-2-maintenance"


More information about the rspec-users mailing list