Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy won't this rspec test pass?
    text
    copied!<p>I've spent the last hour trying to figure out why this test won't pass. </p> <p>I'm working in Rails 4.0 with Capybara 2.1.0 and rspec 2.14.1</p> <p>Here's my test:</p> <pre><code>require 'spec_helper' describe "Stats" do subject { page } describe "Index Page" do before { visit stats_path } it { should have_selector 'h1', text: 'Stats' } end end </code></pre> <p>And my index.html.erb file:</p> <pre><code>&lt;h1&gt;Stats&lt;/h1&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Attendance&lt;/th&gt; &lt;th&gt;Salvations&lt;/th&gt; &lt;th&gt;Visitors&lt;/th&gt; &lt;th&gt;Offering&lt;/th&gt; &lt;th&gt;Service Date&lt;/th&gt; &lt;th&gt;Time&lt;/th&gt; &lt;th&gt;Campus&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;th&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;% @stats.each do |stat| %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= stat.attendance %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= stat.salvations %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= stat.visitors %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= stat.offering %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= stat.date %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= stat.time %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= stat.campus.name %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= link_to 'Show', stat %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= link_to 'Edit', edit_stat_path(stat) %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= link_to 'Destroy', stat, method: :delete, data: { confirm: 'Are you sure?' } %&gt;&lt;/td&gt; &lt;/tr&gt; &lt;% end %&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;br&gt; &lt;%= link_to 'New Stat', new_stat_path %&gt; </code></pre> <p>And the error I'm getting is: </p> <p>1) Stats Index Page should have css "h1" with text "Stats" Failure/Error: it { should have_selector 'h1', text: 'Stats' } Capybara::ExpectationNotMet: expected to find css "h1" with text "Stats" but there were no matches # ./spec/features/stats_spec.rb:7:in `block (3 levels) in '</p> <p>I'm stumped. Any help would be appreciated.</p> <p>Incidentally, my index page renders correctly without any errors.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload