nanoc 4.7.6 → 4.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/NEWS.md +7 -0
  4. data/lib/nanoc/base/entities/identifiable_collection.rb +8 -8
  5. data/lib/nanoc/base/entities/outdatedness_reasons.rb +0 -5
  6. data/lib/nanoc/base/repos/dependency_store.rb +23 -9
  7. data/lib/nanoc/base/services/compiler/stages/preprocess.rb +2 -1
  8. data/lib/nanoc/base/services/compiler_loader.rb +1 -1
  9. data/lib/nanoc/base/services/outdatedness_checker.rb +0 -1
  10. data/lib/nanoc/base/services/outdatedness_rules.rb +0 -1
  11. data/lib/nanoc/cli/commands/compile.rb +1 -0
  12. data/lib/nanoc/cli/commands/compile_listeners/diff_generator.rb +1 -1
  13. data/lib/nanoc/filters/colorize_syntax.rb +54 -316
  14. data/lib/nanoc/filters/colorize_syntax/colorizers.rb +177 -0
  15. data/lib/nanoc/version.rb +1 -1
  16. data/spec/nanoc/base/compiler_spec.rb +5 -2
  17. data/spec/nanoc/base/entities/identifiable_collection_spec.rb +29 -0
  18. data/spec/nanoc/base/repos/dependency_store_spec.rb +79 -79
  19. data/spec/nanoc/base/services/compiler/stages/compile_reps_spec.rb +5 -2
  20. data/spec/nanoc/base/services/dependency_tracker_spec.rb +7 -1
  21. data/spec/nanoc/base/services/outdatedness_checker_spec.rb +6 -7
  22. data/spec/nanoc/base/services/outdatedness_rules_spec.rb +3 -56
  23. data/spec/nanoc/base/views/document_view_spec.rb +7 -1
  24. data/spec/nanoc/base/views/item_rep_view_spec.rb +7 -1
  25. data/spec/nanoc/base/views/item_view_spec.rb +7 -1
  26. data/spec/nanoc/cli/commands/compile/diff_generator_spec.rb +44 -0
  27. data/spec/nanoc/cli/commands/show_data_spec.rb +1 -5
  28. data/spec/nanoc/integration/compile_command_spec.rb +31 -0
  29. data/test/base/test_dependency_tracker.rb +106 -86
  30. data/test/filters/test_xsl.rb +5 -1
  31. metadata +5 -3
  32. data/lib/nanoc/base/services/outdatedness_rules/paths_modified.rb +0 -20
