Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 5408 Bytes
1 | require "#{File.dirname(__FILE__)}/spec_setup" |
2 | require 'rack/cache/cachecontrol' |
3 | |
4 | describe 'Rack::Cache::CacheControl' do |
5 | it 'takes no args and initializes with an empty set of values' do |
6 | cache_control = Rack::Cache::CacheControl.new |
7 | cache_control.should.be.empty |
8 | cache_control.to_s.should.equal '' |
9 | end |
10 | |
11 | it 'takes a String and parses it into a Hash when created' do |
12 | cache_control = Rack::Cache::CacheControl.new('max-age=600, foo') |
13 | cache_control['max-age'].should.equal '600' |
14 | cache_control['foo'].should.be true |
15 | end |
16 | |
17 | it 'takes a String with a single name=value pair' do |
18 | cache_control = Rack::Cache::CacheControl.new('max-age=600') |
19 | cache_control['max-age'].should.equal '600' |
20 | end |
21 | |
22 | it 'takes a String with multiple name=value pairs' do |
23 | cache_control = Rack::Cache::CacheControl.new('max-age=600, max-stale=300, min-fresh=570') |
24 | cache_control['max-age'].should.equal '600' |
25 | cache_control['max-stale'].should.equal '300' |
26 | cache_control['min-fresh'].should.equal '570' |
27 | end |
28 | |
29 | it 'takes a String with a single flag value' do |
30 | cache_control = Rack::Cache::CacheControl.new('no-cache') |
31 | cache_control.should.include 'no-cache' |
32 | cache_control['no-cache'].should.be true |
33 | end |
34 | |
35 | it 'takes a String with a bunch of all kinds of stuff' do |
36 | cache_control = |
37 | Rack::Cache::CacheControl.new('max-age=600,must-revalidate,min-fresh=3000,foo=bar,baz') |
38 | cache_control['max-age'].should.equal '600' |
39 | cache_control['must-revalidate'].should.be true |
40 | cache_control['min-fresh'].should.equal '3000' |
41 | cache_control['foo'].should.equal 'bar' |
42 | cache_control['baz'].should.be true |
43 | end |
44 | |
45 | it 'strips leading and trailing spaces from header value' do |
46 | cache_control = Rack::Cache::CacheControl.new(' public, max-age = 600 ') |
47 | cache_control.should.include 'public' |
48 | cache_control.should.include 'max-age' |
49 | cache_control['max-age'].should.equal '600' |
50 | end |
51 | |
52 | it 'removes all directives with #clear' do |
53 | cache_control = Rack::Cache::CacheControl.new('max-age=600, must-revalidate') |
54 | cache_control.clear |
55 | cache_control.should.be.empty |
56 | end |
57 | |
58 | it 'converts self into header String with #to_s' do |
59 | cache_control = Rack::Cache::CacheControl.new |
60 | cache_control['public'] = true |
61 | cache_control['max-age'] = '600' |
62 | cache_control.to_s.split(', ').sort.should.equal ['max-age=600', 'public'] |
63 | end |
64 | |
65 | it 'sorts alphabetically with boolean directives before value directives' do |
66 | cache_control = Rack::Cache::CacheControl.new('foo=bar, z, x, y, bling=baz, zoom=zib, b, a') |
67 | cache_control.to_s.should.equal 'a, b, x, y, z, bling=baz, foo=bar, zoom=zib' |
68 | end |
69 | |
70 | it 'responds to #max_age with an integer when max-age directive present' do |
71 | cache_control = Rack::Cache::CacheControl.new('public, max-age=600') |
72 | cache_control.max_age.should.equal 600 |
73 | end |
74 | |
75 | it 'responds to #max_age with nil when no max-age directive present' do |
76 | cache_control = Rack::Cache::CacheControl.new('public') |
77 | cache_control.max_age.should.be nil |
78 | end |
79 | |
80 | it 'responds to #shared_max_age with an integer when s-maxage directive present' do |
81 | cache_control = Rack::Cache::CacheControl.new('public, s-maxage=600') |
82 | cache_control.shared_max_age.should.equal 600 |
83 | end |
84 | |
85 | it 'responds to #shared_max_age with nil when no s-maxage directive present' do |
86 | cache_control = Rack::Cache::CacheControl.new('public') |
87 | cache_control.shared_max_age.should.be nil |
88 | end |
89 | |
90 | it 'responds to #public? truthfully when public directive present' do |
91 | cache_control = Rack::Cache::CacheControl.new('public') |
92 | cache_control.should.be.public |
93 | end |
94 | |
95 | it 'responds to #public? non-truthfully when no public directive present' do |
96 | cache_control = Rack::Cache::CacheControl.new('private') |
97 | cache_control.should.not.be.public |
98 | end |
99 | |
100 | it 'responds to #private? truthfully when private directive present' do |
101 | cache_control = Rack::Cache::CacheControl.new('private') |
102 | cache_control.should.be.private |
103 | end |
104 | |
105 | it 'responds to #private? non-truthfully when no private directive present' do |
106 | cache_control = Rack::Cache::CacheControl.new('public') |
107 | cache_control.should.not.be.private |
108 | end |
109 | |
110 | it 'responds to #no_cache? truthfully when no-cache directive present' do |
111 | cache_control = Rack::Cache::CacheControl.new('no-cache') |
112 | cache_control.should.be.no_cache |
113 | end |
114 | |
115 | it 'responds to #no_cache? non-truthfully when no no-cache directive present' do |
116 | cache_control = Rack::Cache::CacheControl.new('max-age=600') |
117 | cache_control.should.not.be.no_cache |
118 | end |
119 | |
120 | it 'responds to #must_revalidate? truthfully when must-revalidate directive present' do |
121 | cache_control = Rack::Cache::CacheControl.new('must-revalidate') |
122 | cache_control.should.be.must_revalidate |
123 | end |
124 | |
125 | it 'responds to #must_revalidate? non-truthfully when no must-revalidate directive present' do |
126 | cache_control = Rack::Cache::CacheControl.new('max-age=600') |
127 | cache_control.should.not.be.no_cache |
128 | end |
129 | |
130 | it 'responds to #proxy_revalidate? truthfully when proxy-revalidate directive present' do |
131 | cache_control = Rack::Cache::CacheControl.new('proxy-revalidate') |
132 | cache_control.should.be.proxy_revalidate |
133 | end |
134 | |
135 | it 'responds to #proxy_revalidate? non-truthfully when no proxy-revalidate directive present' do |
136 | cache_control = Rack::Cache::CacheControl.new('max-age=600') |
137 | cache_control.should.not.be.no_cache |
138 | end |
139 | end |