nanoc 4.8.9 → 4.8.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -4
  3. data/Gemfile +2 -1
  4. data/NEWS.md +7 -0
  5. data/README.md +1 -1
  6. data/lib/nanoc.rb +2 -6
  7. data/lib/nanoc/base/entities/site.rb +9 -5
  8. data/lib/nanoc/base/repos/data_source.rb +0 -15
  9. data/lib/nanoc/base/repos/outdatedness_store.rb +17 -15
  10. data/lib/nanoc/base/services/compilation_context.rb +4 -4
  11. data/lib/nanoc/base/services/compiler.rb +102 -103
  12. data/lib/nanoc/base/services/compiler/stages/build_reps.rb +7 -7
  13. data/lib/nanoc/base/services/compiler/stages/compile_reps.rb +4 -2
  14. data/lib/nanoc/base/services/compiler/stages/determine_outdatedness.rb +25 -7
  15. data/lib/nanoc/base/services/compiler/stages/postprocess.rb +3 -3
  16. data/lib/nanoc/base/services/compiler/stages/preprocess.rb +3 -0
  17. data/lib/nanoc/base/services/compiler_loader.rb +1 -4
  18. data/lib/nanoc/base/views.rb +13 -6
  19. data/lib/nanoc/base/views/{item_rep_collection_view.rb → basic_item_rep_collection_view.rb} +6 -6
  20. data/lib/nanoc/base/views/{item_rep_view.rb → basic_item_rep_view.rb} +8 -29
  21. data/lib/nanoc/base/views/{item_without_reps_view.rb → basic_item_view.rb} +3 -3
  22. data/lib/nanoc/base/views/compilation_item_rep_collection_view.rb +10 -0
  23. data/lib/nanoc/base/views/compilation_item_rep_view.rb +42 -0
  24. data/lib/nanoc/base/views/{mixins/with_reps_view_mixin.rb → compilation_item_view.rb} +3 -3
  25. data/lib/nanoc/base/views/item_collection_with_reps_view.rb +1 -1
  26. data/lib/nanoc/base/views/item_collection_without_reps_view.rb +1 -1
  27. data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +1 -1
  28. data/lib/nanoc/base/views/mutable_item_view.rb +1 -1
  29. data/lib/nanoc/base/views/post_compile_item_rep_collection_view.rb +1 -1
  30. data/lib/nanoc/base/views/post_compile_item_rep_view.rb +7 -2
  31. data/lib/nanoc/base/views/post_compile_item_view.rb +1 -1
  32. data/lib/nanoc/base/views/{view_context.rb → view_context_for_compilation.rb} +10 -1
  33. data/lib/nanoc/base/views/view_context_for_pre_compilation.rb +18 -0
  34. data/lib/nanoc/base/views/view_context_for_shell.rb +23 -0
  35. data/lib/nanoc/checking/check.rb +5 -1
  36. data/lib/nanoc/checking/runner.rb +1 -1
  37. data/lib/nanoc/cli.rb +1 -0
  38. data/lib/nanoc/cli/command_runner.rb +1 -7
  39. data/lib/nanoc/cli/commands/check.rb +2 -2
  40. data/lib/nanoc/cli/commands/compile.rb +8 -47
  41. data/lib/nanoc/cli/commands/compile_listeners/abstract.rb +9 -0
  42. data/lib/nanoc/cli/commands/compile_listeners/aggregate.rb +49 -0
  43. data/lib/nanoc/cli/commands/deploy.rb +2 -1
  44. data/lib/nanoc/cli/commands/prune.rb +5 -4
  45. data/lib/nanoc/cli/commands/shell.rb +4 -6
  46. data/lib/nanoc/cli/commands/show-data.rb +20 -27
  47. data/lib/nanoc/cli/commands/show-rules.rb +20 -22
  48. data/lib/nanoc/cli/error_handler.rb +0 -17
  49. data/lib/nanoc/data_sources/filesystem.rb +4 -2
  50. data/lib/nanoc/deploying/deployers/fog.rb +4 -1
  51. data/lib/nanoc/helpers/link_to.rb +1 -1
  52. data/lib/nanoc/rule_dsl/action_provider.rb +8 -11
  53. data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +14 -5
  54. data/lib/nanoc/rule_dsl/recording_executor.rb +4 -0
  55. data/lib/nanoc/rule_dsl/rule.rb +14 -9
  56. data/lib/nanoc/rule_dsl/rule_context.rb +4 -4
  57. data/lib/nanoc/spec.rb +27 -19
  58. data/lib/nanoc/version.rb +1 -1
  59. data/spec/nanoc/base/checksummer_spec.rb +19 -11
  60. data/spec/nanoc/base/compiler_spec.rb +18 -14
  61. data/spec/nanoc/base/filter_spec.rb +7 -6
  62. data/spec/nanoc/base/repos/outdatedness_store_spec.rb +3 -32
  63. data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +2 -1
  64. data/spec/nanoc/base/services/compiler/stages/determine_outdatedness_spec.rb +148 -0
  65. data/spec/nanoc/base/services/compiler/stages/preprocess_spec.rb +110 -0
  66. data/spec/nanoc/base/services/executor_spec.rb +6 -6
  67. data/spec/nanoc/base/views/basic_item_rep_collection_view_spec.rb +8 -0
  68. data/spec/nanoc/base/views/basic_item_rep_view_spec.rb +9 -0
  69. data/spec/nanoc/base/views/compilation_item_rep_collection_view_spec.rb +8 -0
  70. data/spec/nanoc/base/views/compilation_item_rep_view_spec.rb +136 -0
  71. data/spec/nanoc/base/views/config_view_spec.rb +5 -5
  72. data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +4 -2
  73. data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +4 -2
  74. data/spec/nanoc/base/views/item_view_spec.rb +13 -11
  75. data/spec/nanoc/base/views/layout_collection_view_spec.rb +3 -1
  76. data/spec/nanoc/base/views/layout_view_spec.rb +3 -1
  77. data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +5 -2
  78. data/spec/nanoc/base/views/mutable_item_view_spec.rb +2 -0
  79. data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +5 -2
  80. data/spec/nanoc/base/views/mutable_layout_view_spec.rb +2 -0
  81. data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +2 -0
  82. data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +9 -3
  83. data/spec/nanoc/base/views/{document_view_spec.rb → support/document_view_examples.rb} +5 -5
  84. data/spec/nanoc/base/views/{identifiable_collection_view_spec.rb → support/identifiable_collection_view_examples.rb} +4 -4
  85. data/spec/nanoc/base/views/{item_rep_collection_view_spec.rb → support/item_rep_collection_view_examples.rb} +3 -8
  86. data/spec/nanoc/base/views/{item_rep_view_spec.rb → support/item_rep_view_examples.rb} +10 -111
  87. data/spec/nanoc/base/views/{mutable_document_view_spec.rb → support/mutable_document_view_examples.rb} +7 -6
  88. data/spec/nanoc/base/views/{mutable_identifiable_collection_view_spec.rb → support/mutable_identifiable_collection_view_examples.rb} +1 -1
  89. data/spec/nanoc/cli/commands/compile/abstract_spec.rb +80 -0
  90. data/spec/nanoc/cli/commands/compile_spec.rb +30 -51
  91. data/spec/nanoc/cli/commands/show_data_spec.rb +2 -23
  92. data/spec/nanoc/cli/commands/show_rules_spec.rb +4 -2
  93. data/spec/nanoc/regressions/gh_767_spec.rb +1 -1
  94. data/spec/nanoc/regressions/gh_776_spec.rb +2 -1
  95. data/spec/nanoc/rule_dsl/action_sequence_calculator_spec.rb +25 -12
  96. data/spec/nanoc/rule_dsl/rule_context_spec.rb +16 -6
  97. data/test/base/test_data_source.rb +0 -18
  98. data/test/checking/checks/test_external_links.rb +4 -6
  99. data/test/checking/checks/test_internal_links.rb +6 -9
  100. data/test/cli/commands/test_compile.rb +0 -35
  101. data/test/cli/test_cleaning_stream.rb +1 -1
  102. data/test/data_sources/test_filesystem.rb +16 -0
  103. data/test/filters/test_kramdown.rb +4 -4
  104. data/test/filters/test_sass.rb +1 -1
  105. data/test/filters/test_slim.rb +7 -5
  106. data/test/filters/test_xsl.rb +10 -8
  107. data/test/helpers/test_blogging.rb +5 -5
  108. data/test/helpers/test_capturing.rb +8 -6
  109. data/test/helpers/test_link_to.rb +4 -4
  110. data/test/helpers/test_xml_sitemap.rb +19 -19
  111. metadata +25 -15
  112. data/lib/nanoc/base/views/item_with_reps_view.rb +0 -7
  113. data/spec/nanoc/base/core_ext/pathname_spec.rb +0 -0
