Permalink
Browse files

unifying rendering process of reports to all be done through the rend…

…erer
  • Loading branch information...
1 parent 7546d64 commit fba10b475550204958abb6a0149cc538bf22fa0c @RodneyTurnham RodneyTurnham committed Jul 30, 2013
View
@@ -272,6 +272,7 @@ See the referenced gems for more documentation on using them.
Note: when you run the tests, Dossier will **make and/or truncate** some tables in the `dossier_test` database.
- Run `bundle`
+- `RAILS_ENV=test rake db:create`
- `cp spec/dummy/config/database.yml{.example,}` and edit it so that it can connect to the test database.
- `cp spec/fixtures/db/mysql2.yml{.example,}`
- `cp spec/fixtures/db/sqlite3.yml{.example,}`
@@ -5,13 +5,14 @@ class ReportsController < ApplicationController
self.responder = Dossier::Responder
respond_to :html, :json, :csv, :xls, only: :show
+ respond_to :html, only: :multi
def show
respond_with(report)
end
def multi
- render template: 'dossier/reports/multi', locals: {multi: report}
+ respond_with(report)
end
private
@@ -1,8 +1,8 @@
-%div{id: multi.dom_id}
+%div{id: report.dom_id}
%h1.dossier-multi-header
- = multi.formatted_title
+ = report.formatted_title
- = render_options(multi)
+ = render_options(report)
- - multi.reports.each do |report|
- = report.render layout: false
+ - report.reports.each do |r|
+ = r.render layout: false
@@ -34,4 +34,14 @@ def formatter
def dom_id
nil
end
+
+ def template
+ 'multi'
+ end
+
+ def renderer
+ @renderer ||= Dossier::Renderer.new(self)
+ end
+
+ delegate :render, to: :renderer
end
@@ -9,7 +9,7 @@ def stub_out_report_results(report)
}
end
- let(:results) { mock(arrays: [[]], hashes: [{}]) }
+ let(:results) { double(arrays: [[]], hashes: [{}]) }
let(:report) { EmployeeReport.new }
let(:reports) { [stub_out_report_results(report)] }
let(:controller) {
@@ -2,4 +2,4 @@ adapter: mysql2
database: dossier_test
host: localhost
username: root
-password: something
+password:

0 comments on commit fba10b4

Please sign in to comment.