dossier 2.5.0 → 2.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/dossier/query.rb CHANGED
@@ -15,7 +15,7 @@ module Dossier
15
15
  private
16
16
 
17
17
  def compile
18
- string.gsub(/\w*\:[a-z]+/) { |match| escape(report.public_send(match[1..-1])) }
18
+ string.gsub(/\w*\:[a-z]{1}\w*/) { |match| escape(report.public_send(match[1..-1])) }
19
19
  end
20
20
 
21
21
  def escape(value)
@@ -1,3 +1,3 @@
1
1
  module Dossier
2
- VERSION = "2.5.0"
2
+ VERSION = "2.5.1"
3
3
  end
@@ -17,21 +17,21 @@ describe Dossier::Query do
17
17
  context "when the methods return single values" do
18
18
 
19
19
  before :each do
20
- report.stub(:sql).and_return("SELECT * FROM employees WHERE id = :id OR girth < :girth OR name = :name")
20
+ report.stub(:sql).and_return("SELECT * FROM employees WHERE id = :id OR girth < :girth OR hired_on = :hired_on")
21
21
  report.stub(:id).and_return(92)
22
22
  report.stub(:girth).and_return(3.14)
23
- report.stub(:name).and_return('Jimmy')
23
+ report.stub(:hired_on).and_return('2013-03-29')
24
24
  end
25
25
 
26
26
  it "escapes the values" do
27
27
  query.should_receive(:escape).with(92)
28
28
  query.should_receive(:escape).with(3.14)
29
- query.should_receive(:escape).with('Jimmy')
29
+ query.should_receive(:escape).with('2013-03-29')
30
30
  query.to_s
31
31
  end
32
32
 
33
33
  it "inserts the values" do
34
- expect(query.to_s).to eq("SELECT * FROM employees WHERE id = 92 OR girth < 3.14 OR name = 'Jimmy'")
34
+ expect(query.to_s).to eq("SELECT * FROM employees WHERE id = 92 OR girth < 3.14 OR hired_on = '2013-03-29'")
35
35
  end
36
36
 
37
37
  end
Binary file
@@ -2118,3 +2118,103 @@ Processing by Dossier::ReportsController#show as XLS
2118
2118
  Completed 200 OK in 5ms (ActiveRecord: 0.4ms)
2119
2119
  EmployeeReport (0.3ms) SELECT * FROM employees WHERE 1=1
2120
2120
  ORDER BY name ASC