@@ -9,7 +9,6 @@ describe Nanoc::Int::Compiler do
9
9
  action_sequence_store: action_sequence_store,
10
10
  action_provider: action_provider,
11
11
  dependency_store: dependency_store,
12
- reps: reps,
13
12
  outdatedness_store: outdatedness_store,
14
13
  )
15
14
  end
@@ -18,9 +17,8 @@ describe Nanoc::Int::Compiler do
18
17
  let(:action_sequence_store) { Nanoc::Int::ActionSequenceStore.new }
19
18
 
20
19
  let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts, config) }
21
- let(:reps) { Nanoc::Int::ItemRepRepo.new }
22
20
 
23
- let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(site: site, reps: reps) }
21
+ let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(site: site) }
24
22
  let(:action_provider) { double(:action_provider) }
25
23
 
26
24
  let(:compiled_content_cache) { Nanoc::Int::CompiledContentCache.new(items: items) }
@@ -65,26 +63,31 @@ describe Nanoc::Int::Compiler do
65
63
  end
66
64
 
67
65
  before do
68
- reps << rep
69
- reps << other_rep
70
-
71
- reps.each do |rep|
72
- rep.snapshot_defs << Nanoc::Int::SnapshotDef.new(:last, binary: false)
73
- end
74
-
75
66
  allow(Nanoc::Int::NotificationCenter).to receive(:post)
