私は Cucumber を初めて使用し、Ryan Bates による Railscast を踏んでいます。http://railscasts.com/episodes/155-beginning-with-cucumber
残念ながら、レールキャストが通過する場所で私のシナリオは失敗しています。具体的には、次のステップで失敗しています。Then I should see "New Article Created."
私たちが使用しているgemの異なるバージョンと関係があるのではないかと思います.現在、私はそれぞれの最新のものを持っています.
次のエラーが表示されます。
※すると「記事を新規作成しました」と表示されます。は、次の要素のコンテンツに「New Article Created.」が含まれていることを期待していました:
Title
Content
(Spec::Expectations::ExpectationNotMetError) ./features/step_definitions/web_steps.rb:144:in /^(?:|I )should see "([^\"]*)"$/'
features/manage_articles.feature:18:in
「新しい記事が作成されました」と表示されます。
これはソースです:
manage_articles.feature
Feature: Manage Articles Scenario: Create Valid Article Given I have no articles And I am on the list of articles When I follow "New Article" And I fill in "Title" with "Spuds" And I fill in "Content" with "Delicious potatoes" Then I should see "New Article Created." And I should see "Spuds" And I should see "Delicious potatoes" And I should have 1 article
article_controller.rb
...
def create
@article = Article.create!(params[:article])
flash[:notice] = "New Article Created."
redirect_to articles_path
end
index.html.erb
<p><%= flash[:notice] %></p>
<% for article in @articles %>
<p><%=h article.title %></p>
<p><%=h article.content %></p>
<% end %>
<%= link_to "New Article", new_article_path %>