Commit ac036e0c authored by Terence Lee's avatar Terence Lee

support for injecting env during testing

parent 706cd68a
......@@ -14,9 +14,10 @@ RSpec.describe "Simple" do
app.destroy
end
let(:app) { AppRunner.new(name, @debug) }
let(:app) { AppRunner.new(name, env, @debug) }
let(:name) { "hello_world" }
let(:env) { Hash.new }
it "should serve out of public_html by default" do
response = app.get("/")
......
......@@ -19,11 +19,13 @@ class AppRunner
HOST_IP = boot2docker_ip || "127.0.0.1"
CONTAINER_PORT = "3000"
def initialize(fixture, debug = false)
def initialize(fixture, env = nil, debug = false)
@debug = debug
@container = Docker::Container.create(
'Image' => BuildpackBuilder::TAG,
'Cmd' => ["bash", "-c", "cp -rf /src/* /app/ && /app/bin/boot"],
# Env format is [KEY1=VAL1 KEY2=VAL2]
'Env' => env.to_a.map {|i| i.join("=") },
'HostConfig' => {
'Binds' => ["#{fixtures_path(fixture)}:/src"],
'PortBindings' => {
......
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