dassets 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,7 @@ class Dassets::Server
16
16
  elsif !@asset_file.exists?
17
17
  [ 404, Rack::Utils::HeaderHash.new, ["Not Found"] ]
18
18
  else
19
+ @asset_file.digest!
19
20
  [ 200,
20
21
  Rack::Utils::HeaderHash.new.tap do |h|
21
22
  h["Content-Type"] = @asset_file.mime_type.to_s
@@ -1,3 +1,3 @@
1
1
  module Dassets
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'assert'
2
2
  require 'assert-rack-test'
3
+ require 'fileutils'
3
4
  require 'test/support/app'
4
5
  require 'dassets/server'
5
6
 
@@ -37,6 +38,27 @@ module Dassets
37
38
 
38
39
  end
39
40
 
41
+ class DigestTests < SuccessTests
42
+ setup do
43
+ Dassets.config.file_store = 'public'
44
+ @url = 'file1-daa05c683a4913b268653f7a7e36a5b4.txt'
45
+ @url_file = Dassets.config.file_store.store_path(@url)
46
+ FileUtils.rm(@url_file)
47
+ end
48
+ teardown do
49
+ Dassets.config.file_store = NullFileStore.new
50
+ end
51
+
52
+ should "digest the asset" do
53
+ assert_not_file_exists @url_file
54
+
55
+ resp = get "/#{@url}"
56
+ assert_equal 200, resp.status
57
+ assert_file_exists @url_file
58
+ end
59
+
60
+ end
61
+
40
62
  class NotModifiedTests < RackTests
41
63
  desc "requesting an existing asset file that has not been modified"
42
64
  setup do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dassets
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kelly Redding
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-05-01 00:00:00 Z
19
+ date: 2013-05-02 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: assert