2121
+ Connecting to database specified by database.yml
2122
+ FACTORY (0.9ms) CREATE DATABASE IF NOT EXISTS `dossier_test`
2123
+ FACTORY (68.6ms) DROP TABLE IF EXISTS `employees`
2124
+ FACTORY (28.9ms)  CREATE TABLE `employees` (
2125
+ `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
2126
+ `name` varchar(255) NOT NULL,
2127
+ `division` varchar(255) NOT NULL,
2128
+ `salary` int(11) NOT NULL,
2129
+ `suspended` tinyint(1) NOT NULL DEFAULT 0,
2130
+ `hired_on` date NOT NULL,
2131
+ PRIMARY KEY (`id`)
2132
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2133
+ 
2134
+ FACTORY (1.6ms) TRUNCATE `employees`
2135
+ FACTORY (1.0ms)  INSERT INTO
2136
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
2137
+ VALUES ('Moustafa McMann', '2010-10-02', false, 'Zany Inventions', 30000);
2138
+ 
2139
+ FACTORY (0.9ms) INSERT INTO
2140
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
2141
+ VALUES ('Jimmy Jackalope, Jr.', '2013-01-11', true, 'Tedious Toiling', 20000);
2142
+
2143
+ FACTORY (0.9ms)  INSERT INTO
2144
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
2145
+ VALUES ('Elise Elderberry', '2013-01-11', false, 'Corporate Malfeasance', 99000);
2146
+ 
2147
+ FACTORY (8.8ms) DROP TABLE IF EXISTS `employees`
2148
+ FACTORY (1.0ms)  CREATE TABLE `employees` (
2149
+ `id` INTEGER PRIMARY KEY AUTOINCREMENT,
2150
+ `name` TEXT NOT NULL,
2151
+ `division` TEXT NOT NULL,
2152
+ `salary` INTEGER NOT NULL,
2153
+ `suspended` TINYINT NOT NULL DEFAULT 0,
2154
+ `hired_on` DATE NOT NULL
2155
+ );
2156
+ 
2157
+ FACTORY (0.9ms) DELETE FROM `employees`
2158
+ FACTORY (0.9ms)  INSERT INTO
2159
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
2160
+ VALUES ('MOUSTAFA MCMANN', '2010-10-02', 0, 'Zany Inventions', 30000);
2161
+ 
2162
+ FACTORY (1.0ms) INSERT INTO
2163
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
2164
+ VALUES ('JIMMY JACKALOPE, JR.', '2013-01-11', 1, 'Tedious Toiling', 20000);
2165
+
2166
+ FACTORY (1.0ms)  INSERT INTO
2167
+ `employees` (`name`, `hired_on`, `suspended`, `division`, `salary`)
2168
+ VALUES ('ELISE ELDERBERRY', '2013-01-11', 0, 'Corporate Malfeasance', 99000);
2169
+ 
2170
+ Started GET "/reports/employee_with_custom_client" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2171
+ Processing by Dossier::ReportsController#show as HTML
2172
+ Parameters: {"report"=>"employee_with_custom_client"}
2173
+ EmployeeWithCustomClientReport (3.0ms) SELECT * FROM `employees`
2174
+ Rendered /Users/adamhunter/Studio/adamhunter/dossier/app/views/dossier/reports/show.html.haml within layouts/application (7.3ms)
2175
+ Completed 200 OK in 35ms (Views: 13.2ms | ActiveRecord: 0.0ms)
2176
+ Started GET "/reports/employee.xls" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2177
+ Processing by Dossier::ReportsController#show as XLS
2178
+ Parameters: {"report"=>"employee"}
2179
+ EmployeeReport (0.3ms) SELECT * FROM employees WHERE 1=1
2180
+ ORDER BY name ASC
2181
+ Completed 200 OK in 31ms (ActiveRecord: 0.3ms)
2182
+ Started GET "/reports/employee.csv" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2183
+ Processing by Dossier::ReportsController#show as CSV
2184
+ Parameters: {"report"=>"employee"}
2185
+ EmployeeReport (0.3ms) SELECT * FROM employees WHERE 1=1
2186
+ ORDER BY name ASC
2187
+ Completed 200 OK in 5ms (ActiveRecord: 0.3ms)
2188
+ Started GET "/reports/employee_with_custom_view" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2189
+ Processing by Dossier::ReportsController#show as HTML
2190
+ Parameters: {"report"=>"employee_with_custom_view"}
2191
+ EmployeeWithCustomViewReport (0.2ms) SELECT * FROM employees WHERE suspended = true
2192
+ Completed 200 OK in 9ms (Views: 3.9ms | ActiveRecord: 0.2ms)
2193
+ Started GET "/reports/employee?options[footer]=1" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2194
+ Processing by Dossier::ReportsController#show as HTML
2195
+ Parameters: {"options"=>{"footer"=>"1"}, "report"=>"employee"}
2196
+ EmployeeReport (0.4ms) SELECT * FROM employees WHERE 1=1
2197
+ ORDER BY name ASC
2198
+ Completed 200 OK in 18ms (Views: 12.0ms | ActiveRecord: 0.0ms)
2199
+ Started GET "/reports/employee?options[salary]=true&options[order]=desc&options[names][]=Jimmy+Jackalope&options[names][]=Moustafa+McMann&options[divisions][]=Tedious+Toiling" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2200
+ Processing by Dossier::ReportsController#show as HTML
2201
+ Parameters: {"options"=>{"salary"=>"true", "order"=>"desc", "names"=>["Jimmy Jackalope", "Moustafa McMann"], "divisions"=>["Tedious Toiling"]}, "report"=>"employee"}
2202
+ EmployeeReport (0.5ms) SELECT * FROM employees WHERE 1=1
2203
+ AND division in (('Tedious Toiling'))
2204
+ AND salary > 10000
2205
+ AND (name like '%Moustafa McMann%' or name like '%Jimmy Jackalope%')
2206
+ ORDER BY name DESC
2207
+ Completed 200 OK in 16ms (Views: 3.6ms | ActiveRecord: 0.0ms)
2208
+ Started GET "/reports/employee" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2209
+ Processing by Dossier::ReportsController#show as HTML
2210
+ Parameters: {"report"=>"employee"}
2211
+ EmployeeReport (0.3ms) SELECT * FROM employees WHERE 1=1
2212
+ ORDER BY name ASC
2213
+ Completed 200 OK in 10ms (Views: 4.6ms | ActiveRecord: 0.0ms)
2214
+ Started GET "/employee_report_custom_controller" for 127.0.0.1 at 2013-05-06 11:38:23 -0400
2215
+ Processing by SiteController#report as HTML
2216
+ EmployeeReport (0.4ms) SELECT * FROM employees WHERE 1=1
2217
+ ORDER BY name ASC
2218
+ Completed 200 OK in 9ms (Views: 4.6ms | ActiveRecord: 0.4ms)
2219
+ EmployeeReport (0.3ms) SELECT * FROM employees WHERE 1=1
2220
+ ORDER BY name ASC
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.5.0
4
+ version: 2.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -98,17 +98,17 @@ dependencies:
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  none: false
100
100
  requirements:
101
- - - ! '>='
101
+ - - ~>
102
102
  - !ruby/object:Gem::Version
103
- version: 3.1.6
103
+ version: '3.1'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
- - - ! '>='
109
+ - - ~>
110
110
  - !ruby/object:Gem::Version
111
- version: 3.1.6
111
+ version: '3.1'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: activerecord
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -319,7 +319,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
319
319
  version: '0'
320
320
  segments:
321
321
  - 0
322
- hash: 2711006704364315577
322
+ hash: 4524173527556927315
323
323
  required_rubygems_version: !ruby/object:Gem::Requirement
324
324
  none: false
325
325
  requirements:
@@ -328,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
328
  version: '0'
329
329
  segments:
330
330
  - 0
331
- hash: 2711006704364315577
331
+ hash: 4524173527556927315
332
332
  requirements: []
333
333
  rubyforge_project:
334
334
  rubygems_version: 1.8.23