aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/system_testing/test_helpers/assertions.rb
blob: 865b5e59dbbacd378d2583cc5bbff1d65eeeb017 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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