Rieles / Cucumber / Webrat: redirect_to, flash [: aviso] no funciona
Soy nuevo en Cucumber y he estado atravesando un railscast de Ryan Bates.http://railscasts.com/episodes/155-beginning-with-cucumber
Desafortunadamente mi situación está fallando donde pasa el railscast. En concreto está fallando en el paso:Then I should see "New Article Created."
Sospecho que puede tener algo que ver con las diferentes versiones de las gemas que estamos usando, actualmente tengo la última de cada una.
Me da el siguiente error:
* Entonces debería ver "Nuevo artículo creado". esperaba que el contenido del siguiente elemento incluyera "Nuevo artículo creado":
Title
Content
(Spec :: Expectations :: ExpectationNotMetError) ./features/step_definitions/web_steps.rb:144:in/^(?:|I )should see "([^\"]*)"$/' features/manage_articles.feature:18:in
Entonces debería ver "Nuevo artículo creado".
Esta es la fuente:
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 %>