Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #15132 from zuhao/refactor_actionpack_abstract_col…

…lector_test

Ensure :js is defined regardless of the outcome of the test.
  • Loading branch information...
commit d71c72f7c87d0e733a696c5d638bb1fbd625adcd 2 parents 13e8c80 + 45c396b
@senny senny authored
Showing with 11 additions and 5 deletions.
  1. +11 −5 actionpack/test/abstract/collector_test.rb
View
16 actionpack/test/abstract/collector_test.rb
@@ -24,15 +24,21 @@ class TestCollector < ActiveSupport::TestCase
test "does not respond to unknown mime types" do
collector = MyCollector.new
- assert !collector.respond_to?(:unknown)
+ assert_not_respond_to collector, :unknown
end
test "register mime types on method missing" do
AbstractController::Collector.send(:remove_method, :js)
- collector = MyCollector.new
- assert !collector.respond_to?(:js)
- collector.js
- assert_respond_to collector, :js
+ begin
+ collector = MyCollector.new
+ assert_not_respond_to collector, :js
+ collector.js
+ assert_respond_to collector, :js
+ ensure
+ unless AbstractController::Collector.method_defined? :js
+ AbstractController::Collector.generate_method_for_mime :js
+ end
+ end
end
test "does not register unknown mime types" do
Please sign in to comment.
Something went wrong with that request. Please try again.