Skip to content

Commit

Permalink
Test cache headers for 64-char hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
lime committed Jul 5, 2016
1 parent edb6530 commit b6edf75
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions spec/unit/storage_spec.rb
Expand Up @@ -84,10 +84,20 @@


it 'should correctly set expire date' do
local_files = ['file1.jpg', 'file1-1234567890abcdef1234567890abcdef.jpg',
'file1-1234567890abcdef1234567890abcdef.jpg.gz']
local_files += ['dir1/dir2/file2.jpg', 'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg',
'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg.gz']
local_files = [
'file1.jpg',
'file1-1234567890abcdef1234567890abcdef.jpg',
'file1-1234567890abcdef1234567890abcdef.jpg.gz',
'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg',
'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
]
local_files += [
'dir1/dir2/file2.jpg',
'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg',
'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg.gz',
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg',
'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
]
remote_files = []
storage = AssetSync::Storage.new(@config)
allow(storage).to receive(:local_files).and_return(local_files)
Expand All @@ -101,9 +111,13 @@ def check_file(file)
when 'dir1/dir2/file2.jpg'
!expect(file).not_to include(:cache_control, :expires)
when 'file1-1234567890abcdef1234567890abcdef.jpg'
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg'
when 'file1-1234567890abcdef1234567890abcdef.jpg.gz'
when 'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg'
when 'file1-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg'
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef.jpg.gz'
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg'
when 'dir1/dir2/file2-1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef.jpg.gz'
expect(file).to include(:cache_control, :expires)
else
fail
Expand Down

0 comments on commit b6edf75

Please sign in to comment.