Cucumber を使用して Web ページのフィルター機能をチェックしようとしています。特定の映画の評価を確認すると、表にある評価の映画のみが表示されます。これが私のシナリオです:
When I check the following ratings: 'PG', 'R'
And I press Refresh
Then I should not see /PG/
そして、ここに私のステップ定義があります:
Then /^(?:|I )should not see \/([^\/]*)\/$/ do |regexp|
  regexp = Regexp.new(regexp)
  if page.respond_to? :should
    page.should have_no_xpath('//*', :text => regexp)
  else
    assert page.has_no_xpath?('//*', :text => regexp)
  end
end
しかし、「あいまいな一致」エラーが発生します。
重要な場合に備えて、HTML の一部を次に示します。
  <table id='movies'>
    <thead>
      <tr>
        <th>Movie Title</th>
        <th>Rating</th>
        <th>Release Date</th>
        <th>More Info</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Aladdin</td>
        <td>G</td>
        <td>1992-11-25 00:00:00 UTC</td>
        <td><a href="/movies/1">More about Aladdin</a></td>
      </tr>
ありがとうございました!