on master help sign in
Add tests for ob init
commit06c167a05eb006654dba5c336caafb94996b1356 authorAlexandre Esteves <alexandre.fmp.esteves@gmail.com> dateThu 24 May 2018, 16:52 (8 years ago) parent209a6dc
1 file changed+13
lib/selftest/src/Obelisk/SelfTest.hs+13
lib/selftest/src/Obelisk/SelfTest.hs+13
@@ -38,6 +38,19 @@ main = do
3838 httpManager <- HTTP.newManager HTTP.defaultManagerSettings
3939 withSystemTempDirectory "blank-project" $ \blankProject ->
4040 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+
4154 describe "blank initialized project" $ do
4255 let inProj :: Sh a -> IO ()
4356 inProj = void . shelly . silently . chdir (fromString blankProject)