           error = @stderr.content
         callback(@stdout.content, error)
 
+    @run = (args..., callback) ->
+      @exec args..., (out, err) ->
+        err.should.be.false
+        callback(out)
+
+    @raise = (args..., error, done) ->
+      @exec args..., (out, err) ->
+        out.should.be.empty
+        err.should.match(error)
+        done()
+
   afterEach ->
     fs.removeSync(tempDir) if fs.existsSync(tempDir)
 

  prefixed = "a { -webkit-transition: all 1s; transition: all 1s }"

  it 'shows autoprefixer version', (done) ->
    @exec '-v', (out, err) ->
      err.should.be.false
      out.should.match(/^autoprefixer [\d\.]+\n$/)
      done()

  it 'shows help instructions', (done) ->
    @exec '-h', (out, err) ->
      err.should.be.false
      out.should.match(/Usage:/)
      done()

  it 'shows selected browsers and properties', (done) ->
    @exec '-i', (out, err) ->
      err.should.be.false
      out.should.match(/Browsers:/)
      done()

  it 'changes browsers', (done) ->
    @exec '-i', '-b', 'ie 6', (out, err) ->
      err.should.be.false
      out.should.match(/IE: 6/)
      done()

  it 'rewrites several files', (done) ->
    write('a.css', css)
    write('b.css', css + css)
    @exec '-b', 'chrome 25', 'a.css', 'b.css', (out, err) ->
      err.should.be.false
      out.should.eql ''
      read('a.css').should.eql prefixed
      read('b.css').should.eql prefixed + prefixed

    write('a.css', css)
    write('b.css', css + css)

    @run '-b', 'chrome 25', 'a.css', 'b.css', '-d', 'out/', (out) ->
      out.should.eql ''

      read('a.css').should.eql css
