Permalink
Browse files

Merge branch 'capybara_field_content_assertion_textarea_support' of g…

…it://github.com/nruth/cucumber-rails
  • Loading branch information...
2 parents 35550a8 + e5864f7 commit 23e6b998d33056e7d45608c20462c8ce008f7f1d @aslakhellesoy aslakhellesoy committed May 4, 2010
Showing with 5 additions and 3 deletions.
  1. +5 −3 templates/skeleton/step_definitions/capybara_steps.rb.erb
@@ -143,7 +143,8 @@ end
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should contain "([^\"]*)"$/ do |field, selector, value|
with_scope(selector) do
- field_value = find_field(field).value
+ field = find_field(field)
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
if field_value.respond_to? :should
field_value.should =~ /#{value}/
else
@@ -154,11 +155,12 @@ end
Then /^the "([^\"]*)" field(?: within "([^\"]*)")? should not contain "([^\"]*)"$/ do |field, selector, value|
with_scope(selector) do
- field_value = find_field(field).value
+ field = find_field(field)
+ field_value = (field.tag_name == 'textarea') ? field.text : field.value
if field_value.respond_to? :should_not
field_value.should_not =~ /#{value}/
else
- assert_no_match(/#{value}/, field_value.value)
+ assert_no_match(/#{value}/, field_value)
end
end
end

0 comments on commit 23e6b99

Please sign in to comment.