|
341 | 341 | end |
342 | 342 |
|
343 | 343 | it "returns the value of SHAKAPACKER_ASSET_HOST if set" do |
344 | | - with_env_variable("SHAKAPACKER_ASSET_HOST" => "custom_host.abc") do |
345 | | - expect(config.asset_host).to eq "custom_host.abc" |
346 | | - end |
| 344 | + expect(ENV).to receive(:fetch).with("SHAKAPACKER_ASSET_HOST", nil).and_return("custom_host.abc") |
| 345 | + |
| 346 | + expect(config.asset_host).to eq "custom_host.abc" |
347 | 347 | end |
348 | 348 |
|
349 | 349 | it "returns ActionController::Base.helpers.compute_asset_host if SHAKAPACKER_ASSET_HOST is not set" do |
350 | 350 | allow(ActionController::Base.helpers).to receive(:compute_asset_host).and_return("domain.abc") |
| 351 | + allow(ENV).to receive(:fetch).with("SHAKAPACKER_ASSET_HOST", "domain.abc").and_return("domain.abc") |
351 | 352 |
|
352 | | - with_env_variable("SHAKAPACKER_ASSET_HOST" => nil) do |
353 | | - expect(config.asset_host).to eq "domain.abc" |
354 | | - end |
| 353 | + expect(config.asset_host).to eq "domain.abc" |
355 | 354 | end |
356 | 355 | end |
357 | 356 |
|
|
365 | 364 | end |
366 | 365 |
|
367 | 366 | it "returns the value of SHAKAPACKER_RELATIVE_URL_ROOT if set" do |
368 | | - with_env_variable("SHAKAPACKER_RELATIVE_URL_ROOT" => "custom_value") do |
369 | | - expect(config.relative_url_root).to eq "custom_value" |
370 | | - end |
| 367 | + allow(ENV).to receive(:fetch).with("SHAKAPACKER_RELATIVE_URL_ROOT", nil).and_return("custom_value") |
| 368 | + |
| 369 | + expect(config.relative_url_root).to eq "custom_value" |
371 | 370 | end |
372 | 371 |
|
373 | 372 | it "returns ActionController::Base.helpers.compute_asset_host if SHAKAPACKER_RELATIVE_URL_ROOT is not set" do |
374 | 373 | allow(ActionController::Base).to receive(:relative_url_root).and_return("abcd") |
| 374 | + allow(ENV).to receive(:fetch).with("SHAKAPACKER_RELATIVE_URL_ROOT", "abcd").and_return("abcd") |
375 | 375 |
|
376 | | - with_env_variable("SHAKAPACKER_RELATIVE_URL_ROOT" => nil) do |
377 | | - expect(config.relative_url_root).to eq "abcd" |
378 | | - end |
| 376 | + expect(config.relative_url_root).to eq "abcd" |
379 | 377 | end |
380 | 378 | end |
381 | 379 | end |
0 commit comments