o: ActiveSupport::Cache::Entry :@compressedF:@expires_in0:@created_atf1350920440.6836128: @value"™,{I" class:EFI"ProcessedAsset;FI"logical_path;FI"$reports/personal_report_spec.js;FI" pathname;FI"i/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/reports/personal_report_spec.js.coffee;FI"content_type;FI"application/javascript;FI" mtime;FI"2012-10-22T11:40:25-04:00;FI" length;FieI" digest;F"%6fdf3d6fe8bac1d9fcf75df1dc75c994I" 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"%d121ebcc8c290773674856d71ca0ceb6I"required_paths;F[I"l/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery.js;FI"l/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/sinon-rails-1.4.2.1/vendor/assets/javascripts/sinon.js;FI"d/Users/adamdoeler/Sites/bigbang/woople-theme/vendor/assets/javascripts/sinon-chai/sinon-chai.js;FI"Y/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/templates/tabs.jst.ejs;FI"X/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/spec_helper.js.coffee;FI"/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/less-rails-bootstrap-2.0.13/vendor/assets/javascripts/twitter/bootstrap/tab.js;FI"t/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/highcharts-rails-2.3.3/vendor/assets/javascripts/highcharts.js;FI"w/Users/adamdoeler/Sites/bigbang/woople-theme/app/assets/javascripts/woople-theme/reports/activity_report.js.coffee;FI"i/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/reports/personal_report_spec.js.coffee;FI"dependency_paths;F[{I" path;FI"i/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/reports/personal_report_spec.js.coffee;FI" mtime;FI"2012-10-22T11:40:25-04:00;FI" digest;F"%a7b297ac9fd8ecdc971e6a1af0d450e9{I" path;FI"L/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/templates;FI" mtime;FI"2012-10-11T16:01:17-04:00;FI" digest;F"%3e529859892b429d7f86a1ed01d51e66{I" path;FI"X/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/spec_helper.js.coffee;FI" mtime;FI"2012-10-11T16:01:17-04:00;FI" digest;F"%7ae4f8132c6026d65d0a13f1b18cd8ca{I" path;FI"l/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/jquery-rails-2.1.3/vendor/assets/javascripts/jquery.js;FI" mtime;FI"2012-10-22T11:21:58-04:00;FI" digest;F"%43cde21914c09fcf7ee10c3cf91cb905{I" path;FI"l/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/sinon-rails-1.4.2.1/vendor/assets/javascripts/sinon.js;FI" mtime;FI"2012-10-09T13:37:17-04:00;FI" digest;F"%3975db7dd0993f44f0b2bf44c15e8353{I" path;FI"d/Users/adamdoeler/Sites/bigbang/woople-theme/vendor/assets/javascripts/sinon-chai/sinon-chai.js;FI" mtime;FI"2012-06-14T12:19:40-04:00;FI" digest;F"%84a21bfc872a9ee86eb35f36da448409{I" path;FI"Y/Users/adamdoeler/Sites/bigbang/woople-theme/spec/javascripts/templates/tabs.jst.ejs;FI" mtime;FI"2012-10-10T13:45:38-04:00;FI" digest;F"%eef7087b445699495b494635f70b5694{I" path;FI"/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/less-rails-bootstrap-2.0.13/vendor/assets/javascripts/twitter/bootstrap/tab.js;FI" mtime;FI"2012-08-01T15:29:45-04:00;FI" digest;F"%70f8c244d40a4884d71d8436fb2c08f5{I" path;FI"t/Users/adamdoeler/.rvm/gems/ruby-1.9.3-p194/gems/highcharts-rails-2.3.3/vendor/assets/javascripts/highcharts.js;FI" mtime;FI"2012-10-11T14:31:25-04:00;FI" digest;F"%93fcf6162c00919d57dd01e96a86ca5a{I" path;FI"w/Users/adamdoeler/Sites/bigbang/woople-theme/app/assets/javascripts/woople-theme/reports/activity_report.js.coffee;FI" mtime;FI"2012-10-22T11:40:21-04:00;FI" digest;F"%1903f406635ca9b954b16692d1e38a60I" _version;F"%9f3b95dd7ea3030dc35985c0a8020862