@@ -0,0 +1,177 @@
1
+ module Nanoc::Filters::ColorizeSyntax::Colorizers
2
+ class Abstract
3
+ extend DDPlugin::Plugin
4
+
5
+ def process(_code, _language, params = {}) # rubocop:disable Lint/UnusedMethodArgument
6
+ raise NotImplementedError
7
+ end
8
+
9
+ def postprocess(_language, _element); end
10
+
11
+ private
12
+
13
+ def check_availability(*cmd)
14
+ piper = Nanoc::Extra::Piper.new(stdout: StringIO.new, stderr: StringIO.new)
15
+ piper.run(cmd, nil)
16
+ end
17
+ end
18
+
19
+ class DummyColorizer < Abstract
20
+ identifier :dummy
21
+
22
+ def process(code, language, params = {}) # rubocop:disable Lint/UnusedMethodArgument
23
+ code
24
+ end
25
+ end
26
+
27
+ class CoderayColorizer < Abstract
28
+ identifier :coderay
29
+
30
+ def process(code, language, params = {})
31
+ require 'coderay'
32
+
33
+ ::CodeRay.scan(code, language).html(params)
34
+ end
35
+
36
+ def postprocess(_language, element)
37
+ # Skip if we're a free <code>
38
+ return if element.parent.nil?
39
+
40
+ # <div class="code">
41
+ div_inner = Nokogiri::XML::Node.new('div', element.document)
42
+ div_inner['class'] = 'code'
43
+ div_inner.children = element.dup
44
+
45
+ # <div class="CodeRay">
46
+ div_outer = Nokogiri::XML::Node.new('div', element.document)
47
+ div_outer['class'] = 'CodeRay'
48
+ div_outer.children = div_inner
49
+
50
+ # orig element
51
+ element.swap div_outer
52
+ end
53
+ end
54
+
55
+ class PygmentizeColorizer < Abstract
56
+ identifier :pygmentize
57
+
58
+ def process(code, language, params = {})
59
+ check_availability('pygmentize', '-V')
60
+
61
+ params[:encoding] ||= 'utf-8'
62
+ params[:nowrap] ||= 'True'
63
+
64
+ cmd = ['pygmentize', '-l', language, '-f', 'html']
65
+ cmd << '-O' << params.map { |k, v| "#{k}=#{v}" }.join(',') unless params.empty?
66
+
67
+ stdout = StringIO.new
68
+ stderr = $stderr
69
+ piper = Nanoc::Extra::Piper.new(stdout: stdout, stderr: stderr)
70
+ piper.run(cmd, code)
71
+
72
+ stdout.string
73
+ end
74
+ end
75
+
76
+ class PygmentsrbColorizer < Abstract
77
+ identifier :pygmentsrb
78
+
79
+ def process(code, language, params = {})
80
+ require 'pygments'
81
+
82
+ args = params.dup
83
+ args[:lexer] ||= language
84
+ args[:options] ||= {}
85
+ args[:options][:encoding] ||= 'utf-8'
86
+ args[:options][:nowrap] ||= 'True'
87
+
88
+ Pygments.highlight(code, args)
89
+ end
90
+ end
91
+
92
+ class SimonHighlightColorizer < Abstract
93
+ identifier :simon_highlight
94
+
95
+ SIMON_HIGHLIGHT_OPT_MAP = {
96
+ wrap: '-W',
97
+ include_style: '-I',
98
+ line_numbers: '-l',
99
+ }.freeze
100
+
101
+ def process(code, language, params = {})
102
+ check_availability('highlight', '--version')
103
+
104
+ cmd = ['highlight', '--syntax', language, '--fragment']
105
+ params.each do |key, _value|
106
+ if SIMON_HIGHLIGHT_OPT_MAP[key]
107
+ cmd << SIMON_HIGHLIGHT_OPT_MAP[key]
108
+ else
109
+ # TODO: allow passing other options
110
+ case key
111
+ when :style
112
+ cmd << '--style' << params[:style]
113
+ end
114
+ end
115
+ end
116
+
117
+ stdout = StringIO.new
118
+ stderr = $stderr
119
+ piper = Nanoc::Extra::Piper.new(stdout: stdout, stderr: stderr)
120
+ piper.run(cmd, code)
121
+
122
+ stdout.string
123
+ end
124
+ end
125
+
126
+ class RougeColorizer < Abstract
127
+ identifier :rouge
128
+
129
+ def process(code, language, params = {})
130
+ require 'rouge'
131
+
132
+ if Rouge.version < '2' || params.fetch(:legacy, false)
133
+ # Rouge 1.x or Rouge 2.x legacy options
134
+ formatter_options = {
135
+ css_class: params.fetch(:css_class, 'highlight'),
136
+ inline_theme: params.fetch(:inline_theme, nil),
137
+ line_numbers: params.fetch(:line_numbers, false),
138
+ start_line: params.fetch(:start_line, 1),
139
+ wrap: params.fetch(:wrap, false),
140
+ }
141
+ formatter_cls = Rouge::Formatters.const_get(Rouge.version < '2' ? 'HTML' : 'HTMLLegacy')
142
+ formatter = formatter_cls.new(formatter_options)
143
+ else
144
+ formatter = params.fetch(:formatter, Rouge::Formatters::HTML.new)
145
+ end
146
+
147
+ lexer = Rouge::Lexer.find_fancy(language, code) || Rouge::Lexers::PlainText
148
+ formatter.format(lexer.lex(code))
149
+ end
150
+
151
+ def postprocess(_language, element)
152
+ # Removes the double wrapping.
153
+ #
154
+ # Before:
155
+ #
156
+ # <pre><code class="language-ruby"><pre class="highlight"><code>
157
+ #
158
+ # After:
159
+ #
160
+ # <pre><code class="language-ruby highlight">
161
+
162
+ return if element.name != 'pre'
163
+
164
+ code1 = element.xpath('code').first
165
+ return if code1.nil?
166
+
167
+ pre = code1.xpath('pre').first
168
+ return if pre.nil?
169
+
170
+ code2 = pre.xpath('code').first
171
+ return if code2.nil?
172
+
173
+ code1.inner_html = code2.inner_html
174
+ code1['class'] = [code1['class'], pre['class']].compact.join(' ')
175
+ end
176
+ end
177
+ end
@@ -1,4 +1,4 @@
1
1
  module Nanoc
