Permalink
Browse files

Added have_form_putting_to.

git-svn-id: https://rspec-on-rails-matchers.googlecode.com/svn/trunk@24 11e6f158-dd3c-0410-a69b-4d739fb74d9d
  • Loading branch information...
1 parent 33f44e4 commit 89e73dc828d96b960b03fa3801a058c8bf3400e9 joshknowles committed Mar 3, 2008
Showing with 10 additions and 0 deletions.
  1. +1 −0 CHANGELOG
  2. +2 −0 README
  3. +7 −0 lib/spec/rails/matchers/views.rb
View
@@ -4,6 +4,7 @@ Change Log
Trunk
-----
+* 2008/03/02 - Added have_form_putting_to(url_or_path) - Patch by unknown google code submitter
* 2008/03/02 - Added should observe (Luke Melia)
* 2008/03/02 - Patched validates_length_of to use within to be consistent with Rails (Matt Pelletier)
* 2007/01/03 - Initial Public Release
View
2 README
@@ -63,6 +63,8 @@ Adds the following RSpec matchers:
response.should have_form_posting_to(url_or_path)
TM snippet: [hfpt + tab]
+ response.should have_form_putting_to(url_or_path)
+
response.should have_text_field_for(:attribute)
TM snippet: [htff + tab]
@@ -7,6 +7,13 @@ def have_form_posting_to(url_or_path)
end
end
+ def have_form_puting_to(url_or_path, id)
+ return simple_matcher("have a form submitting via PUT to '#{url_or_path}/#{id}'") do |response|
+ have_tag("form[method=post][action=#{url_or_path}/#{id}]").matches?(response)
+ have_tag("input[name=_method][type=hidden][value=put]").matches?(response)
+ end
+ end
+
def have_label_for(attribute, text)
return simple_matcher("have a label for '#{attribute}' with value of '#{text}'") do |response|
have_tag("label[for=#{attribute}]").matches?(response)

0 comments on commit 89e73dc

Please sign in to comment.