aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2017-03-27 19:51:21 -0400
committerRafael Mendonça França <rafaelmfranca@gmail.com>2017-03-27 19:51:21 -0400
commit84bfb81a62c142e63569863535f0204669bd006c (patch)
tree17e0e6eddb2367ce6a151fd2e32718a24b984e17
parentf76881750d77245a148bca71bcccd9e0720d0c6b (diff)
downloadrails-84bfb81a62c142e63569863535f0204669bd006c.tar.gz
rails-84bfb81a62c142e63569863535f0204669bd006c.tar.bz2
rails-84bfb81a62c142e63569863535f0204669bd006c.zip
Make sure that ActionController::Api can include helpers
Closes #28554
-rw-r--r--actionpack/test/controller/api/with_helpers_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/api/with_helpers_test.rb b/actionpack/test/controller/api/with_helpers_test.rb
new file mode 100644
index 0000000000..9882a25ae1
--- /dev/null
+++ b/actionpack/test/controller/api/with_helpers_test.rb
@@ -0,0 +1,26 @@
+require "abstract_unit"
+
+module ApiWithHelper
+ def my_helper
+ "helper"
+ end
+end
+
+class WithHelpersController < ActionController::API
+ include ActionController::Helpers
+ helper ApiWithHelper
+
+ def with_helpers
+ render plain: self.class.helpers.my_helper
+ end
+end
+
+class WithHelpersTest < ActionController::TestCase
+ tests WithHelpersController
+
+ def test_with_helpers
+ get :with_helpers
+
+ assert_equal "helper", response.body
+ end
+end