dossier 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. data/MIT-LICENSE +1 -1
  2. data/README.markdown +43 -26
  3. data/app/controllers/dossier/reports_controller.rb +1 -1
  4. data/lib/dossier/version.rb +1 -1
  5. data/spec/dossier_spec.rb +3 -3
  6. data/spec/dummy/app/views/dossier/reports/{suspended_employee.html.haml → employee_with_custom_view.html.haml} +0 -0
  7. data/spec/dummy/config/database.yml +13 -0
  8. data/spec/dummy/config/environment.rb +0 -4
  9. data/spec/dummy/db/test.sqlite3 +0 -0
  10. data/spec/dummy/log/development.log +33 -0
  11. data/spec/dummy/log/test.log +24248 -0
  12. data/spec/fixtures/db/mysql2.yml +5 -0
  13. data/spec/fixtures/db/mysql2.yml.example +1 -0
  14. data/spec/fixtures/db/sqlite3.yml +2 -0
  15. data/spec/fixtures/{employee_report.csv → reports/employee.csv} +0 -0
  16. data/spec/fixtures/{employee_report.html → reports/employee.html} +0 -0
  17. data/spec/fixtures/{employee_with_custom_client.html → reports/employee_with_custom_client.html} +0 -0
  18. data/spec/fixtures/reports/employee_with_custom_view.html +15 -0
  19. data/spec/fixtures/{employee_report_with_footer.html → reports/employee_with_footer.html} +0 -0
  20. data/spec/fixtures/{customized_employee_report.html → reports/employee_with_parameters.html} +0 -0
  21. data/spec/requests/{employee_report_spec.rb → employee_spec.rb} +6 -6
  22. data/spec/requests/employee_with_custom_client_spec.rb +2 -2
  23. data/spec/support/reports/{employee_report.rb → employee.rb} +0 -0
  24. data/spec/support/reports/employee_with_custom_view.rb +8 -0
  25. data/spec/support/reports/{test_report.rb → test.rb} +0 -2
  26. metadata +38 -30
  27. data/spec/dummy/app/views/dossier/reports/total.html.haml +0 -11
  28. data/spec/support/reports/sqlite_employee_report.rb +0 -15
  29. data/spec/support/reports/supended_employee_report.rb +0 -7
  30. data/spec/support/reports/total_report.rb +0 -35
@@ -0,0 +1,5 @@
1
+ adapter: mysql2
2
+ database: dossier_test
3
+ host: localhost
4
+ username: root
5
+ password: yePassworde
@@ -1,3 +1,4 @@
1
+ adapter: mysql2
1
2
  database: dossier_test
2
3
  host: localhost
3
4
  username: root
@@ -0,0 +1,2 @@
1
+ adapter: sqlite3
2
+ database: db/test.sqlite3
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <link href="/assets/application.css" media="all" rel="stylesheet" type="text/css" />
6
+ <script src="/assets/application.js" type="text/javascript"></script>
7
+
8
+ </head>
9
+ <body>
10
+
11
+ <h1>Yeah. Did you get that memo?</h1>
12
+
13
+
14
+ </body>
15
+ </html>
@@ -7,8 +7,8 @@ describe "employee report" do
7
7
  context "when a custom view exists for the report" do
8
8
 
9
9
  it "uses the custom view" do
10
- get '/reports/suspended_employee'
11
- expect(response.body).to include('<h1>Yeah. Did you get that memo?</h1>')
10
+ get '/reports/employee_with_custom_view'
11
+ expect(response.body).to eq(File.read('spec/fixtures/reports/employee_with_custom_view.html'))
12
12
  end
13
13
 
14
14
  end
@@ -17,7 +17,7 @@ describe "employee report" do
17
17
 
18
18
  it "creates an HTML report using its standard 'show' view" do
19
19
  get '/reports/employee'
20
- expect(response.body).to eq(File.read('spec/fixtures/employee_report.html'))
20
+ expect(response.body).to eq(File.read('spec/fixtures/reports/employee.html'))
21
21
  end
