clark_kent 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8303deadcad1a6667b944d69247e9cd192edb40
4
- data.tar.gz: 8b4bb42d2056d4afcebb56e2febef4aefaec2da6
3
+ metadata.gz: 68fdd3c6dded98611b013feca6124cb6d5a6ed7f
4
+ data.tar.gz: 6ba358c6cc701e1b894fa182ce457056ba5d7581
5
5
  SHA512:
6
- metadata.gz: 8f698513b62a065f37010bc351261d6f5d31013464e2d8265a964c844733f0e7ba2a4ad10bcff0e664a004a9ca3a33fa7082a48bb9bda82445e258e9a3189181
7
- data.tar.gz: 5aa104bf6efd27169b091de6fefe038fd55750a52d646eadaf65e5a58ed2ea919d6bae3d15e9cb947be3929d1f206aaa358cfab01cb6eb6ba7f480a6514b2c6e
6
+ metadata.gz: dab77b0a0aee17dbc8b019b56c709809154eef49aa46316679faa8ac8e666ae5238ee77ca5eb79e3d3b8fa2a6ef402c3565d1fad05e784313d450d7acabc5708
7
+ data.tar.gz: 15c803be1105a3fd758ad36654adf735eb4dbf641fabbe0d8ed266d294b364f9abd49cae65cd0f79426ac1f6abddd8bdbd15c00f4fd9d32a5619e25129a93a6a
@@ -34,7 +34,8 @@ module ClarkKent
34
34
  end
35
35
 
36
36
  def display_for_value(value, column_name=nil)
37
- return link_to(value, edit_manage_reservation_path(value)) if column_name == 'reservation_id'
37
+ ##TODO, genericize this link display. link info must come from model config.
38
+ return link_to(value, main_app.edit_manage_reservation_path(value)) if column_name == 'reservation_id'
38
39
  return value.join(', ') if value.is_a? Array
39
40
  return value.to_formatted_s(:datepicker) if value.is_a? Date
40
41
  return number_to_currency(value) if value.is_a? Float or value.is_a? BigDecimal or is_decimal?(value)
@@ -33,7 +33,7 @@ module ClarkKent
33
33
  end
34
34
 
35
35
  def begin_date
36
- @begin_date = Date.ih_today
36
+ @begin_date = Date.today
37
37
  direction, period = self.period_offset
38
38
  @begin_date = @begin_date.send(direction, 1.send(period)) if direction
39
39
  @begin_date = @begin_date.find_day(self.day_offset) if self.day_offset
@@ -19,7 +19,6 @@ module ClarkKent
19
19
  has_many :user_report_emails, dependent: :destroy
20
20
  has_many :users, through: :user_report_emails
21
21
 
22
-
23
22
  def self.send_emails_for_today
24
23
  today = Date.ih_today
25
24
  todays_filters = []
@@ -44,7 +43,11 @@ module ClarkKent
44
43
  SharingScopeKind.custom.each do |sharing_scope_kind|
45
44
  unless report.report_filters.map(&:filter_name).include? sharing_scope_kind.basic_association_id_collection_name.to_s
46
45
  associations = sharing_scope_kind.associated_containers_for(user)
47
- params[sharing_scope_kind.basic_association_id_collection_name] = associations.map(&:id)
46
+ if associations.respond_to? :map
47
+ params[sharing_scope_kind.basic_association_id_collection_name] = associations.map(&:id)
48
+ else
49
+ params[sharing_scope_kind.basic_association_id_collection_name] = associations.id
50
+ end
48
51
  end
49
52
  end
50
53
  report_download_url = ClarkKent::Report.send_report_to_s3(self.id, params)
@@ -16,12 +16,12 @@ module ClarkKent
16
16
  end
17
17
 
18
18
  def required_date_params
19
- self::REPORT_FILTER_OPTIONS.select{|rfo| rfo.in_required_date_group}.map{|rfo| rfo.filter_params}.flatten
19
+ self::REPORT_FILTER_OPTIONS.select{|rfo| rfo.in_required_date_group}.map{|rfo| rfo.filter_params}.flatten.map(&:to_sym)
20
20
  end
21
21
 
22
22
  def validate_params(params,report)
23
23
  if required_date_params.any?
24
- missing_params = required_date_params - params.select{|k,v| v.present? }.keys
24
+ missing_params = required_date_params - params.select{|k,v| v.present? }.symbolize_keys.keys
25
25
  # a bit clunky, it only requires any 2 date filters. It would be better to require at least one pair of before/after filters
26
26
  if missing_params.length > (required_date_params.length - 2)
27
27
  raise ClarkKent::ReportFilterError.new("At least one date range is required.")
@@ -30,7 +30,6 @@ module ClarkKent
30
30
  end
31
31
 
32
32
  def report(params,report,count = false)
33
- validate_params(params, report)
34
33
  @selects = []
35
34
  @includes = []
36
35
  @joins = []
@@ -67,6 +66,7 @@ module ClarkKent
67
66
  else
68
67
  params = report.report_filter_params.symbolize_keys!.merge(params.symbolize_keys)
69
68
  end
69
+ validate_params(params, report)
70
70
  params.each do |param_type,param_value|
71
71
  if param_value.present?
72
72
  arel_method_name = self.arel_method_for(param_type)
data/lib/clark_kent.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "clark_kent/engine"
2
2
  require 'simple_form'
3
3
  require 'thin_man'
4
+ require 'aws-sdk'
4
5
 
5
6
  module ClarkKent
6
7
  mattr_accessor :resource_options, :user_class_name, :other_sharing_scopes, :base_controller,
@@ -20,3 +21,15 @@ module ClarkKent
20
21
  end
21
22
 
22
23
  end
24
+
25
+ class Date
26
+ def find_day(day_name)
27
+ if Date::DAYNAMES.include?(day_name.capitalize)
28
+ week_start = self if [0,7].include? self.wday
29
+ week_start ||= (self.beginning_of_week - 1.day)
30
+ week_start + Date::DAYNAMES.index(day_name.capitalize)
31
+ else
32
+ self.send(day_name)
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,3 @@
1
1
  module ClarkKent
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -39,13 +39,13 @@ module ClarkKent
39
39
  test "should show report results" do
40
40
  get :show, id: @report, current_user_id: @current_user.id, run_report: true, created_at_until: Date.today, created_at_from: Date.yesterday
41
41
  assert_response :success
42
- assert_match 'Guitar strings', @response.body
42
+ @response.body.must_match 'Guitar strings'
43
43
  end
44
44
 
45
45
  test "should show report run errors" do
46
46
  get :show, id: @report, current_user_id: @current_user.id, run_report: true
47
47
  assert_response :success
48
- assert_match 'At least one date range is required.', @response.body
48
+ @response.body.must_match 'At least one date range is required.'
49
49
  end
50
50
 
51
51
  test "should get edit" do
Binary file
@@ -18071,3 +18071,5 @@ Started GET "/assets/clark_kent/application.js?body=1" for 127.0.0.1 at 2015-03-
18071
18071
  FROM sqlite_temp_master
18072
18072
  WHERE name='index_clark_kent_reports_on_sharing_scope_type' AND type='index'
18073
18073
 
