From fcac5f42bb12cffe9eb4db07d87c0b6766b9e7b1 Mon Sep 17 00:00:00 2001 From: Felix Mino Date: Thu, 4 Mar 2021 15:00:57 -0500 Subject: [PATCH] Tests refactored --- spec/System/HapistranoSpec.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spec/System/HapistranoSpec.hs b/spec/System/HapistranoSpec.hs index 4897c97..12b68a5 100644 --- a/spec/System/HapistranoSpec.hs +++ b/spec/System/HapistranoSpec.hs @@ -22,7 +22,6 @@ import System.Hapistrano.Types import System.IO import System.IO.Silently (capture_) import System.Info (os) -import qualified System.FilePath as SF import Test.Hspec hiding (shouldBe, shouldReturn) import qualified Test.Hspec as Hspec import Test.Hspec.QuickCheck @@ -32,10 +31,10 @@ testBranchName :: String testBranchName = "another_branch" workingDir :: Path Rel Dir -workingDir = Path "working_dir" +workingDir = $(mkRelDir "working_dir") -releaseDir :: FilePath -releaseDir = toFilePath (Path "releases") +releaseDir :: Path Rel Dir +releaseDir = $(mkRelDir "releases") spec :: Spec spec = do @@ -110,7 +109,8 @@ spec = do (,) <$> Hap.releasePath deployPath release Nothing <*> pure release - toFilePath rpath `shouldBe` toFilePath deployPath SF. releaseDir SF. (renderRelease release <> [SF.pathSeparator]) + rel <- parseRelDir $ renderRelease release + rpath `shouldBe` deployPath releaseDir rel context "when the configWorkingDir is Just" $ it "should return the release path with WorkingDir" $ \(deployPath, repoPath) -> do @@ -119,7 +119,8 @@ spec = do (,) <$> Hap.releasePath deployPath release (Just workingDir) <*> pure release - toFilePath rpath `shouldBe` toFilePath deployPath SF. releaseDir SF. renderRelease release SF. "working_dir" + rel <- parseRelDir $ renderRelease release + rpath `shouldBe` deployPath releaseDir rel workingDir describe "pushRelease" $ do it "sets up repo all right in Zsh" $ \(deployPath, repoPath) ->