multi_sync 0.0.2 → 0.0.3
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/.travis.yml +6 -8
- data/Gemfile +0 -1
- data/README.md +79 -51
- data/Rakefile +0 -22
- data/lib/multi_sync.rb +27 -5
- data/lib/multi_sync/attributes/pathname.rb +1 -1
- data/lib/multi_sync/client.rb +124 -112
- data/lib/multi_sync/configuration.rb +4 -1
- data/lib/multi_sync/extensions/jekyll.rb +24 -0
- data/lib/multi_sync/extensions/middleman.rb +1 -7
- data/lib/multi_sync/extensions/rails.rb +0 -2
- data/lib/multi_sync/{mixins/pluralize_helper.rb → helpers/pluralize.rb} +2 -2
- data/lib/multi_sync/logging.rb +7 -0
- data/lib/multi_sync/resource.rb +0 -2
- data/lib/multi_sync/resources/local_resource.rb +0 -1
- data/lib/multi_sync/source.rb +0 -2
- data/lib/multi_sync/sources/local_source.rb +3 -1
- data/lib/multi_sync/sources/manifest_source.rb +14 -16
- data/lib/multi_sync/target.rb +3 -3
- data/lib/multi_sync/targets/aws_target.rb +6 -10
- data/lib/multi_sync/targets/local_target.rb +7 -15
- data/lib/multi_sync/version.rb +1 -1
- data/lib/tasks/multi_sync_rails.rake +4 -4
- data/multi_sync.gemspec +3 -2
- data/spec/support/fog.rb +0 -1
- data/spec/support/timecop.rb +7 -1
- data/spec/support/tmpdir.rb +18 -0
- data/spec/unit/multi_sync/client_spec.rb +51 -74
- data/spec/unit/multi_sync/configuration_spec.rb +54 -83
- data/spec/unit/multi_sync/resources/local_resource_spec.rb +9 -7
- data/spec/unit/multi_sync/sources/local_source_spec.rb +14 -14
- data/spec/unit/multi_sync/sources/manifest_source_spec.rb +16 -18
- data/spec/unit/multi_sync/targets/aws_target_spec.rb +8 -8
- data/spec/unit/multi_sync/targets/local_target_spec.rb +9 -9
- data/spec/unit/multi_sync_spec.rb +44 -31
- metadata +102 -91
- data/gemfiles/middleman-3.1.x.gemfile +0 -5
- data/gemfiles/rails-3.2.x.gemfile +0 -5
- data/gemfiles/rails-4.0.x.gemfile +0 -5
- data/lib/multi_sync/mixins/log_helper.rb +0 -9
- data/spec/support/fakefs.rb +0 -7
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'tmpdir'
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
RSpec.configure do |config|
|
5
|
+
config.around do |ex|
|
6
|
+
tmpdir = Dir.mktmpdir('multi_sync')
|
7
|
+
tmp = Pathname.new File.join(tmpdir, ex.__id__.to_s)
|
8
|
+
pwd = Dir.pwd
|
9
|
+
FileUtils.mkdir(tmp)
|
10
|
+
begin
|
11
|
+
Dir.chdir(tmp)
|
12
|
+
ex.run
|
13
|
+
Dir.chdir(pwd)
|
14
|
+
ensure
|
15
|
+
FileUtils.remove_entry_secure tmp
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,29 +1,29 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe MultiSync::Client
|
4
|
-
|
3
|
+
describe MultiSync::Client do
|
5
4
|
before do
|
6
|
-
FileUtils.mkdir_p('
|
7
|
-
File.open('
|
8
|
-
File.open('
|
9
|
-
|
10
|
-
|
5
|
+
FileUtils.mkdir_p('tmp/simple')
|
6
|
+
File.open('tmp/simple/foo.txt', File::CREAT | File::RDWR) do |f| f.write('foo') end
|
7
|
+
File.open('tmp/simple/bar.txt', File::CREAT | File::RDWR) do |f| f.write('bar') end
|
8
|
+
|
9
|
+
FileUtils.mkdir_p('tmp/simple/in-a-dir')
|
10
|
+
File.open('tmp/simple/in-a-dir/baz.html', File::CREAT | File::RDWR) do |f| f.write('baz') end
|
11
11
|
|
12
|
-
FileUtils.cp_r('
|
13
|
-
FileUtils.rm_r('
|
12
|
+
FileUtils.cp_r('tmp/simple', 'tmp/simple-with-missing-file')
|
13
|
+
FileUtils.rm_r('tmp/simple-with-missing-file/foo.txt')
|
14
14
|
|
15
|
-
FileUtils.cp_r('
|
16
|
-
File.open('
|
15
|
+
FileUtils.cp_r('tmp/simple', 'tmp/simple-with-abandoned-file')
|
16
|
+
File.open('tmp/simple-with-abandoned-file/baz.txt', File::CREAT | File::RDWR) do |f| f.write('baz') end
|
17
17
|
|
18
|
-
FileUtils.cp_r('
|
19
|
-
File.open('
|
18
|
+
FileUtils.cp_r('tmp/simple', 'tmp/simple-with-outdated-file')
|
19
|
+
File.open('tmp/simple-with-outdated-file/foo.txt', File::CREAT | File::RDWR) do |f| f.write('not-foo') end
|
20
20
|
|
21
|
-
FileUtils.mkdir_p('
|
22
|
-
|
23
|
-
File.open("
|
21
|
+
FileUtils.mkdir_p('tmp/complex')
|
22
|
+
1_000.times do |i|
|
23
|
+
File.open("tmp/complex/#{i.to_s.rjust(4, '0')}.txt", File::CREAT | File::RDWR) do |f| f.write('foo') end
|
24
24
|
end
|
25
25
|
|
26
|
-
FileUtils.mkdir_p('
|
26
|
+
FileUtils.mkdir_p('tmp/complex-empty')
|
27
27
|
end
|
28
28
|
|
29
29
|
context :sync do
|
@@ -31,36 +31,30 @@ describe MultiSync::Client, fakefs: true do
|
|
31
31
|
context 'simple' do
|
32
32
|
it 'should work' do
|
33
33
|
missing_files_target_options = {
|
34
|
-
|
35
|
-
target_dir: '/tmp',
|
34
|
+
target_dir: 'tmp',
|
36
35
|
destination_dir: 'simple-with-missing-file',
|
37
36
|
credentials: {
|
38
|
-
local_root: '
|
37
|
+
local_root: 'tmp'
|
39
38
|
}
|
40
39
|
}
|
41
40
|
|
42
41
|
abandoned_files_target_options = {
|
43
|
-
|
44
|
-
target_dir: '/tmp',
|
42
|
+
target_dir: 'tmp',
|
45
43
|
destination_dir: 'simple-with-abandoned-file',
|
46
44
|
credentials: {
|
47
|
-
local_root: '
|
45
|
+
local_root: 'tmp'
|
48
46
|
}
|
49
47
|
}
|
50
48
|
|
51
49
|
outdated_files_target_options = {
|
52
|
-
|
53
|
-
target_dir: '/tmp',
|
50
|
+
target_dir: 'tmp',
|
54
51
|
destination_dir: 'simple-with-outdated-file',
|
55
52
|
credentials: {
|
56
|
-
local_root: '
|
53
|
+
local_root: 'tmp'
|
57
54
|
}
|
58
55
|
}
|
59
56
|
|
60
|
-
local_source_options = {
|
61
|
-
type: :local,
|
62
|
-
source_dir: '/tmp/simple'
|
63
|
-
}
|
57
|
+
local_source_options = { source_dir: 'tmp/simple' }
|
64
58
|
|
65
59
|
missing_files_target = MultiSync::LocalTarget.new(missing_files_target_options)
|
66
60
|
abandoned_files_target = MultiSync::LocalTarget.new(abandoned_files_target_options)
|
@@ -76,10 +70,10 @@ describe MultiSync::Client, fakefs: true do
|
|
76
70
|
expect(outdated_files_target.files[1].body).to eq 'not-foo'
|
77
71
|
|
78
72
|
MultiSync.run do
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
73
|
+
local_target(missing_files_target_options)
|
74
|
+
local_target(abandoned_files_target_options)
|
75
|
+
local_target(outdated_files_target_options)
|
76
|
+
local_source(local_source_options)
|
83
77
|
end
|
84
78
|
|
85
79
|
expect(missing_files_target).to have(3).files
|
@@ -92,31 +86,27 @@ describe MultiSync::Client, fakefs: true do
|
|
92
86
|
context 'complex' do
|
93
87
|
it 'should work' do
|
94
88
|
complex_empty_target_options = {
|
95
|
-
|
96
|
-
target_dir: '/tmp',
|
89
|
+
target_dir: 'tmp',
|
97
90
|
destination_dir: 'complex-empty',
|
98
91
|
credentials: {
|
99
|
-
local_root: '
|
92
|
+
local_root: 'tmp'
|
100
93
|
}
|
101
94
|
}
|
102
95
|
|
103
|
-
local_source_options = {
|
104
|
-
type: :local,
|
105
|
-
source_dir: '/tmp/complex'
|
106
|
-
}
|
96
|
+
local_source_options = { source_dir: 'tmp/complex' }
|
107
97
|
|
108
98
|
complex_empty_target = MultiSync::LocalTarget.new(complex_empty_target_options)
|
109
99
|
expect(complex_empty_target).to have(0).files
|
110
100
|
|
111
101
|
local_source = MultiSync::LocalSource.new(local_source_options)
|
112
|
-
expect(local_source).to have(
|
102
|
+
expect(local_source).to have(1_000).files
|
113
103
|
|
114
104
|
MultiSync.run do
|
115
|
-
|
116
|
-
|
105
|
+
local_source(local_source_options)
|
106
|
+
local_target(complex_empty_target_options)
|
117
107
|
end
|
118
108
|
|
119
|
-
expect(complex_empty_target).to have(
|
109
|
+
expect(complex_empty_target).to have(1_000).files
|
120
110
|
end
|
121
111
|
end
|
122
112
|
end
|
@@ -134,9 +124,9 @@ describe MultiSync::Client, fakefs: true do
|
|
134
124
|
directory = connection.directories.create(key: 'multi_sync', public: true)
|
135
125
|
|
136
126
|
%w(simple simple-with-missing-file simple-with-abandoned-file simple-with-outdated-file).each do |fixture_name|
|
137
|
-
Dir.glob("
|
127
|
+
Dir.glob("tmp/#{fixture_name}/**/*").reject { |path| File.directory?(path) }.each do |path|
|
138
128
|
directory.files.create(
|
139
|
-
key: path.gsub('
|
129
|
+
key: path.gsub('tmp/', ''),
|
140
130
|
body: File.open(path, 'r'),
|
141
131
|
public: true
|
142
132
|
)
|
@@ -146,7 +136,6 @@ describe MultiSync::Client, fakefs: true do
|
|
146
136
|
|
147
137
|
it 'should work' do
|
148
138
|
missing_files_target_options = {
|
149
|
-
type: :aws,
|
150
139
|
target_dir: 'multi_sync',
|
151
140
|
destination_dir: 'simple-with-missing-file',
|
152
141
|
credentials: {
|
@@ -157,7 +146,6 @@ describe MultiSync::Client, fakefs: true do
|
|
157
146
|
}
|
158
147
|
|
159
148
|
abandoned_files_target_options = {
|
160
|
-
type: :aws,
|
161
149
|
target_dir: 'multi_sync',
|
162
150
|
destination_dir: 'simple-with-abandoned-file',
|
163
151
|
credentials: {
|
@@ -168,7 +156,6 @@ describe MultiSync::Client, fakefs: true do
|
|
168
156
|
}
|
169
157
|
|
170
158
|
outdated_files_target_options = {
|
171
|
-
type: :aws,
|
172
159
|
target_dir: 'multi_sync',
|
173
160
|
destination_dir: 'simple-with-outdated-file',
|
174
161
|
credentials: {
|
@@ -178,10 +165,7 @@ describe MultiSync::Client, fakefs: true do
|
|
178
165
|
}
|
179
166
|
}
|
180
167
|
|
181
|
-
local_source_options = {
|
182
|
-
type: :local,
|
183
|
-
source_dir: '/tmp/simple'
|
184
|
-
}
|
168
|
+
local_source_options = { source_dir: 'tmp/simple' }
|
185
169
|
|
186
170
|
missing_files_target = MultiSync::AwsTarget.new(missing_files_target_options)
|
187
171
|
abandoned_files_target = MultiSync::AwsTarget.new(abandoned_files_target_options)
|
@@ -197,10 +181,10 @@ describe MultiSync::Client, fakefs: true do
|
|
197
181
|
expect(outdated_files_target.files[1].body).to eq 'not-foo'
|
198
182
|
|
199
183
|
MultiSync.run do
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
184
|
+
local_source(local_source_options)
|
185
|
+
aws_target(missing_files_target_options)
|
186
|
+
aws_target(abandoned_files_target_options)
|
187
|
+
aws_target(outdated_files_target_options)
|
204
188
|
end
|
205
189
|
|
206
190
|
expect(missing_files_target).to have(3).files
|
@@ -224,7 +208,6 @@ describe MultiSync::Client, fakefs: true do
|
|
224
208
|
|
225
209
|
it 'should work' do
|
226
210
|
complex_empty_target_options = {
|
227
|
-
type: :aws,
|
228
211
|
target_dir: 'multi_sync',
|
229
212
|
destination_dir: 'complex-empty',
|
230
213
|
credentials: {
|
@@ -234,23 +217,20 @@ describe MultiSync::Client, fakefs: true do
|
|
234
217
|
}
|
235
218
|
}
|
236
219
|
|
237
|
-
local_source_options = {
|
238
|
-
type: :local,
|
239
|
-
source_dir: '/tmp/complex'
|
240
|
-
}
|
220
|
+
local_source_options = { source_dir: 'tmp/complex' }
|
241
221
|
|
242
222
|
complex_empty_target = MultiSync::AwsTarget.new(complex_empty_target_options)
|
243
223
|
expect(complex_empty_target).to have(0).files
|
244
224
|
|
245
225
|
local_source = MultiSync::LocalSource.new(local_source_options)
|
246
|
-
expect(local_source).to have(
|
226
|
+
expect(local_source).to have(1_000).files
|
247
227
|
|
248
228
|
MultiSync.run do
|
249
|
-
|
250
|
-
|
229
|
+
local_source(local_source_options)
|
230
|
+
aws_target(complex_empty_target_options)
|
251
231
|
end
|
252
232
|
|
253
|
-
expect(complex_empty_target).to have(
|
233
|
+
expect(complex_empty_target).to have(1_000).files
|
254
234
|
end
|
255
235
|
end
|
256
236
|
|
@@ -268,7 +248,6 @@ describe MultiSync::Client, fakefs: true do
|
|
268
248
|
|
269
249
|
it 'should work' do
|
270
250
|
without_destination_dir_target_options = {
|
271
|
-
type: :aws,
|
272
251
|
target_dir: 'without_destination_dir',
|
273
252
|
credentials: {
|
274
253
|
region: 'us-east-1',
|
@@ -277,10 +256,7 @@ describe MultiSync::Client, fakefs: true do
|
|
277
256
|
}
|
278
257
|
}
|
279
258
|
|
280
|
-
local_source_options = {
|
281
|
-
type: :local,
|
282
|
-
source_dir: '/tmp/simple'
|
283
|
-
}
|
259
|
+
local_source_options = { source_dir: 'tmp/simple' }
|
284
260
|
|
285
261
|
without_destination_dir_target = MultiSync::AwsTarget.new(without_destination_dir_target_options)
|
286
262
|
expect(without_destination_dir_target).to have(0).files
|
@@ -289,8 +265,8 @@ describe MultiSync::Client, fakefs: true do
|
|
289
265
|
expect(local_source).to have(3).files
|
290
266
|
|
291
267
|
MultiSync.run do
|
292
|
-
|
293
|
-
|
268
|
+
local_source(local_source_options)
|
269
|
+
aws_target(without_destination_dir_target_options)
|
294
270
|
end
|
295
271
|
|
296
272
|
expect(without_destination_dir_target).to have(3).files
|
@@ -298,6 +274,7 @@ describe MultiSync::Client, fakefs: true do
|
|
298
274
|
end
|
299
275
|
|
300
276
|
context 'with resource_options' do
|
277
|
+
# TODO: tests...
|
301
278
|
end
|
302
279
|
end
|
303
280
|
end
|
@@ -1,91 +1,62 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe MultiSync::Configuration
|
4
|
-
|
5
|
-
before do
|
6
|
-
FileUtils.mkdir_p('/tmp/fog')
|
7
|
-
File.open('/tmp/fog/.fog', 'w') do |f|
|
8
|
-
f << "default:\n"
|
9
|
-
f << " aws_access_key_id: AWS_ACCESS_KEY_ID_DEFAULT\n"
|
10
|
-
f << " aws_secret_access_key: AWS_SECRET_ACCESS_KEY_DEFAULT\n"
|
11
|
-
f << "alt:\n"
|
12
|
-
f << " aws_access_key_id: AWS_ACCESS_KEY_ID_ALT\n"
|
13
|
-
f << ' aws_secret_access_key: AWS_SECRET_ACCESS_KEY_ALT'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
3
|
+
describe MultiSync::Configuration do
|
17
4
|
let(:configuration) { MultiSync::Configuration.new }
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
subject { configuration.target_pool_size }
|
23
|
-
it { should > 1 }
|
5
|
+
context :configuration do
|
6
|
+
describe :target_pool_size do
|
7
|
+
it 'should default to celluloid_cores' do
|
8
|
+
expect(configuration.target_pool_size).to eq Celluloid.cores
|
24
9
|
end
|
25
|
-
|
26
|
-
|
27
|
-
context :custom do
|
28
|
-
before do
|
10
|
+
it 'should be settable' do
|
29
11
|
configuration.target_pool_size = 3
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
context "with 'alt' credential set" do
|
80
|
-
before do
|
81
|
-
ENV['FOG_RC'] = '/tmp/fog/.fog'
|
82
|
-
ENV['FOG_CREDENTIAL'] = 'alt'
|
83
|
-
end
|
84
|
-
|
85
|
-
describe :credentials do
|
86
|
-
subject { configuration.credentials }
|
87
|
-
its([:aws_access_key_id]) { should eq 'AWS_ACCESS_KEY_ID_ALT' }
|
88
|
-
its([:aws_secret_access_key]) { should eq 'AWS_SECRET_ACCESS_KEY_ALT' }
|
12
|
+
expect(configuration.target_pool_size).to be 3
|
13
|
+
end
|
14
|
+
end
|
15
|
+
describe :credentials do
|
16
|
+
it 'should be settable' do
|
17
|
+
configuration.credentials = { foo: 'bar' }
|
18
|
+
expect(configuration.credentials).to eq foo: 'bar'
|
19
|
+
end
|
20
|
+
context 'fog environment variables' do
|
21
|
+
before do
|
22
|
+
FileUtils.mkdir_p('/tmp/fog')
|
23
|
+
File.open('/tmp/fog/.fog', 'w') do |f|
|
24
|
+
f << "default:\n"
|
25
|
+
f << " aws_access_key_id: AWS_ACCESS_KEY_ID_DEFAULT\n"
|
26
|
+
f << " aws_secret_access_key: AWS_SECRET_ACCESS_KEY_DEFAULT\n"
|
27
|
+
f << "alt:\n"
|
28
|
+
f << " aws_access_key_id: AWS_ACCESS_KEY_ID_ALT\n"
|
29
|
+
f << ' aws_secret_access_key: AWS_SECRET_ACCESS_KEY_ALT'
|
30
|
+
end
|
31
|
+
Fog.instance_variable_set('@credential_path', nil)
|
32
|
+
Fog.instance_variable_set('@credentials', nil)
|
33
|
+
Fog.instance_variable_set('@credential', nil)
|
34
|
+
end
|
35
|
+
after do
|
36
|
+
ENV['FOG_RC'] = nil
|
37
|
+
ENV['FOG_CREDENTIAL'] = 'default'
|
38
|
+
Fog.instance_variable_set('@credential_path', nil)
|
39
|
+
Fog.instance_variable_set('@credentials', nil)
|
40
|
+
Fog.instance_variable_set('@credential', nil)
|
41
|
+
end
|
42
|
+
it 'should default to fog credentials' do
|
43
|
+
ENV['FOG_RC'] = nil
|
44
|
+
ENV['FOG_CREDENTIAL'] = 'default'
|
45
|
+
expect(configuration.credentials).to eq Fog.credentials
|
46
|
+
end
|
47
|
+
it 'should use fog credentials' do
|
48
|
+
ENV['FOG_RC'] = '/tmp/fog/.fog'
|
49
|
+
ENV['FOG_CREDENTIAL'] = 'default'
|
50
|
+
expect(configuration.credentials).to eq(aws_access_key_id: 'AWS_ACCESS_KEY_ID_DEFAULT', aws_secret_access_key: 'AWS_SECRET_ACCESS_KEY_DEFAULT')
|
51
|
+
end
|
52
|
+
it 'should use fog \'alt\' credentials' do
|
53
|
+
ENV['FOG_RC'] = '/tmp/fog/.fog'
|
54
|
+
ENV['FOG_CREDENTIAL'] = 'alt'
|
55
|
+
expect(configuration.credentials).to eq(
|
56
|
+
aws_access_key_id: 'AWS_ACCESS_KEY_ID_ALT',
|
57
|
+
aws_secret_access_key: 'AWS_SECRET_ACCESS_KEY_ALT'
|
58
|
+
)
|
59
|
+
end
|
89
60
|
end
|
90
61
|
end
|
91
62
|
end
|
@@ -2,19 +2,21 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe MultiSync::LocalResource, fakefs: true do
|
4
4
|
before do
|
5
|
-
FileUtils.mkdir_p('
|
6
|
-
File.open('
|
5
|
+
FileUtils.mkdir_p('tmp/local-resource')
|
6
|
+
File.open('tmp/local-resource/foo.txt', 'w') do |f| f.write('foo') end
|
7
7
|
end
|
8
8
|
|
9
9
|
describe :local do
|
10
10
|
context :valid do
|
11
11
|
it 'should return correct file details' do
|
12
|
-
|
13
|
-
|
12
|
+
resource = MultiSync::LocalResource.new(
|
13
|
+
path_with_root: Pathname.new('tmp/local-resource/foo.txt'),
|
14
|
+
path_without_root: Pathname.new('foo.txt')
|
15
|
+
)
|
14
16
|
expect(resource.body).to eq 'foo'
|
15
17
|
expect(resource.content_length).to eq 3
|
16
18
|
expect(resource.content_type).to eq 'text/plain'
|
17
|
-
expect(resource.mtime).to
|
19
|
+
expect(resource.mtime).to be_within(1).of(Time.now)
|
18
20
|
expect(resource.etag).to eq 'acbd18db4cc2f85cedef654fccc4a4d8'
|
19
21
|
end
|
20
22
|
end
|
@@ -22,7 +24,7 @@ describe MultiSync::LocalResource, fakefs: true do
|
|
22
24
|
context :known do
|
23
25
|
it 'should return correct file details (with overwritten info)' do
|
24
26
|
resource = MultiSync::LocalResource.new(
|
25
|
-
path_with_root: Pathname.new('
|
27
|
+
path_with_root: Pathname.new('tmp/local-resource/foo.txt'),
|
26
28
|
path_without_root: Pathname.new('foo.txt'),
|
27
29
|
content_length: 42,
|
28
30
|
mtime: Time.now - 1,
|
@@ -39,7 +41,7 @@ describe MultiSync::LocalResource, fakefs: true do
|
|
39
41
|
context :unknown do
|
40
42
|
it 'should return default file details' do
|
41
43
|
resource = MultiSync::LocalResource.new(
|
42
|
-
path_with_root: Pathname.new('
|
44
|
+
path_with_root: Pathname.new('tmp/local-resource/missing.txt'),
|
43
45
|
path_without_root: Pathname.new('missing.txt')
|
44
46
|
)
|
45
47
|
expect(resource.body).to eq nil
|