76
67
  end
77
68
 
78
69
  describe '#compile_rep' do
79
- let(:stage) { compiler.send(:compile_reps_stage, action_sequences) }
70
+ let(:stage) { compiler.send(:compile_reps_stage, action_sequences, reps) }
80
71
 
81
72
  subject { stage.send(:compile_rep, rep, is_outdated: is_outdated) }
82
73
 
83
74
  let(:is_outdated) { true }
84
75
 
76
+ let(:reps) do
77
+ Nanoc::Int::ItemRepRepo.new.tap do |rs|
78
+ rs << rep
79
+ rs << other_rep
80
+
81
+ rs.each do |rep|
82
+ rep.snapshot_defs << Nanoc::Int::SnapshotDef.new(:last, binary: false)
83
+ end
84
+ end
85
+ end
86
+
85
87
  it 'generates expected output' do
88
+ reps = Nanoc::Int::ItemRepRepo.new
86
89
  expect { subject }
87
- .to change { compiler.snapshot_repo.get(rep, :last) }
90
+ .to change { compiler.compilation_context(reps: reps).snapshot_repo.get(rep, :last) }
88
91
  .from(nil)
89
92
  .to(some_textual_content('3'))
90
93
  end
@@ -102,14 +105,15 @@ describe Nanoc::Int::Compiler do
102
105
  let(:item) { Nanoc::Int::Item.new('other=<%= @items["/other.*"].compiled_content %>', {}, '/hi.md') }
103
106
 
104
107
  it 'generates expected output' do
105
- expect(compiler.snapshot_repo.get(rep, :last)).to be_nil
108
+ reps = Nanoc::Int::ItemRepRepo.new
109
+ expect(compiler.compilation_context(reps: reps).snapshot_repo.get(rep, :last)).to be_nil
106
110
 
107
111
  expect { stage.send(:compile_rep, rep, is_outdated: true) }
108
112
  .to raise_error(Nanoc::Int::Errors::UnmetDependency)
109
113
  stage.send(:compile_rep, other_rep, is_outdated: true)
110
114
  stage.send(:compile_rep, rep, is_outdated: true)
111
115
 
112
- expect(compiler.snapshot_repo.get(rep, :last).string).to eql('other=other content')
116
+ expect(compiler.compilation_context(reps: reps).snapshot_repo.get(rep, :last).string).to eql('other=other content')
113
117
  end
114
118
 
115
119
  it 'generates notifications in the proper order' do
@@ -82,20 +82,21 @@ describe Nanoc::Filter do
82
82
  let(:item_views) { [item_view] }
83
83
 
84
84
  let(:item) { Nanoc::Int::Item.new('foo', {}, '/stuff.md') }
85
- let(:item_view) { Nanoc::ItemWithRepsView.new(item, view_context) }
85
+ let(:item_view) { Nanoc::CompilationItemView.new(item, view_context) }
86
86
  let(:rep) { Nanoc::Int::ItemRep.new(item, :default) }