22
22
 
23
23
  it "uses any options provided" do
@@ -26,14 +26,14 @@ describe "employee report" do
26
26
  names: ['Jimmy Jackalope', 'Moustafa McMann'],
27
27
  divisions: ['Tedious Toiling']
28
28
  }
29
- expect(response.body).to eq(File.read('spec/fixtures/customized_employee_report.html'))
29
+ expect(response.body).to eq(File.read('spec/fixtures/reports/employee_with_parameters.html'))
30
30
  end
31
31
 
32
32
  it "moves the specified number of rows into the footer" do
33
33
  get '/reports/employee', options: {
34
34
  footer: 1
35
35
  }
36
- expect(response.body).to eq(File.read('spec/fixtures/employee_report_with_footer.html'))
36
+ expect(response.body).to eq(File.read('spec/fixtures/reports/employee_with_footer.html'))
37
37
  end
38
38
 
39
39
  end
@@ -44,7 +44,7 @@ describe "employee report" do
44
44
 
45
45
  it "creates a standard CSV report" do
46
46
  get '/reports/employee.csv'
47
- expect(response.body).to eq(File.read('spec/fixtures/employee_report.csv'))
47
+ expect(response.body).to eq(File.read('spec/fixtures/reports/employee.csv'))
48
48
  end
49
49
 
50
50
  end
@@ -4,9 +4,9 @@ describe EmployeeWithCustomClientReport do
4
4
 
5
5
  describe "rendering HTML" do
6
6
 
7
- it "is awesome" do
7
+ it "builds a report using the specified client's database" do
8
8
  get "reports/employee_with_custom_client"
9
- expect(response.body).to eq(File.read('spec/fixtures/employee_with_custom_client.html'))
9
+ expect(response.body).to eq(File.read('spec/fixtures/reports/employee_with_custom_client.html'))
10
10
  end
11
11
 
12
12
  end
@@ -0,0 +1,8 @@
1
+ class EmployeeWithCustomViewReport < Dossier::Report
2
+ # See spec/dummy/app/views
3
+
4
+ def sql
5
+ "SELECT * FROM employees WHERE suspended = true"
6
+ end
7
+
8
+ end
@@ -1,4 +1,2 @@
1
1
  class TestReport < Dossier::Report
2
-
3
2
  end
4
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dossier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-01-18 00:00:00.000000000 Z
14
+ date: 2013-01-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: arel
@@ -220,11 +220,11 @@ files:
220
220
  - spec/dummy/app/controllers/application_controller.rb
221
221
  - spec/dummy/app/controllers/site_controller.rb
222
222
  - spec/dummy/app/helpers/application_helper.rb
223
- - spec/dummy/app/views/dossier/reports/suspended_employee.html.haml
224
- - spec/dummy/app/views/dossier/reports/total.html.haml
223
+ - spec/dummy/app/views/dossier/reports/employee_with_custom_view.html.haml
225
224
  - spec/dummy/app/views/layouts/application.html.erb
226
225
  - spec/dummy/config/application.rb
227
226
  - spec/dummy/config/boot.rb
227
+ - spec/dummy/config/database.yml
228
228
  - spec/dummy/config/database.yml.example
229
229
  - spec/dummy/config/environment.rb
230
230
  - spec/dummy/config/environments/development.rb
@@ -241,7 +241,10 @@ files:
241
241
  - spec/dummy/config/setup_load_paths.rb
242
242
  - spec/dummy/config.ru
243
243
  - spec/dummy/db/schema.rb
244
+ - spec/dummy/db/test.sqlite3
244
245
  - spec/dummy/dossier_test
246
+ - spec/dummy/log/development.log
247
+ - spec/dummy/log/test.log
245
248
  - spec/dummy/public/404.html
246
249
  - spec/dummy/public/422.html
247
250
  - spec/dummy/public/500.html
@@ -249,24 +252,25 @@ files:
249
252
  - spec/dummy/Rakefile
