packages feed

hspec-tmp-proc (empty) → 0.5.0.0

raw patch · 6 files changed

+116/−0 lines, 6 filesdep +basedep +hspecdep +tmp-procsetup-changed

Dependencies added: base, hspec, tmp-proc

Files

+ ChangeLog.md view
@@ -0,0 +1,6 @@+# Revision history for hspec-tmp-proc++## 0.5.0.0 -- 2021-09-28++* Initial release+* Initial upload to hackage
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2021, Tim Emiola++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Tim Emiola nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ README.md view
@@ -0,0 +1,10 @@+# hspec-tmp-proc++hspec-tmp-proc provides a module that simplifies using `tmp-proc` with tests+that use [hspec][1].++It's a very small package; the aim of providing it in its own package rather+than including it in the `tmp-proc` package is to keep dependencies of+`tmp-proc` to a minimum.++[1]:https://hspec.github.io
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ hspec-tmp-proc.cabal view
@@ -0,0 +1,33 @@+cabal-version:      3.0+name:               hspec-tmp-proc+version:            0.5.0.0+synopsis:           Simplify use of tmp-proc from hspec tests+description:        Reduces boilerplate when using tmp-proc with hspec+license:            BSD-3-Clause+license-file:       LICENSE+copyright:          2021 Tim Emiola+author:             Tim Emiola+maintainer:         adetokunbo@users.noreply.github.com+category:           testing, docker, hspec+bug-reports:        https://github.com/adetokunbo/tmp-proc/issues+build-type:         Simple+extra-source-files:+  ChangeLog.md+  README.md+tested-with:+  GHC == 8.10.5++source-repository head+  type:     git+  location: https://github.com/adetokunbo/tmp-proc.git++library+  exposed-modules:  Test.Hspec.TmpProc+  hs-source-dirs:   src+  build-depends:+    , base      >=4.11    && <4.16+    , hspec     >=2.7.0   && <2.9.0+    , tmp-proc  >=0.5.0.0 && <0.6.0.0++  default-language: Haskell2010+  ghc-options:      -fno-ignore-asserts -Wall
+ src/Test/Hspec/TmpProc.hs view
@@ -0,0 +1,35 @@+{-# OPTIONS_HADDOCK prune not-home #-}+{-|+Copyright   : (c) 2020-2021 Tim Emiola+SPDX-License-Identifier: BSD3+Maintainer  : Tim Emiola <adetokunbo@users.noreply.github.com >++Simplify use of @tmp-proc@ with @hspec@.++-}+module Test.Hspec.TmpProc+  ( -- * Combinators+    tdescribe++    -- * Re-export+  , module System.TmpProc+  )+where++import           System.TmpProc+import           Test.Hspec+++{-| Like 'describe', but makes the specs @pending@ if @docker@ is unavailable. -}+tdescribe :: HasCallStack => String -> SpecWith a -> SpecWith a+tdescribe label action = do+  noDocker <- not <$> runIO hasDocker+  if noDocker then tmpPending label action else describe label action+++tmpPending :: HasCallStack => String -> SpecWith a -> SpecWith a+tmpPending label spec = before_ (pendingWith noDockerMessage) $ describe label spec+++noDockerMessage :: String+noDockerMessage = "docker could not be detected"