キュウリのテスト シナリオに問題があり、残念ながらエラーが発生しました。
When I follow "More about Star Wars" # features/step_definitions/web_steps.rb:56
no link with title, id or text 'More about Star Wars' found (Capybara::ElementNotFound)
(eval):2:in `click_link'
./features/step_definitions/web_steps.rb:57:in `/^(?:|I )follow "([^"]*)"$/'
features/find_movie_with_same_director.feature:18:in `When I follow "More about Star Wars"'
適切なIDを抽出するために動的リンクで接続されていると思います。もちろん、すべてがブラウザーで機能しており、新しいレコードの作成をテストしているときも同様です。
詳細は以下に追記
私のテストシナリオの適切な解決策を見つけるのを手伝ってくれる人はいますか??
でapp/views/movies/index.html.haml
:
%tbody
- @movies.each do |movie|
%tr
%td= movie.title
%td= movie.rating
%td= movie.release_date
%td= movie.director
%td= link_to "More about #{movie.title}", movie_path(movie)
%td= movie_path(movie)
=link_to 'Add new movie', new_movie_path
でfeatures/step_definition/web_steps.rb
:
When /^(?:|I )follow "([^"]*)"$/ do |link|
click_link(link)
end
私の機能ファイルでは:
Feature: search for movies by director
Scenario: find movie with the same director
As a movie buff
So that I can find movies with my favorite director
I want to include and search on director information in movies I enter
Background: movies in database
Given the following movies exist:
| title | rating | director | release_date |
| Star Wars | PG | George Lucas | 1977-05-25 |
| Blade Runner | PG | Ridley Scott | 1982-06-25 |
| Alien | R | | 1979-05-25 |
| THX-1138 | R | George Lucas | 1971-03-11 |
Given I am on the home page
When I follow "More about Star Wars"
Then I should be on the details page for "Star Wars"