diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2017-07-01 13:10:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-01 13:10:05 -0400 |
commit | c197418bdbb0c5546964bfc234d056edaa69eae2 (patch) | |
tree | 9fb085e96e4de9d3a3bc6db80152944705ba3d84 /actionpack/lib/action_dispatch | |
parent | 310918f6a194bf5752fe1025930881756f5d8a8e (diff) | |
parent | 1aea1ddd2a4b3bfa7bb556e4c7cd40f9531ac2e3 (diff) | |
download | rails-c197418bdbb0c5546964bfc234d056edaa69eae2.tar.gz rails-c197418bdbb0c5546964bfc234d056edaa69eae2.tar.bz2 rails-c197418bdbb0c5546964bfc234d056edaa69eae2.zip |
Merge pull request #29622 from yalab/warning_system_tesing_http_verb
Warning http verb method call in SystemTestCase
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/system_test_case.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb | 24 |
2 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/system_test_case.rb b/actionpack/lib/action_dispatch/system_test_case.rb index c39a135ce0..78147f97ae 100644 --- a/actionpack/lib/action_dispatch/system_test_case.rb +++ b/actionpack/lib/action_dispatch/system_test_case.rb @@ -5,6 +5,7 @@ require "action_dispatch/system_testing/driver" require "action_dispatch/system_testing/server" require "action_dispatch/system_testing/test_helpers/screenshot_helper" require "action_dispatch/system_testing/test_helpers/setup_and_teardown" +require "action_dispatch/system_testing/test_helpers/undef_methods" module ActionDispatch # = System Testing @@ -88,6 +89,7 @@ module ActionDispatch include Capybara::Minitest::Assertions include SystemTesting::TestHelpers::SetupAndTeardown include SystemTesting::TestHelpers::ScreenshotHelper + include SystemTesting::TestHelpers::UndefMethods def initialize(*) # :nodoc: super diff --git a/actionpack/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb b/actionpack/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb new file mode 100644 index 0000000000..2d3f4662d7 --- /dev/null +++ b/actionpack/lib/action_dispatch/system_testing/test_helpers/undef_methods.rb @@ -0,0 +1,24 @@ +module ActionDispatch + module SystemTesting + module TestHelpers + module UndefMethods # :nodoc: + extend ActiveSupport::Concern + included do + METHODS = %i(get post put patch delete).freeze + + METHODS.each do |verb| + undef_method verb + end + + def method_missing(method, *args, &block) + if METHODS.include?(method) + raise NoMethodError + else + super + end + end + end + end + end + end +end |