var rework = require('rework')
  , urlPlugin = require('../')
  , fs = require('fs')
  , read = fs.readFileSync;

function fixture (name) {
  return read('test/fixtures/' + name + '.css', 'utf8').trim();
}

describe('.url(fn)', function () {
  it('should map urls', function () {
    function rewrite (url) {
      return 'http://example.com' + url;
    }

    rework(fixture('url'))
      .use(urlPlugin(rewrite))
      .toString()
      .should.equal(fixture('url.out'));
  })
})

describe('.url(fn) with spaces inside parens', function () {
  it('should map urls', function () {
    function rewrite (url) {
      return 'http://example.com' + url;
    }

    rework(fixture('url.spaces'))
      .use(urlPlugin(rewrite))
      .toString()
      .should.equal(fixture('url.out'));
  })
})

@@ -467,24 +467,296 @@
 out'));%0A  %7D)
+%0A%0A  it('should pass node as %60this%60 value', function () %7B%0A    var value;%0A    function rewrite (url) %7B%0A      value = this;%0A      return url;%0A    %7D%0A%0A    rework(fixture('url'))%0A      .use(urlPlugin(rewrite))%0A      .toString();%0A%0A    value.type.should.equal('declaration');%0A  %7D)
 %0A%7D)%0A%0Adescrib

Add test for #5