2
2
  # The current Nanoc version.
3
- VERSION = '4.7.6'.freeze
3
+ VERSION = '4.7.7'.freeze
4
4
  end
@@ -15,7 +15,7 @@ describe Nanoc::Int::Compiler do
15
15
  let(:checksum_store) { Nanoc::Int::ChecksumStore.new(objects: items) }
16
16
  let(:action_sequence_store) { Nanoc::Int::ActionSequenceStore.new }
17
17
 
18
- let(:dependency_store) { Nanoc::Int::DependencyStore.new(items.to_a) }
18
+ let(:dependency_store) { Nanoc::Int::DependencyStore.new(items, layouts) }
19
19
  let(:reps) { Nanoc::Int::ItemRepRepo.new }
20
20
 
21
21
  let(:outdatedness_store) { Nanoc::Int::OutdatednessStore.new(site: site, reps: reps) }
@@ -38,13 +38,16 @@ describe Nanoc::Int::Compiler do
38
38
  end
39
39
 
40
40
  let(:config) { Nanoc::Int::Configuration.new.with_defaults }
41
- let(:layouts) { [] }
42
41
  let(:code_snippets) { [] }
43
42
 
44
43
  let(:items) do
45
44
  Nanoc::Int::IdentifiableCollection.new(config, [item, other_item])
46
45
  end
47
46
 
47
+ let(:layouts) do
48
+ Nanoc::Int::IdentifiableCollection.new(config)
49
+ end
50
+
48
51
  let(:memory) do
49
52
  actions =
