dassets 0.14.3 → 0.15.2

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