87
87
 
88
88
  let(:view_context) do
89
- Nanoc::ViewContext.new(
90
- reps: reps,
91
- items: double(:items),
92
- dependency_tracker: dependency_tracker,
89
+ Nanoc::ViewContextForCompilation.new(
90
+ reps: reps,
91
+ items: Nanoc::Int::ItemCollection.new(config),
92
+ dependency_tracker: dependency_tracker,
93
93
  compilation_context: double(:compilation_context),
94
- snapshot_repo: double(:snapshot_repo),
94
+ snapshot_repo: double(:snapshot_repo),
95
95
  )
96
96
  end
97
97
 
98
98
  let(:dependency_tracker) { double(:dependency_tracker) }
99
+ let(:config) { Nanoc::Int::Configuration.new }
99
100
 
100
101
  let(:reps) { Nanoc::Int::ItemRepRepo.new }
101
102
 
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  describe Nanoc::Int::OutdatednessStore do
4
- subject(:store) { described_class.new(site: site, reps: reps) }
4
+ subject(:store) { described_class.new(site: site) }
5
5
 
6
6
  let(:site) { double(:site) }
7
- let(:reps) { Nanoc::Int::ItemRepRepo.new }
8
7
 
9
8
  let(:item) { Nanoc::Int::Item.new('foo', {}, '/foo.md') }
10
9
  let(:rep) { Nanoc::Int::ItemRep.new(item, :foo) }
@@ -54,19 +53,6 @@ describe Nanoc::Int::OutdatednessStore do
54
53
  end
55
54
  end
56
55
 
57
- describe '#to_a' do
58
- subject { store.to_a }
59
-
60
- context 'nothing added' do
61
- it { is_expected.to be_empty }
62
- end
63
-
64
- context 'one rep added' do
65
- before { store.add(rep) }
66
- it { is_expected.to eql([rep]) }
67
- end
68
- end
69
-
70
56
  describe 'reloading' do
71
57
  subject do
72
58
  store.store
@@ -75,27 +61,12 @@ describe Nanoc::Int::OutdatednessStore do
75
61
  end
76
62
 
77
63
  context 'not added' do
78
- context 'rep part of new reps' do
79
- before { reps << rep }
80
- it { is_expected.not_to be }
81
- end
82
-
83
- context 'rep not part of new reps' do
84
- it { is_expected.not_to be }
85
- end
64
+ it { is_expected.not_to be }
86
65
  end
87
66
 
88
67
  context 'added' do
89
68
  before { store.add(rep) }
90
-
91
- context 'rep part of new reps' do
92
- before { reps << rep }
93
- it { is_expected.to be }
94
- end
95
-
96
- context 'rep not part of new reps' do
97
- it { is_expected.not_to be }
98
- end
69
+ it { is_expected.to be }
99
70
  end
100
71
  end
101
72
  end
@@ -3,6 +3,7 @@
3
3
  describe Nanoc::Int::Compiler::Stages::CompileReps do
4
4
  let(:stage) do
5
5
  described_class.new(
6
+ reps: reps,
6
7
  outdatedness_store: outdatedness_store,
7
8
  dependency_store: dependency_store,
8
9
  action_sequences: action_sequences,
@@ -27,7 +28,7 @@ describe Nanoc::Int::Compiler::Stages::CompileReps do
27
28
  let(:compiled_content_cache) { Nanoc::Int::CompiledContentCache.new(items: items) }
28
29
  let(:snapshot_repo) { Nanoc::Int::SnapshotRepo.new }
29
30
 
30
- let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(site: site, reps: reps) }
31
+ let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(site: site) }
31
32
  let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts, config) }
32
33
 
33
34
  let(:rep) { Nanoc::Int::ItemRep.new(item, :default) }
