fix specs for cumulated reports and live data - reportable - Fork of reportable required by WarVox, from hdm/reportable.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit 7a999addb7eef8518d36310c56b4ca80450f3a4d
(DIR) parent a0b40bc8924c92736fa148ff4625dccc2b4e8a6e
(HTM) Author: Marco Otte-Witte <marco.otte-witte@simplabs.com>
Date: Wed, 24 Feb 2010 20:21:53 +0100
fix specs for cumulated reports and live data
Diffstat:
M spec/classes/cumulated_report_spec… | 38 ++++++++++++++++----------------
1 file changed, 19 insertions(+), 19 deletions(-)
---
(DIR) diff --git a/spec/classes/cumulated_report_spec.rb b/spec/classes/cumulated_report_spec.rb
@@ -36,10 +36,10 @@ describe Saulabs::Reportable::CumulatedReport do
before(:all) do
User.delete_all
- User.create!(:login => 'test 1', :created_at => Time.now - 1.send(grouping), :profile_visits => 1)
- User.create!(:login => 'test 2', :created_at => Time.now - 3.send(grouping), :profile_visits => 2)
- User.create!(:login => 'test 3', :created_at => Time.now - 3.send(grouping), :profile_visits => 3)
- User.create!(:login => 'test 4', :created_at => Time.now - 20.send(grouping), :profile_visits => 1)
+ User.create!(:login => 'test 1', :created_at => Time.now, :profile_visits => 2)
+ User.create!(:login => 'test 2', :created_at => Time.now - 1.send(grouping), :profile_visits => 1)
+ User.create!(:login => 'test 3', :created_at => Time.now - 3.send(grouping), :profile_visits => 2)
+ User.create!(:login => 'test 4', :created_at => Time.now - 3.send(grouping), :profile_visits => 3)
end
describe 'the returned result' do
@@ -80,10 +80,10 @@ describe Saulabs::Reportable::CumulatedReport do
result = @report.run
result[10][1].should == 4.0 if live_data
- result[9][1].should == 4.0
- result[8][1].should == 3.0
- result[7][1].should == 3.0
- result[6][1].should == 1.0
+ result[9][1].should == 3.0
+ result[8][1].should == 2.0
+ result[7][1].should == 2.0
+ result[6][1].should == 0.0
end
it 'should return correct data for aggregation :sum' do
@@ -96,11 +96,11 @@ describe Saulabs::Reportable::CumulatedReport do
)
result = @report.run()
- result[10][1].should == 7.0 if live_data
- result[9][1].should == 7.0
- result[8][1].should == 6.0
- result[7][1].should == 6.0
- result[6][1].should == 1.0
+ result[10][1].should == 8.0 if live_data
+ result[9][1].should == 6.0
+ result[8][1].should == 5.0
+ result[7][1].should == 5.0
+ result[6][1].should == 0.0
end
it 'should return correct data for aggregation :count when custom conditions are specified' do
@@ -113,10 +113,10 @@ describe Saulabs::Reportable::CumulatedReport do
result = @report.run(:conditions => ['login IN (?)', ['test 1', 'test 2', 'test 4']])
result[10][1].should == 3.0 if live_data
- result[9][1].should == 3.0
- result[8][1].should == 2.0
- result[7][1].should == 2.0
- result[6][1].should == 1.0
+ result[9][1].should == 2.0
+ result[8][1].should == 1.0
+ result[7][1].should == 1.0
+ result[6][1].should == 0.0
end
it 'should return correct data for aggregation :sum when custom conditions are specified' do
@@ -129,11 +129,11 @@ describe Saulabs::Reportable::CumulatedReport do
)
result = @report.run(:conditions => ['login IN (?)', ['test 1', 'test 2', 'test 4']])
- result[10][1].should == 4.0 if live_data
+ result[10][1].should == 6.0 if live_data
result[9][1].should == 4.0
result[8][1].should == 3.0
result[7][1].should == 3.0
- result[6][1].should == 1.0
+ result[6][1].should == 0.0
end
end