<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -24,7 +24,13 @@ module DynamicReports
       # Views setter and accessor.
       def views(*array)
         @views ||= [&quot;#{File::dirname(File::expand_path(__FILE__))}/views/&quot;]
-        array ? @views += array : @views
+        unless array.empty?
+          @views.unshift(array)
+          @views.flatten!
+          @views.uniq!
+        else
+          @views
+        end
       end
      
       # class level options accessor
@@ -100,7 +106,11 @@ module DynamicReports
       #   OrdersReport.template # =&gt; :orders
       #
       def template(value = nil)
-        value ? options[:template] = value : options[:template]
+        if value
+          @template = value
+          options[:template] = @template
+        end
+        @template ||= nil
       end
 
       # Accessor for columns
@@ -201,10 +211,15 @@ module DynamicReports
     def initialize(records, *new_options)
       new_options  = new_options.shift || {}
       @records = records
-      @views = []
-      @views &lt;&lt; new_options.delete(:views) if new_options[:views]
-      @views += self.class.views
+
+      @views = self.class.views
+      @views.unshift(new_options.delete(:views)) if new_options[:views]
+      @views.flatten!
+      @views.uniq!
+
+      @template = self.class.template
       @template = new_options.delete(:template) if new_options[:template]
+
       @options = self.class.options.merge!(new_options)
       @options.each_pair do |key,value|
         if key == &quot;chart&quot;
@@ -233,6 +248,7 @@ module DynamicReports
       options = (options.shift || {}).merge!(@options || {})
       # todo: if rails is loaded set the default engine: dynamicreports::report.default_engine
       engine  = options.delete(:engine) || @@default_engine
+      options[:template] = self.class.template
       view.__send__(&quot;#{engine}&quot;, options)
     end
 </diff>
      <filename>lib/dynamic_reports/reports.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,6 @@ class ChartsTest &lt; Test::Unit::TestCase
       class TheReport &lt; DynamicReports::Report
         chart :the_chart_name, :an =&gt; &quot;option&quot;, :another =&gt; &quot;option&quot; do
           title &quot;awesome report!&quot;
-          sub_title &quot;you won't need another!&quot;
           type :svg
           height &quot;350&quot;
           width &quot;250&quot;
@@ -17,7 +16,19 @@ class ChartsTest &lt; Test::Unit::TestCase
       end
     end
 
-    teardown do
+    should &quot;allow specification of options to the chart beyond it's attributes.&quot; do
+      hash = {
+          :name =&gt; :the_chart_name, 
+          :an =&gt; &quot;option&quot;, 
+          :type =&gt; :svg,
+          :another =&gt; &quot;option&quot;,
+          :title=&gt;&quot;awesome report!&quot;,
+          :height=&gt;&quot;350&quot;,
+          :width=&gt;&quot;250&quot;,
+          :columns=&gt;[:pageviews],
+          :label_column =&gt; &quot;created_at&quot;
+        }
+        assert_equal hash, TheReport.chart_with_name(:the_chart_name).options
     end
 
     should &quot;allow setting their name&quot; do
@@ -40,20 +51,6 @@ class ChartsTest &lt; Test::Unit::TestCase
       assert_equal &quot;350&quot;, TheReport.chart_with_name(:the_chart_name).height
     end
     
-
-    should &quot;allow specification of options to the chart beyond it's attributes.&quot; do
-      hash = {
-          :name =&gt; :the_chart_name, 
-          :an =&gt; &quot;option&quot;, 
-          :another =&gt; &quot;option&quot;,
-          :title=&gt;&quot;awesome report!&quot;,
-          :height=&gt;&quot;350&quot;,
-          :width=&gt;&quot;250&quot;,
-          :columns=&gt;[:pageviews]
-        }
-        assert_equal hash, TheReport.chart_with_name(:the_chart_name).options
-    end
-
     should &quot;allow definition of multiple charts&quot; do
       #require &quot;ruby-debug&quot; ; debugger
       assert_contains TheReport.charts[0].name, :the_chart_name</diff>
      <filename>test/dynamic_reports/charts_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -18,9 +18,6 @@ class ReportsTest &lt; Test::Unit::TestCase
       @object_records = DynamicReports::Test::ObjectRecords.generate(TheReport, :count =&gt; 10)
     end
 
-    teardown do
-    end
-
     should &quot;allow setting the title of a report&quot; do
       assert_equal &quot;Daily Report&quot;, TheReport.title
     end
@@ -29,10 +26,6 @@ class ReportsTest &lt; Test::Unit::TestCase
       assert_equal &quot;Happens every day, ya!&quot;, TheReport.sub_title
     end
     
-    #should &quot;allow setting the report template base (not type/extension)&quot; do
-    #  assert_equal TheReport.template, &quot;my_special_template&quot;
-    #end
-    
     should &quot;allow setting the columns to report on&quot; do
       assert_equal [:recorded_at, :viewed_on, :pageviews_count, :visits_count, :conversions_count], TheReport.columns
     end
@@ -50,7 +43,7 @@ class ReportsTest &lt; Test::Unit::TestCase
       assert_match(/class=&quot;report_charts&quot;/, TheReport.on(@array_records).to_html)
     end
     
-    context &quot;Report with template specified&quot; do
+    context &quot;Report with templates and views specified&quot; do
       setup do
         class SpecificTemplateReport &lt; DynamicReports::Report
           name  &quot;A report with specified template!&quot;
@@ -64,9 +57,6 @@ class ReportsTest &lt; Test::Unit::TestCase
         @object_records = DynamicReports::Test::ObjectRecords.generate(SpecificTemplateReport, :count =&gt; 10)
       end
 
-      teardown do
-      end
-
       should &quot;allow setting of the views directories&quot; do
         assert_contains SpecificTemplateReport.views, 
           &quot;#{File::dirname(File::expand_path(__FILE__))}/views/&quot;</diff>
      <filename>test/dynamic_reports/reports_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,27 +1,5 @@
 class ReportsTest &lt; Test::Unit::TestCase
-  context &quot;Views&quot; do
-
-    setup do
-      class ViewTestReport &lt; DynamicReports::Report
-        name  &quot;Report for testing views.&quot;
-        title &quot;Test la views!&quot;
-        columns :recorded_at, :viewed_on, :pageviews_count, :visits_count, :conversions_count
-        template :specific_template
-        views &quot;#{File::dirname(File::expand_path(__FILE__))}/views/&quot;
-      end
-      @array_records  = DynamicReports::Test::ArrayRecords.generate(ViewTestReport, :count =&gt; 10)
-      @report = ViewTestReport.on(@array_records)
-      @view = DynamicReports::View.new(@report)
-    end
-
-    should &quot;have the same views path as the report object it is called with&quot; do
-      assert_equal @report.views, @view.views
-    end
-
-    should &quot;render a specific_template when specified&quot; do
-      assert_equal &quot;This is the specified template!&quot;,
-        @view.__send__(&quot;#{:erb}&quot;, ViewTestReport.options).strip
-    end
+  context &quot;View&quot; do
 
   end
 end</diff>
      <filename>test/dynamic_reports/views_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>3e70fbe6592130f938d6f26bd2226e90c83e1f9a</id>
    </parent>
  </parents>
  <author>
    <name>Wayne E. Seguin</name>
    <email>wayneeseguin@gmail.com</email>
  </author>
  <url>http://github.com/wayneeseguin/dynamic_reports/commit/1a2876650ccce1f39065a9dfd8cdedae0ed280b7</url>
  <id>1a2876650ccce1f39065a9dfd8cdedae0ed280b7</id>
  <committed-date>2009-07-01T04:26:51-07:00</committed-date>
  <authored-date>2009-07-01T04:26:51-07:00</authored-date>
  <message>All tests passing.</message>
  <tree>fa5b4dd8a313959a2fa1acb8e0af3d966d590283</tree>
  <committer>
    <name>Wayne E. Seguin</name>
    <email>wayneeseguin@gmail.com</email>
  </committer>
</commit>
