Rails / Pepino / Webrat: redirect_to, flash [: notice] não está funcionando
Eu sou novo na Cucumber e tenho passado por um railscast de Ryan Bates.http://railscasts.com/episodes/155-beginning-with-cucumber
Infelizmente, meu cenário está falhando onde o railscast passa. Especificamente, está falhando na etapa:Then I should see "New Article Created."
Eu suspeito que pode ter algo a ver com as diferentes versões das gemas que estamos usando, atualmente tenho as últimas de cada uma.
Dá-me o seguinte erro:
* Então eu deveria ver "Novo artigo criado". esperava que o conteúdo do seguinte elemento incluísse "Novo artigo criado".
Title
Content
(Spec :: Expectations :: ExpectationNotMetError) ./features/step_definitions/web_steps.rb:144:in/^(?:|I )should see "([^\"]*)"$/' features/manage_articles.feature:18:in
Então eu deveria ver "Novo artigo criado".
Esta é a fonte:
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 %>