18074
+ ClarkKent::ReportFilter Load (0.5ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" ORDER BY "clark_kent_report_filters"."id" ASC LIMIT 1
18075
+ ClarkKent::ReportFilter Load (0.3ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" ORDER BY "clark_kent_report_filters"."id" DESC LIMIT 1
@@ -14135,3 +14135,2671 @@ Processing by ClarkKent::ReportsController#update as HTML
14135
14135
   (0.0ms) commit transaction
14136
14136
  Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (0.8ms)
14137
14137
  Completed 200 OK in 3ms (Views: 1.1ms | ActiveRecord: 0.2ms)
14138
+  (1.4ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14139
+  (0.1ms) select sqlite_version(*)
14140
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14141
+  (0.9ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14142
+  (0.9ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14143
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14144
+  (0.1ms)  SELECT sql
14145
+ FROM sqlite_master
14146
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14147
+ UNION ALL
14148
+ SELECT sql
14149
+ FROM sqlite_temp_master
14150
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14151
+ 
14152
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14153
+  (0.8ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14154
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14155
+  (0.1ms)  SELECT sql
14156
+ FROM sqlite_master
14157
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14158
+ UNION ALL
14159
+ SELECT sql
14160
+ FROM sqlite_temp_master
14161
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14162
+ 
14163
+  (0.8ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14164
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14165
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14166
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14167
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14168
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14169
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14170
+  (0.1ms) SELECT version FROM "schema_migrations"
14171
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14172
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14173
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14174
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14175
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14176
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14177
+  (0.1ms) begin transaction
14178
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:09:38.877697"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:09:38.877697"]]
14179
+  (0.8ms) commit transaction
14180
+  (0.0ms) begin transaction
14181
+ SQL (0.4ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14182
+  (0.7ms) commit transaction
14183
+  (0.0ms) begin transaction
14184
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14185
+  (0.6ms) commit transaction
14186
+  (0.1ms) begin transaction
14187
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14188
+  (0.7ms) commit transaction
14189
+  (0.0ms) begin transaction
14190
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14191
+  (0.7ms) commit transaction
14192
+  (0.1ms) begin transaction
14193
+ SQL (0.4ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14194
+  (0.7ms) commit transaction
14195
+  (0.0ms) begin transaction
14196
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:09:38.922528"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:09:38.922528"], ["user_id", 1]]
14197
+  (0.7ms) commit transaction
14198
+ -----------------------------------------------------------
14199
+ ClarkKent::ReportsControllerTest: test_should_create_report
14200
+ -----------------------------------------------------------
14201
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14202
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14203
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
14204
+ Processing by ClarkKent::ReportsController#create as HTML
14205
+ Parameters: {"report"=>{"name"=>"delete me", "resource_type"=>"Order", "sharing_scope_id"=>nil, "sharing_scope_type"=>nil}, "current_user_id"=>"1"}
14206
+  (0.1ms) begin transaction
14207
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "name", "resource_type", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2015-03-16 23:09:39.003332"], ["name", "delete me"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:09:39.003332"]]
14208
+  (0.8ms) commit transaction
14209
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (5.5ms)
14210
+ ClarkKent::ReportFilter Load (0.3ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::Report"]]
14211
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_filters/_index.html.erb (6.1ms)
14212
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 2]]
14213
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_index.html.erb (3.0ms)
14214
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 2]]
14215
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_index.html.erb (6.9ms)
14216
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/edit.html.erb within layouts/application (32.1ms)
14217
+ Completed 200 OK in 63ms (Views: 56.0ms | ActiveRecord: 2.3ms)
14218
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
14219
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."name" = 'delete me' LIMIT 1
14220
+  (0.0ms) begin transaction
14221
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::Report"]]
14222
+ ClarkKent::ReportColumn Load (0.0ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 2]]
14223
+ ClarkKent::ReportEmail Load (0.0ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 2]]
14224
+ SQL (0.3ms) DELETE FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? [["id", 2]]
14225
+  (0.7ms) commit transaction
14226
+ ------------------------------------------------------------
14227
+ ClarkKent::ReportsControllerTest: test_should_destroy_report
14228
+ ------------------------------------------------------------
14229
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14230
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14231
+  (0.0ms) begin transaction
14232
+ SQL (0.2ms) INSERT INTO "clark_kent_reports" ("created_at", "name", "resource_type", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2015-03-16 23:09:39.072683"], ["name", "delete me"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:09:39.072683"]]
14233
+  (0.7ms) commit transaction
14234
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
14235
+ Processing by ClarkKent::ReportsController#destroy as HTML
14236
+ Parameters: {"current_user_id"=>"1", "id"=>"3"}
14237
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 3]]
14238
+  (0.0ms) begin transaction
14239
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 3], ["filterable_type", "ClarkKent::Report"]]
14240
+ ClarkKent::ReportColumn Load (0.0ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 3]]
14241
+ ClarkKent::ReportEmail Load (0.0ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 3]]
14242
+ SQL (0.2ms) DELETE FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? [["id", 3]]
14243
+  (0.6ms) commit transaction
14244
+ Redirected to http://test.host/reports/reports
14245
+ Completed 302 Found in 4ms (ActiveRecord: 1.2ms)
14246
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
14247
+ ------------------------------------------------------
14248
+ ClarkKent::ReportsControllerTest: test_should_get_edit
14249
+ ------------------------------------------------------
14250
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14251
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14252
+ Processing by ClarkKent::ReportsController#edit as HTML
14253
+ Parameters: {"current_user_id"=>"1", "id"=>"1"}
14254
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14255
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (0.7ms)
14256
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14257
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_filters/_index.html.erb (1.1ms)
14258
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
14259
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.8ms)
14260
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (2.0ms)
14261
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
14262
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.4ms)
14263
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
14264
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.4ms)
14265
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
14266
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.4ms)
14267
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_index.html.erb (5.5ms)
14268
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 1]]
14269
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_index.html.erb (0.9ms)
14270
+ Completed 200 OK in 11ms (Views: 9.6ms | ActiveRecord: 0.3ms)
14271
+ -------------------------------------------------------
14272
+ ClarkKent::ReportsControllerTest: test_should_get_index
14273
+ -------------------------------------------------------
14274
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14275
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14276
+ Processing by ClarkKent::ReportsController#index as HTML
14277
+ Parameters: {"current_user_id"=>"1"}
14278
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
14279
+ ClarkKent::Report Exists (0.2ms) SELECT 1 AS one FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" = ? AND "clark_kent_reports"."sharing_scope_type" = ? LIMIT 1 [["sharing_scope_id", 1], ["sharing_scope_type", "User"]]
14280
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" IS NULL
14281
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" IS NULL
14282
+ Completed 200 OK in 17ms (Views: 16.3ms | ActiveRecord: 0.6ms)
14283
+ -----------------------------------------------------
14284
+ ClarkKent::ReportsControllerTest: test_should_get_new
14285
+ -----------------------------------------------------
14286
+ ClarkKent::Report Load (0.3ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14287
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14288
+ Processing by ClarkKent::ReportsController#new as HTML
14289
+ Parameters: {"current_user_id"=>"1"}
14290
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
14291
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_edit.html.erb (61.3ms)
14292
+ Completed 200 OK in 65ms (Views: 64.3ms | ActiveRecord: 0.2ms)
14293
+ ---------------------------------------------------------
14294
+ ClarkKent::ReportsControllerTest: test_should_show_report
14295
+ ---------------------------------------------------------
14296
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14297
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14298
+ Processing by ClarkKent::ReportsController#show as HTML
14299
+ Parameters: {"current_user_id"=>"1", "id"=>"1"}
14300
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14301
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
14302
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14303
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14304
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14305
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.8ms)
14306
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14307
+ User Load (0.1ms) SELECT "users".* FROM "users"
14308
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (1.6ms)
14309
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.4ms)
14310
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (0.5ms)
14311
+ Completed 200 OK in 18ms (Views: 11.8ms | ActiveRecord: 1.0ms)
14312
+ -----------------------------------------------------------------
14313
+ ClarkKent::ReportsControllerTest: test_should_show_report_results
14314
+ -----------------------------------------------------------------
14315
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14316
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14317
+ Processing by ClarkKent::ReportsController#show as HTML
14318
+ Parameters: {"current_user_id"=>"1", "run_report"=>true, "created_at_until"=>"2015-03-16", "created_at_from"=>"2015-03-15", "id"=>"1"}
14319
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14320
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
14321
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14322
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
14323
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14324
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14325
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14326
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.2ms)
14327
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14328
+ User Load (0.1ms) SELECT "users".* FROM "users"
14329
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (0.9ms)
14330
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.1ms)
14331
+  (0.1ms) SELECT COUNT(*) FROM "orders"
14332
+  (0.2ms) SELECT COUNT(count_column) FROM (SELECT "orders"."id" AS count_column FROM "orders" LIMIT 10 OFFSET 0) subquery_for_count
14333
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (4.0ms)
14334
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
14335
+ Order Load (0.1ms) SELECT DISTINCT orders.id, orders.user_id, orders.amount, orders.description, orders.created_at, orders.updated_at,
14336
+ (SELECT u.name
14337
+ FROM users u
14338
+ WHERE u.id = orders.user_id)
14339
+ as user_name, NULL FROM "orders" LIMIT 10 OFFSET 0
14340
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_download_link.html.erb (0.8ms)
14341
+ Completed 200 OK in 18ms (Views: 12.7ms | ActiveRecord: 1.4ms)
14342
+ --------------------------------------------------------------------
14343
+ ClarkKent::ReportsControllerTest: test_should_show_report_run_errors
14344
+ --------------------------------------------------------------------
14345
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14346
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14347
+ Processing by ClarkKent::ReportsController#show as HTML
14348
+ Parameters: {"current_user_id"=>"1", "run_report"=>true, "id"=>"1"}
14349
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14350
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
14351
+ ClarkKent::ReportFilter Load (0.4ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14352
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
14353
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14354
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14355
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14356
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.2ms)
14357
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14358
+ User Load (0.1ms) SELECT "users".* FROM "users"
14359
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (0.9ms)
14360
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.1ms)
14361
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (0.1ms)
14362
+ Completed 200 OK in 10ms (Views: 4.1ms | ActiveRecord: 1.2ms)
14363
+ -----------------------------------------------------------
14364
+ ClarkKent::ReportsControllerTest: test_should_update_report
14365
+ -----------------------------------------------------------
14366
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14367
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
14368
+ Processing by ClarkKent::ReportsController#update as HTML
14369
+ Parameters: {"report"=>{"name"=>nil, "resource_type"=>"Order", "sharing_scope_id"=>nil, "sharing_scope_type"=>nil}, "current_user_id"=>"1", "id"=>"1"}
14370
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14371
+  (0.0ms) begin transaction
14372
+  (0.0ms) commit transaction
14373
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (0.8ms)
14374
+ Completed 200 OK in 3ms (Views: 1.1ms | ActiveRecord: 0.1ms)
14375
+ -------------------------
14376
+ ClarkKentTest: test_truth
14377
+ -------------------------
14378
+ ------------------------------------------------------------------------------------------------
14379
+ ClarkKent::ReportTest: test_can't_save_without_a_sharing_scope_id_if_the_sharing_scope_is_custom
14380
+ ------------------------------------------------------------------------------------------------
14381
+  (0.1ms) begin transaction
14382
+  (0.0ms) rollback transaction
14383
+  (1.9ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14384
+  (0.1ms) select sqlite_version(*)
14385
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14386
+  (0.8ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14387
+  (1.0ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14388
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14389
+  (0.1ms)  SELECT sql
14390
+ FROM sqlite_master
14391
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14392
+ UNION ALL
14393
+ SELECT sql
14394
+ FROM sqlite_temp_master
14395
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14396
+ 
14397
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14398
+  (0.9ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14399
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14400
+  (0.1ms)  SELECT sql
14401
+ FROM sqlite_master
14402
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14403
+ UNION ALL
14404
+ SELECT sql
14405
+ FROM sqlite_temp_master
14406
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14407
+ 
14408
+  (0.7ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14409
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14410
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14411
+  (1.0ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14412
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14413
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14414
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14415
+  (0.1ms) SELECT version FROM "schema_migrations"
14416
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14417
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14418
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14419
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14420
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14421
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14422
+  (0.1ms) begin transaction
14423
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:19:25.429995"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:19:25.429995"]]
14424
+  (1.0ms) commit transaction
14425
+  (0.1ms) begin transaction
14426
+ SQL (0.5ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14427
+  (0.8ms) commit transaction
14428
+  (0.1ms) begin transaction
14429
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14430
+  (0.7ms) commit transaction
14431
+  (0.1ms) begin transaction
14432
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14433
+  (0.6ms) commit transaction
14434
+  (0.1ms) begin transaction
14435
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14436
+  (0.9ms) commit transaction
14437
+  (0.1ms) begin transaction
14438
+ SQL (0.3ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14439
+  (1.0ms) commit transaction
14440
+  (0.1ms) begin transaction
14441
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:19:25.475481"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:19:25.475481"], ["user_id", 1]]
14442
+  (1.0ms) commit transaction
14443
+ -----------------------------------------------------------------------------------------
14444
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
14445
+ -----------------------------------------------------------------------------------------
14446
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
14447
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14448
+  (0.1ms) begin transaction
14449
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
14450
+  (0.7ms) commit transaction
14451
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
14452
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14453
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14454
+  (2.1ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14455
+  (0.1ms) select sqlite_version(*)
14456
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14457
+  (0.9ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14458
+  (0.8ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14459
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14460
+  (0.1ms)  SELECT sql
14461
+ FROM sqlite_master
14462
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14463
+ UNION ALL
14464
+ SELECT sql
14465
+ FROM sqlite_temp_master
14466
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14467
+ 
14468
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14469
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14470
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14471
+  (0.1ms)  SELECT sql
14472
+ FROM sqlite_master
14473
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14474
+ UNION ALL
14475
+ SELECT sql
14476
+ FROM sqlite_temp_master
14477
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14478
+ 
14479
+  (0.8ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14480
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14481
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14482
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14483
+  (0.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14484
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14485
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14486
+  (0.1ms) SELECT version FROM "schema_migrations"
14487
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14488
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14489
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14490
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14491
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14492
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14493
+  (0.1ms) begin transaction
14494
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:20:59.701593"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:20:59.701593"]]
14495
+  (1.0ms) commit transaction
14496
+  (0.0ms) begin transaction
14497
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14498
+  (0.7ms) commit transaction
14499
+  (0.0ms) begin transaction
14500
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14501
+  (0.7ms) commit transaction
14502
+  (0.0ms) begin transaction
14503
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14504
+  (0.7ms) commit transaction
14505
+  (0.0ms) begin transaction
14506
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14507
+  (0.7ms) commit transaction
14508
+  (0.1ms) begin transaction
14509
+ SQL (0.3ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14510
+  (0.7ms) commit transaction
14511
+  (0.0ms) begin transaction
14512
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
14513
+  (1.0ms) commit transaction
14514
+  (2.0ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14515
+  (0.1ms) select sqlite_version(*)
14516
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14517
+  (0.9ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14518
+  (0.9ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14519
+  (0.7ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14520
+  (0.1ms)  SELECT sql
14521
+ FROM sqlite_master
14522
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14523
+ UNION ALL
14524
+ SELECT sql
14525
+ FROM sqlite_temp_master
14526
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14527
+ 
14528
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14529
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14530
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14531
+  (0.1ms)  SELECT sql
14532
+ FROM sqlite_master
14533
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14534
+ UNION ALL
14535
+ SELECT sql
14536
+ FROM sqlite_temp_master
14537
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14538
+ 
14539
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14540
+  (1.3ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14541
+  (1.1ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14542
+  (1.0ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14543
+  (0.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14544
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14545
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14546
+  (0.1ms) SELECT version FROM "schema_migrations"
14547
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14548
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14549
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14550
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14551
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14552
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14553
+  (0.1ms) begin transaction
14554
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:22:36.726594"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:22:36.726594"]]
14555
+  (1.0ms) commit transaction
14556
+  (0.1ms) begin transaction
14557
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14558
+  (1.0ms) commit transaction
14559
+  (0.1ms) begin transaction
14560
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14561
+  (0.9ms) commit transaction
14562
+  (0.0ms) begin transaction
14563
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14564
+  (0.9ms) commit transaction
14565
+  (0.0ms) begin transaction
14566
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14567
+  (0.9ms) commit transaction
14568
+  (0.1ms) begin transaction
14569
+ SQL (0.3ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14570
+  (0.8ms) commit transaction
14571
+  (0.1ms) begin transaction
14572
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
14573
+  (0.7ms) commit transaction
14574
+  (1.7ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14575
+  (0.1ms) select sqlite_version(*)
14576
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14577
+  (0.9ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14578
+  (0.8ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14579
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14580
+  (0.1ms)  SELECT sql
14581
+ FROM sqlite_master
14582
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14583
+ UNION ALL
14584
+ SELECT sql
14585
+ FROM sqlite_temp_master
14586
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14587
+ 
14588
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14589
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14590
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14591
+  (0.1ms)  SELECT sql
14592
+ FROM sqlite_master
14593
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14594
+ UNION ALL
14595
+ SELECT sql
14596
+ FROM sqlite_temp_master
14597
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14598
+ 
14599
+  (0.8ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14600
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14601
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14602
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14603
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14604
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14605
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14606
+  (0.1ms) SELECT version FROM "schema_migrations"
14607
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14608
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14609
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14610
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14611
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14612
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14613
+  (0.1ms) begin transaction
14614
+ SQL (0.5ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:23:06.757109"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:23:06.757109"]]
14615
+  (1.1ms) commit transaction
14616
+  (0.1ms) begin transaction
14617
+ SQL (0.4ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14618
+  (0.9ms) commit transaction
14619
+  (0.1ms) begin transaction
14620
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14621
+  (0.9ms) commit transaction
14622
+  (0.1ms) begin transaction
14623
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14624
+  (0.9ms) commit transaction
14625
+  (0.1ms) begin transaction
14626
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14627
+  (0.7ms) commit transaction
14628
+  (0.1ms) begin transaction
14629
+ SQL (0.3ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14630
+  (0.7ms) commit transaction
14631
+  (0.1ms) begin transaction
14632
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
14633
+  (0.9ms) commit transaction
14634
+  (0.1ms) begin transaction
14635
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:23:06.809089"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:23:06.809089"], ["user_id", 1]]
14636
+  (0.7ms) commit transaction
14637
+ -----------------------------------------------------------------------------------------
14638
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
14639
+ -----------------------------------------------------------------------------------------
14640
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
14641
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14642
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = NULL WHERE "clark_kent_reports"."id" = 1
14643
+  (0.1ms) begin transaction
14644
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
14645
+  (0.8ms) commit transaction
14646
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
14647
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14648
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14649
+  (1.9ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14650
+  (0.1ms) select sqlite_version(*)
14651
+  (0.9ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14652
+  (0.8ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14653
+  (0.8ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14654
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14655
+  (0.1ms)  SELECT sql
14656
+ FROM sqlite_master
14657
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14658
+ UNION ALL
14659
+ SELECT sql
14660
+ FROM sqlite_temp_master
14661
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14662
+ 
14663
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14664
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14665
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14666
+  (0.1ms)  SELECT sql
14667
+ FROM sqlite_master
14668
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14669
+ UNION ALL
14670
+ SELECT sql
14671
+ FROM sqlite_temp_master
14672
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14673
+ 
14674
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14675
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14676
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14677
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14678
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14679
+  (1.1ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14680
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14681
+  (0.1ms) SELECT version FROM "schema_migrations"
14682
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14683
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14684
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14685
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14686
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14687
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14688
+  (0.1ms) begin transaction
14689
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:23:36.222380"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:23:36.222380"]]
14690
+  (0.7ms) commit transaction
14691
+  (0.0ms) begin transaction
14692
+ SQL (0.4ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14693
+  (0.7ms) commit transaction
14694
+  (0.0ms) begin transaction
14695
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14696
+  (0.7ms) commit transaction
14697
+  (0.0ms) begin transaction
14698
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14699
+  (0.7ms) commit transaction
14700
+  (0.0ms) begin transaction
14701
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14702
+  (0.7ms) commit transaction
14703
+  (0.1ms) begin transaction
14704
+ SQL (0.3ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14705
+  (0.7ms) commit transaction
14706
+  (0.1ms) begin transaction
14707
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
14708
+  (0.8ms) commit transaction
14709
+  (0.1ms) begin transaction
14710
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:23:36.269704"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:23:36.269704"], ["user_id", 1]]
14711
+  (0.7ms) commit transaction
14712
+ -----------------------------------------------------------------------------------------
14713
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
14714
+ -----------------------------------------------------------------------------------------
14715
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
14716
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14717
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = NULL WHERE "clark_kent_reports"."id" = 1
14718
+  (0.0ms) begin transaction
14719
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
14720
+  (0.7ms) commit transaction
14721
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
14722
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14723
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14724
+  (1.9ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14725
+  (0.1ms) select sqlite_version(*)
14726
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14727
+  (0.8ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14728
+  (0.8ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14729
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14730
+  (0.1ms)  SELECT sql
14731
+ FROM sqlite_master
14732
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14733
+ UNION ALL
14734
+ SELECT sql
14735
+ FROM sqlite_temp_master
14736
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14737
+ 
14738
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14739
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14740
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14741
+  (0.1ms)  SELECT sql
14742
+ FROM sqlite_master
14743
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14744
+ UNION ALL
14745
+ SELECT sql
14746
+ FROM sqlite_temp_master
14747
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14748
+ 
14749
+  (0.8ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14750
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14751
+  (0.8ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14752
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14753
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14754
+  (1.2ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14755
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14756
+  (0.1ms) SELECT version FROM "schema_migrations"
14757
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14758
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14759
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14760
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14761
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14762
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14763
+  (0.1ms) begin transaction
14764
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:23:49.874083"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:23:49.874083"]]
14765
+  (0.7ms) commit transaction
14766
+  (0.0ms) begin transaction
14767
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14768
+  (0.6ms) commit transaction
14769
+  (0.0ms) begin transaction
14770
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14771
+  (0.7ms) commit transaction
14772
+  (0.1ms) begin transaction
14773
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14774
+  (0.7ms) commit transaction
14775
+  (0.1ms) begin transaction
14776
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14777
+  (0.7ms) commit transaction
14778
+  (0.1ms) begin transaction
14779
+ SQL (0.4ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14780
+  (0.8ms) commit transaction
14781
+  (0.0ms) begin transaction
14782
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
14783
+  (0.7ms) commit transaction
14784
+  (0.1ms) begin transaction
14785
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:23:49.922184"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:23:49.922184"], ["user_id", 1]]
14786
+  (1.0ms) commit transaction
14787
+ -----------------------------------------------------------------------------------------
14788
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
14789
+ -----------------------------------------------------------------------------------------
14790
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
14791
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14792
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = NULL WHERE "clark_kent_reports"."id" = 1
14793
+  (0.0ms) begin transaction
14794
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
14795
+  (0.7ms) commit transaction
14796
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
14797
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14798
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14799
+  (1.8ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14800
+  (0.1ms) select sqlite_version(*)
14801
+  (1.2ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14802
+  (1.0ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14803
+  (1.0ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14804
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14805
+  (0.1ms)  SELECT sql
14806
+ FROM sqlite_master
14807
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14808
+ UNION ALL
14809
+ SELECT sql
14810
+ FROM sqlite_temp_master
14811
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14812
+ 
14813
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14814
+  (1.1ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14815
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14816
+  (0.1ms)  SELECT sql
14817
+ FROM sqlite_master
14818
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14819
+ UNION ALL
14820
+ SELECT sql
14821
+ FROM sqlite_temp_master
14822
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14823
+ 
14824
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14825
+  (0.8ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14826
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14827
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14828
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14829
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14830
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14831
+  (0.1ms) SELECT version FROM "schema_migrations"
14832
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14833
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14834
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14835
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14836
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14837
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14838
+  (0.1ms) begin transaction
14839
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:24:11.247244"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:24:11.247244"]]
14840
+  (1.0ms) commit transaction
14841
+  (0.1ms) begin transaction
14842
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14843
+  (0.8ms) commit transaction
14844
+  (0.0ms) begin transaction
14845
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14846
+  (0.7ms) commit transaction
14847
+  (0.0ms) begin transaction
14848
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14849
+  (0.7ms) commit transaction
14850
+  (0.0ms) begin transaction
14851
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14852
+  (0.7ms) commit transaction
14853
+  (0.1ms) begin transaction
14854
+ SQL (0.3ms) INSERT INTO "users" ("email", "name") VALUES (?, ?) [["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14855
+  (0.8ms) commit transaction
14856
+  (0.0ms) begin transaction
14857
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
14858
+  (0.9ms) commit transaction
14859
+  (0.1ms) begin transaction
14860
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:24:11.295599"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:24:11.295599"], ["user_id", 1]]
14861
+  (0.6ms) commit transaction
14862
+ -----------------------------------------------------------------------------------------
14863
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
14864
+ -----------------------------------------------------------------------------------------
14865
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
14866
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14867
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = NULL WHERE "clark_kent_reports"."id" = 1
14868
+  (0.0ms) begin transaction
14869
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
14870
+  (0.7ms) commit transaction
14871
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
14872
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14873
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14874
+  (1.7ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14875
+  (0.1ms) select sqlite_version(*)
14876
+  (0.9ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14877
+  (0.8ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14878
+  (0.8ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14879
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14880
+  (0.1ms)  SELECT sql
14881
+ FROM sqlite_master
14882
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14883
+ UNION ALL
14884
+ SELECT sql
14885
+ FROM sqlite_temp_master
14886
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14887
+ 
14888
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14889
+  (0.8ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14890
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14891
+  (0.1ms)  SELECT sql
14892
+ FROM sqlite_master
14893
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14894
+ UNION ALL
14895
+ SELECT sql
14896
+ FROM sqlite_temp_master
14897
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14898
+ 
14899
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14900
+  (0.8ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14901
+  (0.8ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14902
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14903
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14904
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14905
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14906
+  (0.1ms) SELECT version FROM "schema_migrations"
14907
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14908
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14909
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14910
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14911
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14912
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14913
+  (0.1ms) begin transaction
14914
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:24:44.296222"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:24:44.296222"]]
14915
+  (0.8ms) commit transaction
14916
+  (0.1ms) begin transaction
14917
+ SQL (0.4ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14918
+  (1.0ms) commit transaction
14919
+  (0.1ms) begin transaction
14920
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14921
+  (0.9ms) commit transaction
14922
+  (0.1ms) begin transaction
14923
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
14924
+  (0.7ms) commit transaction
14925
+  (0.0ms) begin transaction
14926
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
14927
+  (0.7ms) commit transaction
14928
+  (0.1ms) begin transaction
14929
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
14930
+  (0.7ms) commit transaction
14931
+  (0.1ms) begin transaction
14932
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
14933
+  (0.7ms) commit transaction
14934
+  (0.0ms) begin transaction
14935
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:24:44.345441"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:24:44.345441"], ["user_id", 1]]
14936
+  (1.0ms) commit transaction
14937
+ -----------------------------------------------------------------------------------------
14938
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
14939
+ -----------------------------------------------------------------------------------------
14940
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
14941
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
14942
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
14943
+  (0.1ms) begin transaction
14944
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
14945
+  (0.7ms) commit transaction
14946
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
14947
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
14948
+ ClarkKent::ReportFilter Load (0.3ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
14949
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
14950
+  (2.0ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
14951
+  (0.2ms) select sqlite_version(*)
14952
+  (1.2ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
14953
+  (1.0ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
14954
+  (1.1ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
14955
+  (1.1ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
14956
+  (0.2ms)  SELECT sql
14957
+ FROM sqlite_master
14958
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14959
+ UNION ALL
14960
+ SELECT sql
14961
+ FROM sqlite_temp_master
14962
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
14963
+ 
14964
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
14965
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
14966
+  (1.1ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
14967
+  (0.1ms)  SELECT sql
14968
+ FROM sqlite_master
14969
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14970
+ UNION ALL
14971
+ SELECT sql
14972
+ FROM sqlite_temp_master
14973
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
14974
+ 
14975
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
14976
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
14977
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
14978
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
14979
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
14980
+  (0.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
14981
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14982
+  (0.1ms) SELECT version FROM "schema_migrations"
14983
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
14984
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
14985
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
14986
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
14987
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
14988
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
14989
+  (0.1ms) begin transaction
14990
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:26:16.741934"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:26:16.741934"]]
14991
+  (0.8ms) commit transaction
14992
+  (0.0ms) begin transaction
14993
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
14994
+  (0.8ms) commit transaction
14995
+  (0.1ms) begin transaction
14996
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
14997
+  (0.7ms) commit transaction
14998
+  (0.0ms) begin transaction
14999
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15000
+  (0.7ms) commit transaction
15001
+  (0.1ms) begin transaction
15002
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15003
+  (0.7ms) commit transaction
15004
+  (0.1ms) begin transaction
15005
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15006
+  (0.7ms) commit transaction
15007
+  (0.0ms) begin transaction
15008
+ SQL (0.4ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15009
+  (0.7ms) commit transaction
15010
+  (0.1ms) begin transaction
15011
+ SQL (0.4ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:26:16.785690"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:26:16.785690"], ["user_id", 1]]
15012
+  (0.7ms) commit transaction
15013
+ -----------------------------------------------------------------------------------------
15014
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15015
+ -----------------------------------------------------------------------------------------
15016
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15017
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15018
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15019
+  (0.0ms) begin transaction
15020
+ SQL (0.4ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15021
+  (0.8ms) commit transaction
15022
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15023
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15024
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15025
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15026
+ ClarkKent::ReportEmail Load (0.2ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15027
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15028
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15029
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15030
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15031
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15032
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15033
+  (2.0ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15034
+  (0.1ms) select sqlite_version(*)
15035
+  (1.2ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15036
+  (1.1ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15037
+  (1.1ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15038
+  (1.1ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15039
+  (0.2ms)  SELECT sql
15040
+ FROM sqlite_master
15041
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15042
+ UNION ALL
15043
+ SELECT sql
15044
+ FROM sqlite_temp_master
15045
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15046
+ 
15047
+  (1.0ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15048
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15049
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15050
+  (0.1ms)  SELECT sql
15051
+ FROM sqlite_master
15052
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15053
+ UNION ALL
15054
+ SELECT sql
15055
+ FROM sqlite_temp_master
15056
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15057
+ 
15058
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15059
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15060
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15061
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15062
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15063
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15064
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15065
+  (0.1ms) SELECT version FROM "schema_migrations"
15066
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15067
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15068
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15069
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15070
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15071
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15072
+  (0.1ms) begin transaction
15073
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-16 23:34:19.324339"], ["resource_type", "Order"], ["updated_at", "2015-03-16 23:34:19.324339"]]
15074
+  (1.0ms) commit transaction
15075
+  (0.1ms) begin transaction
15076
+ SQL (0.4ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15077
+  (1.0ms) commit transaction
15078
+  (0.1ms) begin transaction
15079
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15080
+  (0.8ms) commit transaction
15081
+  (0.1ms) begin transaction
15082
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15083
+  (0.8ms) commit transaction
15084
+  (0.0ms) begin transaction
15085
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15086
+  (0.7ms) commit transaction
15087
+  (0.1ms) begin transaction
15088
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15089
+  (1.0ms) commit transaction
15090
+  (0.1ms) begin transaction
15091
+ SQL (0.5ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15092
+  (0.8ms) commit transaction
15093
+  (0.0ms) begin transaction
15094
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-16 23:34:19.378951"], ["description", "Guitar strings"], ["updated_at", "2015-03-16 23:34:19.378951"], ["user_id", 1]]
15095
+  (0.7ms) commit transaction
15096
+ ---------------------------------------------------
15097
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15098
+ ---------------------------------------------------
15099
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15100
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15101
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15102
+  (0.0ms) begin transaction
15103
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15104
+  (0.7ms) commit transaction
15105
+ -----------------------------------------------------------------------------------------
15106
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15107
+ -----------------------------------------------------------------------------------------
15108
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15109
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15110
+ SQL (0.8ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15111
+  (0.0ms) begin transaction
15112
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15113
+  (0.7ms) commit transaction
15114
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15115
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15116
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15117
+ Department Load (0.2ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15118
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15119
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15120
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15121
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15122
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15123
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15124
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15125
+  (1.0ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15126
+  (0.5ms) select sqlite_version(*)
15127
+  (1.4ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15128
+  (0.8ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15129
+  (0.8ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15130
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15131
+  (0.1ms)  SELECT sql
15132
+ FROM sqlite_master
15133
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15134
+ UNION ALL
15135
+ SELECT sql
15136
+ FROM sqlite_temp_master
15137
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15138
+ 
15139
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15140
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15141
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15142
+  (0.1ms)  SELECT sql
15143
+ FROM sqlite_master
15144
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15145
+ UNION ALL
15146
+ SELECT sql
15147
+ FROM sqlite_temp_master
15148
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15149
+ 
15150
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15151
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15152
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15153
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15154
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15155
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15156
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15157
+  (0.1ms) SELECT version FROM "schema_migrations"
15158
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15159
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15160
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15161
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15162
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15163
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15164
+  (0.1ms) begin transaction
15165
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 13:14:00.328386"], ["resource_type", "Order"], ["updated_at", "2015-03-17 13:14:00.328386"]]
15166
+  (0.7ms) commit transaction
15167
+  (0.0ms) begin transaction
15168
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15169
+  (0.7ms) commit transaction
15170
+  (0.0ms) begin transaction
15171
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15172
+  (0.7ms) commit transaction
15173
+  (0.0ms) begin transaction
15174
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15175
+  (0.7ms) commit transaction
15176
+  (0.0ms) begin transaction
15177
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15178
+  (0.7ms) commit transaction
15179
+  (0.0ms) begin transaction
15180
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15181
+  (0.7ms) commit transaction
15182
+  (0.1ms) begin transaction
15183
+ SQL (0.4ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15184
+  (0.8ms) commit transaction
15185
+  (0.1ms) begin transaction
15186
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 13:14:00.380920"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 13:14:00.380920"], ["user_id", 1]]
15187
+  (0.8ms) commit transaction
15188
+ ---------------------------------------------------
15189
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15190
+ ---------------------------------------------------
15191
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15192
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15193
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15194
+  (0.0ms) begin transaction
15195
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15196
+  (0.8ms) commit transaction
15197
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15198
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15199
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15200
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15201
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15202
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15203
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15204
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15205
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15206
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15207
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15208
+ -----------------------------------------------------------------------------------------
15209
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15210
+ -----------------------------------------------------------------------------------------
15211
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15212
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15213
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15214
+  (0.1ms) begin transaction
15215
+ SQL (0.2ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15216
+  (0.6ms) commit transaction
15217
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15218
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15219
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15220
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15221
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15222
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15223
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15224
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15225
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15226
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15227
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15228
+  (1.9ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15229
+  (0.1ms) select sqlite_version(*)
15230
+  (1.1ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15231
+  (1.2ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15232
+  (1.1ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15233
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15234
+  (0.1ms)  SELECT sql
15235
+ FROM sqlite_master
15236
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15237
+ UNION ALL
15238
+ SELECT sql
15239
+ FROM sqlite_temp_master
15240
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15241
+ 
15242
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15243
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15244
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15245
+  (0.1ms)  SELECT sql
15246
+ FROM sqlite_master
15247
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15248
+ UNION ALL
15249
+ SELECT sql
15250
+ FROM sqlite_temp_master
15251
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15252
+ 
15253
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15254
+  (1.1ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15255
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15256
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15257
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15258
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15259
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15260
+  (0.1ms) SELECT version FROM "schema_migrations"
15261
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15262
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15263
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15264
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15265
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15266
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15267
+  (0.1ms) begin transaction
15268
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 13:21:39.244129"], ["resource_type", "Order"], ["updated_at", "2015-03-17 13:21:39.244129"]]
15269
+  (0.8ms) commit transaction
15270
+  (0.0ms) begin transaction
15271
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15272
+  (0.7ms) commit transaction
15273
+  (0.0ms) begin transaction
15274
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15275
+  (0.7ms) commit transaction
15276
+  (0.0ms) begin transaction
15277
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15278
+  (0.7ms) commit transaction
15279
+  (0.0ms) begin transaction
15280
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15281
+  (0.7ms) commit transaction
15282
+  (0.0ms) begin transaction
15283
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15284
+  (0.9ms) commit transaction
15285
+  (0.1ms) begin transaction
15286
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15287
+  (0.9ms) commit transaction
15288
+  (0.1ms) begin transaction
15289
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 13:21:39.290778"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 13:21:39.290778"], ["user_id", 1]]
15290
+  (0.9ms) commit transaction
15291
+ ---------------------------------------------------
15292
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15293
+ ---------------------------------------------------
15294
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15295
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15296
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15297
+  (0.1ms) begin transaction
15298
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15299
+  (0.7ms) commit transaction
15300
+  (0.1ms) begin transaction
15301
+ SQL (0.5ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 13:21:39.334294"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 13:21:39.334294"]]
15302
+  (0.8ms) commit transaction
15303
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15304
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15305
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15306
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15307
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15308
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15309
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15310
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15311
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15312
+ -----------------------------------------------------------------------------------------
15313
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15314
+ -----------------------------------------------------------------------------------------
15315
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15316
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15317
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15318
+  (0.1ms) begin transaction
15319
+ SQL (0.2ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15320
+  (0.7ms) commit transaction
15321
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15322
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15323
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15324
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15325
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15326
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15327
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15328
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15329
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15330
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15331
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15332
+  (2.0ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15333
+  (0.1ms) select sqlite_version(*)
15334
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15335
+  (0.8ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15336
+  (0.8ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15337
+  (0.7ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15338
+  (0.2ms)  SELECT sql
15339
+ FROM sqlite_master
15340
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15341
+ UNION ALL
15342
+ SELECT sql
15343
+ FROM sqlite_temp_master
15344
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15345
+ 
15346
+  (0.7ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15347
+  (0.8ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15348
+  (0.8ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15349
+  (0.1ms)  SELECT sql
15350
+ FROM sqlite_master
15351
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15352
+ UNION ALL
15353
+ SELECT sql
15354
+ FROM sqlite_temp_master
15355
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15356
+ 
15357
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15358
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15359
+  (0.8ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15360
+  (0.7ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15361
+  (0.7ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15362
+  (4.9ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15363
+  (1.4ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15364
+  (0.1ms) SELECT version FROM "schema_migrations"
15365
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15366
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15367
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15368
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15369
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15370
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15371
+  (0.1ms) begin transaction
15372
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 13:22:23.632678"], ["resource_type", "Order"], ["updated_at", "2015-03-17 13:22:23.632678"]]
15373
+  (0.8ms) commit transaction
15374
+  (0.0ms) begin transaction
15375
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15376
+  (0.8ms) commit transaction
15377
+  (0.0ms) begin transaction
15378
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15379
+  (0.7ms) commit transaction
15380
+  (0.0ms) begin transaction
15381
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15382
+  (0.7ms) commit transaction
15383
+  (0.0ms) begin transaction
15384
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15385
+  (0.6ms) commit transaction
15386
+  (0.0ms) begin transaction
15387
+ SQL (0.5ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15388
+  (0.7ms) commit transaction
15389
+  (0.0ms) begin transaction
15390
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15391
+  (0.7ms) commit transaction
15392
+  (0.0ms) begin transaction
15393
+ SQL (0.4ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 13:22:23.676440"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 13:22:23.676440"], ["user_id", 1]]
15394
+  (0.7ms) commit transaction
15395
+ ---------------------------------------------------
15396
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15397
+ ---------------------------------------------------
15398
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15399
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15400
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15401
+  (0.0ms) begin transaction
15402
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15403
+  (0.7ms) commit transaction
15404
+  (0.0ms) begin transaction
15405
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 13:22:23.715364"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 13:22:23.715364"]]
15406
+  (0.6ms) commit transaction
15407
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15408
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15409
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15410
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15411
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15412
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15413
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15414
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15415
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15416
+ -----------------------------------------------------------------------------------------
15417
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15418
+ -----------------------------------------------------------------------------------------
15419
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15420
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15421
+ SQL (1.1ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15422
+  (0.1ms) begin transaction
15423
+ SQL (0.2ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15424
+  (0.7ms) commit transaction
15425
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15426
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15427
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15428
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15429
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15430
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15431
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15432
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15433
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15434
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15435
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15436
+  (1.3ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15437
+  (0.1ms) select sqlite_version(*)
15438
+  (1.2ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15439
+  (1.1ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15440
+  (1.2ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15441
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15442
+  (0.1ms)  SELECT sql
15443
+ FROM sqlite_master
15444
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15445
+ UNION ALL
15446
+ SELECT sql
15447
+ FROM sqlite_temp_master
15448
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15449
+ 
15450
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15451
+  (1.1ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15452
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15453
+  (0.1ms)  SELECT sql
15454
+ FROM sqlite_master
15455
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15456
+ UNION ALL
15457
+ SELECT sql
15458
+ FROM sqlite_temp_master
15459
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15460
+ 
15461
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15462
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15463
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15464
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15465
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15466
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15467
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15468
+  (0.1ms) SELECT version FROM "schema_migrations"
15469
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15470
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15471
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15472
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15473
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15474
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15475
+  (0.1ms) begin transaction
15476
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 14:51:34.776268"], ["resource_type", "Order"], ["updated_at", "2015-03-17 14:51:34.776268"]]
15477
+  (1.0ms) commit transaction
15478
+  (0.1ms) begin transaction
15479
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15480
+  (0.8ms) commit transaction
15481
+  (0.0ms) begin transaction
15482
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15483
+  (0.7ms) commit transaction
15484
+  (0.0ms) begin transaction
15485
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15486
+  (0.7ms) commit transaction
15487
+  (0.0ms) begin transaction
15488
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15489
+  (0.6ms) commit transaction
15490
+  (0.1ms) begin transaction
15491
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15492
+  (0.7ms) commit transaction
15493
+  (0.0ms) begin transaction
15494
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15495
+  (0.7ms) commit transaction
15496
+  (0.1ms) begin transaction
15497
+ SQL (0.4ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 14:51:34.824258"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 14:51:34.824258"], ["user_id", 1]]
15498
+  (0.8ms) commit transaction
15499
+ ---------------------------------------------------
15500
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15501
+ ---------------------------------------------------
15502
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15503
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15504
+ SQL (1.2ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15505
+  (0.0ms) begin transaction
15506
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15507
+  (0.9ms) commit transaction
15508
+  (0.1ms) begin transaction
15509
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 14:51:34.873269"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 14:51:34.873269"]]
15510
+  (0.7ms) commit transaction
15511
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15512
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15513
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15514
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15515
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15516
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15517
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15518
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15519
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15520
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15521
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15522
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15523
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15524
+  (0.1ms) SELECT COUNT(*) FROM "orders"
15525
+ -----------------------------------------------------------------------------------------
15526
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15527
+ -----------------------------------------------------------------------------------------
15528
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15529
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15530
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15531
+  (0.1ms) begin transaction
15532
+ SQL (0.2ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15533
+  (0.7ms) commit transaction
15534
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15535
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15536
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15537
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15538
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15539
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15540
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15541
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15542
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15543
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15544
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15545
+  (1.2ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15546
+  (0.1ms) select sqlite_version(*)
15547
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15548
+  (0.9ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15549
+  (1.0ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15550
+  (1.1ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15551
+  (0.1ms)  SELECT sql
15552
+ FROM sqlite_master
15553
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15554
+ UNION ALL
15555
+ SELECT sql
15556
+ FROM sqlite_temp_master
15557
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15558
+ 
15559
+  (1.0ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15560
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15561
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15562
+  (0.1ms)  SELECT sql
15563
+ FROM sqlite_master
15564
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15565
+ UNION ALL
15566
+ SELECT sql
15567
+ FROM sqlite_temp_master
15568
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15569
+ 
15570
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15571
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15572
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15573
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15574
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15575
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15576
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15577
+  (0.1ms) SELECT version FROM "schema_migrations"
15578
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15579
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15580
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15581
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15582
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15583
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15584
+  (0.0ms) begin transaction
15585
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:18:50.832734"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:18:50.832734"]]
15586
+  (0.7ms) commit transaction
15587
+  (0.1ms) begin transaction
15588
+ SQL (0.4ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15589
+  (1.1ms) commit transaction
15590
+  (0.1ms) begin transaction
15591
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15592
+  (0.9ms) commit transaction
15593
+  (0.1ms) begin transaction
15594
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15595
+  (0.8ms) commit transaction
15596
+  (0.1ms) begin transaction
15597
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15598
+  (0.7ms) commit transaction
15599
+  (0.1ms) begin transaction
15600
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15601
+  (0.8ms) commit transaction
15602
+  (0.1ms) begin transaction
15603
+ SQL (0.4ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15604
+  (0.8ms) commit transaction
15605
+  (0.1ms) begin transaction
15606
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:18:50.885399"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:18:50.885399"], ["user_id", 1]]
15607
+  (0.9ms) commit transaction
15608
+ ---------------------------------------------------
15609
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15610
+ ---------------------------------------------------
15611
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15612
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15613
+ SQL (1.3ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15614
+  (0.1ms) begin transaction
15615
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15616
+  (0.9ms) commit transaction
15617
+  (0.0ms) begin transaction
15618
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:18:50.935816"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:18:50.935816"]]
15619
+  (0.8ms) commit transaction
15620
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15621
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15622
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15623
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15624
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15625
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15626
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15627
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15628
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15629
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15630
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15631
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15632
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15633
+  (0.1ms) SELECT COUNT(*) FROM "orders"
15634
+ -----------------------------------------------------------------------------------------
15635
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15636
+ -----------------------------------------------------------------------------------------
15637
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15638
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15639
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15640
+  (0.1ms) begin transaction
15641
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15642
+  (0.8ms) commit transaction
15643
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15644
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15645
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15646
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15647
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15648
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15649
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15650
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15651
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15652
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15653
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15654
+  (2.0ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15655
+  (0.1ms) select sqlite_version(*)
15656
+  (1.2ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15657
+  (1.1ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15658
+  (1.2ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15659
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15660
+  (0.1ms)  SELECT sql
15661
+ FROM sqlite_master
15662
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15663
+ UNION ALL
15664
+ SELECT sql
15665
+ FROM sqlite_temp_master
15666
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15667
+ 
15668
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15669
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15670
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15671
+  (0.1ms)  SELECT sql
15672
+ FROM sqlite_master
15673
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15674
+ UNION ALL
15675
+ SELECT sql
15676
+ FROM sqlite_temp_master
15677
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15678
+ 
15679
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15680
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15681
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15682
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15683
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15684
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15685
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15686
+  (0.1ms) SELECT version FROM "schema_migrations"
15687
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15688
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15689
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15690
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15691
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15692
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15693
+  (0.1ms) begin transaction
15694
+ SQL (0.3ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:26:50.966611"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:26:50.966611"]]
15695
+  (1.0ms) commit transaction
15696
+  (0.0ms) begin transaction
15697
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15698
+  (0.9ms) commit transaction
15699
+  (0.1ms) begin transaction
15700
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15701
+  (0.9ms) commit transaction
15702
+  (0.1ms) begin transaction
15703
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15704
+  (0.8ms) commit transaction
15705
+  (0.0ms) begin transaction
15706
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15707
+  (0.7ms) commit transaction
15708
+  (0.0ms) begin transaction
15709
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15710
+  (0.9ms) commit transaction
15711
+  (0.1ms) begin transaction
15712
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15713
+  (0.7ms) commit transaction
15714
+  (0.0ms) begin transaction
15715
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:26:51.013443"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:26:51.013443"], ["user_id", 1]]
15716
+  (0.7ms) commit transaction
15717
+ ---------------------------------------------------
15718
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15719
+ ---------------------------------------------------
15720
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15721
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15722
+ SQL (1.2ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15723
+  (0.1ms) begin transaction
15724
+ SQL (0.4ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15725
+  (0.8ms) commit transaction
15726
+  (0.0ms) begin transaction
15727
+ SQL (0.5ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:26:51.061469"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:26:51.061469"]]
15728
+  (0.7ms) commit transaction
15729
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15730
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15731
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15732
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15733
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15734
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15735
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15736
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15737
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15738
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15739
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15740
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15741
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15742
+  (0.1ms) SELECT COUNT(*) FROM "orders"
15743
+ -----------------------------------------------------------------------------------------
15744
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15745
+ -----------------------------------------------------------------------------------------
15746
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15747
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15748
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15749
+  (0.1ms) begin transaction
15750
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15751
+  (0.7ms) commit transaction
15752
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15753
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15754
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15755
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15756
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15757
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15758
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15759
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15760
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15761
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15762
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15763
+  (1.8ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15764
+  (0.1ms) select sqlite_version(*)
15765
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15766
+  (1.0ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15767
+  (1.0ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15768
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15769
+  (0.1ms)  SELECT sql
15770
+ FROM sqlite_master
15771
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15772
+ UNION ALL
15773
+ SELECT sql
15774
+ FROM sqlite_temp_master
15775
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15776
+ 
15777
+  (1.0ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15778
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15779
+  (1.1ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15780
+  (0.1ms)  SELECT sql
15781
+ FROM sqlite_master
15782
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15783
+ UNION ALL
15784
+ SELECT sql
15785
+ FROM sqlite_temp_master
15786
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15787
+ 
15788
+  (0.8ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15789
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15790
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15791
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15792
+  (1.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15793
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15794
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15795
+  (0.1ms) SELECT version FROM "schema_migrations"
15796
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15797
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15798
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15799
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15800
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15801
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15802
+  (0.0ms) begin transaction
15803
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:27:26.693307"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:27:26.693307"]]
15804
+  (1.0ms) commit transaction
15805
+  (0.1ms) begin transaction
15806
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15807
+  (0.9ms) commit transaction
15808
+  (0.1ms) begin transaction
15809
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15810
+  (0.9ms) commit transaction
15811
+  (0.1ms) begin transaction
15812
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15813
+  (0.7ms) commit transaction
15814
+  (0.0ms) begin transaction
15815
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15816
+  (0.7ms) commit transaction
15817
+  (0.0ms) begin transaction
15818
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15819
+  (0.7ms) commit transaction
15820
+  (0.1ms) begin transaction
15821
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15822
+  (0.7ms) commit transaction
15823
+  (0.1ms) begin transaction
15824
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:27:26.744473"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:27:26.744473"], ["user_id", 1]]
15825
+  (1.0ms) commit transaction
15826
+ ---------------------------------------------------
15827
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15828
+ ---------------------------------------------------
15829
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15830
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15831
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15832
+  (0.1ms) begin transaction
15833
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15834
+  (0.7ms) commit transaction
15835
+  (0.0ms) begin transaction
15836
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:27:26.787407"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:27:26.787407"]]
15837
+  (0.8ms) commit transaction
15838
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15839
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15840
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15841
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15842
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15843
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15844
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15845
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15846
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15847
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15848
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15849
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15850
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15851
+  (0.1ms) SELECT COUNT(*) FROM "orders"
15852
+ -----------------------------------------------------------------------------------------
15853
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15854
+ -----------------------------------------------------------------------------------------
15855
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15856
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15857
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15858
+  (0.0ms) begin transaction
15859
+ SQL (0.2ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15860
+  (0.7ms) commit transaction
15861
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15862
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15863
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15864
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15865
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15866
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15867
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15868
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15869
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15870
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15871
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15872
+  (1.9ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15873
+  (0.1ms) select sqlite_version(*)
15874
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15875
+  (0.8ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15876
+  (0.9ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15877
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15878
+  (0.1ms)  SELECT sql
15879
+ FROM sqlite_master
15880
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15881
+ UNION ALL
15882
+ SELECT sql
15883
+ FROM sqlite_temp_master
15884
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15885
+ 
15886
+  (0.8ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15887
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15888
+  (1.1ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15889
+  (0.1ms)  SELECT sql
15890
+ FROM sqlite_master
15891
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15892
+ UNION ALL
15893
+ SELECT sql
15894
+ FROM sqlite_temp_master
15895
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
15896
+ 
15897
+  (0.8ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
15898
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
15899
+  (0.8ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
15900
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
15901
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
15902
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
15903
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
15904
+  (0.1ms) SELECT version FROM "schema_migrations"
15905
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
15906
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
15907
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
15908
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
15909
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
15910
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
15911
+  (0.1ms) begin transaction
15912
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:31:24.157630"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:31:24.157630"]]
15913
+  (0.8ms) commit transaction
15914
+  (0.1ms) begin transaction
15915
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
15916
+  (0.7ms) commit transaction
15917
+  (0.1ms) begin transaction
15918
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
15919
+  (0.7ms) commit transaction
15920
+  (0.0ms) begin transaction
15921
+ SQL (0.6ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
15922
+  (0.7ms) commit transaction
15923
+  (0.1ms) begin transaction
15924
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
15925
+  (0.8ms) commit transaction
15926
+  (0.0ms) begin transaction
15927
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
15928
+  (0.9ms) commit transaction
15929
+  (0.1ms) begin transaction
15930
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
15931
+  (0.9ms) commit transaction
15932
+  (0.1ms) begin transaction
15933
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:31:24.208898"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:31:24.208898"], ["user_id", 1]]
15934
+  (1.0ms) commit transaction
15935
+ ---------------------------------------------------
15936
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
15937
+ ---------------------------------------------------
15938
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15939
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15940
+ SQL (1.3ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15941
+  (0.1ms) begin transaction
15942
+ SQL (0.4ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15943
+  (0.7ms) commit transaction
15944
+  (0.1ms) begin transaction
15945
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:31:24.260562"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:31:24.260562"]]
15946
+  (1.1ms) commit transaction
15947
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15948
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15949
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15950
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15951
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
15952
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15953
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15954
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15955
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
15956
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15957
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15958
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15959
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15960
+  (0.1ms) SELECT COUNT(*) FROM "orders"
15961
+ -----------------------------------------------------------------------------------------
15962
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
15963
+ -----------------------------------------------------------------------------------------
15964
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
15965
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
15966
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
15967
+  (0.1ms) begin transaction
15968
+ SQL (0.2ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
15969
+  (0.7ms) commit transaction
15970
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
15971
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15972
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15973
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
15974
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
15975
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
15976
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
15977
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
15978
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
15979
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15980
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
15981
+  (1.8ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
15982
+  (0.1ms) select sqlite_version(*)
15983
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
15984
+  (0.9ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
15985
+  (1.0ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
15986
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
15987
+  (0.1ms)  SELECT sql
15988
+ FROM sqlite_master
15989
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15990
+ UNION ALL
15991
+ SELECT sql
15992
+ FROM sqlite_temp_master
15993
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
15994
+ 
15995
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
15996
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
15997
+  (1.0ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
15998
+  (0.1ms)  SELECT sql
15999
+ FROM sqlite_master
16000
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16001
+ UNION ALL
16002
+ SELECT sql
16003
+ FROM sqlite_temp_master
16004
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16005
+ 
16006
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
16007
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
16008
+  (0.8ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
16009
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
16010
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
16011
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
16012
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
16013
+  (0.1ms) SELECT version FROM "schema_migrations"
16014
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
16015
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
16016
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
16017
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
16018
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
16019
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
16020
+  (0.1ms) begin transaction
16021
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:31:55.954307"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:31:55.954307"]]
16022
+  (1.1ms) commit transaction
16023
+  (0.1ms) begin transaction
16024
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
16025
+  (0.8ms) commit transaction
16026
+  (0.0ms) begin transaction
16027
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
16028
+  (0.7ms) commit transaction
16029
+  (0.0ms) begin transaction
16030
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
16031
+  (0.8ms) commit transaction
16032
+  (0.0ms) begin transaction
16033
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
16034
+  (0.7ms) commit transaction
16035
+  (0.1ms) begin transaction
16036
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
16037
+  (0.7ms) commit transaction
16038
+  (0.0ms) begin transaction
16039
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
16040
+  (1.0ms) commit transaction
16041
+  (0.1ms) begin transaction
16042
+ SQL (0.6ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:31:56.005366"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:31:56.005366"], ["user_id", 1]]
16043
+  (0.7ms) commit transaction
16044
+ ---------------------------------------------------
16045
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
16046
+ ---------------------------------------------------
16047
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16048
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16049
+ SQL (1.1ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16050
+  (0.0ms) begin transaction
16051
+ SQL (0.5ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16052
+  (0.7ms) commit transaction
16053
+  (0.1ms) begin transaction
16054
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:31:56.055152"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:31:56.055152"]]
16055
+  (0.8ms) commit transaction
16056
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16057
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16058
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16059
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16060
+ ClarkKent::ReportEmail Load (0.2ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
16061
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16062
+ ClarkKent::ReportColumn Load (0.3ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16063
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16064
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
16065
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16066
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16067
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16068
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16069
+  (0.1ms) SELECT COUNT(*) FROM "orders"
16070
+ -----------------------------------------------------------------------------------------
16071
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
16072
+ -----------------------------------------------------------------------------------------
16073
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16074
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16075
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16076
+  (0.1ms) begin transaction
16077
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16078
+  (0.7ms) commit transaction
16079
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16080
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16081
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16082
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16083
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
16084
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16085
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16086
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16087
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
16088
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16089
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16090
+  (1.8ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
16091
+  (0.1ms) select sqlite_version(*)
16092
+  (1.1ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
16093
+  (1.0ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
16094
+  (0.9ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
16095
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
16096
+  (0.1ms)  SELECT sql
16097
+ FROM sqlite_master
16098
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
16099
+ UNION ALL
16100
+ SELECT sql
16101
+ FROM sqlite_temp_master
16102
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
16103
+ 
16104
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
16105
+  (1.1ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
16106
+  (1.1ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
16107
+  (0.1ms)  SELECT sql
16108
+ FROM sqlite_master
16109
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16110
+ UNION ALL
16111
+ SELECT sql
16112
+ FROM sqlite_temp_master
16113
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16114
+ 
16115
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
16116
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
16117
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
16118
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
16119
+  (0.9ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
16120
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
16121
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
16122
+  (0.1ms) SELECT version FROM "schema_migrations"
16123
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
16124
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
16125
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
16126
+  (1.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
16127
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
16128
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
16129
+  (0.1ms) begin transaction
16130
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:32:07.315042"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:32:07.315042"]]
16131
+  (1.2ms) commit transaction
16132
+  (0.0ms) begin transaction
16133
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
16134
+  (0.8ms) commit transaction
16135
+  (0.0ms) begin transaction
16136
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
16137
+  (0.7ms) commit transaction
16138
+  (0.0ms) begin transaction
16139
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
16140
+  (0.7ms) commit transaction
16141
+  (0.0ms) begin transaction
16142
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
16143
+  (0.7ms) commit transaction
16144
+  (0.0ms) begin transaction
16145
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
16146
+  (0.7ms) commit transaction
16147
+  (0.1ms) begin transaction
16148
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
16149
+  (0.8ms) commit transaction
16150
+  (0.1ms) begin transaction
16151
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:32:07.363045"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:32:07.363045"], ["user_id", 1]]
16152
+  (0.7ms) commit transaction
16153
+ ---------------------------------------------------
16154
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
16155
+ ---------------------------------------------------
16156
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16157
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16158
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16159
+  (0.0ms) begin transaction
16160
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16161
+  (0.7ms) commit transaction
16162
+  (0.0ms) begin transaction
16163
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:32:07.406989"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:32:07.406989"]]
16164
+  (0.8ms) commit transaction
16165
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16166
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16167
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16168
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16169
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
16170
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16171
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16172
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16173
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
16174
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16175
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16176
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16177
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16178
+  (0.1ms) SELECT COUNT(*) FROM "orders"
16179
+ -----------------------------------------------------------------------------------------
16180
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
16181
+ -----------------------------------------------------------------------------------------
16182
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16183
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16184
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16185
+  (0.1ms) begin transaction
16186
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16187
+  (0.8ms) commit transaction
16188
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16189
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16190
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16191
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16192
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
16193
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16194
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16195
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16196
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
16197
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16198
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16199
+  (1.9ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
16200
+  (0.1ms) select sqlite_version(*)
16201
+  (1.0ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
16202
+  (0.9ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
16203
+  (0.9ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
16204
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
16205
+  (0.1ms)  SELECT sql
16206
+ FROM sqlite_master
16207
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
16208
+ UNION ALL
16209
+ SELECT sql
16210
+ FROM sqlite_temp_master
16211
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
16212
+ 
16213
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
16214
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
16215
+  (1.2ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
16216
+  (0.1ms)  SELECT sql
16217
+ FROM sqlite_master
16218
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16219
+ UNION ALL
16220
+ SELECT sql
16221
+ FROM sqlite_temp_master
16222
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16223
+ 
16224
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
16225
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
16226
+  (0.8ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
16227
+  (0.8ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
16228
+  (0.8ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
16229
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
16230
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
16231
+  (0.1ms) SELECT version FROM "schema_migrations"
16232
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
16233
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
16234
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
16235
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
16236
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
16237
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
16238
+  (0.1ms) begin transaction
16239
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:32:44.479231"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:32:44.479231"]]
16240
+  (0.7ms) commit transaction
16241
+  (0.0ms) begin transaction
16242
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
16243
+  (0.9ms) commit transaction
16244
+  (0.1ms) begin transaction
16245
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
16246
+  (0.9ms) commit transaction
16247
+  (0.1ms) begin transaction
16248
+ SQL (0.4ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
16249
+  (0.9ms) commit transaction
16250
+  (0.1ms) begin transaction
16251
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
16252
+  (0.7ms) commit transaction
16253
+  (0.0ms) begin transaction
16254
+ SQL (0.3ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
16255
+  (1.0ms) commit transaction
16256
+  (0.1ms) begin transaction
16257
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
16258
+  (0.8ms) commit transaction
16259
+  (0.1ms) begin transaction
16260
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:32:44.529718"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:32:44.529718"], ["user_id", 1]]
16261
+  (0.8ms) commit transaction
16262
+ ------------------------------------------------------------------------------------------------
16263
+ ClarkKent::ReportTest: test_can't_save_without_a_sharing_scope_id_if_the_sharing_scope_is_custom
16264
+ ------------------------------------------------------------------------------------------------
16265
+  (0.1ms) begin transaction
16266
+  (0.1ms) rollback transaction
16267
+ ---------------------------------------------------
16268
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
16269
+ ---------------------------------------------------
16270
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16271
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16272
+ SQL (1.2ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16273
+  (0.0ms) begin transaction
16274
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16275
+  (0.6ms) commit transaction
16276
+  (0.0ms) begin transaction
16277
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:32:44.623188"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:32:44.623188"]]
16278
+  (0.7ms) commit transaction
16279
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16280
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16281
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16282
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16283
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
16284
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16285
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16286
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16287
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
16288
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16289
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16290
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16291
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16292
+  (0.1ms) SELECT COUNT(*) FROM "orders"
16293
+ -----------------------------------------------------------------------------------------
16294
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
16295
+ -----------------------------------------------------------------------------------------
16296
+ User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16297
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16298
+ SQL (0.9ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16299
+  (0.1ms) begin transaction
16300
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16301
+  (0.7ms) commit transaction
16302
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16303
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16304
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16305
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16306
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
16307
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16308
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16309
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16310
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
16311
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16312
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16313
+ -------------------------
16314
+ ClarkKentTest: test_truth
16315
+ -------------------------
16316
+ -----------------------------------------------------------
16317
+ ClarkKent::ReportsControllerTest: test_should_create_report
16318
+ -----------------------------------------------------------
16319
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16320
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16321
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
16322
+ Processing by ClarkKent::ReportsController#create as HTML
16323
+ Parameters: {"report"=>{"name"=>"delete me", "resource_type"=>"Order", "sharing_scope_id"=>"1", "sharing_scope_type"=>"Department"}, "current_user_id"=>"1"}
16324
+  (0.1ms) begin transaction
16325
+ SQL (0.5ms) INSERT INTO "clark_kent_reports" ("created_at", "name", "resource_type", "sharing_scope_id", "sharing_scope_type", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:32:44.734343"], ["name", "delete me"], ["resource_type", "Order"], ["sharing_scope_id", 1], ["sharing_scope_type", "Department"], ["updated_at", "2015-03-17 15:32:44.734343"]]
16326
+  (0.8ms) commit transaction
16327
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16328
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (3.9ms)
16329
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::Report"]]
16330
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_filters/_index.html.erb (2.8ms)
16331
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 2]]
16332
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_index.html.erb (2.0ms)
16333
+ ClarkKent::ReportEmail Load (0.2ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 2]]
16334
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_index.html.erb (1.8ms)
16335
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/edit.html.erb within layouts/application (20.5ms)
16336
+ Completed 200 OK in 45ms (Views: 40.5ms | ActiveRecord: 1.8ms)
16337
+  (0.2ms) SELECT COUNT(*) FROM "clark_kent_reports"
16338
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."name" = 'delete me' LIMIT 1
16339
+  (0.1ms) begin transaction
16340
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::Report"]]
16341
+ ClarkKent::ReportColumn Load (0.0ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 2]]
16342
+ ClarkKent::ReportEmail Load (0.0ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 2]]
16343
+ SQL (0.3ms) DELETE FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? [["id", 2]]
16344
+  (0.9ms) commit transaction
16345
+ ------------------------------------------------------------
16346
+ ClarkKent::ReportsControllerTest: test_should_destroy_report
16347
+ ------------------------------------------------------------
16348
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16349
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16350
+  (0.0ms) begin transaction
16351
+ SQL (0.3ms) INSERT INTO "clark_kent_reports" ("created_at", "name", "resource_type", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2015-03-17 15:32:44.786697"], ["name", "delete me"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:32:44.786697"]]
16352
+  (0.7ms) commit transaction
16353
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
16354
+ Processing by ClarkKent::ReportsController#destroy as HTML
16355
+ Parameters: {"current_user_id"=>"1", "id"=>"3"}
16356
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 3]]
16357
+  (0.0ms) begin transaction
16358
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 3], ["filterable_type", "ClarkKent::Report"]]
16359
+ ClarkKent::ReportColumn Load (0.0ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 3]]
16360
+ ClarkKent::ReportEmail Load (0.0ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 3]]
16361
+ SQL (0.2ms) DELETE FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? [["id", 3]]
16362
+  (0.8ms) commit transaction
16363
+ Redirected to http://test.host/reports/reports
16364
+ Completed 302 Found in 5ms (ActiveRecord: 1.3ms)
16365
+  (0.2ms) SELECT COUNT(*) FROM "clark_kent_reports"
16366
+ ------------------------------------------------------
16367
+ ClarkKent::ReportsControllerTest: test_should_get_edit
16368
+ ------------------------------------------------------
16369
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16370
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16371
+ Processing by ClarkKent::ReportsController#edit as HTML
16372
+ Parameters: {"current_user_id"=>"1", "id"=>"1"}
16373
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16374
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16375
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (1.6ms)
16376
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16377
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_filters/_index.html.erb (1.3ms)
16378
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16379
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.8ms)
16380
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (2.0ms)
16381
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
16382
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.4ms)
16383
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
16384
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.4ms)
16385
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
16386
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.4ms)
16387
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_index.html.erb (5.6ms)
16388
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 1]]
16389
+ ClarkKent::ReportDateFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."type" IN ('ClarkKent::ReportDateFilter') AND "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
16390
+ User Load (0.3ms) SELECT "users".* FROM "users" INNER JOIN "clark_kent_user_report_emails" ON "users"."id" = "clark_kent_user_report_emails"."user_id" WHERE "clark_kent_user_report_emails"."report_email_id" = ? [["report_email_id", 1]]
16391
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_show.html.erb (23.3ms)
16392
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_show_wrapper.html.erb (24.5ms)
16393
+ ClarkKent::ReportDateFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."type" IN ('ClarkKent::ReportDateFilter') AND "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
16394
+ User Load (0.1ms) SELECT "users".* FROM "users" INNER JOIN "clark_kent_user_report_emails" ON "users"."id" = "clark_kent_user_report_emails"."user_id" WHERE "clark_kent_user_report_emails"."report_email_id" = ? [["report_email_id", 2]]
16395
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_show.html.erb (2.9ms)
16396
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_show_wrapper.html.erb (3.1ms)
16397
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_index.html.erb (29.9ms)
16398
+ Completed 200 OK in 41ms (Views: 38.8ms | ActiveRecord: 1.4ms)
16399
+ -------------------------------------------------------
16400
+ ClarkKent::ReportsControllerTest: test_should_get_index
16401
+ -------------------------------------------------------
16402
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16403
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16404
+ Processing by ClarkKent::ReportsController#index as HTML
16405
+ Parameters: {"current_user_id"=>"1"}
16406
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
16407
+ ClarkKent::Report Exists (0.2ms) SELECT 1 AS one FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" = ? AND "clark_kent_reports"."sharing_scope_type" = ? LIMIT 1 [["sharing_scope_id", 1], ["sharing_scope_type", "User"]]
16408
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16409
+ ClarkKent::Report Exists (0.1ms) SELECT 1 AS one FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" = ? AND "clark_kent_reports"."sharing_scope_type" = ? LIMIT 1 [["sharing_scope_id", 1], ["sharing_scope_type", "Department"]]
16410
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" = ? AND "clark_kent_reports"."sharing_scope_type" = ? [["sharing_scope_id", 1], ["sharing_scope_type", "Department"]]
16411
+  (0.2ms) SELECT COUNT(*) FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" IS NULL
16412
+ Completed 200 OK in 13ms (Views: 11.9ms | ActiveRecord: 0.8ms)
16413
+ -----------------------------------------------------
16414
+ ClarkKent::ReportsControllerTest: test_should_get_new
16415
+ -----------------------------------------------------
16416
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16417
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16418
+ Processing by ClarkKent::ReportsController#new as HTML
16419
+ Parameters: {"current_user_id"=>"1"}
16420
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
16421
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16422
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_edit.html.erb (97.7ms)
16423
+ Completed 200 OK in 101ms (Views: 100.6ms | ActiveRecord: 0.3ms)
16424
+ ---------------------------------------------------------
16425
+ ClarkKent::ReportsControllerTest: test_should_show_report
16426
+ ---------------------------------------------------------
16427
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16428
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16429
+ Processing by ClarkKent::ReportsController#show as HTML
16430
+ Parameters: {"current_user_id"=>"1", "id"=>"1"}
16431
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16432
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
16433
+  (0.3ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16434
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16435
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16436
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (1.0ms)
16437
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16438
+ User Load (0.1ms) SELECT "users".* FROM "users"
16439
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (1.8ms)
16440
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.5ms)
16441
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (0.6ms)
16442
+ Completed 200 OK in 23ms (Views: 14.6ms | ActiveRecord: 1.1ms)
16443
+ -----------------------------------------------------------------
16444
+ ClarkKent::ReportsControllerTest: test_should_show_report_results
16445
+ -----------------------------------------------------------------
16446
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16447
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16448
+ Processing by ClarkKent::ReportsController#show as HTML
16449
+ Parameters: {"current_user_id"=>"1", "run_report"=>true, "created_at_until"=>"2015-03-17", "created_at_from"=>"2015-03-16", "id"=>"1"}
16450
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16451
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
16452
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16453
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16454
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16455
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16456
+  (0.2ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16457
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16458
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.4ms)
16459
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16460
+ User Load (0.1ms) SELECT "users".* FROM "users"
16461
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (1.5ms)
16462
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.3ms)
16463
+  (0.1ms) SELECT COUNT(*) FROM "orders"
16464
+  (0.2ms) SELECT COUNT(count_column) FROM (SELECT "orders"."id" AS count_column FROM "orders" LIMIT 10 OFFSET 0) subquery_for_count
16465
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (6.2ms)
16466
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16467
+ Order Load (0.1ms) SELECT DISTINCT orders.id, orders.user_id, orders.amount, orders.description, orders.created_at, orders.updated_at,
16468
+ (SELECT u.name
16469
+ FROM users u
16470
+ WHERE u.id = orders.user_id)
16471
+ as user_name, NULL FROM "orders" LIMIT 10 OFFSET 0
16472
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_download_link.html.erb (1.0ms)
16473
+ Completed 200 OK in 26ms (Views: 19.6ms | ActiveRecord: 1.8ms)
16474
+ --------------------------------------------------------------------
16475
+ ClarkKent::ReportsControllerTest: test_should_show_report_run_errors
16476
+ --------------------------------------------------------------------
16477
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16478
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16479
+ Processing by ClarkKent::ReportsController#show as HTML
16480
+ Parameters: {"current_user_id"=>"1", "run_report"=>true, "id"=>"1"}
16481
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16482
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
16483
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16484
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16485
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16486
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16487
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16488
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16489
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.2ms)
16490
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16491
+ User Load (0.1ms) SELECT "users".* FROM "users"
16492
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (0.9ms)
16493
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.1ms)
16494
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (0.0ms)
16495
+ Completed 200 OK in 9ms (Views: 4.1ms | ActiveRecord: 1.0ms)
16496
+ -----------------------------------------------------------
16497
+ ClarkKent::ReportsControllerTest: test_should_update_report
16498
+ -----------------------------------------------------------
16499
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16500
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16501
+ Processing by ClarkKent::ReportsController#update as HTML
16502
+ Parameters: {"report"=>{"name"=>nil, "resource_type"=>"Order", "sharing_scope_id"=>"1", "sharing_scope_type"=>"Department"}, "current_user_id"=>"1", "id"=>"1"}
16503
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16504
+  (0.0ms) begin transaction
16505
+  (0.0ms) commit transaction
16506
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16507
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (1.5ms)
16508
+ Completed 200 OK in 3ms (Views: 1.7ms | ActiveRecord: 0.2ms)
16509
+  (1.9ms) CREATE TABLE "clark_kent_report_columns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "column_name" varchar(255), "column_order" integer, "report_sort" varchar(255), "summary_method" varchar(255)) 
16510
+  (0.1ms) select sqlite_version(*)
16511
+  (1.3ms) CREATE INDEX "index_clark_kent_report_columns_on_report_id" ON "clark_kent_report_columns" ("report_id")
16512
+  (1.2ms) CREATE TABLE "clark_kent_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "report_id" integer, "when_to_send" varchar(255), "name" varchar(255))
16513
+  (1.2ms) CREATE TABLE "clark_kent_report_filters" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "filterable_id" integer, "filterable_type" varchar(255) DEFAULT 'ClarkKent::Report', "string" varchar(255) DEFAULT 'ClarkKent::Report', "filter_name" varchar(255), "filter_value" varchar(255), "type" varchar(255), "duration" varchar(255), "kind_of_day" varchar(255), "offset" varchar(255), "created_at" datetime, "updated_at" datetime) 
16514
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_id" ON "clark_kent_report_filters" ("filterable_id")
16515
+  (0.1ms)  SELECT sql
16516
+ FROM sqlite_master
16517
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
16518
+ UNION ALL
16519
+ SELECT sql
16520
+ FROM sqlite_temp_master
16521
+ WHERE name='index_clark_kent_report_filters_on_filterable_id' AND type='index'
16522
+ 
16523
+  (0.9ms) CREATE INDEX "index_clark_kent_report_filters_on_filterable_type" ON "clark_kent_report_filters" ("filterable_type")
16524
+  (1.0ms) CREATE TABLE "clark_kent_reports" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "resource_type" varchar(255), "sharing_scope_type" varchar(255), "sharing_scope_id" integer, "created_at" datetime, "updated_at" datetime) 
16525
+  (1.1ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_id" ON "clark_kent_reports" ("sharing_scope_id")
16526
+  (0.1ms)  SELECT sql
16527
+ FROM sqlite_master
16528
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16529
+ UNION ALL
16530
+ SELECT sql
16531
+ FROM sqlite_temp_master
16532
+ WHERE name='index_clark_kent_reports_on_sharing_scope_id' AND type='index'
16533
+ 
16534
+  (0.9ms) CREATE INDEX "index_clark_kent_reports_on_sharing_scope_type" ON "clark_kent_reports" ("sharing_scope_type")
16535
+  (0.9ms) CREATE TABLE "clark_kent_user_report_emails" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "report_email_id" integer) 
16536
+  (0.9ms) CREATE TABLE "departments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))
16537
+  (0.9ms) CREATE TABLE "orders" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "amount" integer, "description" varchar(255), "created_at" datetime, "updated_at" datetime) 
16538
+  (1.0ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255), "email" varchar(255), "age" integer, "department_id" integer)
16539
+  (1.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
16540
+  (0.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
16541
+  (0.1ms) SELECT version FROM "schema_migrations"
16542
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150313144015')
16543
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170042')
16544
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20131226170112')
16545
+  (0.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20140114010048')
16546
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20140129051754')
16547
+  (0.8ms) INSERT INTO "schema_migrations" (version) VALUES ('20150304233739')
16548
+  (0.0ms) begin transaction
16549
+ SQL (0.3ms) INSERT INTO "clark_kent_reports" ("created_at", "resource_type", "updated_at") VALUES (?, ?, ?) [["created_at", "2015-03-17 15:39:09.788514"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:39:09.788514"]]
16550
+  (1.1ms) commit transaction
16551
+  (0.0ms) begin transaction
16552
+ SQL (0.3ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "user_name"], ["column_order", 1], ["report_id", 1]]
16553
+  (0.8ms) commit transaction
16554
+  (0.0ms) begin transaction
16555
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "id"], ["column_order", 2], ["report_id", 1]]
16556
+  (0.6ms) commit transaction
16557
+  (0.0ms) begin transaction
16558
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "amount"], ["column_order", 3], ["report_id", 1]]
16559
+  (0.6ms) commit transaction
16560
+  (0.0ms) begin transaction
16561
+ SQL (0.2ms) INSERT INTO "clark_kent_report_columns" ("column_name", "column_order", "report_id") VALUES (?, ?, ?) [["column_name", "description"], ["column_order", 4], ["report_id", 1]]
16562
+  (0.7ms) commit transaction
16563
+  (0.0ms) begin transaction
16564
+ SQL (0.4ms) INSERT INTO "departments" ("name") VALUES (?) [["name", "silly walks"]]
16565
+  (0.7ms) commit transaction
16566
+  (0.0ms) begin transaction
16567
+ SQL (0.3ms) INSERT INTO "users" ("department_id", "email", "name") VALUES (?, ?, ?) [["department_id", 1], ["email", "taproot@gmail.com"], ["name", "Michael Hedges"]]
16568
+  (0.8ms) commit transaction
16569
+  (0.1ms) begin transaction
16570
+ SQL (0.3ms) INSERT INTO "orders" ("amount", "created_at", "description", "updated_at", "user_id") VALUES (?, ?, ?, ?, ?) [["amount", 1], ["created_at", "2015-03-17 15:39:09.833901"], ["description", "Guitar strings"], ["updated_at", "2015-03-17 15:39:09.833901"], ["user_id", 1]]
16571
+  (0.7ms) commit transaction
16572
+ -----------------------------------------------------------
16573
+ ClarkKent::ReportsControllerTest: test_should_create_report
16574
+ -----------------------------------------------------------
16575
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16576
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16577
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
16578
+ Processing by ClarkKent::ReportsController#create as HTML
16579
+ Parameters: {"report"=>{"name"=>"delete me", "resource_type"=>"Order", "sharing_scope_id"=>nil, "sharing_scope_type"=>nil}, "current_user_id"=>"1"}
16580
+  (0.1ms) begin transaction
16581
+ SQL (0.4ms) INSERT INTO "clark_kent_reports" ("created_at", "name", "resource_type", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2015-03-17 15:39:09.896336"], ["name", "delete me"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:39:09.896336"]]
16582
+  (0.8ms) commit transaction
16583
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (3.6ms)
16584
+ ClarkKent::ReportFilter Load (0.2ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::Report"]]
16585
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_filters/_index.html.erb (6.4ms)
16586
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 2]]
16587
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_index.html.erb (1.8ms)
16588
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 2]]
16589
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_index.html.erb (7.5ms)
16590
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/edit.html.erb within layouts/application (27.6ms)
16591
+ Completed 200 OK in 49ms (Views: 44.8ms | ActiveRecord: 2.1ms)
16592
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
16593
+ ClarkKent::Report Load (0.4ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."name" = 'delete me' LIMIT 1
16594
+  (0.1ms) begin transaction
16595
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::Report"]]
16596
+ ClarkKent::ReportColumn Load (0.0ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 2]]
16597
+ ClarkKent::ReportEmail Load (0.0ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 2]]
16598
+ SQL (0.3ms) DELETE FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? [["id", 2]]
16599
+  (1.1ms) commit transaction
16600
+ ------------------------------------------------------------
16601
+ ClarkKent::ReportsControllerTest: test_should_destroy_report
16602
+ ------------------------------------------------------------
16603
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16604
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16605
+  (0.1ms) begin transaction
16606
+ SQL (0.3ms) INSERT INTO "clark_kent_reports" ("created_at", "name", "resource_type", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2015-03-17 15:39:09.965438"], ["name", "delete me"], ["resource_type", "Order"], ["updated_at", "2015-03-17 15:39:09.965438"]]
16607
+  (0.8ms) commit transaction
16608
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports"
16609
+ Processing by ClarkKent::ReportsController#destroy as HTML
16610
+ Parameters: {"current_user_id"=>"1", "id"=>"3"}
16611
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 3]]
16612
+  (0.0ms) begin transaction
16613
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 3], ["filterable_type", "ClarkKent::Report"]]
16614
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 3]]
16615
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 3]]
16616
+ SQL (0.4ms) DELETE FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? [["id", 3]]
16617
+  (0.8ms) commit transaction
16618
+ Redirected to http://test.host/reports/reports
16619
+ Completed 302 Found in 7ms (ActiveRecord: 1.6ms)
16620
+  (0.2ms) SELECT COUNT(*) FROM "clark_kent_reports"
16621
+ ------------------------------------------------------
16622
+ ClarkKent::ReportsControllerTest: test_should_get_edit
16623
+ ------------------------------------------------------
16624
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16625
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16626
+ Processing by ClarkKent::ReportsController#edit as HTML
16627
+ Parameters: {"current_user_id"=>"1", "id"=>"1"}
16628
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16629
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (0.8ms)
16630
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16631
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_filters/_index.html.erb (1.2ms)
16632
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16633
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.8ms)
16634
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (2.1ms)
16635
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
16636
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.5ms)
16637
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
16638
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.5ms)
16639
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show.html.erb (0.3ms)
16640
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_show_wrapper.html.erb (0.4ms)
16641
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_columns/_index.html.erb (6.2ms)
16642
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."report_id" = ? [["report_id", 1]]
16643
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/report_emails/_index.html.erb (1.1ms)
16644
+ Completed 200 OK in 12ms (Views: 10.7ms | ActiveRecord: 0.4ms)
16645
+ -------------------------------------------------------
16646
+ ClarkKent::ReportsControllerTest: test_should_get_index
16647
+ -------------------------------------------------------
16648
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16649
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16650
+ Processing by ClarkKent::ReportsController#index as HTML
16651
+ Parameters: {"current_user_id"=>"1"}
16652
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
16653
+ ClarkKent::Report Exists (0.2ms) SELECT 1 AS one FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" = ? AND "clark_kent_reports"."sharing_scope_type" = ? LIMIT 1 [["sharing_scope_id", 1], ["sharing_scope_type", "User"]]
16654
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16655
+ ClarkKent::Report Exists (0.1ms) SELECT 1 AS one FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" = ? AND "clark_kent_reports"."sharing_scope_type" = ? LIMIT 1 [["sharing_scope_id", 1], ["sharing_scope_type", "Department"]]
16656
+  (0.1ms) SELECT COUNT(*) FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" IS NULL
16657
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."sharing_scope_id" IS NULL
16658
+ Completed 200 OK in 17ms (Views: 16.1ms | ActiveRecord: 0.7ms)
16659
+ -----------------------------------------------------
16660
+ ClarkKent::ReportsControllerTest: test_should_get_new
16661
+ -----------------------------------------------------
16662
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16663
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16664
+ Processing by ClarkKent::ReportsController#new as HTML
16665
+ Parameters: {"current_user_id"=>"1"}
16666
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY "users"."id" ASC LIMIT 1
16667
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16668
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_edit.html.erb (45.1ms)
16669
+ Completed 200 OK in 49ms (Views: 48.1ms | ActiveRecord: 0.2ms)
16670
+ ---------------------------------------------------------
16671
+ ClarkKent::ReportsControllerTest: test_should_show_report
16672
+ ---------------------------------------------------------
16673
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16674
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16675
+ Processing by ClarkKent::ReportsController#show as HTML
16676
+ Parameters: {"current_user_id"=>"1", "id"=>"1"}
16677
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16678
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
16679
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16680
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16681
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16682
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.9ms)
16683
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16684
+ User Load (0.1ms) SELECT "users".* FROM "users"
16685
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (1.6ms)
16686
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.7ms)
16687
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (0.8ms)
16688
+ Completed 200 OK in 19ms (Views: 13.8ms | ActiveRecord: 1.1ms)
16689
+ -----------------------------------------------------------------
16690
+ ClarkKent::ReportsControllerTest: test_should_show_report_results
16691
+ -----------------------------------------------------------------
16692
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16693
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16694
+ Processing by ClarkKent::ReportsController#show as HTML
16695
+ Parameters: {"current_user_id"=>"1", "run_report"=>true, "created_at_until"=>"2015-03-17", "created_at_from"=>"2015-03-16", "id"=>"1"}
16696
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16697
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
16698
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16699
+ ClarkKent::ReportColumn Load (0.2ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16700
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16701
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16702
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16703
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.5ms)
16704
+ User Load (0.2ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16705
+ User Load (0.2ms) SELECT "users".* FROM "users"
16706
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (1.8ms)
16707
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.1ms)
16708
+  (0.1ms) SELECT COUNT(*) FROM "orders"
16709
+  (0.4ms) SELECT COUNT(count_column) FROM (SELECT "orders"."id" AS count_column FROM "orders" LIMIT 10 OFFSET 0) subquery_for_count
16710
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (4.8ms)
16711
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16712
+ Order Load (0.1ms) SELECT DISTINCT orders.id, orders.user_id, orders.amount, orders.description, orders.created_at, orders.updated_at,
16713
+ (SELECT u.name
16714
+ FROM users u
16715
+ WHERE u.id = orders.user_id)
16716
+ as user_name, NULL FROM "orders" LIMIT 10 OFFSET 0
16717
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_download_link.html.erb (1.0ms)
16718
+ Completed 200 OK in 22ms (Views: 15.6ms | ActiveRecord: 1.9ms)
16719
+ --------------------------------------------------------------------
16720
+ ClarkKent::ReportsControllerTest: test_should_show_report_run_errors
16721
+ --------------------------------------------------------------------
16722
+ ClarkKent::Report Load (0.2ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16723
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16724
+ Processing by ClarkKent::ReportsController#show as HTML
16725
+ Parameters: {"current_user_id"=>"1", "run_report"=>true, "id"=>"1"}
16726
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = 1 ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16727
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" IN (1) ORDER BY clark_kent_report_columns.column_order
16728
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16729
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16730
+  (0.2ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16731
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16732
+  (0.1ms) SELECT "clark_kent_report_filters"."filter_name" FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16733
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_date_filter.html.erb (0.3ms)
16734
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16735
+ User Load (0.1ms) SELECT "users".* FROM "users"
16736
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_object_filter.html.erb (1.2ms)
16737
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_string_filter.html.erb (0.1ms)
16738
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_print_report.html.erb (0.1ms)
16739
+ Completed 200 OK in 11ms (Views: 6.0ms | ActiveRecord: 1.0ms)
16740
+ -----------------------------------------------------------
16741
+ ClarkKent::ReportsControllerTest: test_should_update_report
16742
+ -----------------------------------------------------------
16743
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16744
+ User Load (0.1ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT 1
16745
+ Processing by ClarkKent::ReportsController#update as HTML
16746
+ Parameters: {"report"=>{"name"=>nil, "resource_type"=>"Order", "sharing_scope_id"=>nil, "sharing_scope_type"=>nil}, "current_user_id"=>"1", "id"=>"1"}
16747
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16748
+  (0.1ms) begin transaction
16749
+  (0.1ms) commit transaction
16750
+ Rendered /Users/eric/projects/clark_kent/app/views/clark_kent/reports/_show.html.erb (1.0ms)
16751
+ Completed 200 OK in 4ms (Views: 1.3ms | ActiveRecord: 0.3ms)
16752
+ -------------------------
16753
+ ClarkKentTest: test_truth
16754
+ -------------------------
16755
+ ------------------------------------------------------------------------------------------------
16756
+ ClarkKent::ReportTest: test_can't_save_without_a_sharing_scope_id_if_the_sharing_scope_is_custom
16757
+ ------------------------------------------------------------------------------------------------
16758
+  (0.1ms) begin transaction
16759
+  (0.0ms) rollback transaction
16760
+ ---------------------------------------------------
16761
+ ClarkKent::ReportEmailTest: test_sends_report_to_s3
16762
+ ---------------------------------------------------
16763
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16764
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16765
+ SQL (1.6ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16766
+  (0.1ms) begin transaction
16767
+ SQL (0.3ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16768
+  (0.7ms) commit transaction
16769
+  (0.0ms) begin transaction
16770
+ SQL (0.4ms) INSERT INTO "clark_kent_report_filters" ("created_at", "duration", "filter_name", "filterable_id", "filterable_type", "kind_of_day", "offset", "type", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) [["created_at", "2015-03-17 15:39:10.162382"], ["duration", "week"], ["filter_name", "created_at"], ["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"], ["kind_of_day", "Monday"], ["offset", "this_week"], ["type", "ClarkKent::ReportDateFilter"], ["updated_at", "2015-03-17 15:39:10.162382"]]
16771
+  (1.1ms) commit transaction
16772
+ User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16773
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16774
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16775
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16776
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 1]]
16777
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16778
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16779
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16780
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::ReportEmail"]]
16781
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16782
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16783
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16784
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16785
+  (0.1ms) SELECT COUNT(*) FROM "orders"
16786
+ -----------------------------------------------------------------------------------------
16787
+ ClarkKent::ReportEmailTest: test_throws_an_error_if_required_date_filters_are_not_present
16788
+ -----------------------------------------------------------------------------------------
16789
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."email" = 'taproot@gmail.com' LIMIT 1
16790
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" ORDER BY "clark_kent_reports"."id" ASC LIMIT 1
16791
+ SQL (1.0ms) UPDATE "clark_kent_reports" SET "sharing_scope_type" = 'Department', "sharing_scope_id" = 1 WHERE "clark_kent_reports"."id" = 1
16792
+  (0.1ms) begin transaction
16793
+ SQL (0.2ms) INSERT INTO "clark_kent_report_emails" ("name", "report_id") VALUES (?, ?) [["name", "test_emailer"], ["report_id", 1]]
16794
+  (0.7ms) commit transaction
16795
+ User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 1]]
16796
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16797
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16798
+ Department Load (0.1ms) SELECT "departments".* FROM "departments" WHERE "departments"."id" = ? LIMIT 1 [["id", 1]]
16799
+ ClarkKent::ReportEmail Load (0.1ms) SELECT "clark_kent_report_emails".* FROM "clark_kent_report_emails" WHERE "clark_kent_report_emails"."id" = ? LIMIT 1 [["id", 2]]
16800
+ ClarkKent::Report Load (0.1ms) SELECT "clark_kent_reports".* FROM "clark_kent_reports" WHERE "clark_kent_reports"."id" = ? LIMIT 1 [["id", 1]]
16801
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? ORDER BY clark_kent_report_columns.column_order [["report_id", 1]]
16802
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 1], ["filterable_type", "ClarkKent::Report"]]
16803
+ ClarkKent::ReportFilter Load (0.1ms) SELECT "clark_kent_report_filters".* FROM "clark_kent_report_filters" WHERE "clark_kent_report_filters"."filterable_id" = ? AND "clark_kent_report_filters"."filterable_type" = ? [["filterable_id", 2], ["filterable_type", "ClarkKent::ReportEmail"]]
16804
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]
16805
+ ClarkKent::ReportColumn Load (0.1ms) SELECT "clark_kent_report_columns".* FROM "clark_kent_report_columns" WHERE "clark_kent_report_columns"."report_id" = ? AND (clark_kent_report_columns.report_sort is not NULL and clark_kent_report_columns.report_sort != '') ORDER BY clark_kent_report_columns.column_order LIMIT 1 [["report_id", 1]]