dassets 0.14.1 → 0.15.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 +7 -7
- data/.ruby-version +1 -0
- data/Gemfile +3 -1
- data/README.md +15 -17
- data/dassets.gemspec +7 -6
- data/lib/dassets.rb +54 -11
- data/lib/dassets/asset_file.rb +14 -12
- data/lib/dassets/cache.rb +27 -33
- data/lib/dassets/config.rb +55 -47
- data/lib/dassets/engine.rb +11 -23
- data/lib/dassets/file_store.rb +27 -27
- data/lib/dassets/server.rb +27 -28
- data/lib/dassets/server/request.rb +43 -41
- data/lib/dassets/server/response.rb +93 -81
- data/lib/dassets/source.rb +13 -8
- data/lib/dassets/source_file.rb +100 -82
- data/lib/dassets/source_proxy.rb +32 -16
- data/lib/dassets/version.rb +3 -1
- data/test/helper.rb +18 -24
- data/test/support/app.rb +3 -5
- data/test/support/factory.rb +1 -2
- data/test/support/{public/nested/file3-d41d8cd98f00b204e9800998ecf8427e.txt → linked_source_files/linked_file.txt} +0 -0
- data/test/support/source_files/linked +1 -0
- data/test/support/source_files/linked_file2.txt +1 -0
- data/test/system/rack_tests.rb +55 -59
- data/test/unit/asset_file_tests.rb +64 -60
- data/test/unit/cache_tests.rb +14 -35
- data/test/unit/config_tests.rb +65 -45
- data/test/unit/dassets_tests.rb +41 -23
- data/test/unit/engine_tests.rb +7 -43
- data/test/unit/file_store_tests.rb +42 -31
- data/test/unit/server/request_tests.rb +48 -53
- data/test/unit/server/response_tests.rb +79 -81
- data/test/unit/server_tests.rb +3 -9
- data/test/unit/source_file_tests.rb +73 -72
- data/test/unit/source_proxy_tests.rb +78 -89
- data/test/unit/source_tests.rb +58 -50
- metadata +78 -70
- data/test/support/public/file2-9bbe1047cffbb590f59e0e5aeff46ae4.txt +0 -1
- data/test/support/public/grumpy_cat-b0d1f399a916f7a25c4c0f693c619013.jpg +0 -0
- data/test/support/public/nested/a-thing.txt-7413d18f2eba9c695a880aff67fde135.no-use +0 -4
data/test/unit/server_tests.rb
CHANGED
@@ -1,17 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "assert"
|
2
|
+
require "dassets/server"
|
3
3
|
|
4
4
|
class Dassets::Server
|
5
|
-
|
6
5
|
class UnitTests < Assert::Context
|
7
6
|
desc "Dassets::Server"
|
8
|
-
|
9
|
-
@server = Dassets::Server.new('a rack app goes here')
|
10
|
-
end
|
11
|
-
subject{ @server }
|
7
|
+
subject { Dassets::Server.new("test rack app") }
|
12
8
|
|
13
9
|
should have_imeths :call, :call!
|
14
|
-
|
15
10
|
end
|
16
|
-
|
17
11
|
end
|
@@ -1,19 +1,18 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "assert"
|
2
|
+
require "dassets/source_file"
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
4
|
+
require "dassets/asset_file"
|
5
|
+
require "dassets/cache"
|
6
|
+
require "dassets/source_proxy"
|
7
7
|
|
8
8
|
class Dassets::SourceFile
|
9
|
-
|
10
9
|
class UnitTests < Assert::Context
|
11
10
|
desc "Dassets::SourceFile"
|
11
|
+
subject { Dassets::SourceFile.new(@file_path) }
|
12
|
+
|
12
13
|
setup do
|
13
|
-
@file_path = TEST_SUPPORT_PATH.join(
|
14
|
-
@source_file = Dassets::SourceFile.new(@file_path)
|
14
|
+
@file_path = TEST_SUPPORT_PATH.join("app/assets/file1.txt").to_s
|
15
15
|
end
|
16
|
-
subject{ @source_file }
|
17
16
|
|
18
17
|
should have_readers :file_path
|
19
18
|
should have_imeths :source, :asset_file, :digest_path
|
@@ -21,74 +20,97 @@ class Dassets::SourceFile
|
|
21
20
|
should have_cmeth :find_by_digest_path
|
22
21
|
|
23
22
|
should "know its file path" do
|
24
|
-
|
23
|
+
assert_that(subject.file_path).equals(@file_path.to_s)
|
25
24
|
end
|
26
25
|
|
27
26
|
should "know its configured source" do
|
28
|
-
exp_source =
|
29
|
-
|
27
|
+
exp_source =
|
28
|
+
Dassets.config.sources.select{ |s| @file_path.include?(s.path) }.last
|
29
|
+
assert_that(subject.source).equals(exp_source)
|
30
30
|
end
|
31
31
|
|
32
32
|
should "know its asset file" do
|
33
|
-
|
34
|
-
|
33
|
+
assert_that(subject.asset_file).is_kind_of(Dassets::AssetFile)
|
34
|
+
assert_that(subject.asset_file)
|
35
|
+
.equals(Dassets::AssetFile.new(subject.digest_path))
|
35
36
|
end
|
36
37
|
|
37
38
|
should "know its digest path" do
|
38
|
-
|
39
|
+
assert_that(subject.digest_path).equals("file1.txt")
|
39
40
|
end
|
40
41
|
|
41
42
|
should "not memoize its compiled source" do
|
42
43
|
compiled1 = subject.compiled
|
43
44
|
compiled2 = subject.compiled
|
44
|
-
|
45
|
+
assert_that(compiled2).is_not(compiled1)
|
45
46
|
end
|
46
47
|
|
47
48
|
should "know if it exists" do
|
48
|
-
|
49
|
+
assert_that(subject.exists?).is_true
|
49
50
|
end
|
50
51
|
|
51
52
|
should "use the mtime of its file as its mtime" do
|
52
|
-
|
53
|
+
assert_that(subject.mtime).equals(File.mtime(subject.file_path))
|
53
54
|
end
|
54
55
|
|
55
56
|
should "use the response headers of its source as its response headers" do
|
56
|
-
|
57
|
+
assert_that(subject.response_headers).is(subject.source.response_headers)
|
57
58
|
end
|
58
59
|
|
59
60
|
should "be findable by its digest path" do
|
60
61
|
found = Dassets::SourceFile.find_by_digest_path(subject.digest_path)
|
61
62
|
|
62
|
-
|
63
|
-
|
63
|
+
assert_that(found).equals(subject)
|
64
|
+
assert_that(found).is_not(subject)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class EngineTests < UnitTests
|
69
|
+
desc "compiled against engines"
|
70
|
+
|
71
|
+
setup do
|
72
|
+
@file_path =
|
73
|
+
TEST_SUPPORT_PATH.join("app/assets/nested/a-thing.txt.useless.dumb")
|
64
74
|
end
|
65
75
|
|
76
|
+
should "build the digest path appropriately" do
|
77
|
+
assert_that(subject.digest_path).equals("nested/a-thing.txt.no-use")
|
78
|
+
end
|
79
|
+
|
80
|
+
should "compile the source content appropriately" do
|
81
|
+
file_content = File.read(@file_path)
|
82
|
+
exp_compiled_content = [file_content, "DUMB", "USELESS"].join("\n")
|
83
|
+
assert_that(subject.compiled).equals(exp_compiled_content)
|
84
|
+
end
|
66
85
|
end
|
86
|
+
end
|
67
87
|
|
68
|
-
|
88
|
+
class Dassets::NullSourceFile
|
89
|
+
class UnitTests < Assert::Context
|
69
90
|
setup do
|
70
|
-
Dassets.config.combination
|
91
|
+
Dassets.config.combination "file3.txt", ["file1.txt", "file2.txt"]
|
71
92
|
end
|
93
|
+
|
72
94
|
teardown do
|
73
|
-
Dassets.config.combinations.delete(
|
95
|
+
Dassets.config.combinations.delete("file3.txt")
|
74
96
|
end
|
75
97
|
|
76
98
|
should "find a null src file if finding by an unknown digest path" do
|
77
|
-
null_src = Dassets::NullSourceFile.new(
|
78
|
-
found = Dassets::SourceFile.find_by_digest_path(
|
99
|
+
null_src = Dassets::NullSourceFile.new("not/found/digest/path")
|
100
|
+
found = Dassets::SourceFile.find_by_digest_path("not/found/digest/path")
|
79
101
|
|
80
|
-
|
81
|
-
|
102
|
+
assert_that(found).equals(null_src)
|
103
|
+
assert_that(found).is_not(null_src)
|
82
104
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
105
|
+
assert_that(null_src.file_path).equals("")
|
106
|
+
assert_that(null_src.exists?).equals(false)
|
107
|
+
assert_that(null_src.compiled).is_nil
|
108
|
+
assert_that(null_src.mtime).is_nil
|
109
|
+
assert_that(null_src.response_headers).equals(Hash.new)
|
88
110
|
end
|
89
111
|
|
90
112
|
should "pass options to a null src when finding by an unknown digest path" do
|
91
|
-
null_src = Dassets::NullSourceFile.new(
|
113
|
+
null_src = Dassets::NullSourceFile.new("not/found/digest/path")
|
92
114
|
null_src_new_called_with = []
|
93
115
|
Assert.stub(Dassets::NullSourceFile, :new) do |*args|
|
94
116
|
null_src_new_called_with = args
|
@@ -96,26 +118,26 @@ class Dassets::SourceFile
|
|
96
118
|
end
|
97
119
|
|
98
120
|
options = {
|
99
|
-
:
|
100
|
-
:
|
121
|
+
content_cache: Dassets::NoCache.new,
|
122
|
+
fingerprint_cache: Dassets::NoCache.new,
|
101
123
|
}
|
102
|
-
Dassets::SourceFile.find_by_digest_path(
|
124
|
+
Dassets::SourceFile.find_by_digest_path("not/found/digest/path", **options)
|
103
125
|
|
104
|
-
exp = [
|
105
|
-
|
126
|
+
exp = ["not/found/digest/path", options]
|
127
|
+
assert_that(null_src_new_called_with).equals(exp)
|
106
128
|
end
|
107
129
|
|
108
|
-
should "
|
109
|
-
src_proxy = Dassets::SourceProxy.new(
|
110
|
-
null_combo_src = Dassets::NullSourceFile.new(
|
130
|
+
should "proxy the digest path if the path is a combination" do
|
131
|
+
src_proxy = Dassets::SourceProxy.new("file3.txt")
|
132
|
+
null_combo_src = Dassets::NullSourceFile.new("file3.txt")
|
111
133
|
|
112
|
-
|
113
|
-
|
114
|
-
|
134
|
+
assert_that(null_combo_src.exists?).equals(src_proxy.exists?)
|
135
|
+
assert_that(null_combo_src.compiled).equals(src_proxy.content)
|
136
|
+
assert_that(null_combo_src.mtime).equals(src_proxy.mtime)
|
115
137
|
end
|
116
138
|
|
117
139
|
should "pass options to its source proxy when the path is a combination" do
|
118
|
-
src_proxy = Dassets::SourceProxy.new(
|
140
|
+
src_proxy = Dassets::SourceProxy.new("file3.txt")
|
119
141
|
src_proxy_new_called_with = []
|
120
142
|
Assert.stub(Dassets::SourceProxy, :new) do |*args|
|
121
143
|
src_proxy_new_called_with = args
|
@@ -123,34 +145,13 @@ class Dassets::SourceFile
|
|
123
145
|
end
|
124
146
|
|
125
147
|
options = {
|
126
|
-
:
|
127
|
-
:
|
148
|
+
content_cache: Dassets::NoCache.new,
|
149
|
+
fingerprint_cache: Dassets::NoCache.new,
|
128
150
|
}
|
129
|
-
Dassets::NullSourceFile.new(
|
151
|
+
Dassets::NullSourceFile.new("file3.txt", **options)
|
130
152
|
|
131
|
-
exp = [
|
132
|
-
|
153
|
+
exp = ["file3.txt", options]
|
154
|
+
assert_that(src_proxy_new_called_with).equals(exp)
|
133
155
|
end
|
134
|
-
|
135
156
|
end
|
136
|
-
|
137
|
-
class EngineTests < UnitTests
|
138
|
-
desc "compiled against engines"
|
139
|
-
setup do
|
140
|
-
@file_path = TEST_SUPPORT_PATH.join('app/assets/nested/a-thing.txt.useless.dumb')
|
141
|
-
@source_file = Dassets::SourceFile.new(@file_path)
|
142
|
-
end
|
143
|
-
|
144
|
-
should "build the digest path appropriately" do
|
145
|
-
assert_equal 'nested/a-thing.txt.no-use', subject.digest_path
|
146
|
-
end
|
147
|
-
|
148
|
-
should "compile the source content appropriately" do
|
149
|
-
file_content = File.read(@file_path)
|
150
|
-
exp_compiled_content = [ file_content, 'DUMB', 'USELESS' ].join("\n")
|
151
|
-
assert_equal exp_compiled_content, subject.compiled
|
152
|
-
end
|
153
|
-
|
154
|
-
end
|
155
|
-
|
156
157
|
end
|
@@ -1,213 +1,202 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "assert"
|
2
|
+
require "dassets/source_proxy"
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
4
|
+
require "digest/md5"
|
5
|
+
require "dassets/cache"
|
6
|
+
require "dassets/source_file"
|
7
|
+
require "dassets/source_proxy"
|
8
8
|
|
9
9
|
class Dassets::SourceProxy
|
10
|
-
|
11
10
|
class UnitTests < Assert::Context
|
12
11
|
desc "Dassets::SourceProxy"
|
13
|
-
|
14
|
-
@source_proxy = Dassets::SourceProxy.new(Factory.string)
|
15
|
-
end
|
16
|
-
subject{ @source_proxy }
|
12
|
+
subject { Dassets::SourceProxy.new(Factory.string) }
|
17
13
|
|
18
14
|
should have_readers :digest_path, :content_cache, :fingerprint_cache
|
19
15
|
should have_readers :source_files
|
20
16
|
should have_imeths :key, :content, :fingerprint, :mtime, :response_headers
|
21
17
|
should have_imeths :exists?
|
22
|
-
|
23
18
|
end
|
24
19
|
|
25
20
|
class NotComboTests < UnitTests
|
26
21
|
desc "when the digest path is not a combination"
|
27
|
-
|
28
|
-
@source_proxy = Dassets::SourceProxy.new('file1.txt')
|
29
|
-
end
|
22
|
+
subject { Dassets::SourceProxy.new("file1.txt") }
|
30
23
|
|
31
24
|
should "know its digest path" do
|
32
|
-
|
25
|
+
assert_that(subject.digest_path).equals("file1.txt")
|
33
26
|
end
|
34
27
|
|
35
28
|
should "use no cache by default" do
|
36
|
-
|
37
|
-
|
29
|
+
assert_that(subject.content_cache).is_kind_of(Dassets::NoCache)
|
30
|
+
assert_that(subject.fingerprint_cache).is_kind_of(Dassets::NoCache)
|
38
31
|
end
|
39
32
|
|
40
33
|
should "have a single source file" do
|
41
|
-
|
42
|
-
exp = Dassets::SourceFile.find_by_digest_path(
|
43
|
-
|
34
|
+
assert_that(subject.source_files.size).equals(1)
|
35
|
+
exp = Dassets::SourceFile.find_by_digest_path("file1.txt")
|
36
|
+
assert_that(subject.source_files.first).equals(exp)
|
44
37
|
end
|
45
38
|
|
46
39
|
should "use its digest path and mtime as its key" do
|
47
40
|
exp = "#{subject.digest_path} -- #{subject.mtime}"
|
48
|
-
|
41
|
+
assert_that(subject.key).equals(exp)
|
49
42
|
end
|
50
43
|
|
51
44
|
should "get its content from the compiled source of the single source file" do
|
52
|
-
|
45
|
+
assert_that(subject.content).equals(subject.source_files.first.compiled)
|
53
46
|
end
|
54
47
|
|
55
48
|
should "get its fingerprint by MD5 hashing the content" do
|
56
49
|
exp = Digest::MD5.new.hexdigest(subject.content)
|
57
|
-
|
50
|
+
assert_that(subject.fingerprint).equals(exp)
|
58
51
|
end
|
59
52
|
|
60
53
|
should "use its single source file's max mtime as its mtime" do
|
61
|
-
|
54
|
+
assert_that(subject.mtime).equals(subject.source_files.first.mtime)
|
62
55
|
end
|
63
56
|
|
64
57
|
should "use its single source file's response headers as its resonse headers" do
|
65
|
-
|
58
|
+
assert_that(subject.response_headers)
|
59
|
+
.equals(subject.source_files.first.response_headers)
|
66
60
|
end
|
67
61
|
|
68
62
|
should "exist if its single source file exists" do
|
69
|
-
|
63
|
+
assert_that(subject.exists?).equals(subject.source_files.first.exists?)
|
70
64
|
end
|
71
|
-
|
72
65
|
end
|
73
66
|
|
74
67
|
class ComboSetupTests < UnitTests
|
75
68
|
setup do
|
76
|
-
Dassets.config.combination
|
77
|
-
Dassets.config.combination
|
78
|
-
Dassets.config.combination
|
69
|
+
Dassets.config.combination "file3.txt", ["file1.txt", "file2.txt"]
|
70
|
+
Dassets.config.combination "file4.txt", []
|
71
|
+
Dassets.config.combination "file5.txt", ["file3.txt", "file4.txt"]
|
79
72
|
end
|
73
|
+
|
80
74
|
teardown do
|
81
|
-
Dassets.config.combinations.delete(
|
82
|
-
Dassets.config.combinations.delete(
|
83
|
-
Dassets.config.combinations.delete(
|
75
|
+
Dassets.config.combinations.delete("file5.txt")
|
76
|
+
Dassets.config.combinations.delete("file4.txt")
|
77
|
+
Dassets.config.combinations.delete("file3.txt")
|
84
78
|
end
|
85
|
-
|
86
79
|
end
|
87
80
|
|
88
81
|
class ComboTests < ComboSetupTests
|
89
82
|
desc "when the digest path is a combination to multiple source files"
|
83
|
+
subject { Dassets::SourceProxy.new("file3.txt") }
|
84
|
+
|
90
85
|
setup do
|
91
86
|
@exp_source_files = [
|
92
|
-
Dassets::SourceFile.find_by_digest_path(
|
93
|
-
Dassets::SourceFile.find_by_digest_path(
|
87
|
+
Dassets::SourceFile.find_by_digest_path("file1.txt"),
|
88
|
+
Dassets::SourceFile.find_by_digest_path("file2.txt")
|
94
89
|
]
|
95
|
-
@source_proxy = Dassets::SourceProxy.new('file3.txt')
|
96
90
|
end
|
97
91
|
|
98
92
|
should "know its digest path" do
|
99
|
-
|
93
|
+
assert_that(subject.digest_path).equals("file3.txt")
|
100
94
|
end
|
101
95
|
|
102
96
|
should "know its source files" do
|
103
|
-
|
104
|
-
|
97
|
+
assert_that(subject.source_files.size).equals(2)
|
98
|
+
assert_that(subject.source_files).equals(@exp_source_files)
|
105
99
|
end
|
106
100
|
|
107
101
|
should "get its content from the compiled source of its source files" do
|
108
|
-
exp = subject.source_files.map{ |f| f.compiled }.join("\n")
|
109
|
-
|
102
|
+
exp = subject.source_files.map { |f| f.compiled }.join("\n")
|
103
|
+
assert_that(subject.content).equals(exp)
|
110
104
|
end
|
111
105
|
|
112
106
|
should "use its source files' max mtime as its mtime" do
|
113
|
-
exp = subject.source_files.map{ |f| f.mtime }.max
|
114
|
-
|
107
|
+
exp = subject.source_files.map { |f| f.mtime }.max
|
108
|
+
assert_that(subject.mtime).equals(exp)
|
115
109
|
end
|
116
110
|
|
117
111
|
should "use its source files' merged response headers as its response headers" do
|
118
|
-
exp =
|
119
|
-
|
120
|
-
|
121
|
-
|
112
|
+
exp =
|
113
|
+
subject.source_files.reduce(Hash.new) { |hash, file|
|
114
|
+
hash.merge!(file.response_headers)
|
115
|
+
}
|
116
|
+
assert_that(subject.response_headers).equals(exp)
|
122
117
|
end
|
123
118
|
|
124
119
|
should "exist if its all its source files exist" do
|
125
|
-
exp = subject.source_files.
|
126
|
-
|
120
|
+
exp = subject.source_files.reduce(true) { |res, f| res && f.exists? }
|
121
|
+
assert_that(subject.exists?).equals(exp)
|
127
122
|
end
|
128
|
-
|
129
123
|
end
|
130
124
|
|
131
125
|
class EmptyComboTests < ComboSetupTests
|
132
126
|
desc "when the digest path is an empty combination"
|
133
|
-
|
134
|
-
@source_proxy = Dassets::SourceProxy.new('file4.txt')
|
135
|
-
end
|
127
|
+
subject { Dassets::SourceProxy.new("file4.txt") }
|
136
128
|
|
137
129
|
should "not have any source files" do
|
138
|
-
|
130
|
+
assert_that(subject.source_files.size).equals(0)
|
139
131
|
end
|
140
132
|
|
141
133
|
should "have empty content" do
|
142
|
-
|
134
|
+
assert_that(subject.content).equals("")
|
143
135
|
end
|
144
136
|
|
145
137
|
should "have no mtime" do
|
146
|
-
|
138
|
+
assert_that(subject.mtime).is_nil
|
147
139
|
end
|
148
140
|
|
149
141
|
should "exist" do
|
150
|
-
|
142
|
+
assert_that(subject.exists?).is_true
|
151
143
|
end
|
152
|
-
|
153
144
|
end
|
154
145
|
|
155
146
|
class ComboWithEmptyComboTests < ComboSetupTests
|
156
|
-
desc "when the digest path is a combination that includes an empty
|
157
|
-
|
158
|
-
|
159
|
-
end
|
147
|
+
desc "when the digest path is a combination that includes an empty "\
|
148
|
+
"combination"
|
149
|
+
subject { Dassets::SourceProxy.new("file5.txt") }
|
160
150
|
|
161
151
|
should "ignore the mtime of the empty combination" do
|
162
|
-
exp_mtime = subject.source_files.map{ |f| f.mtime }.compact.max
|
163
|
-
|
152
|
+
exp_mtime = subject.source_files.map { |f| f.mtime }.compact.max
|
153
|
+
assert_that(subject.mtime).equals(exp_mtime)
|
164
154
|
end
|
165
|
-
|
166
155
|
end
|
167
156
|
|
168
157
|
class NoCacheTests < UnitTests
|
169
158
|
desc "with a `NoCache` cache handler"
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
:
|
175
|
-
|
176
|
-
|
159
|
+
subject {
|
160
|
+
cache = Dassets::NoCache.new
|
161
|
+
Dassets::SourceProxy.new(
|
162
|
+
"file1.txt",
|
163
|
+
content_cache: cache,
|
164
|
+
fingerprint_cache: cache,
|
165
|
+
)
|
166
|
+
}
|
177
167
|
|
178
168
|
should "not cache its source content/fingerprint" do
|
179
169
|
content1 = subject.content
|
180
170
|
content2 = subject.content
|
181
|
-
|
171
|
+
assert_that(content2).is_not(content1)
|
182
172
|
|
183
173
|
finger1 = subject.fingerprint
|
184
174
|
finger2 = subject.fingerprint
|
185
|
-
|
175
|
+
assert_that(finger2).is_not(finger1)
|
186
176
|
end
|
187
|
-
|
188
177
|
end
|
189
178
|
|
190
179
|
class MemCacheTests < UnitTests
|
191
180
|
desc "with a `MemCache` cache handler"
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
181
|
+
subject {
|
182
|
+
content_cache = Dassets::MemCache.new
|
183
|
+
fingerprint_cache = Dassets::MemCache.new
|
184
|
+
|
185
|
+
Dassets::SourceProxy.new(
|
186
|
+
"file1.txt",
|
187
|
+
content_cache: content_cache,
|
188
|
+
fingerprint_cache: fingerprint_cache,
|
189
|
+
)
|
190
|
+
}
|
200
191
|
|
201
192
|
should "cache its source content/fingerprint in memory" do
|
202
193
|
content1 = subject.content
|
203
194
|
content2 = subject.content
|
204
|
-
|
195
|
+
assert_that(content2).is(content1)
|
205
196
|
|
206
197
|
finger1 = subject.fingerprint
|
207
198
|
finger2 = subject.fingerprint
|
208
|
-
|
199
|
+
assert_that(finger2).is(finger1)
|
209
200
|
end
|
210
|
-
|
211
201
|
end
|
212
|
-
|
213
202
|
end
|