fastly-rails 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/fastly-rails.rb +8 -2
- data/lib/fastly-rails/action_controller/cache_control_headers.rb +1 -3
- data/lib/fastly-rails/active_record/surrogate_key.rb +2 -2
- data/lib/fastly-rails/configuration.rb +6 -0
- data/lib/fastly-rails/mongoid/surrogate_key.rb +2 -2
- data/lib/fastly-rails/version.rb +1 -1
- data/test/dummy/config/environments/test.rb +3 -1
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +22 -5
- data/test/dummy/log/test.log +13317 -53130
- data/test/dummy/test/factories/books.rb +1 -1
- data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/fastly-rails/active_record/surrogate_key_test.rb +0 -0
- data/test/fastly-rails/configuration_test.rb +16 -0
- data/test/fastly-rails_test.rb +28 -5
- data/test/test_helper.rb +0 -2
- metadata +7 -3
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
@@ -65,6 +65,22 @@ describe FastlyRails::Configuration do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
describe 'purging_enabled?' do
|
69
|
+
it 'is enabled by default' do
|
70
|
+
assert_equal true, configuration.purging_enabled?
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'is enabled when set to true' do
|
74
|
+
configuration.purging_enabled = true
|
75
|
+
assert_equal true, configuration.purging_enabled?
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'is disabled when set to false' do
|
79
|
+
configuration.purging_enabled = false
|
80
|
+
assert_equal false, configuration.purging_enabled?
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
68
84
|
it 'should have a default value for max_age since none was provided' do
|
69
85
|
assert_equal FastlyRails::Configuration.max_age_default, configuration.max_age
|
70
86
|
end
|
data/test/fastly-rails_test.rb
CHANGED
@@ -5,19 +5,19 @@ describe FastlyRails do
|
|
5
5
|
let(:user) { nil }
|
6
6
|
let(:password) { nil }
|
7
7
|
let(:max_age) { 100000 }
|
8
|
-
let(:configuration) { FastlyRails.
|
8
|
+
let(:configuration) { FastlyRails::Configuration.new }
|
9
9
|
let(:service_id) { 'someserviceid' }
|
10
10
|
let(:client) { FastlyRails.client }
|
11
11
|
|
12
|
+
before do
|
13
|
+
FastlyRails.instance_variable_set('@configuration', configuration)
|
14
|
+
end
|
15
|
+
|
12
16
|
it 'should be a module' do
|
13
17
|
assert_kind_of Module, FastlyRails
|
14
18
|
end
|
15
19
|
|
16
20
|
describe 'credentials not provided' do
|
17
|
-
before do
|
18
|
-
FastlyRails.instance_variable_set('@configuration', FastlyRails::Configuration.new)
|
19
|
-
end
|
20
|
-
|
21
21
|
it 'should raise an error if configuration is not authenticatable' do
|
22
22
|
assert_equal false, configuration.authenticatable?
|
23
23
|
assert_equal true, configuration.invalid_service_id?
|
@@ -47,10 +47,33 @@ describe FastlyRails do
|
|
47
47
|
assert_equal password, configuration.password
|
48
48
|
assert_equal max_age, configuration.max_age
|
49
49
|
assert_equal service_id, configuration.service_id
|
50
|
+
assert_equal true, configuration.purging_enabled?
|
50
51
|
end
|
51
52
|
|
52
53
|
it 'should return a valid client' do
|
53
54
|
assert_instance_of FastlyRails::Client, client
|
54
55
|
end
|
55
56
|
end
|
57
|
+
|
58
|
+
describe 'purge_by_key' do
|
59
|
+
let(:client) { MiniTest::Mock.new }
|
60
|
+
let(:key) { "key" }
|
61
|
+
|
62
|
+
it 'delegates to the client when purging is enabled' do
|
63
|
+
FastlyRails.stub(:client, client) do
|
64
|
+
FastlyRails.stub(:purging_enabled?, true) do
|
65
|
+
client.expect(:purge_by_key, nil, [key])
|
66
|
+
FastlyRails.purge_by_key(key)
|
67
|
+
client.verify
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'does nothing when purging is disabled' do
|
73
|
+
configuration.purging_enabled = false
|
74
|
+
FastlyRails.stub(:client, client) do
|
75
|
+
FastlyRails.purge_by_key(key)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
56
79
|
end
|
data/test/test_helper.rb
CHANGED
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.
|
4
|
+
version: 0.4.0
|
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: 2015-
|
14
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- test/dummy/config/initializers/wrap_parameters.rb
|
196
196
|
- test/dummy/config/locales/en.yml
|
197
197
|
- test/dummy/config/routes.rb
|
198
|
+
- test/dummy/db/development.sqlite3
|
198
199
|
- test/dummy/db/migrate/20140407202136_create_books.rb
|
199
200
|
- test/dummy/db/migrate/20150312044151_add_service_id_to_books.rb
|
200
201
|
- test/dummy/db/schema.rb
|
@@ -217,6 +218,7 @@ files:
|
|
217
218
|
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
218
219
|
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
219
220
|
- test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
221
|
+
- test/fastly-rails/active_record/surrogate_key_test.rb
|
220
222
|
- test/fastly-rails/cache_control_headers_test.rb
|
221
223
|
- test/fastly-rails/client_test.rb
|
222
224
|
- test/fastly-rails/configuration_test.rb
|
@@ -241,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
243
|
version: '0'
|
242
244
|
requirements: []
|
243
245
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.
|
246
|
+
rubygems_version: 2.2.2
|
245
247
|
signing_key:
|
246
248
|
specification_version: 4
|
247
249
|
summary: Fastly instant purging integration for Rails
|
@@ -276,6 +278,7 @@ test_files:
|
|
276
278
|
- test/dummy/config/locales/en.yml
|
277
279
|
- test/dummy/config/routes.rb
|
278
280
|
- test/dummy/config.ru
|
281
|
+
- test/dummy/db/development.sqlite3
|
279
282
|
- test/dummy/db/migrate/20140407202136_create_books.rb
|
280
283
|
- test/dummy/db/migrate/20150312044151_add_service_id_to_books.rb
|
281
284
|
- test/dummy/db/schema.rb
|
@@ -300,6 +303,7 @@ test_files:
|
|
300
303
|
- test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994
|
301
304
|
- test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6
|
302
305
|
- test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655
|
306
|
+
- test/fastly-rails/active_record/surrogate_key_test.rb
|
303
307
|
- test/fastly-rails/cache_control_headers_test.rb
|
304
308
|
- test/fastly-rails/client_test.rb
|
305
309
|
- test/fastly-rails/configuration_test.rb
|