250
253
  - spec/dummy/README.rdoc
251
254
  - spec/dummy/script/rails
252
- - spec/fixtures/customized_employee_report.html
255
+ - spec/fixtures/db/mysql2.yml
253
256
  - spec/fixtures/db/mysql2.yml.example
257
+ - spec/fixtures/db/sqlite3.yml
254
258
  - spec/fixtures/db/sqlite3.yml.example
255
- - spec/fixtures/employee_report.csv
256
- - spec/fixtures/employee_report.html
257
- - spec/fixtures/employee_report_with_footer.html
258
- - spec/fixtures/employee_with_custom_client.html
259
- - spec/requests/employee_report_spec.rb
259
+ - spec/fixtures/reports/employee.csv
260
+ - spec/fixtures/reports/employee.html
261
+ - spec/fixtures/reports/employee_with_custom_client.html
262
+ - spec/fixtures/reports/employee_with_custom_view.html
263
+ - spec/fixtures/reports/employee_with_footer.html
264
+ - spec/fixtures/reports/employee_with_parameters.html
265
+ - spec/requests/employee_spec.rb
260
266
  - spec/requests/employee_with_custom_client_spec.rb
261
267
  - spec/routing/dossier_routes_spec.rb
262
268
  - spec/spec_helper.rb
263
269
  - spec/support/factory.rb
264
- - spec/support/reports/employee_report.rb
270
+ - spec/support/reports/employee.rb
265
271
  - spec/support/reports/employee_with_custom_client.rb
266
- - spec/support/reports/sqlite_employee_report.rb
267
- - spec/support/reports/supended_employee_report.rb
268
- - spec/support/reports/test_report.rb
269
- - spec/support/reports/total_report.rb
272
+ - spec/support/reports/employee_with_custom_view.rb
273
+ - spec/support/reports/test.rb
270
274
  homepage:
271
275
  licenses: []
272
276
  post_install_message:
@@ -281,7 +285,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
281
285
  version: '0'
282
286
  segments:
283
287
  - 0
284
- hash: 2096972700425199909
288
+ hash: -785659853303395799
285
289
  required_rubygems_version: !ruby/object:Gem::Requirement
286
290
  none: false
287
291
  requirements:
@@ -290,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
294
  version: '0'
291
295
  segments:
292
296
  - 0
293
- hash: 2096972700425199909
297
+ hash: -785659853303395799
294
298
  requirements: []
295
299
  rubyforge_project:
296
300
  rubygems_version: 1.8.24
@@ -312,11 +316,11 @@ test_files:
312
316
  - spec/dummy/app/controllers/application_controller.rb
313
317
  - spec/dummy/app/controllers/site_controller.rb
314
318
  - spec/dummy/app/helpers/application_helper.rb
315
- - spec/dummy/app/views/dossier/reports/suspended_employee.html.haml
316
- - spec/dummy/app/views/dossier/reports/total.html.haml
319
+ - spec/dummy/app/views/dossier/reports/employee_with_custom_view.html.haml
317
320
  - spec/dummy/app/views/layouts/application.html.erb
318
321
  - spec/dummy/config/application.rb
319
322
  - spec/dummy/config/boot.rb
323
+ - spec/dummy/config/database.yml
320
324
  - spec/dummy/config/database.yml.example
321
325
  - spec/dummy/config/environment.rb
322
326
  - spec/dummy/config/environments/development.rb
@@ -333,7 +337,10 @@ test_files:
333
337
  - spec/dummy/config/setup_load_paths.rb
334
338
  - spec/dummy/config.ru
335
339
  - spec/dummy/db/schema.rb
340
+ - spec/dummy/db/test.sqlite3
336
341
  - spec/dummy/dossier_test
342
+ - spec/dummy/log/development.log
343
+ - spec/dummy/log/test.log
337
344
  - spec/dummy/public/404.html
338
345
  - spec/dummy/public/422.html
