         target: "#{scratch}/a_file"
         content: 'ok'
         mode: 0o0705
-      , (err, written) ->
-        written.should.be.true()
+      , (err, status) ->
+        status.should.be.true() unless err
       .file
         target: "#{scratch}/a_file"
         content: 'ok'
         mode: 0o0705
-      , (err, written) ->
-        written.should.be.false()
+      , (err, status) ->
+        status.should.be.false() unless err
       .then next
 
     they 'change permission after modification', (ssh, next) ->

          append: true
          replace: 'my best friend'
          eof: true
        , (err, written) ->
          written.should.be.true()
        .call (options, next) ->
          fs.readFile ssh, "#{scratch}/fromto.md", 'utf8', (err, content) ->
            content.should.eql 'here we are\nyou coquin\n# from\nmy best friend\n# to\n'
            next()
        .then next
    
    they 'with from and without to', (ssh, next) ->
      mecano.file
        ssh: ssh
        target: "#{scratch}/fromto.md"
        from: '# from'
        content: 'here we are\n# from\nlets try to replace that one\n# to\nyou coquin'
        replace: 'my friend'
      , (err, written) ->
        return next err if err
        written.should.be.true()
        fs.readFile ssh, "#{scratch}/fromto.md", 'utf8', (err, content) ->
          return next err if err
          content.should.eql 'here we are\n# from\nmy friend'
          next()
    
    they 'without from and with to', (ssh, next) ->
      mecano.file

      # File does not exist, it create it with the content
      mecano.file
        ssh: ssh
        target: "#{scratch}/a_file"
        content: 'hello'
        append: true
      .file.assert
        target: "#{scratch}/a_file"
        content: 'hello'
      .then next

    they 'append content to existing file', (ssh, next) ->
      # File does not exists, it create one
      mecano
        ssh: ssh
      .file
        target: "#{scratch}/a_file"
        content: 'hello'
        append: true
      .file # File exists, it append to it
        target: "#{scratch}/a_file"
        content: 'world'
        append: true
      .file.assert
        target: "#{scratch}/a_file"
        content: 'helloworld'
      .then next

  describe 'match & append or place_before', ->

