Commit ce97bead authored by Terence Lee's avatar Terence Lee

change tests to fit more inline with repo current way of testing

- separate redirect + redirect interpolation changes
- use env hash inside test and don't hardcode in app_runner.rb
parent e7e98bd5
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
"/old/gone": { "/old/gone": {
"url": "/", "url": "/",
"status": 302 "status": 302
},
"/old/interpolation": {
"url": "${INTERPOLATED_URL}",
"status": 302
} }
} }
} }
{
"redirects": {
"/old/gone": {
"url": "/",
"status": 302
},
"/old/interpolation": {
"url": "${INTERPOLATED_URL}",
"status": 302
}
}
}
...@@ -90,10 +90,18 @@ RSpec.describe "Simple" do ...@@ -90,10 +90,18 @@ RSpec.describe "Simple" do
expect(response["location"]).to eq("http://#{AppRunner::HOST_IP}/") expect(response["location"]).to eq("http://#{AppRunner::HOST_IP}/")
end end
it "should redirect using interpolated urls" do context "interpolation" do
response = app.get("/old/interpolation") let(:name) { "redirects_interpolation" }
expect(response.code).to eq("302")
expect(response["location"]).to eq("http://#{AppRunner::HOST_IP}/interpolation.html") let(:env) {
{ "INTERPOLATED_URL" => "/interpolation.html" }
}
it "should redirect using interpolated urls" do
response = app.get("/old/interpolation")
expect(response.code).to eq("302")
expect(response["location"]).to eq("http://#{AppRunner::HOST_IP}/interpolation.html")
end
end end
end end
......
...@@ -24,9 +24,6 @@ class AppRunner ...@@ -24,9 +24,6 @@ class AppRunner
@debug = debug @debug = debug
env.merge!("STATIC_DEBUG" => true) if @debug env.merge!("STATIC_DEBUG" => true) if @debug
# support interpolation specs
env.merge!("INTERPOLATED_URL" => "/interpolation.html")
@container = Docker::Container.create( @container = Docker::Container.create(
"Image" => BuildpackBuilder::TAG, "Image" => BuildpackBuilder::TAG,
"Cmd" => ["bash", "-c", "cp -rf /src/* /app/ && /app/bin/boot"], "Cmd" => ["bash", "-c", "cp -rf /src/* /app/ && /app/bin/boot"],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment