Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
change tests to fit more inline with repo current way of testing
Browse files Browse the repository at this point in the history
- separate redirect + redirect interpolation changes
- use env hash inside test and don't hardcode in app_runner.rb
  • Loading branch information
hone committed Jun 10, 2016
1 parent e7e98bd commit ce97bea
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
4 changes: 0 additions & 4 deletions spec/fixtures/redirects/static.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
"/old/gone": {
"url": "/",
"status": 302
},
"/old/interpolation": {
"url": "${INTERPOLATED_URL}",
"status": 302
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello world
12 changes: 12 additions & 0 deletions spec/fixtures/redirects_interpolation/static.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"redirects": {
"/old/gone": {
"url": "/",
"status": 302
},
"/old/interpolation": {
"url": "${INTERPOLATED_URL}",
"status": 302
}
}
}
16 changes: 12 additions & 4 deletions spec/simple_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,18 @@
expect(response["location"]).to eq("http://#{AppRunner::HOST_IP}/")
end

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")
context "interpolation" do
let(:name) { "redirects_interpolation" }

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

Expand Down
3 changes: 0 additions & 3 deletions spec/support/app_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ def initialize(fixture, env = {}, debug = false)
@debug = debug
env.merge!("STATIC_DEBUG" => true) if @debug

# support interpolation specs
env.merge!("INTERPOLATED_URL" => "/interpolation.html")

@container = Docker::Container.create(
"Image" => BuildpackBuilder::TAG,
"Cmd" => ["bash", "-c", "cp -rf /src/* /app/ && /app/bin/boot"],
Expand Down

0 comments on commit ce97bea

Please sign in to comment.