50
53
  [
@@ -43,4 +43,33 @@ describe Nanoc::Int::IdentifiableCollection do
43
43
  end
44
44
  end
45
45
  end
46
+
47
+ describe '#object_with_identifier' do
48
+ let(:objects) do
49
+ [
50
+ Nanoc::Int::Item.new('stuff', {}, Nanoc::Identifier.new('/about.css')),
51
+ Nanoc::Int::Item.new('stuff', {}, Nanoc::Identifier.new('/about.md')),
52
+ Nanoc::Int::Item.new('stuff', {}, Nanoc::Identifier.new('/style.css')),
53
+ ]
54
+ end
55
+
56
+ let(:arg) { raise 'override me' }
57
+
58
+ subject { identifiable_collection.object_with_identifier(arg) }
59
+
60
+ context 'with string' do
61
+ let(:arg) { '/about.css' }
62
+ it { is_expected.to eq(objects[0]) }
63
+ end
64
+
65
+ context 'with identifier' do
66
+ let(:arg) { Nanoc::Identifier.new('/about.css') }
67
+ it { is_expected.to eq(objects[0]) }
68
+ end
69
+
70
+ context 'with glob string' do
71
+ let(:arg) { '/about.*' }
72
+ it { is_expected.to be_nil }
73
+ end
74
+ end
46
75
  end
@@ -1,43 +1,43 @@
1
1
  describe Nanoc::Int::DependencyStore do
2
- let(:store) { described_class.new(objects) }
2
+ let(:store) { described_class.new(items, layouts) }
3
3
 
4
- let(:objects) do
5
- [obj_a, obj_b, obj_c]
6
- end
4
+ let(:item_a) { Nanoc::Int::Item.new('a', {}, '/a.md') }
5
+ let(:item_b) { Nanoc::Int::Item.new('b', {}, '/b.md') }
6
+ let(:item_c) { Nanoc::Int::Item.new('c', {}, '/c.md') }
7
7
 
8
- let(:obj_a) { Nanoc::Int::Item.new('a', {}, '/a.md') }
9
- let(:obj_b) { Nanoc::Int::Item.new('b', {}, '/b.md') }
10
- let(:obj_c) { Nanoc::Int::Item.new('c', {}, '/c.md') }
8
+ let(:items) { Nanoc::Int::IdentifiableCollection.new(config, [item_a, item_b, item_c]) }
9
+ let(:layouts) { Nanoc::Int::IdentifiableCollection.new(config) }
10
+ let(:config) { Nanoc::Int::Configuration.new }
11
11
 
12
12
  describe '#dependencies_causing_outdatedness_of' do
13
13
  context 'no dependencies' do
14
14
  it 'returns nothing for each' do
15
- expect(store.dependencies_causing_outdatedness_of(obj_a)).to be_empty
16
- expect(store.dependencies_causing_outdatedness_of(obj_b)).to be_empty
17
- expect(store.dependencies_causing_outdatedness_of(obj_c)).to be_empty
15
+ expect(store.dependencies_causing_outdatedness_of(item_a)).to be_empty
16
+ expect(store.dependencies_causing_outdatedness_of(item_b)).to be_empty
17
+ expect(store.dependencies_causing_outdatedness_of(item_c)).to be_empty
18
18
  end
19
19
  end
20
20
 
21
21
  context 'one dependency' do
22
22
  context 'no props' do
23
23
  before do
24
- # FIXME: weird argument order (obj_b depends on obj_a, not th other way around)
25
- store.record_dependency(obj_a, obj_b)
24
+ # FIXME: weird argument order (item_b depends on item_a, not th other way around)
25
+ store.record_dependency(item_a, item_b)
26
26
  end
27
27
 
28
28
  it 'returns one dependency' do
29
- deps = store.dependencies_causing_outdatedness_of(obj_a)
29
+ deps = store.dependencies_causing_outdatedness_of(item_a)
30
30
  expect(deps.size).to eql(1)
31
31
  end
32
32
 
33
33
  it 'returns dependency from b to a' do
34
- deps = store.dependencies_causing_outdatedness_of(obj_a)
35
- expect(deps[0].from).to eql(obj_b)
36
- expect(deps[0].to).to eql(obj_a)
34
+ deps = store.dependencies_causing_outdatedness_of(item_a)
35
+ expect(deps[0].from).to eql(item_b)
36
+ expect(deps[0].to).to eql(item_a)
37
37
  end
38
38
 
39
39
  it 'returns true for all props by default' do
40
- deps = store.dependencies_causing_outdatedness_of(obj_a)
40
+ deps = store.dependencies_causing_outdatedness_of(item_a)
41
41
  expect(deps[0].props.raw_content?).to eq(true)
42
42
  expect(deps[0].props.attributes?).to eq(true)
43
43
  expect(deps[0].props.compiled_content?).to eq(true)
@@ -45,45 +45,45 @@ describe Nanoc::Int::DependencyStore do
45
45
  end
46
46
 
47
47
  it 'returns nothing for the others' do
48
- expect(store.dependencies_causing_outdatedness_of(obj_b)).to be_empty
49
- expect(store.dependencies_causing_outdatedness_of(obj_c)).to be_empty
48
+ expect(store.dependencies_causing_outdatedness_of(item_b)).to be_empty
49
+ expect(store.dependencies_causing_outdatedness_of(item_c)).to be_empty
50
50
  end
51
51
  end
52
52
 
53
53
  context 'one prop' do
54
54
  before do
55
- # FIXME: weird argument order (obj_b depends on obj_a, not th other way around)
56
- store.record_dependency(obj_a, obj_b, compiled_content: true)
55
+ # FIXME: weird argument order (item_b depends on item_a, not th other way around)
56
+ store.record_dependency(item_a, item_b, compiled_content: true)
57
57
  end
58
58
 
59
59
  it 'returns false for all unspecified props' do
60
- deps = store.dependencies_causing_outdatedness_of(obj_a)
60
+ deps = store.dependencies_causing_outdatedness_of(item_a)
61
61
  expect(deps[0].props.raw_content?).to eq(false)
62
62
  expect(deps[0].props.attributes?).to eq(false)
63
63
  expect(deps[0].props.path?).to eq(false)
64
64
  end
65
65
 
66
66
  it 'returns the specified props' do
67
- deps = store.dependencies_causing_outdatedness_of(obj_a)
67
+ deps = store.dependencies_causing_outdatedness_of(item_a)
68
68
  expect(deps[0].props.compiled_content?).to eq(true)
69
69
  end
70
70
  end
71
71
 
72
72
  context 'two props' do
73
73
  before do
74
- # FIXME: weird argument order (obj_b depends on obj_a, not th other way around)
75
- store.record_dependency(obj_a, obj_b, compiled_content: true)
76
- store.record_dependency(obj_a, obj_b, attributes: true)
74
+ # FIXME: weird argument order (item_b depends on item_a, not th other way around)
75
+ store.record_dependency(item_a, item_b, compiled_content: true)
76
+ store.record_dependency(item_a, item_b, attributes: true)
77
77
  end
78
78
 
79
79
  it 'returns false for all unspecified props' do
80
- deps = store.dependencies_causing_outdatedness_of(obj_a)
80
+ deps = store.dependencies_causing_outdatedness_of(item_a)
81
81
  expect(deps[0].props.raw_content?).to eq(false)
82
82
  expect(deps[0].props.path?).to eq(false)
83
83
  end
84
84
 
85
85
  it 'returns the specified props' do
86
- deps = store.dependencies_causing_outdatedness_of(obj_a)
86
+ deps = store.dependencies_causing_outdatedness_of(item_a)
87
87
  expect(deps[0].props.attributes?).to eq(true)
88
88
  expect(deps[0].props.compiled_content?).to eq(true)
89
89
  end
@@ -92,48 +92,48 @@ describe Nanoc::Int::DependencyStore do
92
92
 
93
93
  context 'two dependency in a chain' do
94
94
  before do
95
- # FIXME: weird argument order (obj_b depends on obj_a, not th other way around)
96
- store.record_dependency(obj_a, obj_b)
97
- store.record_dependency(obj_b, obj_c)
95
+ # FIXME: weird argument order (item_b depends on item_a, not th other way around)
96
+ store.record_dependency(item_a, item_b)
97
+ store.record_dependency(item_b, item_c)
98
98
  end
99
99
 
100
100
  it 'returns one dependency for object A' do
101
- deps = store.dependencies_causing_outdatedness_of(obj_a)
101
+ deps = store.dependencies_causing_outdatedness_of(item_a)
102
102
  expect(deps.size).to eql(1)
103
- expect(deps[0].from).to eql(obj_b)
103
+ expect(deps[0].from).to eql(item_b)
104
104
  end
105
105
 
106
106
  it 'returns one dependency for object B' do
107
- deps = store.dependencies_causing_outdatedness_of(obj_b)
107
+ deps = store.dependencies_causing_outdatedness_of(item_b)
108
108
  expect(deps.size).to eql(1)
109
- expect(deps[0].from).to eql(obj_c)
109
+ expect(deps[0].from).to eql(item_c)
110
110
  end
111
111
 
112
112
  it 'returns nothing for the others' do
113
- expect(store.dependencies_causing_outdatedness_of(obj_c)).to be_empty
113
+ expect(store.dependencies_causing_outdatedness_of(item_c)).to be_empty
114
114
  end
115
115
  end
116
116
  end
117
117
 
118
118
  describe 'reloading' do
119
119
  before do
120
- store.record_dependency(obj_a, obj_b, compiled_content: true)
121
- store.record_dependency(obj_a, obj_b, attributes: true)
120
+ store.record_dependency(item_a, item_b, compiled_content: true)
121
+ store.record_dependency(item_a, item_b, attributes: true)
122
122
 
123
123
  store.store
124
- store.objects = objects_after
124
+ store.items = items_after
125
125
  store.load
126
126
  end
127
127
 
128
- context 'no new objects' do
129
- let(:objects_after) { objects }
128
+ context 'no new items' do
129
+ let(:items_after) { items }
130
130
 
131
131
  it 'has the right dependencies for item A' do
132
- deps = store.dependencies_causing_outdatedness_of(obj_a)
132
+ deps = store.dependencies_causing_outdatedness_of(item_a)
133
133
  expect(deps.size).to eql(1)
134
134
 
135
- expect(deps[0].from).to eql(obj_b)
136
- expect(deps[0].to).to eql(obj_a)
135
+ expect(deps[0].from).to eql(item_b)
136
+ expect(deps[0].to).to eql(item_a)
137
137
 
138
138
  expect(deps[0].props.raw_content?).to eq(false)
139
139
  expect(deps[0].props.attributes?).to eq(true)
@@ -142,82 +142,82 @@ describe Nanoc::Int::DependencyStore do
142
142
  end
143
143
 
144
144
  it 'has the right dependencies for item B' do
145
- deps = store.dependencies_causing_outdatedness_of(obj_b)
145
+ deps = store.dependencies_causing_outdatedness_of(item_b)
146
146
  expect(deps).to be_empty
147
147
  end
148
148
 
149
149
  it 'has the right dependencies for item C' do
150
- deps = store.dependencies_causing_outdatedness_of(obj_c)
150
+ deps = store.dependencies_causing_outdatedness_of(item_c)
151
151
  expect(deps).to be_empty
152
152
  end
153
153
  end
154
154
 
155
- context 'one new object' do
156
- let(:objects_after) do
157
- [obj_a, obj_b, obj_c, obj_d]
155
+ context 'one new item' do
156
+ let(:items_after) do
157
+ Nanoc::Int::IdentifiableCollection.new(config, [item_a, item_b, item_c, item_d])
158
158
  end
159
159
 
160
- let(:obj_d) { Nanoc::Int::Item.new('d', {}, '/d.md') }
160
+ let(:item_d) { Nanoc::Int::Item.new('d', {}, '/d.md') }
161
161
 
162
162
  it 'marks existing items as outdated' do
163
- expect(store.objects_causing_outdatedness_of(obj_a)).to eq([obj_d])
164
- expect(store.objects_causing_outdatedness_of(obj_b)).to eq([obj_d])
165
- expect(store.objects_causing_outdatedness_of(obj_c)).to eq([obj_d])
163
+ expect(store.objects_causing_outdatedness_of(item_a)).to eq([item_d])
164
+ expect(store.objects_causing_outdatedness_of(item_b)).to eq([item_d])
165
+ expect(store.objects_causing_outdatedness_of(item_c)).to eq([item_d])
166
166
  end
167
167
 
168
168
  it 'marks new items as outdated' do
169
- expect(store.objects_causing_outdatedness_of(obj_d)).to eq([obj_d])
169
+ expect(store.objects_causing_outdatedness_of(item_d)).to eq([item_d])
170
170
  end
171
171
  end
172
172
 
173
- context 'two new objects' do
174
- let(:objects_after) do
175
- [obj_a, obj_b, obj_c, obj_d, obj_e]
173
+ context 'two new items' do
174
+ let(:items_after) do
175
+ Nanoc::Int::IdentifiableCollection.new(config, [item_a, item_b, item_c, item_d, item_e])
176
176
  end
177
177
 
178
- let(:obj_d) { Nanoc::Int::Item.new('d', {}, '/d.md') }
179
- let(:obj_e) { Nanoc::Int::Item.new('e', {}, '/e.md') }
178
+ let(:item_d) { Nanoc::Int::Item.new('d', {}, '/d.md') }
179
+ let(:item_e) { Nanoc::Int::Item.new('e', {}, '/e.md') }
180
180
 
181
181
  it 'marks existing items as outdated' do
182
182
  # Only one of obj D or E needed!
183
- expect(store.objects_causing_outdatedness_of(obj_a)).to eq([obj_d]).or eq([obj_e])
184
- expect(store.objects_causing_outdatedness_of(obj_b)).to eq([obj_d]).or eq([obj_e])
185
- expect(store.objects_causing_outdatedness_of(obj_c)).to eq([obj_d]).or eq([obj_e])
183
+ expect(store.objects_causing_outdatedness_of(item_a)).to eq([item_d]).or eq([item_e])
184
+ expect(store.objects_causing_outdatedness_of(item_b)).to eq([item_d]).or eq([item_e])
185
+ expect(store.objects_causing_outdatedness_of(item_c)).to eq([item_d]).or eq([item_e])
186
186
  end
187
187
 
188
188
  it 'marks new items as outdated' do
189
189
  # Only one of obj D or E needed!
190
- expect(store.objects_causing_outdatedness_of(obj_d)).to eq([obj_d]).or eq([obj_e])
191
- expect(store.objects_causing_outdatedness_of(obj_e)).to eq([obj_d]).or eq([obj_e])
190
+ expect(store.objects_causing_outdatedness_of(item_d)).to eq([item_d]).or eq([item_e])
191
+ expect(store.objects_causing_outdatedness_of(item_e)).to eq([item_d]).or eq([item_e])
192
192
  end
193
193
  end
194
194
  end
195
195
 
196
196
  describe '#record_dependency' do
197
197
  context 'no props' do
198
- subject { store.record_dependency(obj_a, obj_b) }
198
+ subject { store.record_dependency(item_a, item_b) }
199
199
 
200
200
  it 'records a dependency' do
201
201
  expect { subject }
202
- .to change { store.objects_causing_outdatedness_of(obj_a) }
202
+ .to change { store.objects_causing_outdatedness_of(item_a) }
203
203
  .from([])
204
- .to([obj_b])
204
+ .to([item_b])
205
205
  end
206
206
  end
207
207
 
208
208
  context 'compiled content prop' do
209
- subject { store.record_dependency(obj_a, obj_b, compiled_content: true) }
209
+ subject { store.record_dependency(item_a, item_b, compiled_content: true) }
210
210
 
211
211
  it 'records a dependency' do
212
212
  expect { subject }
213
- .to change { store.objects_causing_outdatedness_of(obj_a) }
213
+ .to change { store.objects_causing_outdatedness_of(item_a) }
214
214
  .from([])
215
- .to([obj_b])
215
+ .to([item_b])
216
216
  end
217
217
 
218
218
  it 'records a dependency with the right props' do
219
219
  subject
220
- deps = store.dependencies_causing_outdatedness_of(obj_a)
220
+ deps = store.dependencies_causing_outdatedness_of(item_a)
221
221
 
222
222
  expect(deps.first.props.attributes?).not_to be
223
223
  expect(deps.first.props.compiled_content?).to be
@@ -225,18 +225,18 @@ describe Nanoc::Int::DependencyStore do
225
225
  end
226
226
 
227
227
  context 'attribute prop (true)' do
228
- subject { store.record_dependency(obj_a, obj_b, attributes: true) }
228
+ subject { store.record_dependency(item_a, item_b, attributes: true) }
229
229
 
230
230
  it 'records a dependency' do
231
231
  expect { subject }
232
- .to change { store.objects_causing_outdatedness_of(obj_a) }
232
+ .to change { store.objects_causing_outdatedness_of(item_a) }
233
233
  .from([])
234
- .to([obj_b])
234
+ .to([item_b])
235
235
  end
236
236
 
237
237
  it 'records a dependency with the right props' do
238
238
  subject
239
- deps = store.dependencies_causing_outdatedness_of(obj_a)
239
+ deps = store.dependencies_causing_outdatedness_of(item_a)
240
240
 
241
241
  expect(deps.first.props.attributes?).to be
242
242
  expect(deps.first.props.attributes).to be
@@ -245,18 +245,18 @@ describe Nanoc::Int::DependencyStore do
245
245
  end
246
246
 
247
247
  context 'attribute prop (true)' do
248
- subject { store.record_dependency(obj_a, obj_b, attributes: [:giraffe]) }
248
+ subject { store.record_dependency(item_a, item_b, attributes: [:giraffe]) }
249
249
 
250
250
  it 'records a dependency' do
251
251
  expect { subject }
252
- .to change { store.objects_causing_outdatedness_of(obj_a) }
252
+ .to change { store.objects_causing_outdatedness_of(item_a) }
253
253
  .from([])
254
- .to([obj_b])
254
+ .to([item_b])
255
255
  end
256
256
 
257
257
  it 'records a dependency with the right props' do
258
258
  subject
259
- deps = store.dependencies_causing_outdatedness_of(obj_a)
259
+ deps = store.dependencies_causing_outdatedness_of(item_a)
260
260
 
261
261
  expect(deps.first.props.attributes?).to be
262
262
  expect(deps.first.props.attributes).to match_array([:giraffe])