o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1371410625.394194: @value"š{I" class:EFI"ProcessedAsset;FI"logical_path;FI""teaspoon/base/fixture_spec.js;FI" pathname;FI"Z/Users/jejacks0n/Projects/teaspoon/spec/javascripts/teaspoon/base/fixture_spec.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2013-06-16T11:48:01-06:00;FI" length;FieI" digest;F"%1ad804d21c1a26d0f6a4ae553badd389I" source;FI"e(function() { describe("Teaspoon.fixture", function() { beforeEach(function() { var e; fixture.cache = {}; fixture.cleanup(); this.mockXhr = { readyState: 4, status: 200, responseText: "_content_", getResponseHeader: function() { return "_type_"; }, open: function() {}, send: function() {} }; this.xhrSpy = spyOn(this.mockXhr, 'open'); this.xhrSpy; try { return spyOn(window, 'XMLHttpRequest').andReturn(this.mockXhr); } catch (_error) { e = _error; return spyOn(window, 'ActiveXObject').andReturn(this.mockXhr); } }); describe("@load", function() { it("loads all of the files requested", function() { fixture.load("fixture.html", "fixture.json"); expect(this.xhrSpy).toHaveBeenCalledWith("GET", "/teaspoon/fixtures/fixture.html", false); return expect(this.xhrSpy).toHaveBeenCalledWith("GET", "/teaspoon/fixtures/fixture.json", false); }); it("caches the type/contents of those files", function() { fixture.load("fixture.html"); this.mockXhr.onreadystatechange(); return expect(fixture.cache["fixture.html"]).toEqual({ type: "_type_", content: "_content_" }); }); it("throws an exception if unable to load a file", function() { var _this = this; fixture.load("foo.html"); this.mockXhr.status = 500; return expect(function() { return _this.mockXhr.onreadystatechange(); }).toThrow("Unable to load fixture \"foo.html\"."); }); it("adds the contents of files to a fixture element", function() { fixture.load("fixture.html"); this.mockXhr.onreadystatechange(); expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV"); expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content_"); return expect(document.getElementById("teaspoon-fixtures")).toBe(fixture.el); }); it("allows appending file contents to the fixture element", function() { fixture.load("fixture.html1"); this.mockXhr.onreadystatechange(); expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV"); expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content_"); fixture.load("fixture.html2", true); this.mockXhr.onreadystatechange(); expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content__content_"); fixture.load("fixture.html3", false); this.mockXhr.onreadystatechange(); return expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content_"); }); return it("handles JSON fixtures", function() { this.mockXhr.responseText = '{"foo": "bar"}'; this.mockXhr.getResponseHeader = function() { return "application/json; encoding-blah"; }; fixture.load("fixture.json"); this.mockXhr.onreadystatechange(); expect(fixture.json.length).toBe(1); return expect(fixture.json[0]).toEqual({ foo: "bar" }); }); }); describe("@set", function() { it("adds all the contents passed to a fixture element", function() { fixture.set("_content1_", "_content2_"); expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV"); return expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content1__content2_"); }); return it("allows appending contents to the fixture element", function() { fixture.set("_content1_"); expect(document.getElementById("teaspoon-fixtures").tagName).toBe("DIV"); expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content1_"); fixture.set("_content2_", true); expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content1__content2_"); fixture.set("_content3_", false); return expect(document.getElementById("teaspoon-fixtures").innerHTML).toBe("_content3_"); }); }); return describe("@preload", function() { it("loads all of the files requested", function() { fixture.preload("fixture.html", "fixture.json"); expect(this.xhrSpy).toHaveBeenCalledWith("GET", "/teaspoon/fixtures/fixture.html", false); return expect(this.xhrSpy).toHaveBeenCalledWith("GET", "/teaspoon/fixtures/fixture.json", false); }); expect(document.getElementById("teaspoon-fixtures")).toBe(null); return it("caches the type/contents of those files", function() { fixture.preload("fixture.html"); this.mockXhr.onreadystatechange(); return expect(fixture.cache["fixture.html"]).toEqual({ type: "_type_", content: "_content_" }); }); }); }); }).call(this); ;TI"dependency_digest;F"%e687d2b3b1ba60b8e883e7eebaf1c840I"required_paths;F[I"Z/Users/jejacks0n/Projects/teaspoon/spec/javascripts/teaspoon/base/fixture_spec.coffee;FI"dependency_paths;F[{I" path;FI"Z/Users/jejacks0n/Projects/teaspoon/spec/javascripts/teaspoon/base/fixture_spec.coffee;FI" mtime;FI"2013-06-16T11:48:01-06:00;FI" digest;F"%879562603522cefdde512aaca6652d7eI" _version;F"%6776f581a4329e299531e1d52aa59832