339
346
  - spec/dummy/public/500.html
@@ -341,21 +348,22 @@ test_files:
341
348
  - spec/dummy/Rakefile
342
349
  - spec/dummy/README.rdoc
343
350
  - spec/dummy/script/rails
344
- - spec/fixtures/customized_employee_report.html
351
+ - spec/fixtures/db/mysql2.yml
345
352
  - spec/fixtures/db/mysql2.yml.example
353
+ - spec/fixtures/db/sqlite3.yml
346
354
  - spec/fixtures/db/sqlite3.yml.example
347
- - spec/fixtures/employee_report.csv
348
- - spec/fixtures/employee_report.html
349
- - spec/fixtures/employee_report_with_footer.html
350
- - spec/fixtures/employee_with_custom_client.html
351
- - spec/requests/employee_report_spec.rb
355
+ - spec/fixtures/reports/employee.csv
356
+ - spec/fixtures/reports/employee.html
357
+ - spec/fixtures/reports/employee_with_custom_client.html
358
+ - spec/fixtures/reports/employee_with_custom_view.html
359
+ - spec/fixtures/reports/employee_with_footer.html
360
+ - spec/fixtures/reports/employee_with_parameters.html
361
+ - spec/requests/employee_spec.rb
352
362
  - spec/requests/employee_with_custom_client_spec.rb
353
363
  - spec/routing/dossier_routes_spec.rb
354
364
  - spec/spec_helper.rb
355
365
  - spec/support/factory.rb
356
- - spec/support/reports/employee_report.rb
366
+ - spec/support/reports/employee.rb
357
367
  - spec/support/reports/employee_with_custom_client.rb
358
- - spec/support/reports/sqlite_employee_report.rb
359
- - spec/support/reports/supended_employee_report.rb
360
- - spec/support/reports/test_report.rb
361
- - spec/support/reports/total_report.rb
368
+ - spec/support/reports/employee_with_custom_view.rb
369
+ - spec/support/reports/test.rb
@@ -1,11 +0,0 @@
1
- Oh Hai, I iz customized!
2
- %table
3
- %thead
4
- %tr
5
- - @report.headers.each do |header|
6
- %th= header
7
- %tbody
8
- - @report.rows.each do |row|
9
- %tr
10
- - row.each do |value|
11
- %td= value
@@ -1,15 +0,0 @@
1
- class SqliteEmployeeReport < Dossier::Report
2
-
3
- def sql
4
- "SELECT * FROM `employees` WHERE name LIKE :name"
5
- end
6
-
7
- def name
8
- '%Jimmy%'
9
- end
10
-
11
- def format_salary(salary)
12
- formatter.number_to_currency(salary)
13
- end
14
-
15
- end
@@ -1,7 +0,0 @@
1
- class SuspendedEmployeeReport < Dossier::Report
2
-
3
- def sql
4
- "SELECT * FROM employees WHERE suspended = true"
5
- end
6
-
7
- end
@@ -1,35 +0,0 @@
1
- class TotalReport < Dossier::Report
2
-
3
- def sql
4
- <<-SQL.strip_heredoc
5
- SELECT
6
- business_id,
7
- sum( IF( `year` = '2011', amount, 0 ) ) AS 2011_total,
8
- sum( IF( `year` = '2010', amount, 0 ) ) AS 2010_total,
9
- sum( IF( `year` = '2009', amount, 0 ) ) AS 2009_total
10
- FROM
11
- totals
12
- WHERE
13
- business_id IN (:businesses)
14
- GROUP BY
15
- business_id
16
- SQL
17
- end
18
-
19
- def businesses
20
- options.fetch(:businesses) { '' }.split(',')
21
- end
22
-
23
- def format_2011_total(value)
24
- formatter.currency(value)
25
- end
26
-
27
- def format_2010_total(value)
28
- formatter.currency(value)
29
- end
30
-
31
- def format_2009_total(value)
32
- formatter.currency(value)
33
- end
34
-
35
- end