I am new to Cucumber and go through the railscast of Ryan Bates. http://railscasts.com/episodes/155-beginning-with-cucumber
Unfortunately, my script does not work when railscast passes. In particular, it does not work on the step: Then I should see "New Article Created."
I suspect that this may have something to do with the different versions of the gems we use, I currently have the last one.
This gives me the following error:
* Then I should see "Created New Article". expected the following elemental content to include "Create Article" .:
Title Content
(Spec :: Expectations :: ExpectationNotMetError). / features / step _definitions / web_steps.rb: 144: in /^(?:|I )should see "([^\"]*)"$/' features/manage_articles.feature:18:in Then I should see" New article created. "* *
This is the source:
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
articles_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 %>
ruby-on-rails cucumber webrat
Evan
source share