       )
 
   describe 'should_not_exist', ->
-    it 'should succeed if file doesnt exist', (next) ->
+    they 'should succeed if file doesnt exist', (ssh, next) ->
       conditions.should_not_exist(
+        ssh: ssh
         should_not_exist: './oh_no'
         () -> should.be.ok false
         next
       )
-    it 'should failed if file exists', (next) ->
+    they 'should failed if file exists', (ssh, next) ->
       conditions.should_not_exist(
+        ssh: ssh
         should_not_exist: __filename
         (err) ->
           err.should.be.a 'object'
           next()
         () -> should.be.ok false
       )
-    it 'should failed if at least one file exists', (next) ->
+    they 'should failed if at least one file exists', (ssh, next) ->
       conditions.should_not_exist(
+        ssh: ssh
         should_not_exist: ['./oh_no', __filename]
         (err) ->
           err.should.be.a 'object'

fs = require 'fs'
http = require 'http'
should = require 'should'
conditions = if process.env.MECANO_COV then require '../lib-cov/conditions' else require '../lib/conditions'

describe 'conditions', ->

  describe 'if', ->

    it 'should bypass if not present', (next) ->
      conditions.if(
        {}
        () -> should.be.ok false
        next
      )
    it 'should succeed if `true`', (next) ->
      conditions.if(
        if: true
        () -> should.be.ok false
        next
      )
    it 'should failed if `false`', (next) ->
      conditions.if(
        if: false
        next
        () -> should.be.ok false
      )
    it 'should succeed on `succeed` callback', (next) ->
      conditions.if(
        if: (options, failed, succeed) -> succeed()
        () -> should.be.ok false
        next
      )
    it 'should failed on `failed` callback', (next) ->
      conditions.if(
        if: (options, failed, succeed) -> failed()
        next
        () -> should.be.ok false
      )
    it 'should pass error object on `failed` callback', (next) ->
      conditions.if(
        if: (options, failed, succeed) -> failed new Error 'cool'
        (err) -> err.message is 'cool' and next()
        () -> should.be.ok false


  describe 'if_exists', ->

    they 'should pass if not present', (ssh, next) ->
      conditions.if_exists(
        ssh: ssh
        () -> should.be.ok false
        next
      )
    they 'should succeed if dir exists', (ssh, next) ->
      conditions.if_exists(
        ssh: ssh
        if_exists: __dirname
        () -> should.be.ok false
        -> next()
      )
    they 'should skip if file does not exists', (ssh, next) ->
      conditions.if_exists(
        ssh: ssh
        if_exists: './oh_no'
        next
        () -> should.be.ok false
      )
    they 'should succeed if all files exists', (ssh, next) ->
      conditions.if_exists(
        ssh: ssh
        if_exists: [__dirname, __filename]
        () -> should.be.ok false
        -> next()
      )
    they 'should skip if at least one file exists', (ssh, next) ->
      conditions.if_exists(
        ssh: ssh
        if_exists: [__dirname, './oh_no']
        next
        () -> should.be.ok false
