var assert = require("assert");
var vows = require("vows");
var Writer = require("./../mustache").Writer;

vows.describe("Mustache.Writer").addBatch({
  "A Writer": {
    topic: function () {
      var writer = new Writer();
      return writer;
    },
    "loads partials correctly": function (writer) {
      var partial = "The content of the partial.";
      var result = writer.render("{{>partial}}", {}, function (name) {
        assert.equal(name, "partial");
        return partial;
      });

      assert.equal(result, partial);
    }
  }
}).export(module);

var assert = require("assert");
var vows = require("vows");
var Writer = require("./../mustache").Writer;

vows.describe("Mustache.Writer").addBatch({
  "A Writer": {
    topic: function () {
      var writer = new Writer();
      return writer;
    },
    "loads partials correctly": function (writer) {
      var partial = "The content of the partial.";
      var result = writer.render("{{>partial}}", {}, function (name) {
        assert.equal(name, "partial");
        return partial;
      });

      assert.equal(result, partial);
    },
    "caches partials by content, not by name": function (writer) {
      var result = writer.render("{{>partial}}", {}, {
        partial: "partial one"
      });

      assert.equal(result, "partial one");

      result = writer.render("{{>partial}}", {}, {
        partial: "partial two"
      });

      assert.equal(result, "partial two");
    }
  }
}).export(module);

Add spec for partial caching issue
Add spec for partial caching issue
