| Added failing spec for duplicate key sql error I'm getting. - reportable - Fork… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit 8791b1e44c216af03bcf53805cdfb642d49b20e0 | |
| parent 1bee300b16dc0dcad74c6a22ec01f5946856a4ed | |
| Author: Myron Marston <[email protected]> | |
| Date: Mon, 4 May 2009 10:34:23 +0800 | |
| Added failing spec for duplicate key sql error I'm getting. | |
| Signed-off-by: Marco Otte-Witte <[email protected]> | |
| Diffstat: | |
| M spec/boot.rb | 3 +++ | |
| M spec/classes/report_spec.rb | 14 ++++++++++++-- | |
| 2 files changed, 15 insertions(+), 2 deletions(-) | |
| --- | |
| diff --git a/spec/boot.rb b/spec/boot.rb | |
| @@ -12,6 +12,9 @@ $:.unshift "#{plugin_root}/lib" | |
| RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../') | |
| Rails::Initializer.run(:set_load_path) | |
| Rails::Initializer.run(:set_autoload_paths) | |
| +Rails::Initializer.run(:initialize_time_zone) do |config| | |
| + config.time_zone = 'Pacific Time (US & Canada)' | |
| +end | |
| require File.join(File.dirname(__FILE__), '/../init.rb') | |
| diff --git a/spec/classes/report_spec.rb b/spec/classes/report_spec.rb | |
| @@ -81,6 +81,16 @@ describe Simplabs::ReportsAsSparkline::Report do | |
| describe 'when :end_date is specified' do | |
| + it 'should not raise a SQL duplicate key error after multiple runs' … | |
| + @report = Simplabs::ReportsAsSparkline::Report.new(User, :registra… | |
| + :limit => 2, | |
| + :grouping => grouping, | |
| + :end_date => Date.yesterday.to_datetime | |
| + ) | |
| + @report.run | |
| + lambda { @report.run }.should_not raise_error | |
| + end | |
| + | |
| describe 'the returned result' do | |
| before do | |
| @@ -428,11 +438,11 @@ describe Simplabs::ReportsAsSparkline::Report do | |
| it 'should return conditions for date_column >= begin_at when no custom co… | |
| @report.send(:setup_conditions, @begin_at, nil).should == ["#{@created_a… | |
| end | |
| - | |
| + | |
| it 'should return conditions for date_column <= end_at when no custom cond… | |
| @report.send(:setup_conditions, nil, @end_at).should == ["#{@created_at_… | |
| end | |
| - | |
| + | |
| it 'should raise an argument error when neither begin_at or end_at are spe… | |
| lambda {@report.send(:setup_conditions, nil, nil)}.should raise_error(Ar… | |
| end |