diff --git a/conf/nginx.conf b/conf/nginx.conf index c3fd55f..96f53c4 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -32,6 +32,11 @@ http { } } + server { + server_name apps.miti.sh; + root /var/www/sites/apps.miti.sh; + } + server { # listen 443 ssl; server_name webdevcat.me; diff --git a/spec/routes_spec.moon b/spec/routes_spec.moon index 6e3bf0f..97c9152 100644 --- a/spec/routes_spec.moon +++ b/spec/routes_spec.moon @@ -8,6 +8,12 @@ req = (url) -> error request\lastError! if not st request +describe "test environment", -> + it "can't connect to the internet", -> + request = http.init "http://example.org" + assert.not_true request\perform! + assert.same request\lastError!, "Couldn't resolve host name" + describe "http://webdevcat.me", -> it "permanently redirects to http://miti.sh", -> request = req "http://webdevcat.me" @@ -69,3 +75,9 @@ describe "http://miti.sh/posts", -> assert.same request\statusCode!, 200 assert.same request\statusMessage!, "OK" assert.same request\body!\match("(.*)"), "miti.sh ยท Posts" + +describe "http://apps.miti.sh", -> + it "doesn't find it", -> + request = req "http://apps.miti.sh" + assert.same request\statusCode!, 404 + assert.same request\statusMessage!, "Not Found" diff --git a/test.sh b/test.sh index ecb6bb5..138c805 100755 --- a/test.sh +++ b/test.sh @@ -5,8 +5,12 @@ image=miti.sh echo "Starting test container..." -container_id=$(docker run --rm -d -v $(pwd):/opt/app \ + +# Make sure to create 'no-internet' network, if it doesn't already exist: +# $ docker network create --internal no-internet +container_id=$(docker run --rm -d -v $(pwd):/opt/app --network no-internet \ --add-host=miti.sh=127.0.0.1 \ + --add-host=apps.miti.sh=127.0.0.1 \ --add-host=webdevcat.me=127.0.0.1 \ $image)