nanoc 4.6.1 → 4.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Appraisals +1 -1
- data/Gemfile.lock +22 -22
- data/NEWS.md +12 -0
- data/lib/nanoc/base/entities/document.rb +7 -0
- data/lib/nanoc/base/entities/identifiable_collection.rb +12 -9
- data/lib/nanoc/base/entities/item_rep.rb +24 -28
- data/lib/nanoc/base/entities/processing_actions/snapshot.rb +15 -11
- data/lib/nanoc/base/entities/rule_memory.rb +15 -5
- data/lib/nanoc/base/entities/site.rb +15 -10
- data/lib/nanoc/base/entities/snapshot_def.rb +8 -2
- data/lib/nanoc/base/repos.rb +3 -0
- data/lib/nanoc/base/repos/aggregate_data_source.rb +20 -0
- data/lib/nanoc/base/repos/in_mem_data_source.rb +13 -0
- data/lib/nanoc/base/repos/prefixed_data_source.rb +19 -0
- data/lib/nanoc/base/repos/site_loader.rb +8 -16
- data/lib/nanoc/base/repos/snapshot_repo.rb +10 -5
- data/lib/nanoc/base/services/action_provider.rb +12 -0
- data/lib/nanoc/base/services/compiler/phases/recalculate.rb +5 -2
- data/lib/nanoc/base/services/compiler/phases/write.rb +1 -3
- data/lib/nanoc/base/services/compiler/stages/preprocess.rb +6 -3
- data/lib/nanoc/base/services/executor.rb +2 -4
- data/lib/nanoc/base/services/filter.rb +7 -12
- data/lib/nanoc/base/services/item_rep_router.rb +40 -16
- data/lib/nanoc/base/services/item_rep_writer.rb +19 -3
- data/lib/nanoc/base/services/pruner.rb +1 -1
- data/lib/nanoc/base/views/item_rep_view.rb +12 -3
- data/lib/nanoc/base/views/mutable_identifiable_collection_view.rb +1 -1
- data/lib/nanoc/base/views/mutable_item_collection_view.rb +1 -1
- data/lib/nanoc/base/views/mutable_layout_collection_view.rb +1 -1
- data/lib/nanoc/checking/checks/html.rb +1 -1
- data/lib/nanoc/checking/checks/stale.rb +2 -1
- data/lib/nanoc/checking/checks/w3c_validator.rb +1 -0
- data/lib/nanoc/cli/commands/compile.rb +3 -2
- data/lib/nanoc/cli/commands/show-data.rb +4 -2
- data/lib/nanoc/data_sources/filesystem.rb +1 -1
- data/lib/nanoc/helpers/filtering.rb +1 -2
- data/lib/nanoc/helpers/rendering.rb +1 -2
- data/lib/nanoc/helpers/xml_sitemap.rb +2 -2
- data/lib/nanoc/rule_dsl/action_provider.rb +7 -0
- data/lib/nanoc/rule_dsl/rule_context.rb +4 -1
- data/lib/nanoc/rule_dsl/rule_memory_calculator.rb +33 -13
- data/lib/nanoc/spec.rb +5 -6
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/checksummer_spec.rb +19 -9
- data/spec/nanoc/base/compiler_spec.rb +4 -8
- data/spec/nanoc/base/entities/document_spec.rb +20 -0
- data/spec/nanoc/base/entities/identifiable_collection_spec.rb +12 -0
- data/spec/nanoc/base/entities/item_rep_spec.rb +1 -1
- data/spec/nanoc/base/entities/processing_actions/snapshot_spec.rb +19 -13
- data/spec/nanoc/base/entities/rule_memory_spec.rb +39 -3
- data/spec/nanoc/base/entities/site_spec.rb +15 -10
- data/spec/nanoc/base/filter_spec.rb +28 -1
- data/spec/nanoc/base/item_rep_writer_spec.rb +4 -2
- data/spec/nanoc/base/repos/outdatedness_store_spec.rb +1 -2
- data/spec/nanoc/base/repos/snapshot_repo_spec.rb +4 -4
- data/spec/nanoc/base/repos/store_spec.rb +5 -1
- data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +9 -10
- data/spec/nanoc/base/services/executor_spec.rb +2 -2
- data/spec/nanoc/base/services/item_rep_router_spec.rb +83 -39
- data/spec/nanoc/base/services/outdatedness_checker_spec.rb +1 -2
- data/spec/nanoc/base/services/outdatedness_rules_spec.rb +2 -3
- data/spec/nanoc/base/services/pruner_spec.rb +2 -2
- data/spec/nanoc/base/views/identifiable_collection_view_spec.rb +46 -28
- data/spec/nanoc/base/views/item_rep_view_spec.rb +72 -15
- data/spec/nanoc/base/views/item_view_spec.rb +20 -14
- data/spec/nanoc/base/views/mutable_identifiable_collection_view_spec.rb +10 -4
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +10 -5
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +10 -5
- data/spec/nanoc/cli/commands/compile/file_action_printer_spec.rb +1 -1
- data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +1 -1
- data/spec/nanoc/cli/commands/show_data_spec.rb +9 -7
- data/spec/nanoc/cli/commands/show_rules_spec.rb +16 -10
- data/spec/nanoc/regressions/gh_1037a_spec.rb +29 -0
- data/spec/nanoc/regressions/gh_1037b_spec.rb +18 -0
- data/spec/nanoc/regressions/gh_1082a_spec.rb +18 -0
- data/spec/nanoc/regressions/gh_1082b_spec.rb +20 -0
- data/spec/nanoc/regressions/gh_1082c_spec.rb +19 -0
- data/spec/nanoc/regressions/gh_1082d_spec.rb +17 -0
- data/spec/nanoc/regressions/gh_1093_spec.rb +49 -0
- data/spec/nanoc/regressions/gh_1097_spec.rb +21 -0
- data/spec/nanoc/regressions/gh_1100_spec.rb +20 -0
- data/spec/nanoc/regressions/gh_1102_spec.rb +26 -0
- data/spec/nanoc/regressions/gh_776_spec.rb +1 -5
- data/spec/nanoc/rule_dsl/recording_executor_spec.rb +14 -14
- data/spec/nanoc/rule_dsl/rule_context_spec.rb +22 -13
- data/spec/nanoc/rule_dsl/rule_memory_calculator_spec.rb +38 -54
- data/spec/spec_helper.rb +1 -1
- data/test/base/test_compiler.rb +3 -4
- data/test/base/test_item_array.rb +4 -15
- data/test/checking/checks/test_html.rb +4 -3
- data/test/cli/commands/test_compile.rb +2 -2
- data/test/filters/test_relativize_paths.rb +28 -28
- data/test/fixtures/vcr_cassettes/html_run_error.yml +25 -76
- data/test/helpers/test_xml_sitemap.rb +22 -19
- metadata +16 -2
@@ -25,9 +25,8 @@ describe Nanoc::Int::OutdatednessRules do
|
|
25
25
|
let(:site) do
|
26
26
|
Nanoc::Int::Site.new(
|
27
27
|
config: config,
|
28
|
-
items: [],
|
29
|
-
layouts: [],
|
30
28
|
code_snippets: code_snippets,
|
29
|
+
data_source: Nanoc::Int::InMemDataSource.new([], []),
|
31
30
|
)
|
32
31
|
end
|
33
32
|
|
@@ -105,7 +104,7 @@ describe Nanoc::Int::OutdatednessRules do
|
|
105
104
|
context 'path' do
|
106
105
|
let(:path) { 'foo.txt' }
|
107
106
|
|
108
|
-
before { item_rep.raw_paths = { last: path } }
|
107
|
+
before { item_rep.raw_paths = { last: [path] } }
|
109
108
|
|
110
109
|
context 'not written' do
|
111
110
|
it { is_expected.to be }
|
@@ -8,11 +8,11 @@ describe Nanoc::Pruner do
|
|
8
8
|
let(:reps) do
|
9
9
|
Nanoc::Int::ItemRepRepo.new.tap do |reps|
|
10
10
|
reps << Nanoc::Int::ItemRep.new(item, :default).tap do |rep|
|
11
|
-
rep.raw_paths = { last: 'output/asdf.html' }
|
11
|
+
rep.raw_paths = { last: ['output/asdf.html'] }
|
12
12
|
end
|
13
13
|
|
14
14
|
reps << Nanoc::Int::ItemRep.new(item, :text).tap do |rep|
|
15
|
-
rep.raw_paths = { last: 'output/asdf.txt' }
|
15
|
+
rep.raw_paths = { last: ['output/asdf.txt'] }
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -10,10 +10,13 @@ shared_examples 'an identifiable collection' do
|
|
10
10
|
|
11
11
|
describe '#frozen?' do
|
12
12
|
let(:wrapped) do
|
13
|
-
Nanoc::Int::IdentifiableCollection.new(
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
Nanoc::Int::IdentifiableCollection.new(
|
14
|
+
config,
|
15
|
+
[
|
16
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
17
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
18
|
+
],
|
19
|
+
)
|
17
20
|
end
|
18
21
|
|
19
22
|
subject { view.frozen? }
|
@@ -34,11 +37,14 @@ shared_examples 'an identifiable collection' do
|
|
34
37
|
|
35
38
|
describe '#unwrap' do
|
36
39
|
let(:wrapped) do
|
37
|
-
Nanoc::Int::IdentifiableCollection.new(
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
40
|
+
Nanoc::Int::IdentifiableCollection.new(
|
41
|
+
config,
|
42
|
+
[
|
43
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
44
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
45
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/baz')),
|
46
|
+
],
|
47
|
+
)
|
42
48
|
end
|
43
49
|
|
44
50
|
subject { view.unwrap }
|
@@ -48,11 +54,14 @@ shared_examples 'an identifiable collection' do
|
|
48
54
|
|
49
55
|
describe '#each' do
|
50
56
|
let(:wrapped) do
|
51
|
-
Nanoc::Int::IdentifiableCollection.new(
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
57
|
+
Nanoc::Int::IdentifiableCollection.new(
|
58
|
+
config,
|
59
|
+
[
|
60
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
61
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
62
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/baz')),
|
63
|
+
],
|
64
|
+
)
|
56
65
|
end
|
57
66
|
|
58
67
|
it 'returns self' do
|
@@ -66,11 +75,14 @@ shared_examples 'an identifiable collection' do
|
|
66
75
|
|
67
76
|
describe '#size' do
|
68
77
|
let(:wrapped) do
|
69
|
-
Nanoc::Int::IdentifiableCollection.new(
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
78
|
+
Nanoc::Int::IdentifiableCollection.new(
|
79
|
+
config,
|
80
|
+
[
|
81
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/foo')),
|
82
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/bar')),
|
83
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/baz')),
|
84
|
+
],
|
85
|
+
)
|
74
86
|
end
|
75
87
|
|
76
88
|
subject { view.size }
|
@@ -88,10 +100,13 @@ shared_examples 'an identifiable collection' do
|
|
88
100
|
end
|
89
101
|
|
90
102
|
let(:wrapped) do
|
91
|
-
Nanoc::Int::IdentifiableCollection.new(
|
92
|
-
|
93
|
-
|
94
|
-
|
103
|
+
Nanoc::Int::IdentifiableCollection.new(
|
104
|
+
config,
|
105
|
+
[
|
106
|
+
page_object,
|
107
|
+
home_object,
|
108
|
+
],
|
109
|
+
)
|
95
110
|
end
|
96
111
|
|
97
112
|
subject { view[arg] }
|
@@ -154,11 +169,14 @@ shared_examples 'an identifiable collection' do
|
|
154
169
|
|
155
170
|
describe '#find_all' do
|
156
171
|
let(:wrapped) do
|
157
|
-
Nanoc::Int::IdentifiableCollection.new(
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
172
|
+
Nanoc::Int::IdentifiableCollection.new(
|
173
|
+
config,
|
174
|
+
[
|
175
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/about.css')),
|
176
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/about.md')),
|
177
|
+
double(:identifiable, identifier: Nanoc::Identifier.new('/style.css')),
|
178
|
+
],
|
179
|
+
)
|
162
180
|
end
|
163
181
|
|
164
182
|
subject { view.find_all(arg) }
|
@@ -146,7 +146,7 @@ describe Nanoc::ItemRepView do
|
|
146
146
|
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
147
147
|
ir.compiled = true
|
148
148
|
ir.snapshot_defs = [
|
149
|
-
Nanoc::Int::SnapshotDef.new(:last),
|
149
|
+
Nanoc::Int::SnapshotDef.new(:last, binary: false),
|
150
150
|
]
|
151
151
|
end
|
152
152
|
end
|
@@ -213,7 +213,7 @@ describe Nanoc::ItemRepView do
|
|
213
213
|
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
214
214
|
ir.compiled = true
|
215
215
|
ir.snapshot_defs = [
|
216
|
-
Nanoc::Int::SnapshotDef.new(:last),
|
216
|
+
Nanoc::Int::SnapshotDef.new(:last, binary: false),
|
217
217
|
]
|
218
218
|
end
|
219
219
|
end
|
@@ -255,7 +255,7 @@ describe Nanoc::ItemRepView do
|
|
255
255
|
let(:rep) do
|
256
256
|
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
257
257
|
ir.paths = {
|
258
|
-
last: '/about/',
|
258
|
+
last: ['/about/'],
|
259
259
|
}
|
260
260
|
end
|
261
261
|
end
|
@@ -283,14 +283,14 @@ describe Nanoc::ItemRepView do
|
|
283
283
|
end
|
284
284
|
|
285
285
|
describe '#raw_path' do
|
286
|
-
subject { view.raw_path }
|
286
|
+
subject { Fiber.new { view.raw_path }.resume }
|
287
287
|
|
288
288
|
let(:view) { described_class.new(rep, view_context) }
|
289
289
|
|
290
290
|
let(:rep) do
|
291
291
|
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
292
292
|
ir.raw_paths = {
|
293
|
-
last: 'output/about/index.html',
|
293
|
+
last: ['output/about/index.html'],
|
294
294
|
}
|
295
295
|
end
|
296
296
|
end
|
@@ -299,22 +299,79 @@ describe Nanoc::ItemRepView do
|
|
299
299
|
Nanoc::Int::Item.new('content', {}, '/asdf.md')
|
300
300
|
end
|
301
301
|
|
302
|
-
|
303
|
-
|
302
|
+
context 'rep is not compiled' do
|
303
|
+
it 'creates a dependency' do
|
304
|
+
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([item])
|
305
|
+
end
|
306
|
+
|
307
|
+
it 'creates a dependency with the right props' do
|
308
|
+
subject
|
309
|
+
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
310
|
+
|
311
|
+
expect(dep.props.compiled_content?).to eq(true)
|
312
|
+
|
313
|
+
expect(dep.props.raw_content?).to eq(false)
|
314
|
+
expect(dep.props.attributes?).to eq(false)
|
315
|
+
expect(dep.props.path?).to eq(false)
|
316
|
+
end
|
317
|
+
|
318
|
+
it { should be_a(Nanoc::Int::Errors::UnmetDependency) }
|
304
319
|
end
|
305
320
|
|
306
|
-
|
307
|
-
|
308
|
-
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
321
|
+
context 'rep is compiled' do
|
322
|
+
before { rep.compiled = true }
|
309
323
|
|
310
|
-
|
324
|
+
it 'creates a dependency' do
|
325
|
+
expect { subject }.to change { dependency_store.objects_causing_outdatedness_of(base_item) }.from([]).to([item])
|
326
|
+
end
|
311
327
|
|
312
|
-
|
313
|
-
|
314
|
-
|
328
|
+
it 'creates a dependency with the right props' do
|
329
|
+
subject
|
330
|
+
dep = dependency_store.dependencies_causing_outdatedness_of(base_item)[0]
|
331
|
+
|
332
|
+
expect(dep.props.compiled_content?).to eq(true)
|
333
|
+
|
334
|
+
expect(dep.props.raw_content?).to eq(false)
|
335
|
+
expect(dep.props.attributes?).to eq(false)
|
336
|
+
expect(dep.props.path?).to eq(false)
|
337
|
+
end
|
338
|
+
|
339
|
+
it { should eq('output/about/index.html') }
|
315
340
|
end
|
341
|
+
end
|
342
|
+
|
343
|
+
describe '#binary?' do
|
344
|
+
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
345
|
+
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo/') }
|
346
|
+
let(:view) { described_class.new(item_rep, view_context) }
|
347
|
+
|
348
|
+
subject { view.binary? }
|
316
349
|
|
317
|
-
|
350
|
+
context 'no :last snapshot' do
|
351
|
+
before do
|
352
|
+
item_rep.snapshot_defs = []
|
353
|
+
end
|
354
|
+
|
355
|
+
it 'raises' do
|
356
|
+
expect { subject }.to raise_error(Nanoc::Int::Errors::NoSuchSnapshot)
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
context ':last snapshot is textual' do
|
361
|
+
before do
|
362
|
+
item_rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(:last, binary: false)]
|
363
|
+
end
|
364
|
+
|
365
|
+
it { is_expected.not_to be }
|
366
|
+
end
|
367
|
+
|
368
|
+
context ':last snapshot is binary' do
|
369
|
+
before do
|
370
|
+
item_rep.snapshot_defs = [Nanoc::Int::SnapshotDef.new(:last, binary: true)]
|
371
|
+
end
|
372
|
+
|
373
|
+
it { is_expected.to be }
|
374
|
+
end
|
318
375
|
end
|
319
376
|
|
320
377
|
describe '#item' do
|
@@ -34,10 +34,13 @@ describe Nanoc::ItemWithRepsView do
|
|
34
34
|
let(:view) { described_class.new(item, view_context) }
|
35
35
|
|
36
36
|
let(:items) do
|
37
|
-
Nanoc::Int::IdentifiableCollection.new(
|
38
|
-
|
39
|
-
|
40
|
-
|
37
|
+
Nanoc::Int::IdentifiableCollection.new(
|
38
|
+
{},
|
39
|
+
[
|
40
|
+
item,
|
41
|
+
parent_item,
|
42
|
+
].compact,
|
43
|
+
)
|
41
44
|
end
|
42
45
|
|
43
46
|
subject { view.parent }
|
@@ -130,10 +133,13 @@ describe Nanoc::ItemWithRepsView do
|
|
130
133
|
let(:view) { described_class.new(item, view_context) }
|
131
134
|
|
132
135
|
let(:items) do
|
133
|
-
Nanoc::Int::IdentifiableCollection.new(
|
134
|
-
|
135
|
-
|
136
|
-
|
136
|
+
Nanoc::Int::IdentifiableCollection.new(
|
137
|
+
{},
|
138
|
+
[
|
139
|
+
item,
|
140
|
+
*children,
|
141
|
+
],
|
142
|
+
)
|
137
143
|
end
|
138
144
|
|
139
145
|
subject { view.children }
|
@@ -208,10 +214,10 @@ describe Nanoc::ItemWithRepsView do
|
|
208
214
|
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
209
215
|
ir.compiled = true
|
210
216
|
ir.snapshot_defs = [
|
211
|
-
Nanoc::Int::SnapshotDef.new(:last),
|
212
|
-
Nanoc::Int::SnapshotDef.new(:pre),
|
213
|
-
Nanoc::Int::SnapshotDef.new(:post),
|
214
|
-
Nanoc::Int::SnapshotDef.new(:specific),
|
217
|
+
Nanoc::Int::SnapshotDef.new(:last, binary: false),
|
218
|
+
Nanoc::Int::SnapshotDef.new(:pre, binary: false),
|
219
|
+
Nanoc::Int::SnapshotDef.new(:post, binary: false),
|
220
|
+
Nanoc::Int::SnapshotDef.new(:specific, binary: false),
|
215
221
|
]
|
216
222
|
end
|
217
223
|
end
|
@@ -286,8 +292,8 @@ describe Nanoc::ItemWithRepsView do
|
|
286
292
|
let(:rep) do
|
287
293
|
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
288
294
|
ir.paths = {
|
289
|
-
last: '/about/',
|
290
|
-
specific: '/about.txt',
|
295
|
+
last: ['/about/'],
|
296
|
+
specific: ['/about.txt'],
|
291
297
|
}
|
292
298
|
end
|
293
299
|
end
|
@@ -9,14 +9,20 @@ shared_examples 'a mutable identifiable collection' do
|
|
9
9
|
|
10
10
|
describe '#delete_if' do
|
11
11
|
let(:wrapped) do
|
12
|
-
Nanoc::Int::IdentifiableCollection.new(
|
13
|
-
|
14
|
-
|
12
|
+
Nanoc::Int::IdentifiableCollection.new(
|
13
|
+
config,
|
14
|
+
[double(:identifiable, identifier: Nanoc::Identifier.new('/asdf/'))],
|
15
|
+
)
|
15
16
|
end
|
16
17
|
|
17
18
|
it 'deletes matching' do
|
18
19
|
view.delete_if { |i| i.identifier == '/asdf/' }
|
19
|
-
expect(
|
20
|
+
expect(view.unwrap).to be_empty
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'does not mutate' do
|
24
|
+
view.delete_if { |i| i.identifier == '/asdf/' }
|
25
|
+
expect(wrapped).not_to be_empty
|
20
26
|
end
|
21
27
|
|
22
28
|
it 'deletes no non-matching' do
|
@@ -13,9 +13,7 @@ describe Nanoc::MutableItemCollectionView do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:wrapped) do
|
16
|
-
Nanoc::Int::IdentifiableCollection.new(config)
|
17
|
-
coll << item
|
18
|
-
end
|
16
|
+
Nanoc::Int::IdentifiableCollection.new(config, [item])
|
19
17
|
end
|
20
18
|
|
21
19
|
let(:view) { described_class.new(wrapped, nil) }
|
@@ -23,8 +21,15 @@ describe Nanoc::MutableItemCollectionView do
|
|
23
21
|
it 'creates an object' do
|
24
22
|
view.create('new content', { title: 'New Page' }, '/new/')
|
25
23
|
|
26
|
-
expect(
|
27
|
-
expect(
|
24
|
+
expect(view.unwrap.size).to eq(2)
|
25
|
+
expect(view.unwrap['/new/'].content.string).to eq('new content')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'does not update wrapped' do
|
29
|
+
view.create('new content', { title: 'New Page' }, '/new/')
|
30
|
+
|
31
|
+
expect(wrapped.size).to eq(1)
|
32
|
+
expect(wrapped['/new']).to be_nil
|
28
33
|
end
|
29
34
|
|
30
35
|
it 'returns self' do
|
@@ -13,9 +13,7 @@ describe Nanoc::MutableLayoutCollectionView do
|
|
13
13
|
end
|
14
14
|
|
15
15
|
let(:wrapped) do
|
16
|
-
Nanoc::Int::IdentifiableCollection.new(config)
|
17
|
-
coll << layout
|
18
|
-
end
|
16
|
+
Nanoc::Int::IdentifiableCollection.new(config, [layout])
|
19
17
|
end
|
20
18
|
|
21
19
|
let(:view) { described_class.new(wrapped, nil) }
|
@@ -23,8 +21,15 @@ describe Nanoc::MutableLayoutCollectionView do
|
|
23
21
|
it 'creates an object' do
|
24
22
|
view.create('new content', { title: 'New Page' }, '/new/')
|
25
23
|
|
26
|
-
expect(
|
27
|
-
expect(
|
24
|
+
expect(view.unwrap.size).to eq(2)
|
25
|
+
expect(view.unwrap['/new/'].content.string).to eq('new content')
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'does not update wrapped' do
|
29
|
+
view.create('new content', { title: 'New Page' }, '/new/')
|
30
|
+
|
31
|
+
expect(wrapped.size).to eq(1)
|
32
|
+
expect(wrapped['/new']).to be_nil
|
28
33
|
end
|
29
34
|
|
30
35
|
it 'returns self' do
|