opal-sprockets 0.4.9.1.0.3.7 → 1.0.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 +4 -4
- data/.github/workflows/build.yml +26 -0
- data/CHANGELOG.md +11 -0
- data/bin/console +14 -0
- data/bin/rake +6 -0
- data/bin/rspec +29 -0
- data/bin/setup +8 -0
- data/lib/opal/environment.rb +4 -0
- data/lib/opal/processor.rb +4 -0
- data/lib/opal/sprockets.rb +13 -81
- data/lib/opal/sprockets/assets_helper.rb +78 -0
- data/lib/opal/sprockets/environment.rb +12 -14
- data/lib/opal/sprockets/erb.rb +12 -16
- data/lib/opal/sprockets/mime_types.rb +19 -0
- data/lib/opal/sprockets/processor.rb +111 -114
- data/lib/opal/sprockets/server.rb +94 -98
- data/lib/opal/sprockets/version.rb +1 -8
- data/opal-sprockets.gemspec +38 -24
- data/spec/fixtures/complex_sprockets.js.rb.erb +1 -1
- data/spec/fixtures/{jst_file.js.jst → jst_file.jst.ejs} +0 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/sprockets/erb_spec.rb +15 -25
- data/spec/sprockets/processor_spec.rb +53 -57
- data/spec/sprockets/server_spec.rb +95 -25
- data/spec/tilt/opal_spec.rb +1 -1
- metadata +66 -24
- data/.travis.yml +0 -21
- data/lib/opal/sprockets/path_reader.rb +0 -36
- data/spec/shared/path_finder_shared.rb +0 -19
- data/spec/shared/path_reader_shared.rb +0 -31
- data/spec/sprockets/path_reader_spec.rb +0 -41
@@ -20,60 +20,130 @@ describe Opal::Sprockets::Server do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'serves assets with complex sprockets requires' do
|
23
|
-
asset = app.sprockets['complex_sprockets']
|
23
|
+
asset = app.sprockets['complex_sprockets', accept: "application/javascript"]
|
24
24
|
expect(asset).to be_truthy
|
25
25
|
|
26
|
-
assets = asset.
|
27
|
-
sub_asset.
|
26
|
+
assets = asset.metadata[:included].map do |sub_asset|
|
27
|
+
URI.parse(sub_asset).path.split(%r'/fixtures/|/stdlib/').last
|
28
28
|
end
|
29
29
|
|
30
30
|
%w[
|
31
|
-
base64.
|
32
|
-
no_requires.
|
33
|
-
jst_file.
|
34
|
-
required_tree_test/required_file1.
|
35
|
-
required_tree_test/required_file2.
|
31
|
+
base64.rb
|
32
|
+
no_requires.rb
|
33
|
+
jst_file.jst.ejs
|
34
|
+
required_tree_test/required_file1.rb
|
35
|
+
required_tree_test/required_file2.rb
|
36
36
|
file_with_directives.js
|
37
37
|
].each do |logical_path|
|
38
38
|
expect(assets).to include(logical_path)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
it 'recompiles the asset when its dependencies change' do
|
43
|
+
does_include = proc do |it, what, what_not=[], what_else=nil, what_else_not=nil|
|
44
|
+
expect(it).to include what_else if what_else
|
45
|
+
expect(it).not_to include what_else_not if what_else_not
|
46
|
+
what.each { |i| expect(it).to include %{modules["required_tree_test/required_file#{i}"]} }
|
47
|
+
what_not.each { |i| expect(it).not_to include %{modules["required_tree_test/required_file#{i}"]} }
|
48
|
+
end
|
49
|
+
|
50
|
+
["default", "debug"].each do |pipeline|
|
51
|
+
asset = app.sprockets['require_tree_test', pipeline: pipeline, accept: "application/javascript"]
|
52
|
+
expect(asset).to be_truthy
|
53
|
+
does_include.(asset.to_s, [1,2], [3], nil, "UNIQUESTRING")
|
54
|
+
get "/assets/require_tree_test.#{pipeline}.js"
|
55
|
+
does_include.(last_response.body, [1,2], [3], nil, "UNIQUESTRING")
|
56
|
+
|
57
|
+
sleep 1 # Make sure to modify mtime
|
58
|
+
|
59
|
+
File.write(__dir__+"/../fixtures/required_tree_test/required_file2.rb", "p 'UNIQUESTRING1'")
|
60
|
+
|
61
|
+
asset = app.sprockets['require_tree_test', pipeline: pipeline, accept: "application/javascript"]
|
62
|
+
expect(asset).to be_truthy
|
63
|
+
does_include.(asset.to_s, [1,2], [3], "UNIQUESTRING1")
|
64
|
+
get "/assets/require_tree_test.#{pipeline}.js"
|
65
|
+
does_include.(last_response.body, [1,2], [3], "UNIQUESTRING1")
|
66
|
+
|
67
|
+
sleep 1 # Make sure to modify mtime
|
68
|
+
|
69
|
+
File.write(__dir__+"/../fixtures/required_tree_test/required_file2.rb", "p 'UNIQUESTRING2'")
|
70
|
+
|
71
|
+
asset = app.sprockets['require_tree_test', pipeline: pipeline, accept: "application/javascript"]
|
72
|
+
expect(asset).to be_truthy
|
73
|
+
does_include.(asset.to_s, [1,2], [3], "UNIQUESTRING2")
|
74
|
+
get "/assets/require_tree_test.#{pipeline}.js"
|
75
|
+
does_include.(last_response.body, [1,2], [3], "UNIQUESTRING2")
|
76
|
+
|
77
|
+
sleep 1 # Make sure to modify mtime
|
78
|
+
|
79
|
+
File.write(__dir__+"/../fixtures/required_tree_test/required_file2.rb", "p 'UNIQUESTRING3'")
|
80
|
+
File.write(__dir__+"/../fixtures/required_tree_test/required_file3.rb", "p 3")
|
81
|
+
|
82
|
+
asset = app.sprockets['require_tree_test', pipeline: pipeline, accept: "application/javascript"]
|
83
|
+
expect(asset).to be_truthy
|
84
|
+
does_include.(asset.to_s, [1,2,3], [], "UNIQUESTRING3")
|
85
|
+
get "/assets/require_tree_test.#{pipeline}.js"
|
86
|
+
does_include.(last_response.body, [1,2], [], "UNIQUESTRING3") # fails with 3 - it doesn't get new files
|
87
|
+
|
88
|
+
sleep 1 # Make sure to modify mtime
|
89
|
+
ensure
|
90
|
+
File.write(__dir__+"/../fixtures/required_tree_test/required_file2.rb", "p 2\n")
|
91
|
+
File.unlink(__dir__+"/../fixtures/required_tree_test/required_file3.rb") rescue nil
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
42
95
|
describe 'source maps' do
|
43
|
-
RSpec::Matchers.define :
|
96
|
+
RSpec::Matchers.define :include_source_map do
|
44
97
|
match do |actual_response|
|
45
98
|
actual_response.ok? &&
|
46
|
-
actual_response.body.lines.last.start_with?('//# sourceMappingURL=
|
99
|
+
actual_response.body.lines.last.start_with?('//# sourceMappingURL=')
|
47
100
|
end
|
48
101
|
end
|
49
102
|
|
50
|
-
def
|
103
|
+
def extract_map(path, response)
|
51
104
|
last_line = response.body.lines.last
|
52
|
-
|
53
|
-
|
105
|
+
if last_line.start_with? "//# sourceMappingURL=data:application/json;base64,"
|
106
|
+
b64_encoded = last_line.split('//# sourceMappingURL=data:application/json;base64,', 2)[1]
|
107
|
+
json_string = Base64.decode64(b64_encoded)
|
108
|
+
else
|
109
|
+
map_file = last_line.split('//# sourceMappingURL=', 2)[1].chomp
|
110
|
+
map_file = relative_path(path, map_file)
|
111
|
+
map_file = get map_file
|
112
|
+
json_string = map_file.body
|
113
|
+
end
|
54
114
|
JSON.parse(json_string, symbolize_names: true)
|
55
115
|
end
|
56
116
|
|
117
|
+
def relative_path(path, file)
|
118
|
+
URI.join("http://example.com/", path, file).path
|
119
|
+
end
|
120
|
+
|
57
121
|
it 'serves map for a top level file' do
|
58
|
-
|
59
|
-
|
122
|
+
path = '/assets/opal_file.debug.js'
|
123
|
+
get path
|
124
|
+
expect(last_response).to include_source_map
|
60
125
|
|
61
|
-
map =
|
126
|
+
map = extract_map(path, last_response)
|
62
127
|
|
63
|
-
expect(map[:
|
64
|
-
expect(map[:
|
128
|
+
expect(map[:file]).to eq('opal_file.rb')
|
129
|
+
expect(map[:sections].last[:map][:sources]).to eq(['opal_file.source.rb'])
|
130
|
+
|
131
|
+
expect(get(relative_path(path, map[:sections].last[:map][:sources][0])).body.chomp)
|
132
|
+
.to eq("require 'opal'\nputs 'hi from opal!'")
|
65
133
|
end
|
66
134
|
|
67
135
|
it 'serves map for a subfolder file' do
|
68
|
-
|
69
|
-
|
136
|
+
path = '/assets/source_map/subfolder/other_file.debug.js'
|
137
|
+
get path
|
138
|
+
expect(last_response).to include_source_map
|
139
|
+
|
140
|
+
map = extract_map(path, last_response)
|
70
141
|
|
71
|
-
map
|
142
|
+
expect(map[:file]).to eq('source_map/subfolder/other_file.rb')
|
143
|
+
expect(map[:sections].first[:map][:sources]).to eq(['other_file.source.rb'])
|
72
144
|
|
73
|
-
expect(map[:sources])
|
74
|
-
.to eq(
|
75
|
-
.or eq(['source_map/subfolder/other_file'])
|
76
|
-
expect(map[:sourcesContent]).to eq(["puts 'other!'\n"])
|
145
|
+
expect(get(relative_path(path, map[:sections][0][:map][:sources][0])).body.chomp)
|
146
|
+
.to eq("puts 'other!'")
|
77
147
|
end
|
78
148
|
end
|
79
149
|
end
|
data/spec/tilt/opal_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Opal::TiltTemplate do
|
|
5
5
|
%w[rb js.rb opal js.opal].each do |ext|
|
6
6
|
let(:ext) { ext }
|
7
7
|
|
8
|
-
describe %
|
8
|
+
describe %{with extension ".#{ext}"} do
|
9
9
|
it "is registered for '.#{ext}' files" do
|
10
10
|
expect(Tilt["test.#{ext}"]).to be <= described_class
|
11
11
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-sprockets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
8
8
|
- Adam Beynon
|
9
9
|
autorequire:
|
10
|
-
bindir:
|
10
|
+
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sprockets
|
@@ -17,28 +17,34 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '4.0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '4.0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: opal
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.0'
|
35
|
+
- - "<"
|
33
36
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
37
|
+
version: '1.2'
|
35
38
|
type: :runtime
|
36
39
|
prerelease: false
|
37
40
|
version_requirements: !ruby/object:Gem::Requirement
|
38
41
|
requirements:
|
39
|
-
- - "
|
42
|
+
- - ">="
|
40
43
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.0
|
44
|
+
version: '1.0'
|
45
|
+
- - "<"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.2'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
49
|
name: tilt
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,19 +115,51 @@ dependencies:
|
|
109
115
|
- - ">="
|
110
116
|
- !ruby/object:Gem::Version
|
111
117
|
version: '0'
|
112
|
-
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: ejs
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: pry
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
type: :development
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
description:
|
113
147
|
email: elia@schito.me
|
114
148
|
executables: []
|
115
149
|
extensions: []
|
116
150
|
extra_rdoc_files: []
|
117
151
|
files:
|
152
|
+
- ".github/workflows/build.yml"
|
118
153
|
- ".gitignore"
|
119
154
|
- ".rspec"
|
120
|
-
- ".travis.yml"
|
121
155
|
- CHANGELOG.md
|
122
156
|
- Gemfile
|
123
157
|
- README.md
|
124
158
|
- Rakefile
|
159
|
+
- bin/console
|
160
|
+
- bin/rake
|
161
|
+
- bin/rspec
|
162
|
+
- bin/setup
|
125
163
|
- example/Gemfile
|
126
164
|
- example/Gemfile.lock
|
127
165
|
- example/app/application.rb
|
@@ -129,17 +167,20 @@ files:
|
|
129
167
|
- example/config.ru
|
130
168
|
- example/index.html.erb
|
131
169
|
- lib/opal-sprockets.rb
|
170
|
+
- lib/opal/environment.rb
|
171
|
+
- lib/opal/processor.rb
|
132
172
|
- lib/opal/sprockets.rb
|
173
|
+
- lib/opal/sprockets/assets_helper.rb
|
133
174
|
- lib/opal/sprockets/environment.rb
|
134
175
|
- lib/opal/sprockets/erb.rb
|
135
|
-
- lib/opal/sprockets/
|
176
|
+
- lib/opal/sprockets/mime_types.rb
|
136
177
|
- lib/opal/sprockets/processor.rb
|
137
178
|
- lib/opal/sprockets/server.rb
|
138
179
|
- lib/opal/sprockets/version.rb
|
139
180
|
- opal-sprockets.gemspec
|
140
181
|
- spec/fixtures/complex_sprockets.js.rb.erb
|
141
182
|
- spec/fixtures/file_with_directives.js
|
142
|
-
- spec/fixtures/jst_file.
|
183
|
+
- spec/fixtures/jst_file.jst.ejs
|
143
184
|
- spec/fixtures/no_requires.rb
|
144
185
|
- spec/fixtures/opal_file.rb
|
145
186
|
- spec/fixtures/require_tree_test.rb
|
@@ -150,18 +191,19 @@ files:
|
|
150
191
|
- spec/fixtures/source_map/subfolder/other_file.rb
|
151
192
|
- spec/fixtures/sprockets_file.js.rb
|
152
193
|
- spec/fixtures/sprockets_require_tree_test.rb
|
153
|
-
- spec/shared/path_finder_shared.rb
|
154
|
-
- spec/shared/path_reader_shared.rb
|
155
194
|
- spec/spec_helper.rb
|
156
195
|
- spec/sprockets/erb_spec.rb
|
157
|
-
- spec/sprockets/path_reader_spec.rb
|
158
196
|
- spec/sprockets/processor_spec.rb
|
159
197
|
- spec/sprockets/server_spec.rb
|
160
198
|
- spec/sprockets_spec.rb
|
161
199
|
- spec/tilt/opal_spec.rb
|
162
200
|
homepage: https://github.com/opal/opal-sprockets#readme
|
163
|
-
licenses:
|
164
|
-
|
201
|
+
licenses:
|
202
|
+
- MIT
|
203
|
+
metadata:
|
204
|
+
homepage_uri: https://github.com/opal/opal-sprockets#readme
|
205
|
+
source_code_uri: https://github.com/opal/opal-sprockets
|
206
|
+
changelog_uri: https://github.com/opal/opal-sprockets/blob/master/CHANGELOG.md
|
165
207
|
post_install_message:
|
166
208
|
rdoc_options: []
|
167
209
|
require_paths:
|
@@ -170,21 +212,24 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
170
212
|
requirements:
|
171
213
|
- - ">="
|
172
214
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
215
|
+
version: '2.5'
|
216
|
+
- - "<"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '3.1'
|
174
219
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
220
|
requirements:
|
176
221
|
- - ">="
|
177
222
|
- !ruby/object:Gem::Version
|
178
223
|
version: '0'
|
179
224
|
requirements: []
|
180
|
-
rubygems_version: 3.
|
225
|
+
rubygems_version: 3.2.3
|
181
226
|
signing_key:
|
182
227
|
specification_version: 4
|
183
228
|
summary: Sprockets support for Opal.
|
184
229
|
test_files:
|
185
230
|
- spec/fixtures/complex_sprockets.js.rb.erb
|
186
231
|
- spec/fixtures/file_with_directives.js
|
187
|
-
- spec/fixtures/jst_file.
|
232
|
+
- spec/fixtures/jst_file.jst.ejs
|
188
233
|
- spec/fixtures/no_requires.rb
|
189
234
|
- spec/fixtures/opal_file.rb
|
190
235
|
- spec/fixtures/require_tree_test.rb
|
@@ -195,11 +240,8 @@ test_files:
|
|
195
240
|
- spec/fixtures/source_map/subfolder/other_file.rb
|
196
241
|
- spec/fixtures/sprockets_file.js.rb
|
197
242
|
- spec/fixtures/sprockets_require_tree_test.rb
|
198
|
-
- spec/shared/path_finder_shared.rb
|
199
|
-
- spec/shared/path_reader_shared.rb
|
200
243
|
- spec/spec_helper.rb
|
201
244
|
- spec/sprockets/erb_spec.rb
|
202
|
-
- spec/sprockets/path_reader_spec.rb
|
203
245
|
- spec/sprockets/processor_spec.rb
|
204
246
|
- spec/sprockets/server_spec.rb
|
205
247
|
- spec/sprockets_spec.rb
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
branches:
|
4
|
-
only:
|
5
|
-
- master
|
6
|
-
- /^.*-stable$/
|
7
|
-
- /^.*ci-check$/
|
8
|
-
|
9
|
-
matrix:
|
10
|
-
include:
|
11
|
-
- rvm: 2.3
|
12
|
-
env: OPAL_VERSION='~> 1.0.0'
|
13
|
-
- rvm: 2.4
|
14
|
-
env: OPAL_VERSION='~> 1.0.0'
|
15
|
-
- rvm: 2.5
|
16
|
-
env: OPAL_VERSION='~> 1.0.0'
|
17
|
-
- rvm: 2.6
|
18
|
-
env: OPAL_VERSION='~> 1.0.0'
|
19
|
-
|
20
|
-
notifications:
|
21
|
-
irc: "irc.freenode.org#opal"
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Opal
|
2
|
-
module Sprockets
|
3
|
-
|
4
|
-
class PathReader
|
5
|
-
def initialize(env, context)
|
6
|
-
@env ||= env
|
7
|
-
@context ||= context
|
8
|
-
end
|
9
|
-
|
10
|
-
def read path
|
11
|
-
if path.end_with? '.js'
|
12
|
-
context.depend_on_asset(path)
|
13
|
-
env[path, bundle: true].to_s
|
14
|
-
else
|
15
|
-
context.depend_on(path)
|
16
|
-
File.open(expand(path), 'rb:UTF-8'){|f| f.read}
|
17
|
-
end
|
18
|
-
rescue ::Sprockets::FileNotFound
|
19
|
-
nil
|
20
|
-
end
|
21
|
-
|
22
|
-
def expand path
|
23
|
-
env.resolve(path) or
|
24
|
-
# Sprockets 3 just returns nil for unknown paths
|
25
|
-
raise ::Sprockets::FileNotFound, path.inspect
|
26
|
-
end
|
27
|
-
|
28
|
-
def paths
|
29
|
-
env.paths
|
30
|
-
end
|
31
|
-
|
32
|
-
attr_reader :env, :context
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
shared_examples :path_finder do
|
4
|
-
# @param path
|
5
|
-
# the path we want to read
|
6
|
-
#
|
7
|
-
# @param full_path
|
8
|
-
# the expanded path that should be found
|
9
|
-
#
|
10
|
-
it 'returns the full path if the path exists' do
|
11
|
-
expect(path_finder.find(path)).to eq(full_path)
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'returns nil if the path is missing' do
|
15
|
-
expect(path_finder.find('unexpected-path')).to eq(nil)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
# Below the helpers expected from a spec that
|
4
|
-
# includes these shared examples:
|
5
|
-
#
|
6
|
-
# @object [PathReader] path_reader the object under test
|
7
|
-
# @method [String] path the path we want to read
|
8
|
-
# @method [String] contents the contents we expect to be read
|
9
|
-
#
|
10
|
-
shared_examples :path_reader do
|
11
|
-
describe '#paths' do
|
12
|
-
it 'is an Enumberable' do
|
13
|
-
expect(path_reader.paths).to be_an(Enumerable)
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'includes Opal.paths' do
|
17
|
-
paths = path_reader.paths.to_a
|
18
|
-
Opal.paths.each { |path| expect(paths).to include(path) }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe '#read' do
|
23
|
-
it 'responds to #path' do
|
24
|
-
expect(path_reader.read(path)).to eq(contents)
|
25
|
-
end
|
26
|
-
|
27
|
-
it 'returns nil if the file is missing' do
|
28
|
-
expect(path_reader.read('unexpected-path!')).to be_nil
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|