Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adicionado a funcionalidade de gerenciar artigos

  • Loading branch information...
commit 32484d80b151ffb2fe5f870254361d0dc87d498a 1 parent d5bff91
@rafaelfranca authored
View
41 features/manage_articles.feature
@@ -0,0 +1,41 @@
+# language: pt
+Funcionalidade: Gerenciar artigos
+ Para manter meu blog sempre atualizado e pertinente
+ como um blogueiro
+ eu quero poder manipular meus artigos
+
+ @wip
+ Cenario: Criar um novo artigo
+ Dado que eu estou em home page
+ Quando eu clico "Novo artigo"
+ E eu preencho com:
+ | Título | Livrem-se dos cowboys |
+ | Texto | Livrem-se dos cowboys, desenvolva software com testes |
+ E eu clico "Criar"
+ Entao eu deveria estar no artigo "livrem-se-dos-cowboys"
+ E eu deveria ver "Livrem-se dos cowboys" em "title"
+ E eu deveria ver "Livrem-se dos cowboys, desenvolva software com testes" em "article"
+
+ # Rails generates Delete links that use Javascript to pop up a confirmation
+ # dialog and then do a HTTP POST request (emulated DELETE request).
+ #
+ # Capybara must use Culerity/Celerity or Selenium2 (webdriver) when pages rely
+ # on Javascript events. Only Culerity/Celerity supports clicking on confirmation
+ # dialogs.
+ #
+ # Since Culerity/Celerity and Selenium2 has some overhead, Cucumber-Rails will
+ # detect the presence of Javascript behind Delete links and issue a DELETE request
+ # instead of a GET request.
+ #
+ # You can turn this emulation off by tagging your scenario with @no-js-emulation.
+ # Turning on browser testing with @selenium, @culerity, @celerity or @javascript
+ # will also turn off the emulation. (See the Capybara documentation for
+ # details about those tags). If any of the browser tags are present, Cucumber-Rails
+ # will also turn off transactions and clean the database with DatabaseCleaner
+ # after the scenario has finished. This is to prevent data from leaking into
+ # the next scenario.
+ #
+ # Another way to avoid Cucumber-Rails' javascript emulation without using any
+ # of the tags above is to modify your views to use <button> instead. You can
+ # see how in http://github.com/jnicklas/capybara/issues#issue/12
+ #
View
14 features/step_definitions/article_steps.rb
@@ -0,0 +1,14 @@
+Given /^the following posts:$/ do |posts|
+ Post.create!(posts.hashes)
+end
+
+When /^I delete the (\d+)(?:st|nd|rd|th) post$/ do |pos|
+ visit posts_path
+ within("table tr:nth-child(#{pos.to_i+1})") do
+ click_link "Destroy"
+ end
+end
+
+Then /^I should see the following posts:$/ do |expected_posts_table|
+ expected_posts_table.diff!(tableish('table tr', 'td,th'))
+end
View
5 features/step_definitions/web_steps_pt-BR.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
# It is recommended to regenerate this file in the future when you upgrade to a
# newer version of cucumber-rails. Consider adding your own code to a new file
@@ -59,7 +60,7 @@ def with_scope(locator)
# TODO: Add support for checkbox, select og option
# based on naming conventions.
#
-Quando /^(?:|eu )preencho com o seguinte(?: em "([^\"]*)")?:$/ do |selector, fields|
+Quando /^(?:|eu )preencho com(?: em "([^\"]*)")?:$/ do |selector, fields|
with_scope(selector) do
fields.rows_hash.each do |name, value|
Quando %{eu preenchp o campo "#{name}" com "#{value}"}
@@ -192,7 +193,7 @@ def with_scope(locator)
end
end
-Entao /^(?:|eu )deveria estar em (.+)$/ do |page_name|
+Entao /^(?:|eu )deveria estar (?:|em )(.+)$/ do |page_name|
current_path = URI.parse(current_url).path
if current_path.respond_to? :should
current_path.should == path_to(page_name)
View
4 features/support/paths.rb
@@ -10,6 +10,10 @@ def path_to(page_name)
when /the home\s?page/
'/'
+ when /the new article page/
+ new_article_path
+ when /^no artigo "^([^\"]*)"/
+ article_path(Article.find_by_slug($1))
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
Please sign in to comment.
Something went wrong with that request. Please try again.