Skip to content

Commit

Permalink
Add clean unnedded spec files and add helper sanitize method to capyb…
Browse files Browse the repository at this point in the history
…ara_matchers.rb
  • Loading branch information
alobato committed Jul 14, 2010
1 parent 2cc0962 commit 58e9a05
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions main.rb
Expand Up @@ -34,6 +34,8 @@
generate "controller home index"
gsub_file "config/routes.rb", ' get "home/index"', ""
route "root :to => 'home#index'"
run "rm spec/helpers/home_helper_spec.rb"
run "rm -rf spec/views/home"

##### layout #####
gsub_file "app/views/layouts/application.html.erb", '<%= yield %>', '<p class="notice"><%= notice %></p>\n<p class="alert"><%= alert %></p>\n\n<%= yield %>'
Expand Down
6 changes: 5 additions & 1 deletion spec/support/capybara_matchers.rb
@@ -1,8 +1,12 @@
# http://yardoc.org/docs/jnicklas-capybara/Capybara/Session
module Capybara
class Session
def s(string)
XPath.escape(string)
end

def has_form_to?(path, options={})
has_xpath?("//form[@action=\"#{path}\"]", options)
has_xpath?("//form[@action=#{s(path)}]", options)
end
end
end

0 comments on commit 58e9a05

Please sign in to comment.