o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1357227532.416033: @value"-{I" class:EFI"ProcessedAsset;FI"logical_path;FI"$reports/personal_report_spec.js;TI" pathname;FI"i/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/reports/personal_report_spec.js.coffee;TI"content_type;FI"application/javascript;FI" mtime;FI"2012-11-15T14:33:57-05:00;FI" length;FieI" digest;F"%0ed91ea2d4088548b46dbe457e0a83aaI" source;FI"e(function() { describe('ActivityReport', function() { beforeEach(function() { $('body').html(JST['templates/tabs']()); this.selector = $('#spec_reports_nav a[data-toggle="tab"]'); return this.sut = new ActivityReport(); }); describe('shownListener', function() { return it('should load the report based on the selector data-attributes', function() { var spy, stub; spy = sinon.spy(this.sut, 'shownListener'); stub = sinon.stub(this.sut, 'loadReport').returns(true); this.sut.init(this.selector, false); this.selector.trigger('shown'); expect(spy).to.have.been.calledOnce; expect(stub).to.have.been.calledOnce; spy.restore(); return stub.restore(); }); }); describe('loadReport', function() { describe('successful response', function() { return it('builds the report', function() { var spy, stub1, stub2, target; stub1 = sinon.stub(jQuery, 'ajax').yieldsTo('success', [1, 2, 3]); stub2 = sinon.stub(this.sut, 'buildReport').returns(true); spy = sinon.spy(this.sut, 'successCallback'); this.sut.init(this.selector, false); target = this.selector.attr('data-toggle'); this.sut.loadReport($(target).attr('data-type'), $(target).attr('data-container'), $(target).attr('data-path')); expect(stub1).to.have.been.calledOnce; expect(stub2).to.have.been.calledOnce; expect(spy.withArgs([1, 2, 3])).to.have.been.calledOnce; stub1.restore(); stub2.restore(); return spy.restore(); }); }); return describe('error response', function() { return it('currently does nothing', function() { var spy, stub, target; stub = sinon.stub(jQuery, 'ajax').yieldsTo('error', [1, 2, 3]); spy = sinon.spy(this.sut, 'errorCallback'); this.sut.init(this.selector, false); target = this.selector.attr('data-toggle'); this.sut.loadReport($(target).attr('data-type'), $(target).attr('data-container'), $(target).attr('data-path')); expect(stub).to.have.been.calledOnce; expect(spy.withArgs([1, 2, 3])).to.have.been.calledOnce; stub.restore(); return spy.restore(); }); }); }); describe('buildReport', function() { return it('should render the chart', function() { var stub1, stub2; stub1 = sinon.stub(this.sut, 'highchartOptions').returns(true); stub2 = sinon.stub(Highcharts, 'Chart').returns(true); this.sut.buildReport(); expect(this.sut.chart).to.exist; expect(stub1).to.have.been.calledOnce; expect(stub2.withArgs(this.sut.highchartOptions())).to.have.been.calledOnce; stub1.restore(); return stub2.restore(); }); }); describe('reportTitle', function() { return it('should use the data-title of the active tab pane', function() { this.sut.reportType = 'week'; return expect(this.sut.reportTitle()).to.equal($('#week').data('title')); }); }); describe('categories', function() { return it('creates an array of formatted categories', function() { var categories, dataMock, spy; spy = sinon.spy(this.sut, 'formatCategoryName'); dataMock = { primary_name: "2012-10-05", secondary_name: "" }; this.sut.reportData = [dataMock]; categories = this.sut.categories(); expect(spy).to.have.been.calledOnce; expect(categories).to.not.be.empty; return spy.restore(); }); }); describe('formatCategoryName', function() { return it('formats the chart category name', function() { var data; data = { primary_name: 'Primary', secondary_name: 'Secondary' }; return expect(this.sut.formatCategoryName(data)).to.equal("Primary
Secondary"); }); }); describe('uniqueViews', function() { return it('creates an array of formatted views', function() { var dataMock, spy, uniqueViews; spy = sinon.spy(this.sut, 'gradeColour'); dataMock = { primary_name: "2012-10-05", secondary_name: "", views: 1, relearns: 1 }; this.sut.reportData = [dataMock]; uniqueViews = this.sut.uniqueViews(); expect(spy.withArgs(dataMock)).to.have.been.calledOnce; expect(uniqueViews).to.not.be.empty; return spy.restore(); }); }); describe('relearns', function() { return it('creates an array of formatted relearns', function() { var dataMock, relearns, spy; spy = sinon.spy(this.sut, 'gradeColour'); dataMock = { primary_name: "2012-10-05", secondary_name: "", views: 1, relearns: 1 }; this.sut.reportData = [dataMock]; relearns = this.sut.relearns(); expect(spy.withArgs(dataMock)).to.have.been.calledOnce; expect(relearns).to.not.be.empty; return spy.restore(); }); }); describe('gradeColour', function() { afterEach(function() { return this.stub.restore(); }); it('returns GREEN when above or equal to the GREEN_GOAL', function() { var dataMock, expectation; this.stub = sinon.stub(this.sut, 'isWeekly').returns(true); dataMock = { views: 7, relearns: 0 }; expectation = "rgba(" + ActivityReport.GREEN + ", 1)"; return expect(this.sut.gradeColour(dataMock, 1)).to.equal(expectation); }); it('returns YELLOW when between the YELLOW_GOAL and GREEN_GOAL', function() { var dataMock, expectation; this.stub = sinon.stub(this.sut, 'isWeekly').returns(true); dataMock = { views: 4, relearns: 0 }; expectation = "rgba(" + ActivityReport.YELLOW + ", 1)"; return expect(this.sut.gradeColour(dataMock, 1)).to.equal(expectation); }); return it('returns RED when beneath the YELLOW_GOAL', function() { var dataMock, expectation; this.stub = sinon.stub(this.sut, 'isWeekly').returns(true); dataMock = { views: 1, relearns: 0 }; expectation = "rgba(" + ActivityReport.RED + ", 1)"; return expect(this.sut.gradeColour(dataMock, 1)).to.equal(expectation); }); }); describe('multiplier', function() { it('returns 1 if report type is week', function() { this.sut.reportType = 'week'; return expect(this.sut.multiplier()).to.equal(1); }); it('returns 7 if report type is month', function() { this.sut.reportType = 'month'; return expect(this.sut.multiplier()).to.equal(7); }); return it('returns 31 if report type is annual', function() { this.sut.reportType = 'annual'; return expect(this.sut.multiplier()).to.equal(31); }); }); return describe('log', function() { it('should write to the console when debugging is enabled', function() { var stub; stub = sinon.stub(console, 'log').returns(true); this.sut.init('x', true); expect(stub.withArgs("[ActivityReport] initialize")).to.have.been.calledOnce; return stub.restore(); }); return it('should not write to the console when debugging is disabled', function() { var stub; stub = sinon.stub(console, 'log').returns(true); this.sut.init('x', false); expect(stub).to.not.have.been.called; return stub.restore(); }); }); }); }).call(this); ;TI"dependency_digest;F"%0641340d93921c9c6488fde0240cca10I"required_paths;F[I"y/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery.js;TI"y/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/sinon-rails-1.4.2.1/vendor/assets/javascripts/sinon.js;TI"d/Users/adamdoeler/Sites/bigbang/woople-theme/vendor/assets/javascripts/sinon-chai/sinon-chai.js;TI"Y/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/templates/tabs.jst.ejs;TI"X/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/spec_helper.js.coffee;TI"Œ/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/less-rails-bootstrap-2.0.13/vendor/assets/javascripts/twitter/bootstrap/tab.js;TI"|/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/highcharts-rails-2.3.3/vendor/assets/javascripts/highcharts.js;TI"w/Users/adamdoeler/Sites/bigbang/woople-theme/app/assets/javascripts/woople-theme/reports/activity_report.js.coffee;TI"i/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/reports/personal_report_spec.js.coffee;TI"dependency_paths;F[{I" path;FI"i/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/reports/personal_report_spec.js.coffee;TI" mtime;FI"2012-11-15T14:33:57-05:00;FI" digest;F"%915a33f6b3c8866a85bce245d2876a73{I" path;FI"L/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/templates;TI" mtime;FI"2012-10-11T16:01:17-04:00;FI" digest;F"%f6029330714acec9fa4e55e351e699fe{I" path;FI"X/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/spec_helper.js.coffee;TI" mtime;FI"2012-11-15T14:33:57-05:00;FI" digest;F"%67b22f2939837ac46cf4ee450b9ff01c{I" path;FI"y/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery.js;TI" mtime;FI"2012-11-23T13:58:18-05:00;FI" digest;F"%8a9d9a628fa634d048c33edeb256d188{I" path;FI"y/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/sinon-rails-1.4.2.1/vendor/assets/javascripts/sinon.js;TI" mtime;FI"2012-11-23T13:58:35-05:00;FI" digest;F"%c24806bd84daee815304e7dfb3a42760{I" path;FI"d/Users/adamdoeler/Sites/bigbang/woople-theme/vendor/assets/javascripts/sinon-chai/sinon-chai.js;TI" mtime;FI"2012-10-11T16:01:17-04:00;FI" digest;F"%50df106c8b2be6544750327b582cca96{I" path;FI"Y/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/templates/tabs.jst.ejs;TI" mtime;FI"2012-10-11T16:01:17-04:00;FI" digest;F"%07ec6626d1af7ac92590b64448f375b1{I" path;FI"Œ/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/less-rails-bootstrap-2.0.13/vendor/assets/javascripts/twitter/bootstrap/tab.js;TI" mtime;FI"2012-11-23T13:58:22-05:00;FI" digest;F"%bbca82b54ec0ba4e515a33ea98c6a824{I" path;FI"|/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p327@woople-theme/gems/highcharts-rails-2.3.3/vendor/assets/javascripts/highcharts.js;TI" mtime;FI"2012-11-23T13:58:17-05:00;FI" digest;F"%7d58f71ae72ee38304fdd86e0544753e{I" path;FI"w/Users/adamdoeler/Sites/bigbang/woople-theme/app/assets/javascripts/woople-theme/reports/activity_report.js.coffee;TI" mtime;FI"2012-12-05T14:56:05-05:00;FI" digest;F"%1cc09f9d491c8b2675f5e2e187347575I" _version;F"%6776f581a4329e299531e1d52aa59832