fastly-rails 0.1.5 → 0.1.6

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: 4d90a97d194d67de7d338ed01d2436ff40edf90c
4
- data.tar.gz: 6c9f500d83f22b92b7939043f44d16cf23274b7a
3
+ metadata.gz: 96ad775c62ad1a9feadeca838e58be31d012e992
4
+ data.tar.gz: 28cc744738033d1f209ba9835dccb4b536e4ae33
5
5
  SHA512:
6
- metadata.gz: 00d1056a0d5f6668120941b551206c6ddf4aaeda8ca7294cf7946a3faa9dc7030c906cdfc103b7673b02500a91da43c7a8969098a7e8ec6722bf6d0fcfc3c047
7
- data.tar.gz: 10a2cc598aadcc5d4ebd0c10e7a8d6eb70d42b283322717051eb84804ec40dc69611757ff89a7d09ee76e84b79706d7a5aff48a026871e05882d4684681d3229
6
+ metadata.gz: 0819bd60b2aef49acbc14892084863ffd5d1344b247762d2f61ceb040dfddd5b93fb29ab77bc379eb130bf8c565cdc932ecc2b721e8ad5c1acc2e48b11635aa5
7
+ data.tar.gz: 222df845d6aebde41f8d709568c1f653c39810a28da7172eb0028f5fed346843fb68650ea28b01da2c0e6cd5314ba21f89c9f8f4820b3daefa3645973ce43ba1
@@ -2,10 +2,10 @@ module FastlyRails
2
2
  module CacheControlHeaders
3
3
  extend ActiveSupport::Concern
4
4
 
5
- # Sets Cache-Control and Surrogate-Control headers
5
+ # Sets Cache-Control and Surrogate-Control HTTP headers
6
6
  # Surrogate-Control is stripped at the cache, Cache-Control persists (in case of other caches in front of fastly)
7
7
  # Defaults are:
8
- # Cache-Control: 'public, no-cache, s-maxage: 30 days'
8
+ # Cache-Control: 'public, no-cache'
9
9
  # Surrogate-Control: 'max-age: 30 days
10
10
  # custom config example:
11
11
  # {cache_control: 'public, no-cache, maxage=xyz', surrogate_control: 'max-age: blah'}
@@ -0,0 +1,11 @@
1
+ module FastlyRails
2
+ module SurrogateKeyHeaders
3
+
4
+ # Sets Surrogate-Key HTTP header with one or more keys
5
+ # strips session data from the request
6
+ def set_surrogate_key_header(*surrogate_keys)
7
+ request.session_options[:skip] = true # No Set-Cookie
8
+ response.headers['Surrogate-Key'] = surrogate_keys.join(' ')
9
+ end
10
+ end
11
+ end
@@ -1,4 +1,6 @@
1
1
  # Adds surrogate key methods to ActiveRecord models
2
+ # Purge methods use a POST over PURGE
3
+ # The choice of this HTTP method should not effect anything
2
4
  module FastlyRails
3
5
  module ActiveRecord
4
6
  module SurrogateKey
@@ -7,7 +9,7 @@ module FastlyRails
7
9
  module ClassMethods
8
10
 
9
11
  def purge_all
10
- FastlyRails.client.get_service(service_id).purge_by_key(table_key)
12
+ FastlyRails::Client.purge_by_key(table_key)
11
13
  end
12
14
 
13
15
  def table_key
@@ -28,7 +30,7 @@ module FastlyRails
28
30
  end
29
31
 
30
32
  def purge
31
- FastlyRails.client.get_service(service_id).purge_by_key(record_key)
33
+ FastlyRails::Client.purge_by_key(record_key)
32
34
  end
33
35
 
34
36
  def purge_all
@@ -6,5 +6,13 @@ module FastlyRails
6
6
  def initialize(opts={})
7
7
  super(Fastly.new(opts))
8
8
  end
9
+
10
+ def purge_by_key(key)
11
+ client.post purge_url(key)
12
+ end
13
+
14
+ def purge_url(key)
15
+ "/service/#{FastlyRails.service_id}/purge/#{key}"
16
+ end
9
17
  end
10
18
  end
@@ -1,7 +1,8 @@
1
1
  require 'fastly-rails/active_record/surrogate_key'
2
2
  require 'fastly-rails/mongoid/surrogate_key'
3
3
  require 'fastly-rails/action_controller/cache_control_headers'
4
- require 'fastly-rails/action_controller/surrogate_control_headers'
4
+ require 'fastly-rails/action_controller/surrogate_key_headers'
5
+ require 'fastly-rails/rack/remove_set_cookie_header'
5
6
 
6
7
  module FastlyRails
7
8
  class Engine < ::Rails::Engine
@@ -14,7 +15,7 @@ module FastlyRails
14
15
 
15
16
  ActiveSupport.on_load :action_controller do
16
17
  ActionController::Base.send :include, FastlyRails::CacheControlHeaders
17
- ActionController::Base.send :include, FastlyRails::SurrogateControlHeaders
18
+ ActionController::Base.send :include, FastlyRails::SurrogateKeyHeaders
18
19
  end
19
20
 
20
21
  ActiveSupport.on_load :active_record do
@@ -7,7 +7,7 @@ module FastlyRails
7
7
  module ClassMethods
8
8
 
9
9
  def purge_all
10
- FastlyRails.client.get_service(service_id).purge_by_key(table_key)
10
+ FastlyRails::Client.purge_by_key(table_key)
11
11
  end
12
12
 
13
13
  def table_key
@@ -28,7 +28,7 @@ module FastlyRails
28
28
  end
29
29
 
30
30
  def purge
31
- FastlyRails.client.get_service(service_id).purge_by_key(record_key)
31
+ FastlyRails::Client.purge_by_key(record_key)
32
32
  end
33
33
 
34
34
  def purge_all
@@ -0,0 +1,19 @@
1
+ module FastlyRails
2
+ module Rack
3
+ class RemoveSetCookieHeader
4
+ def initialize(app)
5
+ @app = app
6
+ end
7
+
8
+ def call(env)
9
+ status, headers, response = @app.call(env)
10
+
11
+ if headers["Surrogate-Control"] || headers["Surrogate-Key"]
12
+ headers.delete("Set-Cookie")
13
+ end
14
+
15
+ [status, headers, response]
16
+ end
17
+ end
18
+ end
19
+ end
@@ -1,3 +1,3 @@
1
1
  module FastlyRails
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
@@ -52168,3 +52168,672 @@ FastlyRails::CacheControlHeadersTest: test_sets_cache_control_headers_on_actionc
52168
52168
   (0.0ms) commit transaction
52169
52169
   (0.0ms) begin transaction
52170
52170
   (0.1ms) rollback transaction
