Introduction
Introduction Statistics Contact Development Disclaimer Help
Specs and fixes for ReportTagHelper#grafico_report_tag - reportable - Fork of r…
Log
Files
Refs
README
---
commit e4f1ef62eaa8132c5e61a4b6cfa463f24e990691
parent 5ef77ac9f838a14326d882124c57fca5886be26b
Author: Martin Kavalar <[email protected]>
Date: Wed, 21 Apr 2010 16:37:53 +0200
Specs and fixes for ReportTagHelper#grafico_report_tag
Diffstat:
M lib/saulabs/reportable/config.rb | 4 ++--
M lib/saulabs/reportable/report_tag_… | 4 ++--
M spec/other/report_tag_helper_spec.… | 24 ++++++++++++++++++++++++
3 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/lib/saulabs/reportable/config.rb b/lib/saulabs/reportable/config.rb
@@ -16,11 +16,11 @@ module Saulabs
mattr_accessor :grafico_options
- @@grafico_basic_options = {
+ @@grafico_options = {
:width => 300,
:height => 100,
:dom_id => nil,
- :format => 'div(100).to_i',
+ :format => 'to_i',
:area_opacity => 0.3,
:markers => 'value',
:grid => false,
diff --git a/lib/saulabs/reportable/report_tag_helper.rb b/lib/saulabs/reportab…
@@ -83,9 +83,9 @@ module Saulabs
# <%= report_tag(User.registrations_report, {:width => 200, :height =>…
#
def grafico_report_tag(data, options = {}, grafico_options = {})
- options.reverse_merge!(Config.grafico_options.slice(:width, :height))
+ options.reverse_merge!(Config.grafico_options.slice(:width, :height, :…
options.reverse_merge!(:dom_id => "#{data.model_name.downcase}_#{data.…
- grafico_options.reverse_merge!(Config.grafico_options.except(:width, :…
+ grafico_options.reverse_merge!(Config.grafico_options.except(:width, :…
%Q{<div id="#{options[:dom_id] || "reportable_#{Time.now}"}" style="wi…
<script type="text/javascript" charset="utf-8">
new Grafico.AreaGraph(
diff --git a/spec/other/report_tag_helper_spec.rb b/spec/other/report_tag_helpe…
@@ -5,6 +5,30 @@ describe Saulabs::Reportable::ReportTagHelper do
before do
@helper = TestHelper.new
end
+
+ describe '#grafico_report_tag' do
+
+ data_set = Saulabs::Reportable::ResultSet.new([[DateTime.now, 1.0], [DateT…
+
+ it 'should not raise an error' do
+ lambda {
+ @helper.grafico_report_tag(data_set)
+ }.should_not raise_error
+ end
+
+ it 'should return a string' do
+ @helper.grafico_report_tag(data_set).class.should == String
+ end
+
+ it 'should contain div tag' do
+ @helper.grafico_report_tag(data_set).should =~ /^<div id=".*">.*<\/div>/
+ end
+
+ it 'should contain script tag' do
+ @helper.grafico_report_tag(data_set).should =~ /<script type="text\/java…
+ end
+
+ end
describe '#google_report_tag' do
You are viewing proxied material from jay.scot. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.