File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
lib/action_pack/cloudfront
test/actionpack/cloudfront Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ module LocationHeaders
99 |RS|SK|SI|ES|SE|CH|UA|GB|VA|RS)$/ix
1010
1111 included do
12- helper_method :request_eu?
12+ if respond_to? ( :helper_method )
13+ helper_method :request_eu?
14+ end
1315 end
1416
1517 private
Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ class Railtie < ::Rails::Railtie
1919 config . to_prepare do
2020 ::ApplicationController . send :include , ActionPack ::Cloudfront ::LocationHeaders
2121 end
22-
2322 end
2423 end
2524end
Original file line number Diff line number Diff line change 1+ require 'test_helper'
2+
3+ class LocationHeadersTest < ActiveSupport ::TestCase
4+ class ApplicationController < ActionController ::Base
5+ include ActionPack ::Cloudfront ::LocationHeaders
6+ end
7+
8+ class ApiController < ActionController ::API
9+ include ActionPack ::Cloudfront ::LocationHeaders
10+ end
11+
12+ test '#request_eu? - includes when has helper method' do
13+ assert_includes ApplicationController . _helper_methods , :request_eu?
14+ assert_nil ApiController . try ( :_helper_methods )
15+ end
16+ end
You can’t perform that action at this time.
0 commit comments