52171
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
52172
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
52173
+  (0.1ms) begin transaction
52174
+ --------------------------------
52175
+ BooksControllerTest: test_create
52176
+ --------------------------------
52177
+  (0.1ms) SAVEPOINT active_record_1
52178
+ SQL (0.4ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.187272"], ["name", "Journey of the Brain"], ["updated_at", "2014-09-17 18:01:43.187272"]]
52179
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52180
+  (0.0ms) SAVEPOINT active_record_1
52181
+ SQL (0.7ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.190504"], ["name", "Champagne Thief"], ["updated_at", "2014-09-17 18:01:43.190504"]]
52182
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52183
+  (0.0ms) SAVEPOINT active_record_1
52184
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.192351"], ["name", "Hungry Wolves"], ["updated_at", "2014-09-17 18:01:43.192351"]]
52185
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52186
+  (0.0ms) SAVEPOINT active_record_1
52187
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.193121"], ["name", "A Fistful of Bloody Beast"], ["updated_at", "2014-09-17 18:01:43.193121"]]
52188
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52189
+  (0.0ms) SAVEPOINT active_record_1
52190
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.193878"], ["name", "Death Rain"], ["updated_at", "2014-09-17 18:01:43.193878"]]
52191
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52192
+  (0.1ms) SELECT COUNT(*) FROM "books"
52193
+ Processing by BooksController#create as HTML
52194
+ Parameters: {"book"=>{"name"=>"newly-created-book"}}
52195
+  (0.1ms) SAVEPOINT active_record_1
52196
+ SQL (0.1ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.198428"], ["name", "newly-created-book"], ["updated_at", "2014-09-17 18:01:43.198428"]]
52197
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52198
+ Redirected to http://test.host/books
52199
+ Completed 302 Found in 2ms (ActiveRecord: 0.2ms)
52200
+  (0.1ms) SELECT COUNT(*) FROM "books"
52201
+  (0.4ms) rollback transaction
52202
+  (0.0ms) begin transaction
52203
+ -------------------------------
52204
+ BooksControllerTest: test_index
52205
+ -------------------------------
52206
+  (0.0ms) SAVEPOINT active_record_1
52207
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.201734"], ["name", "The Blow from 15154 Leagues"], ["updated_at", "2014-09-17 18:01:43.201734"]]
52208
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52209
+  (0.0ms) SAVEPOINT active_record_1
52210
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.202852"], ["name", "The Men from the Black Lagoon"], ["updated_at", "2014-09-17 18:01:43.202852"]]
52211
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52212
+  (0.0ms) SAVEPOINT active_record_1
52213
+ SQL (0.1ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.203802"], ["name", "The Hungry Beast from Mars"], ["updated_at", "2014-09-17 18:01:43.203802"]]
52214
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52215
+  (0.0ms) SAVEPOINT active_record_1
52216
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.204562"], ["name", "The Tentacle from 17486 Leagues"], ["updated_at", "2014-09-17 18:01:43.204562"]]
52217
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52218
+  (0.0ms) SAVEPOINT active_record_1
52219
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.205277"], ["name", "Nuclear Jungle"], ["updated_at", "2014-09-17 18:01:43.205277"]]
52220
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52221
+ Processing by BooksController#index as HTML
52222
+ Book Load (0.1ms) SELECT "books".* FROM "books"
52223
+ Completed 200 OK in 11ms (Views: 10.7ms | ActiveRecord: 0.1ms)
52224
+  (0.1ms) SELECT COUNT(*) FROM "books"
52225
+  (0.4ms) rollback transaction
52226
+  (0.0ms) begin transaction
52227
+ ----------------------------------------------------
52228
+ BooksControllerTest: test_index_with_multiple_params
52229
+ ----------------------------------------------------
52230
+  (0.0ms) SAVEPOINT active_record_1
52231
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.220676"], ["name", "Dr. Rain"], ["updated_at", "2014-09-17 18:01:43.220676"]]
52232
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52233
+  (0.0ms) SAVEPOINT active_record_1
52234
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.221842"], ["name", "Legend of Death Pickpocket"], ["updated_at", "2014-09-17 18:01:43.221842"]]
52235
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52236
+  (0.0ms) SAVEPOINT active_record_1
52237
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.222726"], ["name", "The Nuclear Identity Who Fell to Earth"], ["updated_at", "2014-09-17 18:01:43.222726"]]
52238
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52239
+  (0.0ms) SAVEPOINT active_record_1
52240
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.223407"], ["name", "Hungry Demon"], ["updated_at", "2014-09-17 18:01:43.223407"]]
52241
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52242
+  (0.0ms) SAVEPOINT active_record_1
52243
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.224072"], ["name", "Danger Men"], ["updated_at", "2014-09-17 18:01:43.224072"]]
52244
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52245
+ Processing by BooksController#index as HTML
52246
+ Book Load (0.1ms) SELECT "books".* FROM "books"
52247
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.1ms)
52248
+  (0.5ms) rollback transaction
52249
+  (0.0ms) begin transaction
52250
+ ------------------------------
52251
+ BooksControllerTest: test_show
52252
+ ------------------------------
52253
+  (0.0ms) SAVEPOINT active_record_1
52254
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.228833"], ["name", "Electric Gypsy"], ["updated_at", "2014-09-17 18:01:43.228833"]]
52255
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52256
+  (0.0ms) SAVEPOINT active_record_1
52257
+ SQL (0.3ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.230586"], ["name", "Christmas on Kulas Stream"], ["updated_at", "2014-09-17 18:01:43.230586"]]
52258
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52259
+  (0.0ms) SAVEPOINT active_record_1
52260
+ SQL (0.1ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.232157"], ["name", "The Hills That Came to Dinner"], ["updated_at", "2014-09-17 18:01:43.232157"]]
52261
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52262
+  (0.0ms) SAVEPOINT active_record_1
52263
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.232963"], ["name", "The Witch with a Thousand Faces"], ["updated_at", "2014-09-17 18:01:43.232963"]]
52264
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52265
+  (0.0ms) SAVEPOINT active_record_1
52266
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.233636"], ["name", "The Champagne Jungle Who Fell to Earth"], ["updated_at", "2014-09-17 18:01:43.233636"]]
52267
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52268
+ Processing by BooksController#show as HTML
52269
+ Parameters: {"id"=>"1"}
52270
+ Book Load (0.1ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52271
+ Completed 200 OK in 3ms (Views: 1.5ms | ActiveRecord: 0.1ms)
52272
+  (0.5ms) rollback transaction
52273
+  (0.1ms) begin transaction
52274
+  (0.0ms) commit transaction
52275
+  (0.0ms) begin transaction
52276
+  (0.0ms) rollback transaction
52277
+  (0.0ms) begin transaction
52278
+  (0.0ms) commit transaction
52279
+  (0.0ms) begin transaction
52280
+  (0.0ms) rollback transaction
52281
+  (0.0ms) begin transaction
52282
+  (0.0ms) commit transaction
52283
+  (0.0ms) begin transaction
52284
+  (0.0ms) rollback transaction
52285
+  (0.0ms) begin transaction
52286
+  (0.0ms) commit transaction
52287
+  (0.0ms) begin transaction
52288
+  (0.1ms) rollback transaction
52289
+  (0.0ms) begin transaction
52290
+  (0.0ms) commit transaction
52291
+  (0.0ms) begin transaction
52292
+  (0.0ms) rollback transaction
52293
+  (0.0ms) begin transaction
52294
+  (0.0ms) commit transaction
52295
+  (0.0ms) begin transaction
52296
+  (0.0ms) rollback transaction
52297
+  (0.0ms) begin transaction
52298
+  (0.0ms) commit transaction
52299
+  (0.0ms) begin transaction
52300
+  (0.0ms) rollback transaction
52301
+  (0.0ms) begin transaction
52302
+  (0.0ms) commit transaction
52303
+  (0.0ms) begin transaction
52304
+  (0.0ms) rollback transaction
52305
+  (0.0ms) begin transaction
52306
+  (0.0ms) commit transaction
52307
+  (0.0ms) begin transaction
52308
+  (0.0ms) rollback transaction
52309
+  (0.0ms) begin transaction
52310
+  (0.0ms) commit transaction
52311
+  (0.0ms) begin transaction
52312
+  (0.0ms) rollback transaction
52313
+  (0.0ms) begin transaction
52314
+  (0.0ms) commit transaction
52315
+  (0.0ms) begin transaction
52316
+  (0.0ms) rollback transaction
52317
+  (0.0ms) begin transaction
52318
+  (0.0ms) commit transaction
52319
+  (0.0ms) begin transaction
52320
+  (0.1ms) rollback transaction
52321
+  (0.0ms) begin transaction
52322
+  (0.0ms) commit transaction
52323
+  (0.0ms) begin transaction
52324
+  (0.1ms) rollback transaction
52325
+  (0.0ms) begin transaction
52326
+  (0.0ms) commit transaction
52327
+  (0.0ms) begin transaction
52328
+  (0.0ms) rollback transaction
52329
+  (0.1ms) begin transaction
52330
+  (0.0ms) commit transaction
52331
+  (0.0ms) begin transaction
52332
+  (0.1ms) SAVEPOINT active_record_1
52333
+ SQL (0.3ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.260913"], ["id", 1], ["name", "Case of the Missing Cat"], ["updated_at", "2014-09-17 18:01:43.260913"]]
52334
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52335
+  (0.3ms) rollback transaction
52336
+  (0.1ms) begin transaction
52337
+  (0.0ms) commit transaction
52338
+  (0.0ms) begin transaction
52339
+  (0.0ms) SAVEPOINT active_record_1
52340
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.264408"], ["id", 1], ["name", "The Mutant from Candlewood Country Club"], ["updated_at", "2014-09-17 18:01:43.264408"]]
52341
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52342
+  (0.3ms) rollback transaction
52343
+  (0.0ms) begin transaction
52344
+  (0.0ms) commit transaction
52345
+  (0.0ms) begin transaction
52346
+  (0.0ms) SAVEPOINT active_record_1
52347
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.266995"], ["id", 1], ["name", "Hungry Wizard 2: Son of Hungry Wizard"], ["updated_at", "2014-09-17 18:01:43.266995"]]
52348
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52349
+  (0.3ms) rollback transaction
52350
+  (0.1ms) begin transaction
52351
+  (0.0ms) commit transaction
52352
+  (0.0ms) begin transaction
52353
+  (0.0ms) rollback transaction
52354
+  (0.0ms) begin transaction
52355
+  (0.0ms) commit transaction
52356
+  (0.0ms) begin transaction
52357
+  (0.0ms) SAVEPOINT active_record_1
52358
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.270523"], ["id", 1], ["name", "Red Cat"], ["updated_at", "2014-09-17 18:01:43.270523"]]
52359
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52360
+  (0.3ms) rollback transaction
52361
+  (0.0ms) begin transaction
52362
+  (0.0ms) commit transaction
52363
+  (0.0ms) begin transaction
52364
+  (0.0ms) rollback transaction
52365
+  (0.0ms) begin transaction
52366
+  (0.0ms) commit transaction
52367
+  (0.0ms) begin transaction
52368
+  (0.0ms) rollback transaction
52369
+  (0.0ms) begin transaction
52370
+  (0.0ms) commit transaction
52371
+  (0.0ms) begin transaction
52372
+  (0.0ms) rollback transaction
52373
+  (0.0ms) begin transaction
52374
+  (0.0ms) commit transaction
52375
+  (0.0ms) begin transaction
52376
+  (0.0ms) rollback transaction
52377
+  (0.0ms) begin transaction
52378
+  (0.0ms) commit transaction
52379
+  (0.0ms) begin transaction
52380
+  (0.0ms) rollback transaction
52381
+  (0.0ms) begin transaction
52382
+ -----------------------------------------------------------------------
52383
+ FastlyHeadersTest: test_/books/:id_show_page_should_have_fastly_headers
52384
+ -----------------------------------------------------------------------
52385
+  (0.0ms) SAVEPOINT active_record_1
52386
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.276327"], ["id", 1], ["name", "Fly 2: Electric Boogaloo"], ["updated_at", "2014-09-17 18:01:43.276327"]]
52387
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52388
+ Started GET "/books/1" for 127.0.0.1 at 2014-09-17 11:01:43 -0700
52389
+ Processing by BooksController#show as HTML
52390
+ Parameters: {"id"=>"1"}
52391
+ Book Load (0.1ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52392
+ Completed 200 OK in 2ms (Views: 1.2ms | ActiveRecord: 0.1ms)
52393
+  (0.4ms) rollback transaction
52394
+  (0.0ms) begin transaction
52395
+ --------------------------------------------------------------------
52396
+ FastlyHeadersTest: test_/books_index_page_should_have_fastly_headers
52397
+ --------------------------------------------------------------------
52398
+ Started GET "/books" for 127.0.0.1 at 2014-09-17 11:01:43 -0700
52399
+ Processing by BooksController#index as HTML
52400
+ Book Load (0.1ms) SELECT "books".* FROM "books"
52401
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.1ms)
52402
+  (0.0ms) rollback transaction
52403
+  (0.0ms) begin transaction
52404
+ ----------------------------------------------------------------------------------------------
52405
+ FastlyHeadersTest: test_DELETE_/books/:id_should_not_have_fastly_headers/_fastly_header_values
52406
+ ----------------------------------------------------------------------------------------------
52407
+  (0.0ms) SAVEPOINT active_record_1
52408
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.290132"], ["id", 1], ["name", "Green Woman"], ["updated_at", "2014-09-17 18:01:43.290132"]]
52409
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52410
+ Started DELETE "/books/1" for 127.0.0.1 at 2014-09-17 11:01:43 -0700
52411
+ Processing by BooksController#destroy as HTML
52412
+ Parameters: {"id"=>"1"}
52413
+ Book Load (0.0ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52414
+  (0.0ms) SAVEPOINT active_record_1
52415
+ SQL (0.3ms) DELETE FROM "books" WHERE "books"."id" = ? [["id", 1]]
52416
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52417
+ Redirected to http://www.example.com/books
52418
+ Completed 302 Found in 2ms (ActiveRecord: 0.4ms)
52419
+  (0.1ms) SELECT COUNT(*) FROM "books" WHERE "books"."id" = 1
52420
+  (0.5ms) rollback transaction
52421
+  (0.0ms) begin transaction
52422
+ ----------------------------------------------------------------------------------------
52423
+ FastlyHeadersTest: test_POST_/books_should_not_have_fastly_headers/_fastly_header_values
52424
+ ----------------------------------------------------------------------------------------
52425
+  (0.1ms) SELECT COUNT(*) FROM "books"
52426
+ Started POST "/books" for 127.0.0.1 at 2014-09-17 11:01:43 -0700
52427
+ Processing by BooksController#create as HTML
52428
+ Parameters: {"book"=>{"name"=>"some new book"}}
52429
+  (0.1ms) SAVEPOINT active_record_1
52430
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-17 18:01:43.300532"], ["name", "some new book"], ["updated_at", "2014-09-17 18:01:43.300532"]]
52431
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52432
+ Redirected to http://www.example.com/books
52433
+ Completed 302 Found in 2ms (ActiveRecord: 0.3ms)
52434
+  (0.1ms) SELECT COUNT(*) FROM "books"
52435
+  (0.3ms) rollback transaction
52436
+  (0.1ms) begin transaction
52437
+ -------------------------------------------------------------------------------------------
52438
+ FastlyHeadersTest: test_PUT_/books/:id_should_not_have_fastly_headers/_fastly_header_values
52439
+ -------------------------------------------------------------------------------------------
52440
+  (0.0ms) SAVEPOINT active_record_1
52441
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.304449"], ["id", 1], ["name", "some new book"], ["updated_at", "2014-09-17 18:01:43.304449"]]
52442
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52443
+ Started PUT "/books/1" for 127.0.0.1 at 2014-09-17 11:01:43 -0700
52444
+ Processing by BooksController#update as HTML
52445
+ Parameters: {"id"=>"1", "book"=>{"name"=>"changed book"}}
52446
+ Book Load (0.1ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52447
+  (0.0ms) SAVEPOINT active_record_1
52448
+ SQL (0.4ms) UPDATE "books" SET "name" = ?, "updated_at" = ? WHERE "books"."id" = 1 [["name", "changed book"], ["updated_at", "2014-09-17 18:01:43.308155"]]
52449
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52450
+ Redirected to http://www.example.com/books/1
52451
+ Completed 302 Found in 3ms (ActiveRecord: 0.5ms)
52452
+ Book Load (0.0ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52453
+  (0.4ms) rollback transaction
52454
+  (0.0ms) begin transaction
52455
+  (0.0ms) commit transaction
52456
+  (0.0ms) begin transaction
52457
+  (0.0ms) rollback transaction
52458
+  (0.0ms) begin transaction
52459
+  (0.0ms) commit transaction
52460
+  (0.0ms) begin transaction
52461
+  (0.0ms) rollback transaction
52462
+  (0.0ms) begin transaction
52463
+  (0.0ms) commit transaction
52464
+  (0.0ms) begin transaction
52465
+  (0.0ms) rollback transaction
52466
+  (0.0ms) begin transaction
52467
+  (0.0ms) commit transaction
52468
+  (0.0ms) begin transaction
52469
+  (0.0ms) rollback transaction
52470
+  (0.0ms) begin transaction
52471
+ -------------------------------------------------------------------------------------------------
52472
+ FastlyRails::CacheControlHeadersTest: test_sets_cache_control_headers_on_actioncontroller_request
52473
+ -------------------------------------------------------------------------------------------------
52474
+  (0.0ms) rollback transaction
52475
+  (0.0ms) begin transaction
52476
+  (0.0ms) commit transaction
52477
+  (0.0ms) begin transaction
52478
+  (0.0ms) SAVEPOINT active_record_1
52479
+ SQL (0.3ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.318417"], ["id", 1], ["name", "Return of the Brains"], ["updated_at", "2014-09-17 18:01:43.318417"]]
52480
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52481
+  (0.3ms) rollback transaction
52482
+  (0.0ms) begin transaction
52483
+  (0.0ms) commit transaction
52484
+  (0.0ms) begin transaction
52485
+  (0.0ms) SAVEPOINT active_record_1
52486
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-17 18:01:43.320887"], ["id", 1], ["name", "The Men from Mars"], ["updated_at", "2014-09-17 18:01:43.320887"]]
52487
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52488
+  (0.3ms) rollback transaction
52489
+  (0.0ms) begin transaction
52490
+  (0.0ms) commit transaction
52491
+  (0.0ms) begin transaction
52492
+  (0.0ms) rollback transaction
52493
+  (0.0ms) begin transaction
52494
+  (0.0ms) commit transaction
52495
+  (0.0ms) begin transaction
52496
+  (0.1ms) rollback transaction
52497
+  (0.0ms) begin transaction
52498
+  (0.0ms) commit transaction
52499
+  (0.0ms) begin transaction
52500
+  (0.1ms) rollback transaction
52501
+  (0.0ms) begin transaction
52502
+  (0.0ms) commit transaction
52503
+  (0.0ms) begin transaction
52504
+  (0.0ms) rollback transaction
52505
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
52506
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
52507
+  (0.1ms) begin transaction
52508
+  (0.0ms) commit transaction
52509
+  (0.0ms) begin transaction
52510
+  (0.0ms) rollback transaction
52511
+  (0.0ms) begin transaction
52512
+  (0.0ms) commit transaction
52513
+  (0.0ms) begin transaction
52514
+  (0.1ms) rollback transaction
52515
+  (0.0ms) begin transaction
52516
+  (0.0ms) commit transaction
52517
+  (0.0ms) begin transaction
52518
+  (0.0ms) rollback transaction
52519
+  (0.0ms) begin transaction
52520
+ -----------------------------------------------------------------------
52521
+ FastlyHeadersTest: test_/books/:id_show_page_should_have_fastly_headers
52522
+ -----------------------------------------------------------------------
52523
+  (0.1ms) SAVEPOINT active_record_1
52524
+ SQL (0.9ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.036617"], ["id", 1], ["name", "The Black Rose of England"], ["updated_at", "2014-09-23 19:32:15.036617"]]
52525
+  (0.1ms) RELEASE SAVEPOINT active_record_1
52526
+ Started GET "/books/1" for 127.0.0.1 at 2014-09-23 12:32:15 -0700
52527
+ Processing by BooksController#show as HTML
52528
+ Parameters: {"id"=>"1"}
52529
+ Book Load (0.1ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52530
+ Rendered books/show.html.erb within layouts/application (1.2ms)
52531
+ Completed 200 OK in 15ms (Views: 13.4ms | ActiveRecord: 0.1ms)
52532
+  (0.4ms) rollback transaction
52533
+  (0.0ms) begin transaction
52534
+ --------------------------------------------------------------------
52535
+ FastlyHeadersTest: test_/books_index_page_should_have_fastly_headers
52536
+ --------------------------------------------------------------------
52537
+ Started GET "/books" for 127.0.0.1 at 2014-09-23 12:32:15 -0700
52538
+ Processing by BooksController#index as HTML
52539
+ Book Load (0.1ms) SELECT "books".* FROM "books"
52540
+ Completed 200 OK in 3ms (Views: 1.9ms | ActiveRecord: 0.1ms)
52541
+  (0.1ms) rollback transaction
52542
+  (0.0ms) begin transaction
52543
+ ----------------------------------------------------------------------------------------------
52544
+ FastlyHeadersTest: test_DELETE_/books/:id_should_not_have_fastly_headers/_fastly_header_values
52545
+ ----------------------------------------------------------------------------------------------
52546
+  (0.1ms) SAVEPOINT active_record_1
52547
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.136051"], ["id", 1], ["name", "Planet of the Hungry Man"], ["updated_at", "2014-09-23 19:32:15.136051"]]
52548
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52549
+ Started DELETE "/books/1" for 127.0.0.1 at 2014-09-23 12:32:15 -0700
52550
+ Processing by BooksController#destroy as HTML
52551
+ Parameters: {"id"=>"1"}
52552
+ Book Load (0.0ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52553
+  (0.0ms) SAVEPOINT active_record_1
52554
+ SQL (0.7ms) DELETE FROM "books" WHERE "books"."id" = ? [["id", 1]]
52555
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52556
+ Redirected to http://www.example.com/books
52557
+ Completed 302 Found in 2ms (ActiveRecord: 0.9ms)
52558
+  (0.1ms) SELECT COUNT(*) FROM "books" WHERE "books"."id" = 1
52559
+  (0.4ms) rollback transaction
52560
+  (0.0ms) begin transaction
52561
+ ----------------------------------------------------------------------------------------
52562
+ FastlyHeadersTest: test_POST_/books_should_not_have_fastly_headers/_fastly_header_values
52563
+ ----------------------------------------------------------------------------------------
52564
+  (0.1ms) SELECT COUNT(*) FROM "books"
52565
+ Started POST "/books" for 127.0.0.1 at 2014-09-23 12:32:15 -0700
52566
+ Processing by BooksController#create as HTML
52567
+ Parameters: {"book"=>{"name"=>"some new book"}}
52568
+  (0.1ms) SAVEPOINT active_record_1
52569
+ SQL (0.3ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.148477"], ["name", "some new book"], ["updated_at", "2014-09-23 19:32:15.148477"]]
52570
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52571
+ Redirected to http://www.example.com/books
52572
+ Completed 302 Found in 2ms (ActiveRecord: 0.3ms)
52573
+  (0.1ms) SELECT COUNT(*) FROM "books"
52574
+  (0.4ms) rollback transaction
52575
+  (0.0ms) begin transaction
52576
+ -------------------------------------------------------------------------------------------
52577
+ FastlyHeadersTest: test_PUT_/books/:id_should_not_have_fastly_headers/_fastly_header_values
52578
+ -------------------------------------------------------------------------------------------
52579
+  (0.0ms) SAVEPOINT active_record_1
52580
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.152152"], ["id", 1], ["name", "some new book"], ["updated_at", "2014-09-23 19:32:15.152152"]]
52581
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52582
+ Started PUT "/books/1" for 127.0.0.1 at 2014-09-23 12:32:15 -0700
52583
+ Processing by BooksController#update as HTML
52584
+ Parameters: {"id"=>"1", "book"=>{"name"=>"changed book"}}
52585
+ Book Load (0.1ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52586
+  (0.0ms) SAVEPOINT active_record_1
52587
+ SQL (0.3ms) UPDATE "books" SET "name" = ?, "updated_at" = ? WHERE "books"."id" = 1 [["name", "changed book"], ["updated_at", "2014-09-23 19:32:15.155582"]]
52588
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52589
+ Redirected to http://www.example.com/books/1
52590
+ Completed 302 Found in 2ms (ActiveRecord: 0.4ms)
52591
+ Book Load (0.0ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52592
+  (0.4ms) rollback transaction
52593
+  (0.0ms) begin transaction
52594
+  (0.0ms) commit transaction
52595
+  (0.0ms) begin transaction
52596
+  (0.1ms) rollback transaction
52597
+  (0.1ms) begin transaction
52598
+  (0.0ms) commit transaction
52599
+  (0.0ms) begin transaction
52600
+  (0.1ms) rollback transaction
52601
+  (0.0ms) begin transaction
52602
+  (0.0ms) commit transaction
52603
+  (0.0ms) begin transaction
52604
+  (0.0ms) rollback transaction
52605
+  (0.0ms) begin transaction
52606
+  (0.0ms) commit transaction
52607
+  (0.0ms) begin transaction
52608
+  (0.0ms) rollback transaction
52609
+  (0.0ms) begin transaction
52610
+  (0.0ms) commit transaction
52611
+  (0.0ms) begin transaction
52612
+  (0.0ms) rollback transaction
52613
+  (0.1ms) begin transaction
52614
+  (0.0ms) commit transaction
52615
+  (0.0ms) begin transaction
52616
+  (0.0ms) rollback transaction
52617
+  (0.0ms) begin transaction
52618
+  (0.0ms) commit transaction
52619
+  (0.0ms) begin transaction
52620
+  (0.0ms) rollback transaction
52621
+  (0.0ms) begin transaction
52622
+  (0.0ms) commit transaction
52623
+  (0.0ms) begin transaction
52624
+  (0.0ms) rollback transaction
52625
+  (0.0ms) begin transaction
52626
+  (0.0ms) commit transaction
52627
+  (0.0ms) begin transaction
52628
+  (0.0ms) rollback transaction
52629
+  (0.0ms) begin transaction
52630
+  (0.0ms) commit transaction
52631
+  (0.0ms) begin transaction
52632
+  (0.1ms) SAVEPOINT active_record_1
52633
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.174107"], ["id", 1], ["name", "Je Vous Presente, Adah"], ["updated_at", "2014-09-23 19:32:15.174107"]]
52634
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52635
+  (0.3ms) rollback transaction
52636
+  (0.0ms) begin transaction
52637
+  (0.0ms) commit transaction
52638
+  (0.0ms) begin transaction
52639
+  (0.0ms) SAVEPOINT active_record_1
52640
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.176619"], ["id", 1], ["name", "Hungry Tears"], ["updated_at", "2014-09-23 19:32:15.176619"]]
52641
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52642
+  (0.3ms) rollback transaction
52643
+  (0.1ms) begin transaction
52644
+  (0.0ms) commit transaction
52645
+  (0.0ms) begin transaction
52646
+  (0.0ms) rollback transaction
52647
+  (0.0ms) begin transaction
52648
+  (0.0ms) commit transaction
52649
+  (0.0ms) begin transaction
52650
+  (0.0ms) rollback transaction
52651
+  (0.0ms) begin transaction
52652
+  (0.0ms) commit transaction
52653
+  (0.0ms) begin transaction
52654
+  (0.0ms) rollback transaction
52655
+  (0.0ms) begin transaction
52656
+  (0.0ms) commit transaction
52657
+  (0.0ms) begin transaction
52658
+  (0.0ms) rollback transaction
52659
+  (0.0ms) begin transaction
52660
+  (0.0ms) commit transaction
52661
+  (0.0ms) begin transaction
52662
+  (0.0ms) rollback transaction
52663
+  (0.0ms) begin transaction
52664
+  (0.0ms) commit transaction
52665
+  (0.0ms) begin transaction
52666
+  (0.0ms) rollback transaction
52667
+  (0.0ms) begin transaction
52668
+ --------------------------------
52669
+ BooksControllerTest: test_create
52670
+ --------------------------------
52671
+  (0.0ms) SAVEPOINT active_record_1
52672
+ SQL (0.3ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.217106"], ["name", "I am Brain"], ["updated_at", "2014-09-23 19:32:15.217106"]]
52673
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52674
+  (0.0ms) SAVEPOINT active_record_1
52675
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.218367"], ["name", "The Hills Without a Diaries"], ["updated_at", "2014-09-23 19:32:15.218367"]]
52676
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52677
+  (0.0ms) SAVEPOINT active_record_1
52678
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.219328"], ["name", "Return of the Action Witch"], ["updated_at", "2014-09-23 19:32:15.219328"]]
52679
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52680
+  (0.0ms) SAVEPOINT active_record_1
52681
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.219987"], ["name", "Dr. Cat"], ["updated_at", "2014-09-23 19:32:15.219987"]]
52682
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52683
+  (0.0ms) SAVEPOINT active_record_1
52684
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.220639"], ["name", "The Beast from Across the Ocean"], ["updated_at", "2014-09-23 19:32:15.220639"]]
52685
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52686
+  (0.0ms) SELECT COUNT(*) FROM "books"
52687
+ Processing by BooksController#create as HTML
52688
+ Parameters: {"book"=>{"name"=>"newly-created-book"}}
52689
+  (0.0ms) SAVEPOINT active_record_1
52690
+ SQL (0.1ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.223562"], ["name", "newly-created-book"], ["updated_at", "2014-09-23 19:32:15.223562"]]
52691
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52692
+ Redirected to http://test.host/books
52693
+ Completed 302 Found in 1ms (ActiveRecord: 0.1ms)
52694
+  (0.0ms) SELECT COUNT(*) FROM "books"
52695
+  (0.4ms) rollback transaction
52696
+  (0.0ms) begin transaction
52697
+ -------------------------------
52698
+ BooksControllerTest: test_index
52699
+ -------------------------------
52700
+  (0.0ms) SAVEPOINT active_record_1
52701
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.226354"], ["name", "I Married a Clash"], ["updated_at", "2014-09-23 19:32:15.226354"]]
52702
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52703
+  (0.0ms) SAVEPOINT active_record_1
52704
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.227244"], ["name", "Case of the Missing Flying Men"], ["updated_at", "2014-09-23 19:32:15.227244"]]
52705
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52706
+  (0.0ms) SAVEPOINT active_record_1
52707
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.228162"], ["name", "The Men from Mars"], ["updated_at", "2014-09-23 19:32:15.228162"]]
52708
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52709
+  (0.1ms) SAVEPOINT active_record_1
52710
+ SQL (0.1ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.229656"], ["name", "Flying Witch: The Ralph Rosenbaum Story"], ["updated_at", "2014-09-23 19:32:15.229656"]]
52711
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52712
+  (0.0ms) SAVEPOINT active_record_1
52713
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.230761"], ["name", "Tokyo Brains"], ["updated_at", "2014-09-23 19:32:15.230761"]]
52714
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52715
+ Processing by BooksController#index as HTML
52716
+ Book Load (0.1ms) SELECT "books".* FROM "books"
52717
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.1ms)
52718
+  (0.0ms) SELECT COUNT(*) FROM "books"
52719
+  (0.4ms) rollback transaction
52720
+  (0.0ms) begin transaction
52721
+ ----------------------------------------------------
52722
+ BooksControllerTest: test_index_with_multiple_params
52723
+ ----------------------------------------------------
52724
+  (0.0ms) SAVEPOINT active_record_1
52725
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.235737"], ["name", "Flying Rain"], ["updated_at", "2014-09-23 19:32:15.235737"]]
52726
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52727
+  (0.0ms) SAVEPOINT active_record_1
52728
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.236805"], ["name", "The Forbidden Gypsy from Outer Space"], ["updated_at", "2014-09-23 19:32:15.236805"]]
52729
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52730
+  (0.0ms) SAVEPOINT active_record_1
52731
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.237695"], ["name", "Tokyo Women"], ["updated_at", "2014-09-23 19:32:15.237695"]]
52732
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52733
+  (0.0ms) SAVEPOINT active_record_1
52734
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.238374"], ["name", "Red Blow"], ["updated_at", "2014-09-23 19:32:15.238374"]]
52735
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52736
+  (0.0ms) SAVEPOINT active_record_1
52737
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.239030"], ["name", "The Wolf Who Fell to Earth"], ["updated_at", "2014-09-23 19:32:15.239030"]]
52738
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52739
+ Processing by BooksController#index as HTML
52740
+ Book Load (0.1ms) SELECT "books".* FROM "books"
52741
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.1ms)
52742
+  (0.5ms) rollback transaction
52743
+  (0.0ms) begin transaction
52744
+ ------------------------------
52745
+ BooksControllerTest: test_show
52746
+ ------------------------------
52747
+  (0.0ms) SAVEPOINT active_record_1
52748
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.243644"], ["name", "Invasion of the Hills"], ["updated_at", "2014-09-23 19:32:15.243644"]]
52749
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52750
+  (0.0ms) SAVEPOINT active_record_1
52751
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.244869"], ["name", "I am Mutant"], ["updated_at", "2014-09-23 19:32:15.244869"]]
52752
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52753
+  (0.0ms) SAVEPOINT active_record_1
52754
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.245820"], ["name", "Ultra Gypsy"], ["updated_at", "2014-09-23 19:32:15.245820"]]
52755
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52756
+  (0.0ms) SAVEPOINT active_record_1
52757
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.246507"], ["name", "Legend of Men"], ["updated_at", "2014-09-23 19:32:15.246507"]]
52758
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52759
+  (0.0ms) SAVEPOINT active_record_1
52760
+ SQL (0.0ms) INSERT INTO "books" ("created_at", "name", "updated_at") VALUES (?, ?, ?) [["created_at", "2014-09-23 19:32:15.247173"], ["name", "The Red Monster That Came to Dinner"], ["updated_at", "2014-09-23 19:32:15.247173"]]
52761
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52762
+ Processing by BooksController#show as HTML
52763
+ Parameters: {"id"=>"1"}
52764
+ Book Load (0.0ms) SELECT "books".* FROM "books" WHERE "books"."id" = ? LIMIT 1 [["id", 1]]
52765
+ Completed 200 OK in 1ms (Views: 0.7ms | ActiveRecord: 0.0ms)
52766
+  (0.5ms) rollback transaction
52767
+  (0.0ms) begin transaction
52768
+  (0.0ms) commit transaction
52769
+  (0.0ms) begin transaction
52770
+  (0.0ms) rollback transaction
52771
+  (0.0ms) begin transaction
52772
+  (0.0ms) commit transaction
52773
+  (0.0ms) begin transaction
52774
+  (0.0ms) rollback transaction
52775
+  (0.0ms) begin transaction
52776
+  (0.0ms) commit transaction
52777
+  (0.0ms) begin transaction
52778
+  (0.0ms) rollback transaction
52779
+  (0.0ms) begin transaction
52780
+  (0.0ms) commit transaction
52781
+  (0.0ms) begin transaction
52782
+  (0.0ms) rollback transaction
52783
+  (0.0ms) begin transaction
52784
+  (0.0ms) commit transaction
52785
+  (0.0ms) begin transaction
52786
+  (0.0ms) rollback transaction
52787
+  (0.0ms) begin transaction
52788
+ -------------------------------------------------------------------------------------------------
52789
+ FastlyRails::CacheControlHeadersTest: test_sets_cache_control_headers_on_actioncontroller_request
52790
+ -------------------------------------------------------------------------------------------------
52791
+  (0.0ms) rollback transaction
52792
+  (0.0ms) begin transaction
52793
+  (0.0ms) commit transaction
52794
+  (0.0ms) begin transaction
52795
+  (0.0ms) SAVEPOINT active_record_1
52796
+ SQL (0.3ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.255779"], ["id", 1], ["name", "Day of the Dangerous Wizard"], ["updated_at", "2014-09-23 19:32:15.255779"]]
52797
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52798
+  (0.3ms) rollback transaction
52799
+  (0.0ms) begin transaction
52800
+  (0.0ms) commit transaction
52801
+  (0.0ms) begin transaction
52802
+  (0.0ms) SAVEPOINT active_record_1
52803
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.258288"], ["id", 1], ["name", "Blue Witch"], ["updated_at", "2014-09-23 19:32:15.258288"]]
52804
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52805
+  (0.3ms) rollback transaction
52806
+  (0.0ms) begin transaction
52807
+  (0.0ms) commit transaction
52808
+  (0.0ms) begin transaction
52809
+  (0.0ms) rollback transaction
52810
+  (0.0ms) begin transaction
52811
+  (0.0ms) commit transaction
52812
+  (0.0ms) begin transaction
52813
+  (0.0ms) SAVEPOINT active_record_1
52814
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.261219"], ["id", 1], ["name", "War of the Jungle"], ["updated_at", "2014-09-23 19:32:15.261219"]]
52815
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52816
+  (0.3ms) rollback transaction
52817
+  (0.0ms) begin transaction
52818
+  (0.0ms) commit transaction
52819
+  (0.0ms) begin transaction
52820
+  (0.0ms) SAVEPOINT active_record_1
52821
+ SQL (0.2ms) INSERT INTO "books" ("created_at", "id", "name", "updated_at") VALUES (?, ?, ?, ?) [["created_at", "2014-09-23 19:32:15.263373"], ["id", 1], ["name", "The Cat from the Black Lagoon"], ["updated_at", "2014-09-23 19:32:15.263373"]]
52822
+  (0.0ms) RELEASE SAVEPOINT active_record_1
52823
+  (0.3ms) rollback transaction
52824
+  (0.0ms) begin transaction
52825
+  (0.0ms) commit transaction
52826
+  (0.0ms) begin transaction
52827
+  (0.0ms) rollback transaction
52828
+  (0.0ms) begin transaction
52829
+  (0.0ms) commit transaction
52830
+  (0.0ms) begin transaction
52831
+  (0.0ms) rollback transaction
52832
+  (0.0ms) begin transaction
52833
+  (0.0ms) commit transaction
52834
+  (0.0ms) begin transaction
52835
+  (0.0ms) rollback transaction
52836
+  (0.0ms) begin transaction
52837
+  (0.0ms) commit transaction
52838
+  (0.0ms) begin transaction
52839
+  (0.0ms) rollback transaction
@@ -0,0 +1,43 @@
1
+ describe FastlyRails::Rack::RemoveSetCookieHeader do
2
+ it "removes 'set-cookie' header if 'surrogate-control' header present" do
3
+ headers = { "Surrogate-Control" => "test", "Set-Cookie" => "NOOO" }
4
+
5
+ app = Rack::Builder.new do
6
+ use FastlyRails::Rack::RemoveSetCookieHeader
7
+ run lambda { |env| Rack::Response.new("", 200, headers).finish }
8
+ end
9
+
10
+ env = Rack::MockRequest.env_for('/')
11
+ response = Rack::MockResponse.new(*app.call(env))
12
+
13
+ assert_nil response.headers['Set-Cookie']
14
+ end
15
+
16
+ it "removes 'set-cookie' header if 'surrogate-key' header present" do
17
+ headers = { "Surrogate-Key" => "test", "Set-Cookie" => "NOOO" }
18
+
19
+ app = Rack::Builder.new do
20
+ use FastlyRails::Rack::RemoveSetCookieHeader
21
+ run lambda { |env| Rack::Response.new("", 200, headers).finish }
22
+ end
23
+
24
+ env = Rack::MockRequest.env_for('/')
25
+ response = Rack::MockResponse.new(*app.call(env))
26
+
27
+ assert_nil response.headers['Set-Cookie']
28
+ end
29
+
30
+ it "keeps 'set-cookie' if no 'surrogate-control' or 'surrogate-key'" do
31
+ headers = { "Set-Cookie" => "yes!!" }
32
+
33
+ app = Rack::Builder.new do
34
+ use FastlyRails::Rack::RemoveSetCookieHeader
35
+ run lambda { |env| Rack::Response.new("", 200, headers).finish }
36
+ end
37
+
38
+ env = Rack::MockRequest.env_for('/')
39
+ response = Rack::MockResponse.new(*app.call(env))
40
+
41
+ assert_equal response.headers['Set-Cookie'], "yes!!"
42
+ end
43
+ end
@@ -33,4 +33,31 @@ describe FastlyRails::Client do
33
33
 
34
34
  end
35
35
 
36
+ describe 'purge_by_key' do
37
+ it 'raises if purge called and no service id configured' do
38
+ FastlyRails.configuration.service_id = nil
39
+
40
+ assert_raises FastlyRails::NoServiceIdProvidedError do
41
+ client.purge_by_key('test')
42
+ end
43
+ end
44
+
45
+ it 'should call Fastly::Client.post method with the purge url' do
46
+ FastlyRails.configuration.service_id = 'testly'
47
+ assert_equal "/service/#{FastlyRails.service_id}/purge/test", client.purge_url('test')
48
+
49
+ resp = client.purge_by_key('test')
50
+ assert_equal "ok", resp['status']
51
+ end
52
+
53
+ it 'should be authed' do
54
+ assert_equal true, client.fully_authed?
55
+
56
+ client.client.user = nil
57
+ client.client.password = nil
58
+ assert_equal false, client.fully_authed?
59
+ assert_equal true, client.authed?
60
+ end
61
+ end
62
+
36
63
  end
data/test/test_helper.rb CHANGED
@@ -28,12 +28,16 @@ class Minitest::Spec
28
28
  include FactoryGirl::Syntax::Methods
29
29
 
30
30
  before :each do
31
- stub_request(:any, /.*/).
31
+ stub_request(:any, "https://api.fastly.com/login").
32
32
  to_return(
33
33
  :status => 200,
34
34
  :body => "{}",
35
35
  :message => "{}"
36
36
  )
37
+ stub_request(:post, /https:\/\/api.fastly.com\/service\/.*\/purge\/.*/)
38
+ .to_return(
39
+ body: "{\"status\":\"ok\"}"
40
+ )
37
41
 
38
42
  DatabaseCleaner.start
39
43
  end
@@ -63,5 +67,4 @@ class ActionDispatch::IntegrationTest
63
67
 
64
68
  end
65
69
 
66
- # Stub any request to api.fastly.com
67
70
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastly-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael May
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-09-04 00:00:00.000000000 Z
14
+ date: 2014-09-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -150,20 +150,19 @@ executables: []
150
150
  extensions: []
151
151
  extra_rdoc_files: []
152
152
  files:
153
- - MIT-LICENSE
154
- - Rakefile
155
- - lib/fastly-rails.rb
156
153
  - lib/fastly-rails/action_controller/cache_control_headers.rb
157
- - lib/fastly-rails/action_controller/surrogate_control_headers.rb
154
+ - lib/fastly-rails/action_controller/surrogate_key_headers.rb
158
155
  - lib/fastly-rails/active_record/surrogate_key.rb
159
156
  - lib/fastly-rails/client.rb
160
157
  - lib/fastly-rails/configuration.rb
161
158
  - lib/fastly-rails/engine.rb
162
159
  - lib/fastly-rails/errors.rb
163
160
  - lib/fastly-rails/mongoid/surrogate_key.rb
161
+ - lib/fastly-rails/rack/remove_set_cookie_header.rb
164
162
  - lib/fastly-rails/version.rb
165
- - test/dummy/README.rdoc
166
- - test/dummy/Rakefile
163
+ - lib/fastly-rails.rb
164
+ - MIT-LICENSE
165
+ - Rakefile
167
166
  - test/dummy/app/assets/javascripts/application.js
168
167
  - test/dummy/app/assets/stylesheets/application.css
169
168
  - test/dummy/app/controllers/application_controller.rb
@@ -176,7 +175,6 @@ files:
176
175
  - test/dummy/bin/bundle
177
176
  - test/dummy/bin/rails
178
177
  - test/dummy/bin/rake
179
- - test/dummy/config.ru
180
178
  - test/dummy/config/application.rb
181
179
  - test/dummy/config/boot.rb
182
180
  - test/dummy/config/database.yml
@@ -194,6 +192,7 @@ files:
194
192
  - test/dummy/config/initializers/wrap_parameters.rb
195
193
  - test/dummy/config/locales/en.yml
196
194
  - test/dummy/config/routes.rb
195
+ - test/dummy/config.ru
197
196
  - test/dummy/db/migrate/20140407202136_create_books.rb
198
197
  - test/dummy/db/schema.rb
199
198
  - test/dummy/db/test.sqlite3
@@ -203,10 +202,13 @@ files:
203
202
  - test/dummy/public/422.html
204
203
  - test/dummy/public/500.html
205
204
  - test/dummy/public/favicon.ico
205
+ - test/dummy/Rakefile
206
+ - test/dummy/README.rdoc
206
207
  - test/dummy/test/controllers/books_controller_test.rb
207
208
  - test/dummy/test/factories/books.rb
208
209
  - test/dummy/test/fixtures/books.yml
209
210
  - test/dummy/test/integration/fastly_headers_test.rb
211
+ - test/dummy/test/lib/remove_set_cookie_header_test.rb
210
212
  - test/dummy/test/models/book_test.rb
211
213
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
212
214
  - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
@@ -238,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
240
  version: '0'
239
241
  requirements: []
240
242
  rubyforge_project:
241
- rubygems_version: 2.2.1
243
+ rubygems_version: 2.0.14
242
244
  signing_key:
243
245
  specification_version: 4
244
246
  summary: Fastly instant purging integration for Rails
@@ -288,6 +290,7 @@ test_files:
288
290
  - test/dummy/test/factories/books.rb
289
291
  - test/dummy/test/fixtures/books.yml
290
292
  - test/dummy/test/integration/fastly_headers_test.rb
293
+ - test/dummy/test/lib/remove_set_cookie_header_test.rb
291
294
  - test/dummy/test/models/book_test.rb
292
295
  - test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705
293
296
  - test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af
@@ -1,14 +0,0 @@
1
- module FastlyRails
2
- module SurrogateControlHeaders
3
- # Sets Surrogate-Control header
4
- # Defaults are:
5
- # Cache-Control: 'public, no-cache, s-maxage: 30 days'
6
- # Surrogate-Control: 'max-age: 30 days
7
- # custom config example:
8
- # {cache_control: 'blah, blah, blah', surrogate_control: 'max-age: blah'}
9
- def set_surrogate_key_header(*surrogate_keys)
10
- request.session_options[:skip] = true # no cookies
11
- response.headers['Surrogate-Key'] = surrogate_keys.join(' ')
12
- end
13
- end
14
- end