aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/system_testing/test_helpers
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2016-08-12 08:19:55 -0400
committereileencodes <eileencodes@gmail.com>2017-02-20 15:07:31 -0500
commit93eff636a677215eb130f775b99e9421fb30f7a2 (patch)
tree3652b95d82adc57287c093177d24a95624da9673 /actionpack/lib/system_testing/test_helpers
parent0dc63281da1c7075ce63d8dba62e4230d72bfc2a (diff)
downloadrails-93eff636a677215eb130f775b99e9421fb30f7a2.tar.gz
rails-93eff636a677215eb130f775b99e9421fb30f7a2.tar.bz2
rails-93eff636a677215eb130f775b99e9421fb30f7a2.zip
Add test assertion helpers
Adds assertions that are not part of Capybara but may be useful to Rails users writing system tests.
Diffstat (limited to 'actionpack/lib/system_testing/test_helpers')
-rw-r--r--actionpack/lib/system_testing/test_helpers/assertions.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/actionpack/lib/system_testing/test_helpers/assertions.rb b/actionpack/lib/system_testing/test_helpers/assertions.rb
new file mode 100644
index 0000000000..865b5e59db
--- /dev/null
+++ b/actionpack/lib/system_testing/test_helpers/assertions.rb
@@ -0,0 +1,32 @@
+module SystemTesting
+ module TestHelpers
+ module Assertions
+ def assert_all_of_selectors(*items)
+ options = items.extract_options!
+ type = type_for_selector(items)
+
+ items.each do |item|
+ assert_selector type, item, options
+ end
+ end
+
+ def assert_none_of_selectors(*items)
+ options = items.extract_options!
+ type = type_for_selector(items)
+
+ items.each do |item|
+ assert_no_selector type, item, options
+ end
+ end
+
+ private
+ def type_for_selector(*items)
+ if items.first.is_a?(Symbol)
+ items.shift
+ else
+ Capybara.default_selector
+ end
+ end
+ end
+ end
+end