dassets 0.14.2 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) 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 -27
  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 +15 -9
  15. data/lib/dassets/source_file.rb +103 -82
  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/{public/nested/file3-d41d8cd98f00b204e9800998ecf8427e.txt → 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 +69 -61
  27. data/test/unit/cache_tests.rb +15 -34
  28. data/test/unit/config_tests.rb +59 -52
  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 +44 -31
  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 +80 -73
  36. data/test/unit/source_proxy_tests.rb +84 -90
  37. data/test/unit/source_tests.rb +66 -50
  38. data/tmp/.gitkeep +0 -0
  39. metadata +92 -72
  40. data/.gitignore +0 -19
  41. data/test/support/public/file2-9bbe1047cffbb590f59e0e5aeff46ae4.txt +0 -1
  42. data/test/support/public/grumpy_cat-b0d1f399a916f7a25c4c0f693c619013.jpg +0 -0
  43. data/test/support/public/nested/a-thing.txt-7413d18f2eba9c695a880aff67fde135.no-use +0 -4
@@ -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,19 +1,20 @@
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
@@ -21,74 +22,98 @@ class Dassets::SourceFile
21
22
  should have_cmeth :find_by_digest_path
22
23
 
23
24
  should "know its file path" do
24
- assert_equal @file_path.to_s, subject.file_path
25
+ assert_that(subject.file_path).equals(@file_path.to_s)
25
26
  end
26
27
 
27
28
  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
29
+ exp_source =
30
+ Dassets.config.sources.select{ |s| @file_path.include?(s.path) }.last
31
+ assert_that(subject.source).equals(exp_source)
30
32
  end
31
33
 
32
34
  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
35
+ assert_that(subject.asset_file).is_kind_of(Dassets::AssetFile)
36
+ assert_that(subject.asset_file)
37
+ .equals(Dassets::AssetFile.new(subject.digest_path))
35
38
  end
36
39
 
37
40
  should "know its digest path" do
38
- assert_equal 'file1.txt', subject.digest_path
41
+ assert_that(subject.digest_path).equals("file1.txt")
39
42
  end
40
43
 
41
44
  should "not memoize its compiled source" do
42
45
  compiled1 = subject.compiled
43
46
  compiled2 = subject.compiled
44
- assert_not_same compiled2, compiled1
47
+ assert_that(compiled2).is_not(compiled1)
45
48
  end
46
49
 
47
50
  should "know if it exists" do
48
- assert subject.exists?
51
+ assert_that(subject.exists?).is_true
49
52
  end
50
53
 
51
54
  should "use the mtime of its file as its mtime" do
52
- assert_equal File.mtime(subject.file_path), subject.mtime
55
+ assert_that(subject.mtime).equals(File.mtime(subject.file_path))
53
56
  end
54
57
 
55
58
  should "use the response headers of its source as its response headers" do
56
- assert_same subject.source.response_headers, subject.response_headers
59
+ assert_that(subject.response_headers).is(subject.source.response_headers)
57
60
  end
58
61
 
59
62
  should "be findable by its digest path" do
60
63
  found = Dassets::SourceFile.find_by_digest_path(subject.digest_path)
61
64
 
62
- assert_equal subject, found
63
- assert_not_same subject, found
65
+ assert_that(found).equals(subject)
66
+ assert_that(found).is_not(subject)
67
+ end
68
+ end
69
+
70
+ class EngineTests < UnitTests
71
+ desc "compiled against engines"
72
+
73
+ setup do
74
+ @file_path =
75
+ TEST_SUPPORT_PATH.join("app/assets/nested/a-thing.txt.useless.dumb")
64
76
  end
65
77
 
78
+ should "build the digest path appropriately" do
79
+ assert_that(subject.digest_path).equals("nested/a-thing.txt.no-use")
80
+ end
81
+
82
+ should "compile the source content appropriately" do
83
+ file_content = File.read(@file_path)
84
+ exp_compiled_content = [file_content, "DUMB", "USELESS"].join("\n")
85
+ assert_that(subject.compiled).equals(exp_compiled_content)
86
+ end
66
87
  end
88
+ end
67
89
 
68
- class NullSourceTests < UnitTests
90
+ class Dassets::NullSourceFile
91
+ class UnitTests < Assert::Context
69
92
  setup do
70
- Dassets.config.combination 'file3.txt', ['file1.txt', 'file2.txt']
93
+ Dassets.config.combination "file3.txt", ["file1.txt", "file2.txt"]
71
94
  end
95
+
72
96
  teardown do
73
- Dassets.config.combinations.delete('file3.txt')
97
+ Dassets.config.combinations.delete("file3.txt")
74
98
  end
75
99
 
76
100
  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')
101
+ null_src = Dassets::NullSourceFile.new("not/found/digest/path")
102
+ found = Dassets::SourceFile.find_by_digest_path("not/found/digest/path")
79
103
 
80
- assert_equal null_src, found
81
- assert_not_same null_src, found
104
+ assert_that(found).equals(null_src)
105
+ assert_that(found).is_not(null_src)
82
106
 
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
107
+ assert_that(null_src.file_path).equals("")
108
+ assert_that(null_src.exists?).equals(false)
109
+ assert_that(null_src.compiled).is_nil
110
+ assert_that(null_src.mtime).is_nil
111
+ assert_that(null_src.response_headers).equals({})
88
112
  end
89
113
 
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')
114
+ should "pass options to a null src when finding by an unknown digest "\
115
+ "path" do
116
+ null_src = Dassets::NullSourceFile.new("not/found/digest/path")
92
117
  null_src_new_called_with = []
93
118
  Assert.stub(Dassets::NullSourceFile, :new) do |*args|
94
119
  null_src_new_called_with = args
@@ -96,26 +121,29 @@ class Dassets::SourceFile
96
121
  end
97
122
 
98
123
  options = {
99
- :content_cache => Dassets::Cache::NoCache.new,
100
- :fingerprint_cache => Dassets::Cache::NoCache.new
124
+ content_cache: Dassets::NoCache.new,
125
+ fingerprint_cache: Dassets::NoCache.new,
101
126
  }
102
- Dassets::SourceFile.find_by_digest_path('not/found/digest/path', options)
127
+ Dassets::SourceFile.find_by_digest_path(
128
+ "not/found/digest/path",
129
+ **options,
130
+ )
103
131
 
104
- exp = ['not/found/digest/path', options]
105
- assert_equal exp, null_src_new_called_with
132
+ exp = ["not/found/digest/path", options]
133
+ assert_that(null_src_new_called_with).equals(exp)
106
134
  end
107
135
 
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')
136
+ should "proxy the digest path if the path is a combination" do
137
+ src_proxy = Dassets::SourceProxy.new("file3.txt")
138
+ null_combo_src = Dassets::NullSourceFile.new("file3.txt")
111
139
 
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
140
+ assert_that(null_combo_src.exists?).equals(src_proxy.exists?)
141
+ assert_that(null_combo_src.compiled).equals(src_proxy.content)
142
+ assert_that(null_combo_src.mtime).equals(src_proxy.mtime)
115
143
  end
116
144
 
117
145
  should "pass options to its source proxy when the path is a combination" do
118
- src_proxy = Dassets::SourceProxy.new('file3.txt')
146
+ src_proxy = Dassets::SourceProxy.new("file3.txt")
119
147
  src_proxy_new_called_with = []
120
148
  Assert.stub(Dassets::SourceProxy, :new) do |*args|
121
149
  src_proxy_new_called_with = args
@@ -123,34 +151,13 @@ class Dassets::SourceFile
123
151
  end
124
152
 
125
153
  options = {
126
- :content_cache => Dassets::Cache::NoCache.new,
127
- :fingerprint_cache => Dassets::Cache::NoCache.new
154
+ content_cache: Dassets::NoCache.new,
155
+ fingerprint_cache: Dassets::NoCache.new,
128
156
  }
129
- Dassets::NullSourceFile.new('file3.txt', options)
157
+ Dassets::NullSourceFile.new("file3.txt", **options)
130
158
 
131
- exp = ['file3.txt', options]
132
- assert_equal exp, src_proxy_new_called_with
159
+ exp = ["file3.txt", options]
160
+ assert_that(src_proxy_new_called_with).equals(exp)
133
161
  end
134
-
135
162
  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
163
  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