File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 356
356
expect ( config . asset_host ) . to eq "domain.abc"
357
357
end
358
358
end
359
+
360
+ describe "#relative_url_root" do
361
+ let ( :config ) do
362
+ Shakapacker ::Configuration . new (
363
+ root_path : ROOT_PATH ,
364
+ config_path : Pathname . new ( File . expand_path ( "./test_app/config/shakapacker.yml" , __dir__ ) ) ,
365
+ env : "production"
366
+ )
367
+ end
368
+
369
+ it "returns the value of SHAKAPACKER_RELATIVE_URL_ROOT if set" do
370
+ original_env_value = ENV [ "SHAKAPACKER_RELATIVE_URL_ROOT" ]
371
+ ENV [ "SHAKAPACKER_RELATIVE_URL_ROOT" ] = "custom_value"
372
+
373
+ expect ( config . relative_url_root ) . to eq "custom_value"
374
+
375
+ ensure
376
+ ENV [ "SHAKAPACKER_RELATIVE_URL_ROOT" ] = original_env_value
377
+ end
378
+
379
+ it "returns ActionController::Base.helpers.compute_asset_host if SHAKAPACKER_RELATIVE_URL_ROOT is not set" do
380
+ allow ( ActionController ::Base ) . to receive ( :relative_url_root ) . and_return ( "abcd" )
381
+
382
+ expect ( config . relative_url_root ) . to eq "abcd"
383
+ end
384
+ end
359
385
end
You can’t perform that action at this time.
0 commit comments