この機能がパスしない理由がわかりません...手動テストで機能していることはわかっていますが、このエラーが継続的に発生しています
cannot select option, no option with text 'Don Moen' in select box 'audio_file[artist_id]'
(Capybara::ElementNotFound)
(eval):2:in `select'
./features/step_definitions/web_steps.rb:34:in `/^I select "(.*?)" from "(.*?)"$/'
features/adding_audio.feature:19:in `When I select "Don Moen" from "audio_file[artist_id]"'
シナリオの失敗:
Background:
Given I am on the home page
And I have an admin account
And I submit valid login information
And I am in the admin panel
And I follow "New Upload"
Scenario: Adding Audio with Existing Artist
Given the following Artists exist
| name |
| Don Moen |
When I fill in "Title" with "Song Name"
When I select "Don Moen" from "audio_file[artist_id]"
And I press "Upload"
Then I should not see an error message
問題のステップの定義:
Given /^the following Artists exist$/ do |table|
table.hashes.each do |attributes|
Artist.create :name => attributes[:name]
end
end
When /^I select "(.*?)" from "(.*?)"$/ do |option, field|
page.select option, :from => field
end
モデルがデータベースに保存されていないことに問題があることはわかっています。テスト コンソールにそのアーティストを手動で追加すると、機能がパスするからです。
たぶん、私が台無しにしたいくつかのdb構成ですか?