on master help sign in
Merge pull request #4 from alexfmpe/ob-init-tests
3caa3dbLuigy Leon
lib/selftest/src/Obelisk/SelfTest.hs+13
@@ -38,6 +38,19 @@ main = do
38 httpManager <- HTTP.newManager HTTP.defaultManagerSettings
38 httpManager <- HTTP.newManager HTTP.defaultManagerSettings
39 withSystemTempDirectory "blank-project" $ \blankProject ->
39 withSystemTempDirectory "blank-project" $ \blankProject ->
40 hspec $ do
40 hspec $ do
41+
42+ describe "ob init" $ do
43+ let inTmp :: (Shelly.FilePath -> Sh a) -> IO ()
44+ inTmp f = void . shelly . silently . withSystemTempDirectory "ob-init" $ (chdir <*> f) . fromString
45+
46+ it "works with default impl" $ inTmp $ \_ -> run "ob" ["init"]
47+ it "works with master branch impl" $ inTmp $ \_ -> run "ob" ["init", "--branch", "master"]
48+ it "works with symlink" $ inTmp $ \_ -> run "ob" ["init", "--symlink", fromString obeliskImpl]
49+
50+ it "doesn't create anything when given an invalid impl" $ inTmp $ \tmp -> do
51+ errExit False $ run "ob" ["init", "--symlink", "/dev/null"]
52+ ls tmp >>= liftIO . assertEqual "" []
53+
41 describe "blank initialized project" $ do
54 describe "blank initialized project" $ do
42 let inProj :: Sh a -> IO ()
55 let inProj :: Sh a -> IO ()
43 inProj = void . shelly . silently . chdir (fromString blankProject)
56 inProj = void . shelly . silently . chdir (fromString blankProject)