@@ -28,6 +28,9 @@ def setup
2828 foo.css foo.js bar.css bar.js
2929 file1.css file1.js file2.css file2.js
3030 )
31+ @view . request = ActionDispatch ::Request . new ( {
32+ "rack.url_scheme" => "https"
33+ } )
3134
3235 @assets . context_class . assets_prefix = @view . assets_prefix
3336 @assets . context_class . config = @view . config
@@ -177,42 +180,42 @@ def setup
177180 end
178181
179182 def test_javascript_path
180- assert_equal "//assets.example.com/javascripts/xmlhr.js" , @view . javascript_path ( "xmlhr" )
181- assert_equal "//assets.example.com/javascripts/xmlhr.js" , @view . javascript_path ( "xmlhr.js" )
182- assert_equal "//assets.example.com/javascripts/super/xmlhr.js" , @view . javascript_path ( "super/xmlhr" )
183- assert_equal "//assets.example.com/super/xmlhr.js" , @view . javascript_path ( "/super/xmlhr" )
184-
185- assert_equal "//assets.example.com/javascripts/xmlhr.js?foo=1" , @view . javascript_path ( "xmlhr.js?foo=1" )
186- assert_equal "//assets.example.com/javascripts/xmlhr.js?foo=1" , @view . javascript_path ( "xmlhr?foo=1" )
187- assert_equal "//assets.example.com/javascripts/xmlhr.js#hash" , @view . javascript_path ( "xmlhr.js#hash" )
188- assert_equal "//assets.example.com/javascripts/xmlhr.js#hash" , @view . javascript_path ( "xmlhr#hash" )
189- assert_equal "//assets.example.com/javascripts/xmlhr.js?foo=1#hash" , @view . javascript_path ( "xmlhr.js?foo=1#hash" )
190-
191- assert_dom_equal %(<script src="//assets.example.com/assets/foo.js"></script>) ,
183+ assert_equal "https: //assets.example.com/javascripts/xmlhr.js" , @view . javascript_path ( "xmlhr" )
184+ assert_equal "https: //assets.example.com/javascripts/xmlhr.js" , @view . javascript_path ( "xmlhr.js" )
185+ assert_equal "https: //assets.example.com/javascripts/super/xmlhr.js" , @view . javascript_path ( "super/xmlhr" )
186+ assert_equal "https: //assets.example.com/super/xmlhr.js" , @view . javascript_path ( "/super/xmlhr" )
187+
188+ assert_equal "https: //assets.example.com/javascripts/xmlhr.js?foo=1" , @view . javascript_path ( "xmlhr.js?foo=1" )
189+ assert_equal "https: //assets.example.com/javascripts/xmlhr.js?foo=1" , @view . javascript_path ( "xmlhr?foo=1" )
190+ assert_equal "https: //assets.example.com/javascripts/xmlhr.js#hash" , @view . javascript_path ( "xmlhr.js#hash" )
191+ assert_equal "https: //assets.example.com/javascripts/xmlhr.js#hash" , @view . javascript_path ( "xmlhr#hash" )
192+ assert_equal "https: //assets.example.com/javascripts/xmlhr.js?foo=1#hash" , @view . javascript_path ( "xmlhr.js?foo=1#hash" )
193+
194+ assert_dom_equal %(<script src="https: //assets.example.com/assets/foo.js"></script>) ,
192195 @view . javascript_include_tag ( "foo" )
193- assert_dom_equal %(<script src="//assets.example.com/assets/foo.js"></script>) ,
196+ assert_dom_equal %(<script src="https: //assets.example.com/assets/foo.js"></script>) ,
194197 @view . javascript_include_tag ( "foo.js" )
195- assert_dom_equal %(<script src="//assets.example.com/assets/foo.js"></script>) ,
198+ assert_dom_equal %(<script src="https: //assets.example.com/assets/foo.js"></script>) ,
196199 @view . javascript_include_tag ( :foo )
197200 end
198201
199202 def test_stylesheet_path
200- assert_equal "//assets.example.com/stylesheets/bank.css" , @view . stylesheet_path ( "bank" )
201- assert_equal "//assets.example.com/stylesheets/bank.css" , @view . stylesheet_path ( "bank.css" )
202- assert_equal "//assets.example.com/stylesheets/subdir/subdir.css" , @view . stylesheet_path ( "subdir/subdir" )
203- assert_equal "//assets.example.com/subdir/subdir.css" , @view . stylesheet_path ( "/subdir/subdir.css" )
204-
205- assert_equal "//assets.example.com/stylesheets/bank.css?foo=1" , @view . stylesheet_path ( "bank.css?foo=1" )
206- assert_equal "//assets.example.com/stylesheets/bank.css?foo=1" , @view . stylesheet_path ( "bank?foo=1" )
207- assert_equal "//assets.example.com/stylesheets/bank.css#hash" , @view . stylesheet_path ( "bank.css#hash" )
208- assert_equal "//assets.example.com/stylesheets/bank.css#hash" , @view . stylesheet_path ( "bank#hash" )
209- assert_equal "//assets.example.com/stylesheets/bank.css?foo=1#hash" , @view . stylesheet_path ( "bank.css?foo=1#hash" )
210-
211- assert_dom_equal %(<link href="//assets.example.com/assets/foo.css" media="screen" rel="stylesheet" />) ,
203+ assert_equal "https: //assets.example.com/stylesheets/bank.css" , @view . stylesheet_path ( "bank" )
204+ assert_equal "https: //assets.example.com/stylesheets/bank.css" , @view . stylesheet_path ( "bank.css" )
205+ assert_equal "https: //assets.example.com/stylesheets/subdir/subdir.css" , @view . stylesheet_path ( "subdir/subdir" )
206+ assert_equal "https: //assets.example.com/subdir/subdir.css" , @view . stylesheet_path ( "/subdir/subdir.css" )
207+
208+ assert_equal "https: //assets.example.com/stylesheets/bank.css?foo=1" , @view . stylesheet_path ( "bank.css?foo=1" )
209+ assert_equal "https: //assets.example.com/stylesheets/bank.css?foo=1" , @view . stylesheet_path ( "bank?foo=1" )
210+ assert_equal "https: //assets.example.com/stylesheets/bank.css#hash" , @view . stylesheet_path ( "bank.css#hash" )
211+ assert_equal "https: //assets.example.com/stylesheets/bank.css#hash" , @view . stylesheet_path ( "bank#hash" )
212+ assert_equal "https: //assets.example.com/stylesheets/bank.css?foo=1#hash" , @view . stylesheet_path ( "bank.css?foo=1#hash" )
213+
214+ assert_dom_equal %(<link href="https: //assets.example.com/assets/foo.css" media="screen" rel="stylesheet" />) ,
212215 @view . stylesheet_link_tag ( "foo" )
213- assert_dom_equal %(<link href="//assets.example.com/assets/foo.css" media="screen" rel="stylesheet" />) ,
216+ assert_dom_equal %(<link href="https: //assets.example.com/assets/foo.css" media="screen" rel="stylesheet" />) ,
214217 @view . stylesheet_link_tag ( "foo.css" )
215- assert_dom_equal %(<link href="//assets.example.com/assets/foo.css" media="screen" rel="stylesheet" />) ,
218+ assert_dom_equal %(<link href="https: //assets.example.com/assets/foo.css" media="screen" rel="stylesheet" />) ,
216219 @view . stylesheet_link_tag ( :foo )
217220 end
218221
0 commit comments