aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/system_testing/test_helpers/setup_and_teardown.rb
blob: 30dc21ebb92bf8bb9b96f4212f282dcab2dfa630 (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
# frozen_string_literal: true

module ActionDispatch
  module SystemTesting
    module TestHelpers
      module SetupAndTeardown # :nodoc:
        def host!(host)
          ActiveSupport::Deprecation.warn \
            "ActionDispatch::SystemTestCase#host! is deprecated with no replacement. " \
            "Set Capybara.app_host directly or rely on Capybara's default host."

          Capybara.app_host = host
        end

        def before_teardown
          take_failed_screenshot
        ensure
          super
        end

        def after_teardown
          Capybara.reset_sessions!
        ensure
          super
        end
      end
    end
  end
end