Permalink
Browse files

Add test assertion helpers

Adds assertions that are not part of Capybara but may be useful to Rails
users writing system tests.
  • Loading branch information...
eileencodes committed Aug 12, 2016
1 parent 0dc6328 commit 93eff636a677215eb130f775b99e9421fb30f7a2
@@ -5,6 +5,7 @@ module SystemTesting
module TestHelper
include Capybara::DSL
include TestHelpers::FormHelper
include TestHelpers::Assertions
def after_teardown
Capybara.reset_sessions!
@@ -3,5 +3,6 @@ module TestHelpers
extend ActiveSupport::Autoload
autoload :FormHelper
autoload :Assertions
end
end
@@ -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

0 comments on commit 93eff63

Please sign in to comment.