         , (err, written) ->
           return next err if err
           written.should.eql 1
-          misc.file.readFile null, "#{scratch}/file", (err, content) ->
+          misc.file.readFile ssh, "#{scratch}/file", (err, content) ->
             return next err if err
             content.should.eql 'here we are\nnew coquin\n'
             # Write a second time with same match
             mecano.write
+              ssh: ssh
               match: /.*coquin/
               destination: "#{scratch}/file"
               replace: 'new coquin'

    , (err, written) ->
      return next err if err
      written.should.eql 1
      misc.file.readFile null, "#{scratch}/fromto.md", (err, content) ->
        return next err if err
        content.should.eql 'here we are\nmy friend\nyou coquin'
        next()
  
  it 'with match as a regular expression', (next) ->
    mecano.write
      match: /(.*try.*)/
      content: 'here we are\nlets try to replace that one\nyou coquin'
      replace: 'my friend'

        return next err if err
        written.should.eql 1
        mecano.write
          ssh: ssh
          match: /(.*content)/
          replace: 'a text'
          destination: "#{scratch}/a_file"
        , (err, written) ->
          return next err if err
          written.should.eql 0
          misc.file.readFile ssh, "#{scratch}/a_file", (err, content) ->
            return next err if err
            content.should.eql 'This is\na text\nfor testing'
            next()

  they 'can not defined source and content', (ssh, next) ->
    mecano.write
      ssh: ssh
      source: 'abc'
      content: 'abc'
      destination: 'abc'
