title: How to create a Cuke step definition that will test that only certainly results are displayed?
body: <p>I've been searching high and low trying to implement a bunch of suggestions to crack this one, but none of them seem to work. Sorry if this has been answered elsewhere, I just couldn't find it!</p>
  
  <p>Basically, I'm stuck writing a step definition that tests that the current view has been filtered by certain criteria. Here are the relevant steps:</p>
  
  <pre><code>  When I check the following ratings: PG, R
    And I uncheck the following ratings: G, PG-13, NC-17
    And I press "Refresh"
    Then I should see movies with the ratings: PG, R
  </code></pre>
  
  <p>And here are my step definitions for the latter two:</p>
  
  <pre><code>And /I press "Refresh"/ do
      click_button("Refresh")
  end
  
  Then /I should see movies with the ratings: (.*)/ do |ratings|
      page.should have_content ratings
  end
  </code></pre>
  
  <p>The first one straight up doesn't work (says it's ambiguous), and the second one says that it can't find the text PG, R on the page. Cucumber is totally alien to me, and I am very lost! Any advice you can offer would be greatly appreciated!</p>
  
  <p>Edit: As requested, this is the Haml that Capybara is operating on:</p>
  
  <pre><code>-#  This file is app/views/movies/index.html.haml
  %h1 All Movies
  
  = form_tag movies_path, :method =&gt; :get, :id =&gt; 'ratings_form' do
    = hidden_field_tag "title_sort", true if @title_header
    = hidden_field_tag ":release_date_sort", true if @date_header
    Include: 
    - @all_ratings.each do |rating|
      = rating
      = check_box_tag "ratings[#{rating}]", 1, @selected_ratings.include?(rating), :id =&gt; "ratings_#{rating}"
    = submit_tag 'Refresh', :id =&gt; 'ratings_submit'
  
  %table#movies
    %thead
      %tr
        %th{:class =&gt; @title_header}= link_to 'Movie Title', movies_path(:sort =&gt; 'title', :ratings =&gt; @selected_ratings), :id =&gt; 'title_header'
        %th Rating
        %th{:class =&gt; @date_header}= link_to 'Release Date', movies_path(:sort =&gt; 'release_date', :ratings =&gt; @selected_ratings), :id =&gt; 'release_date_header'
        %th More Info
    %tbody
      - @movies.each do |movie|
        %tr
          %td= movie.title 
          %td= movie.rating
          %td= movie.release_date
          %td= link_to "More about #{movie.title}", movie_path(movie)
  
  = link_to 'Add new movie', new_movie_path
  </code></pre>