o: ActiveSupport::Cache::Entry	:@compressedF:@expires_in0:@created_atf1356590595.235043:@value"lD{I"
class:EFI"BundledAsset;�FI"logical_path;�FI"'teabag/base/reporters/html_spec.js;�FI"
pathname;�FI"]/Users/jejacks0n/Projects/teabag/spec/javascripts/teabag/base/reporters/html_spec.coffee;�FI"content_type;�FI"application/javascript;�FI"
mtime;�FI"2012-12-26T15:31:54-07:00;�FI"length;�Fi|BI"digest;�F"%192042815fb6609000b7c9d444cb3467I"source;�FI"|B(function() {

  describe("Teabag.Reporters.HTML", function() {
    beforeEach(function() {
      var _this = this;
      this.buildSpy = spyOn(Teabag.Reporters.HTML.prototype, "build");
      this.readConfigSpy = spyOn(Teabag.Reporters.HTML.prototype, "readConfig");
      this.reporter = new Teabag.Reporters.HTML();
      this.jasmineSuite = {
        getFullName: function() {
          return "_full jasmine suite description_";
        }
      };
      this.jasmineSpecResultsItems = [
        {
          message: "_jasmine_message1_",
          trace: {
            stack: "_jasmine_stack_trace1_"
          },
          passed: function() {
            return false;
          }
        }, {
          message: "_jasmine_message2_",
          trace: {
            stack: "_jasmine_stack_trace2_"
          },
          passed: function() {
            return false;
          }
        }
      ];
      this.jasmineSpecResults = {
        skipped: false,
        passed: function() {
          return true;
        },
        getItems: function() {
          return _this.jasmineSpecResultsItems;
        }
      };
      return this.jasmineSpec = {
        description: "_jasmine_description_",
        viewId: 42,
        pending: false,
        suite: this.jasmineSuite,
        getFullName: function() {
          return "_full jasmine description_";
        },
        results: function() {
          return _this.jasmineSpecResults;
        }
      };
    });
    describe("constructor", function() {
      it("sets up the expected variables", function() {
        expect(this.reporter.start).toBeDefined();
        expect(this.reporter.config).toEqual({
          "use-catch": true,
          "build-full-report": false,
          "display-progress": true
        });
        expect(this.reporter.total).toEqual({
          exist: 0,
          run: 0,
          passes: 0,
          failures: 0,
          skipped: 0
        });
        expect(this.reporter.views).toEqual({
          specs: {},
          suites: {}
        });
        return expect(this.reporter.filter).toEqual(false);
      });
      return it("calls readConfig", function() {
        return expect(this.readConfigSpy).toHaveBeenCalled();
      });
    });
    describe("#build", function() {
      beforeEach(function() {
        this.el = {};
        this.buildSpy.andCallThrough();
        this.buildLayoutSpy = spyOn(this.reporter, "buildLayout");
        this.findElSpy = spyOn(this.reporter, "findEl").andReturn(this.el);
        this.setTextSpy = spyOn(this.reporter, "setText");
        this.showConfigurationSpy = spyOn(this.reporter, "showConfiguration");
        this.buildProgressSpy = spyOn(this.reporter, "buildProgress");
        spyOn(this.reporter, "envInfo").andReturn("library 1.0.0");
        return this.reporter.build();
      });
      it("calls buildLayout", function() {
        return expect(this.buildLayoutSpy).toHaveBeenCalled();
      });
      it("finds the element and assigns it", function() {
        expect(this.findElSpy).toHaveBeenCalledWith("report-all");
        return expect(this.reporter.el).toBe(this.el);
      });
      it("sets the env-info and version", function() {
        expect(this.setTextSpy).toHaveBeenCalledWith("env-info", "library 1.0.0");
        return expect(this.setTextSpy).toHaveBeenCalledWith("version", Teabag.version);
      });
      it("makes the toggles clickable", function() {
        expect(this.findElSpy).toHaveBeenCalledWith("toggles");
        return expect(this.el.onclick).toBe(this.reporter.toggleConfig);
      });
      it("calls showConfiguration", function() {
        return expect(this.showConfigurationSpy).toHaveBeenCalled();
      });
      return it("calls buildProgress", function() {
        return expect(this.buildProgressSpy).toHaveBeenCalled();
      });
    });
    describe("#buildLayout", function() {
      beforeEach(function() {
        this.el = {};
        this.buildSuiteSelectSpy = spyOn(this.reporter, "buildSuiteSelect");
        this.createElSpy = spyOn(this.reporter, "createEl").andReturn(this.el);
        this.appendChildSpy = spyOn(document.body, "appendChild");
        return this.reporter.buildLayout();
      });
      it("calls buildSuiteSelect", function() {
        return expect(this.buildSuiteSelectSpy).toHaveBeenCalled();
      });
      return it("creates an element and appends it to the body", function() {
        expect(this.createElSpy).toHaveBeenCalledWith("div");
        expect(this.appendChildSpy).toHaveBeenCalledWith(this.el);
        return expect(this.el.innerHTML).toContain("Teabag");
      });
    });
    describe("#buildSuiteSelect", function() {
      beforeEach(function() {
        return Teabag.suites = {
          all: ["default", "foo", "bar"],
          active: "foo"
        };
      });
      return it("builds a select that displays the suites", function() {
        var result;
        result = this.reporter.buildSuiteSelect();
        expect(result).toContain("select id=");
        return expect(result).toContain("selected='selected' value=\"foo\"");
      });
    });
    describe("#buildProgress", function() {
      beforeEach(function() {
        this.progress = {
          appendTo: function() {}
        };
        this.findElSpy = spyOn(this.reporter, "findEl").andReturn("_element_");
        this.createSpy = spyOn(Teabag.Reporters.HTML.ProgressView, "create").andReturn(this.progress);
        this.appendToSpy = spyOn(this.progress, "appendTo");
        return this.reporter.buildProgress();
      });
      it("calls create on ProgressView", function() {
        return expect(this.createSpy).toHaveBeenCalledWith(true);
      });
      return it("appends the progress element to the dom", function() {
        return expect(this.appendToSpy).toHaveBeenCalledWith("_element_");
      });
    });
    describe("#reportRunnerStarting", function() {
      beforeEach(function() {
        this.setTextSpy = spyOn(this.reporter, "setText");
        return this.reporter.reportRunnerStarting({
          total: 42
        });
      });
      it("gets the totals", function() {
        return expect(this.reporter.total.exist).toBe(42);
      });
      return it("sets the duration text", function() {
        return expect(this.setTextSpy).toHaveBeenCalledWith("stats-duration", "...");
      });
    });
    describe("#reportSpecStarting", function() {
      it("creates a SpecView", function() {
        var spy;
        this.reporter.config["build-full-report"] = true;
        spy = spyOn(Teabag.Reporters.HTML, "SpecView");
        this.reporter.reportSpecStarting(this.jasmineSpec);
        return expect(spy).toHaveBeenCalled();
      });
      it("doesn't create the SpecView if we're not building the full report", function() {
        var spy;
        this.reporter.config["build-full-report"] = false;
        spy = spyOn(Teabag.Reporters.HTML, "SpecView");
        this.reporter.reportSpecStarting(this.jasmineSpec);
        return expect(spy).wasNotCalled();
      });
      return it("tracks the start time of the spec", function() {
        this.reporter.specStart = void 0;
        this.reporter.reportSpecStarting(this.jasmineSpec);
        return expect(this.reporter.specStart).toBeDefined();
      });
    });
    describe("#reportSpecResults", function() {
      beforeEach(function() {
        this.updateProgressSpy = spyOn(this.reporter, "updateProgress");
        return this.updateStatusSpy = spyOn(this.reporter, "updateStatus");
      });
      it("increases the total run count", function() {
        this.reporter.total.run = 41;
        this.reporter.reportSpecResults(this.jasmineSpec);
        return expect(this.reporter.total.run).toBe(42);
      });
      it("calls updateProgress", function() {
        this.reporter.reportSpecResults(this.jasmineSpec);
        return expect(this.updateProgressSpy).toHaveBeenCalled();
      });
      return it("calls updateStatus", function() {
        this.reporter.reportSpecResults(this.jasmineSpec);
        return expect(this.updateStatusSpy).toHaveBeenCalledWith(this.jasmineSpec);
      });
    });
    describe("#reportRunnerResults", function() {
      beforeEach(function() {
        this.setTextSpy = spyOn(this.reporter, "setText");
        this.setStatusSpy = spyOn(this.reporter, "setStatus");
        this.updateProgressSpy = spyOn(this.reporter, "updateProgress");
        this.elapsedTimeSpy = spyOn(this.reporter, "elapsedTime").andReturn("1.000s");
        return this.reporter.total = {
          run: 666,
          exist: 42,
          failures: 5,
          passes: 10,
          skipped: 15
        };
      });
      it("does nothing if there were no tests run", function() {
        this.reporter.total.run = 0;
        this.reporter.reportRunnerResults();
        return expect(this.setTextSpy).wasNotCalled();
      });
      it("sets the duration text", function() {
        this.reporter.total = {
          run: 666,
          exist: 42
        };
        this.reporter.reportRunnerResults();
        return expect(this.setTextSpy).toHaveBeenCalledWith("stats-duration", "1.000s");
      });
      it("sets the status to passed if there are no failures", function() {
        this.reporter.total.failures = 0;
        this.reporter.reportRunnerResults();
        return expect(this.setStatusSpy).toHaveBeenCalledWith("passed");
      });
      it("displays the total passes", function() {
        this.reporter.reportRunnerResults();
        return expect(this.setTextSpy).toHaveBeenCalledWith("stats-passes", 10);
      });
      it("displays the total failures", function() {
        this.reporter.reportRunnerResults();
        return expect(this.setTextSpy).toHaveBeenCalledWith("stats-failures", 5);
      });
      it("displays the total skipped", function() {
        this.reporter.reportRunnerResults();
        return expect(this.setTextSpy).toHaveBeenCalledWith("stats-skipped", 15);
      });
      return it("calls updateProgress", function() {
        this.reporter.reportRunnerResults();
        return expect(this.updateProgressSpy).toHaveBeenCalled();
      });
    });
    describe("#updateStat", function() {
      beforeEach(function() {
        return this.setTextSpy = spyOn(this.reporter, "setText");
      });
      it("does nothing if we're not displaying progress", function() {
        this.reporter.config["display-progress"] = false;
        this.reporter.updateStat("name", 42);
        return expect(this.setTextSpy).wasNotCalled();
      });
      return it("sets the text of the stat we want to set", function() {
        this.reporter.updateStat("name", 42);
        return expect(this.setTextSpy).toHaveBeenCalledWith("stats-name", 42);
      });
    });
    describe("#updateStatus", function() {
      beforeEach(function() {
        this.updateStatSpy = spyOn(this.reporter, "updateStat");
        this.setStatusSpy = spyOn(this.reporter, "setStatus");
        return this.findElSpy = spyOn(this.reporter, "findEl").andReturn({
          appendChild: function() {}
        });
      });
      describe("skipped", function() {
        return it("updates the statistic", function() {
          this.jasmineSpecResults.skipped = true;
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(this.updateStatSpy).toHaveBeenCalledWith("skipped", 1);
        });
      });
      describe("pass", function() {
        it("updates the statistic", function() {
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(this.updateStatSpy).toHaveBeenCalledWith("passes", 1);
        });
        return it("calls updateState on the view", function() {
          var spy;
          this.reporter.reportView = {
            updateState: function() {}
          };
          spy = spyOn(this.reporter.reportView, "updateState");
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(spy.argsForCall[0][0]).toBe("passed");
        });
      });
      return describe("failure", function() {
        beforeEach(function() {
          return this.jasmineSpecResults.passed = function() {
            return false;
          };
        });
        it("updates the statistic", function() {
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(this.updateStatSpy).toHaveBeenCalledWith("failures", 1);
        });
        it("calls updateState on the view", function() {
          var spy;
          this.reporter.reportView = {
            updateState: function() {}
          };
          spy = spyOn(this.reporter.reportView, "updateState");
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(spy.argsForCall[0][0]).toBe("failed");
        });
        it("creates a FailureView and appends it to the dom", function() {
          var spy;
          spy = spyOn(Teabag.Reporters.HTML, "FailureView").andReturn({
            appendTo: function() {}
          });
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(spy).toHaveBeenCalled();
        });
        it("doesn't create a FailureView if we're building the full report", function() {
          var spy;
          this.reporter.config["build-full-report"] = true;
          spy = spyOn(Teabag.Reporters.HTML, "FailureView").andReturn({
            appendTo: function() {}
          });
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(spy).wasNotCalled();
        });
        return it("sets the status", function() {
          this.reporter.updateStatus(this.jasmineSpec);
          return expect(this.setStatusSpy).toHaveBeenCalledWith("failed");
        });
      });
    });
    describe("#updateProgress", function() {
      beforeEach(function() {
        this.progress = {
          update: function() {}
        };
        this.updateSpy = spyOn(this.progress, "update");
        this.reporter.progress = this.progress;
        this.reporter.total = {
          exist: 666,
          run: 42
        };
        return this.reporter.updateProgress();
      });
      return it("calls update on the progress view", function() {
        return expect(this.updateSpy).toHaveBeenCalledWith(666, 42);
      });
    });
    describe("#showConfiguration", function() {
      beforeEach(function() {
        return this.setClassSpy = spyOn(this.reporter, "setClass");
      });
      return it("sets the class to active on the toggle buttons for each configuration", function() {
        this.reporter.showConfiguration();
        expect(this.setClassSpy).toHaveBeenCalledWith("use-catch", "active");
        expect(this.setClassSpy).toHaveBeenCalledWith("build-full-report", "");
        return expect(this.setClassSpy).toHaveBeenCalledWith("display-progress", "active");
      });
    });
    describe("#setStatus", function() {
      return it("sets the body class to the status passed in", function() {
        var current;
        current = document.body.className;
        this.reporter.setStatus("foo");
        expect(document.body.className).toBe("teabag-foo");
        return document.body.className = current;
      });
    });
    describe("#setFilter", function() {
      beforeEach(function() {
        this.setClassSpy = spyOn(this.reporter, "setClass");
        this.setHtmlSpy = spyOn(this.reporter, "setHtml");
        return this.reporter.setFilter("_filter_");
      });
      return it("sets a class and the html for the filter display", function() {
        expect(this.setClassSpy).toHaveBeenCalledWith("filter", "teabag-filtered");
        return expect(this.setHtmlSpy).toHaveBeenCalledWith("filter-info", "_filter_", true);
      });
    });
    describe("#readConfig", function() {
      beforeEach(function() {
        this.readConfigSpy.andCallThrough();
        this.config = {};
        this.cookieSpy = spyOn(this.reporter, "cookie").andReturn(this.config);
        return this.reporter.readConfig();
      });
      return it("reads the configuration from the cookie", function() {
        expect(this.cookieSpy).toHaveBeenCalledWith("teabag");
        return expect(this.reporter.config).toEqual(this.config);
      });
    });
    return describe("#toggleConfig", function() {
      beforeEach(function() {
        this.refreshSpy = spyOn(this.reporter, "refresh");
        this.cookieSpy = spyOn(this.reporter, "cookie");
        return this.reporter.toggleConfig({
          target: {
            tagName: "button",
            getAttribute: function() {
              return "teabag-use-catch";
            }
          }
        });
      });
      it("toggles the configuration", function() {
        return expect(this.reporter.config["use-catch"]).toBe(false);
      });
      it("sets the cookie", function() {
        return expect(this.cookieSpy).toHaveBeenCalledWith("teabag", this.reporter.config);
      });
      return it("refreshes the page", function() {
        return expect(this.refreshSpy).toHaveBeenCalled();
      });
    });
  });

}).call(this);
;�FI"required_assets_digest;�F"%b55985a1885150a70bc5ab09741581a1I"
_version;�F"%6776f581a4329e299531e1d52aa59832