title: How to programmatically ignore/skip tests with ScalaTest?
body: <p>I am running some tests with ScalaTest which rely on connections to test servers to be present. I currently created my own Spec similar to this:</p>
  
  <pre><code>abstract class ServerDependingSpec extends FlatSpec with Matchers {
  
    def serverIsAvailable: Boolean = {
      // Check if the server is available
    }
  }
  </code></pre>
  
  <p>Is it possible to ignore (but not fail) tests when this method returns <code>false</code>?</p>
  
  <p>Currently I do it in a "hackish" way:</p>
  
  <pre><code>"Something" should "do something" in {
    if(serverIsAvailable) {
      // my test code
    }
  }
  </code></pre>
  
  <p>but I want something like</p>
  
  <pre><code>whenServerAvailable "Something" should "do something" in { 
    // test code
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>"Something" should "do something" whenServerAvailable { 
    // test code
  }
  </code></pre>
  
  <p>I think I should define my custom tag, but I can only refer to the source code of <code>in</code> or <code>ignore</code> and I do not understand how I should plug in my custom implementations.</p>
  
  <p>How should I accomplish this?</p>