diff options
author | Ryan T. Hosford <tad.hosford@gmail.com> | 2016-03-24 12:11:51 -0500 |
---|---|---|
committer | Ryan T. Hosford <tad.hosford@gmail.com> | 2016-04-04 08:51:29 -0500 |
commit | f99106805d7275c790466b31514e52544ee1a8d6 (patch) | |
tree | 3cf2e494efabdb81716b6b6ade3834faa4ea5747 /actionpack/test | |
parent | 8040e55063abde6eeaac2702ca9961ce34a2d6c7 (diff) | |
download | rails-f99106805d7275c790466b31514e52544ee1a8d6.tar.gz rails-f99106805d7275c790466b31514e52544ee1a8d6.tar.bz2 rails-f99106805d7275c790466b31514e52544ee1a8d6.zip |
Fixes #24239
- skip calling helper_method if it's not there: if we don't have helpers, we needn't define one.
- tests that an api controller can include and use ActionController::Cookies
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/api/with_cookies_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/actionpack/test/controller/api/with_cookies_test.rb b/actionpack/test/controller/api/with_cookies_test.rb new file mode 100644 index 0000000000..4491dc9002 --- /dev/null +++ b/actionpack/test/controller/api/with_cookies_test.rb @@ -0,0 +1,21 @@ +require 'abstract_unit' + +class WithCookiesController < ActionController::API + include ActionController::Cookies + + def with_cookies + render plain: cookies[:foobar] + end +end + +class WithCookiesTest < ActionController::TestCase + tests WithCookiesController + + def test_with_cookies + request.cookies[:foobar] = 'bazbang' + + get :with_cookies + + assert_equal 'bazbang', response.body + end +end |