RoR アプリケーションで BDD に Cucumber と Capybara を使用しています。私は次の機能を持っています
Feature: List profiles
In order to know that the people behind the profiles are real people
As a lurker
I want to be able to find who is registed and see their profile picture
Background: Profiles have been added to the database, some with picture attached
Given some profiles exist
And I am on the home page
Scenario: Search by city, avatars should be there
When I search for a city with profiles
Then I should see some result profiles with avatar
基礎となる Capybara ステップ ファイルには以下が含まれます。
Then /^I should see some result profiles with avatar$/ do
page.should have_css("#profile_search_results .profile img.avatar", :count => some_profiles)
end
このステップでは、ページに含まれていることを確認します
<div id="#profile_search_results>
<img class="avatar" src="" />
しかし...画像が存在するかどうかも確認したい(壊れた画像ではない)。
カピバラのステップでこれを行うにはどうすればよいですか?