| prohibit combination of :live_data and :end_date (closes #2) - reportable - For… | |
| Log | |
| Files | |
| Refs | |
| README | |
| --- | |
| commit fd453311d9cc27bf335e629114c4be99832b97ba | |
| parent 063ae7ebfb466b15d8fdb0347f9c4eaeff7775b2 | |
| Author: Marco Otte-Witte <[email protected]> | |
| Date: Wed, 29 Apr 2009 15:21:57 +0200 | |
| prohibit combination of :live_data and :end_date (closes #2) | |
| Diffstat: | |
| M lib/simplabs/reports_as_sparkline/… | 14 ++++++++------ | |
| M spec/classes/report_spec.rb | 12 ++++++++++++ | |
| 2 files changed, 20 insertions(+), 6 deletions(-) | |
| --- | |
| diff --git a/lib/simplabs/reports_as_sparkline/report.rb b/lib/simplabs/reports… | |
| @@ -96,17 +96,19 @@ module Simplabs #:nodoc: | |
| case context | |
| when :initialize | |
| options.each_key do |k| | |
| - raise ArgumentError.new("Invalid option #{k}") unless [:limit,… | |
| + raise ArgumentError.new("Invalid option #{k}!") unless [:limit… | |
| end | |
| - raise ArgumentError.new("Invalid aggregation #{options[:aggregat… | |
| - raise ArgumentError.new('The name of the column holding the valu… | |
| + raise ArgumentError.new("Invalid aggregation #{options[:aggregat… | |
| + raise ArgumentError.new('The name of the column holding the valu… | |
| when :run | |
| options.each_key do |k| | |
| - raise ArgumentError.new("Invalid option #{k}") unless [:limit,… | |
| + raise ArgumentError.new("Invalid option #{k}!") unless [:limit… | |
| end | |
| end | |
| - raise ArgumentError.new("Invalid grouping #{options[:grouping]}") if… | |
| - raise ArgumentError.new("Invalid conditions: #{options[:conditions].… | |
| + raise ArgumentError.new('Options :live_data and :end_date may not bo… | |
| + raise ArgumentError.new("Invalid grouping #{options[:grouping]}!") i… | |
| + raise ArgumentError.new("Invalid conditions: #{options[:conditions].… | |
| + raise ArgumentError.new("Invalid end date: #{options[:end_date].insp… | |
| end | |
| end | |
| diff --git a/spec/classes/report_spec.rb b/spec/classes/report_spec.rb | |
| @@ -421,6 +421,18 @@ describe Simplabs::ReportsAsSparkline::Report do | |
| lambda { @report.send(:ensure_valid_options, { :grouping => :decade }) }… | |
| end | |
| + it 'should raise an error if an end date is specified that is not a DateTi… | |
| + lambda { @report.send(:ensure_valid_options, { :end_date => 'today' }) }… | |
| + end | |
| + | |
| + it 'should raise an error if both an end date and :live_data = true are sp… | |
| + lambda { @report.send(:ensure_valid_options, { :end_date => DateTime.now… | |
| + end | |
| + | |
| + it 'should not raise an error if both an end date and :live_data = false a… | |
| + lambda { @report.send(:ensure_valid_options, { :end_date => DateTime.now… | |
| + end | |
| + | |
| describe 'for context :initialize' do | |
| it 'should not raise an error if valid options are specified' do |