@@ -0,0 +1,148 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe Nanoc::Int::Compiler::Stages::DetermineOutdatedness do
4
+ let(:stage) do
5
+ described_class.new(
6
+ reps: reps,
7
+ outdatedness_checker: outdatedness_checker,
8
+ outdatedness_store: outdatedness_store,
9
+ )
10
+ end
11
+
12
+ let(:reps) do
13
+ Nanoc::Int::ItemRepRepo.new
14
+ end
15
+
16
+ let(:outdatedness_checker) do
17
+ double(:outdatedness_checker)
18
+ end
19
+
20
+ let(:outdatedness_store) do
21
+ Nanoc::Int::OutdatednessStore.new
22
+ end
23
+
24
+ describe '#run' do
25
+ subject { stage.run }
26
+
27
+ context 'outdatedness store is empty' do
28
+ let(:item) do
29
+ Nanoc::Int::Item.new('', {}, '/hi.md')
30
+ end
31
+
32
+ let(:rep) do
33
+ Nanoc::Int::ItemRep.new(item, :woof)
34
+ end
35
+
36
+ let(:other_rep) do
37
+ Nanoc::Int::ItemRep.new(item, :bark)
38
+ end
39
+
40
+ context 'outdatedness checker thinks rep is outdated' do
41
+ before do
42
+ reps << rep
43
+ reps << other_rep
44
+
45
+ expect(outdatedness_checker)
46
+ .to receive(:outdated?).with(rep).and_return(true)
47
+
48
+ expect(outdatedness_checker)
49
+ .to receive(:outdated?).with(other_rep).and_return(false)
50
+ end
51
+
52
+ it 'adds the rep' do
53
+ expect { subject }
54
+ .to change { outdatedness_store.include?(rep) }
55
+ .from(false)
56
+ .to(true)
57
+ end
58
+
59
+ it 'also adds the other rep' do
60
+ expect { subject }
61
+ .to change { outdatedness_store.include?(other_rep) }
62
+ .from(false)
63
+ .to(true)
64
+ end
65
+
66
+ it 'returns a list with the known rep’s item' do
67
+ expect(subject).to eq([rep.item])
68
+ end
69
+ end
70
+
71
+ context 'outdatedness checker thinks rep is not outdated' do
72
+ it 'keeps the outdatedness store empty' do
73
+ expect { subject }
74
+ .not_to change { outdatedness_store.empty? }
75
+ end
76
+
77
+ it 'returns an empty list' do
78
+ expect(subject).to be_empty
79
+ end
80
+ end
81
+ end
82
+
83
+ context 'outdatedness store contains known rep' do
84
+ let(:item) do
85
+ Nanoc::Int::Item.new('', {}, '/hi.md')
86
+ end
87
+
88
+ let(:rep) do
89
+ Nanoc::Int::ItemRep.new(item, :woof)
90
+ end
91
+
92
+ let(:other_rep) do
93
+ Nanoc::Int::ItemRep.new(item, :bark)
94
+ end
95
+
96
+ before do
97
+ reps << rep
98
+ reps << other_rep
99
+
100
+ outdatedness_store.add(rep)
101
+
102
+ expect(outdatedness_checker)
103
+ .to receive(:outdated?).with(other_rep).and_return(false)
104
+ end
105
+
106
+ it 'keeps the rep' do
107
+ expect { subject }
108
+ .not_to change { outdatedness_store.include?(rep) }
109
+ end
110
+
111
+ it 'also adds the other rep' do
112
+ expect { subject }
113
+ .to change { outdatedness_store.include?(other_rep) }
114
+ .from(false)
115
+ .to(true)
116
+ end
117
+
118
+ it 'returns a list with the known rep’s item' do
119
+ expect(subject).to eq([rep.item])
120
+ end
121
+ end
122
+
123
+ context 'outdatedness store contains unknown rep' do
124
+ let(:item) do
125
+ Nanoc::Int::Item.new('', {}, '/hi.md')
126
+ end
127
+
128
+ let(:unknown_rep) do
129
+ Nanoc::Int::ItemRep.new(item, :woof)
130
+ end
131
+
132
+ before do
133
+ outdatedness_store.add(unknown_rep)
134
+ end
135
+
136
+ it 'removes the unknown rep' do
137
+ expect { subject }
138
+ .to change { outdatedness_store.include?(unknown_rep) }
139
+ .from(true)
140
+ .to(false)
141
+ end
142
+
143
+ it 'returns an empty list' do
144
+ expect(subject).to be_empty
145
+ end
146
+ end
147
+ end
148
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ describe Nanoc::Int::Compiler::Stages::Preprocess do
4
+ let(:stage) do
5
+ described_class.new(
6
+ action_provider: action_provider,
7
+ site: site,
8
+ dependency_store: dependency_store,
9
+ checksum_store: checksum_store,
10
+ )
11
+ end
12
+
13
+ let(:action_provider) do
14
+ double(:action_provider)
15
+ end
16
+
17
+ let(:site) do
18
+ Nanoc::Int::Site.new(
19
+ config: config,
20
+ code_snippets: [],
21
+ data_source: data_source,
22
+ )
23
+ end
24
+
25
+ let(:data_source) { Nanoc::Int::InMemDataSource.new(items, layouts) }
26
+ let(:config) { Nanoc::Int::Configuration.new.with_defaults }
27
+ let(:items) { Nanoc::Int::ItemCollection.new(config) }
28
+ let(:layouts) { Nanoc::Int::LayoutCollection.new(config) }
29
+
30
+ let(:dependency_store) do
31
+ Nanoc::Int::DependencyStore.new(items, layouts, config, site: site)
32
+ end
33
+
34
+ let(:checksum_store) do
35
+ Nanoc::Int::ChecksumStore.new(site: site, objects: items.to_a + layouts.to_a)
36
+ end
37
+
38
+ describe '#run' do
39
+ subject { stage.run }
40
+
41
+ context 'no preprocessing needed' do
42
+ before do
43
+ expect(action_provider).to receive(:need_preprocessing?).and_return(false)
44
+ end
45
+
46
+ it 'marks the site as preprocessed' do
47
+ expect { subject }
48
+ .to change { site.preprocessed? }
49
+ .from(false)
50
+ .to(true)
51
+ end
52
+
53
+ it 'freezes the site' do
54
+ subject
55
+ end
56
+ end
57
+
58
+ context 'preprocessing needed' do
59
+ let(:new_item) { Nanoc::Int::Item.new('new item', {}, '/new.md') }
60
+ let(:new_layout) { Nanoc::Int::Layout.new('new layout', {}, '/new.md') }
61
+
62
+ before do
63
+ expect(action_provider).to receive(:need_preprocessing?).and_return(true)
64
+
65
+ expect(action_provider).to receive(:preprocess) do |site|
66
+ site.data_source =
67
+ Nanoc::Int::InMemDataSource.new(
68
+ Nanoc::Int::ItemCollection.new(config, [new_item]),
69
+ Nanoc::Int::LayoutCollection.new(config, [new_layout]),
70
+ )
71
+ end
72
+ end
73
+
74
+ it 'marks the site as preprocessed' do
75
+ expect { subject }
76
+ .to change { site.preprocessed? }
77
+ .from(false)
78
+ .to(true)
79
+ end
80
+
81
+ it 'freezes the site' do
82
+ expect { subject }
83
+ .to change { site.config.frozen? }
84
+ .from(false)
85
+ .to(true)
86
+ end
87
+
88
+ it 'sets items on dependency store' do
89
+ expect { subject }
90
+ .to change { dependency_store.items.to_a }
91
+ .from([])
92
+ .to([new_item])
93
+ end
94
+
95
+ it 'sets layouts on dependency store' do
96
+ expect { subject }
97
+ .to change { dependency_store.layouts.to_a }
98
+ .from([])
99
+ .to([new_layout])
100
+ end
101
+
102
+ it 'sets data on checksum store' do
103
+ expect { subject }
104
+ .to change { checksum_store.objects.to_a }
105
+ .from([])
106
+ .to(match_array([new_item, new_layout, config]))
107
+ end
108
+ end
109
+ end
110
+ end
@@ -400,12 +400,12 @@ describe Nanoc::Int::Executor do
400
400
  end
401
401
 
402
402
  let(:view_context) do
403
- Nanoc::ViewContext.new(
404
- reps: double(:reps),
405
- items: double(:items),
406
- dependency_tracker: dependency_tracker,
403
+ Nanoc::ViewContextForCompilation.new(
404
+ reps: Nanoc::Int::ItemRepRepo.new,
405
+ items: Nanoc::Int::ItemCollection.new(config),
406
+ dependency_tracker: dependency_tracker,
407
407
  compilation_context: double(:compilation_context),
408
- snapshot_repo: snapshot_repo,
408
+ snapshot_repo: snapshot_repo,
409
409
  )
410
410
  end
411
411
 
@@ -482,7 +482,7 @@ describe Nanoc::Int::Executor do
482
482
  let(:layout_content) { 'head <%= @item_rep.compiled_content(snapshot: :pre) %> foot' }
483
483
 
484
484
  let(:assigns) do
485
- { item_rep: Nanoc::ItemRepView.new(rep, view_context) }
485
+ { item_rep: Nanoc::CompilationItemRepView.new(rep, view_context) }
486
486
  end
487
487
 
488
488
  before do