nanoc 4.0.0b1 → 4.0.0b2
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/Gemfile.lock +1 -1
- data/NEWS.md +26 -2
- data/README.md +1 -1
- data/lib/nanoc/base.rb +3 -1
- data/lib/nanoc/base/checksummer.rb +1 -3
- data/lib/nanoc/base/compilation/compiler.rb +3 -3
- data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -3
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +1 -1
- data/lib/nanoc/base/core_ext/array.rb +0 -11
- data/lib/nanoc/base/core_ext/hash.rb +0 -11
- data/lib/nanoc/base/identifiable_collection.rb +81 -0
- data/lib/nanoc/base/source_data/identifier.rb +9 -9
- data/lib/nanoc/base/source_data/site.rb +7 -5
- data/lib/nanoc/base/views/identifiable_collection.rb +78 -0
- data/lib/nanoc/base/views/item_collection.rb +1 -86
- data/lib/nanoc/base/views/layout_collection.rb +1 -57
- data/lib/nanoc/base/views/mutable_identifiable_collection.rb +17 -0
- data/lib/nanoc/base/views/mutable_item_collection.rb +2 -14
- data/lib/nanoc/base/views/mutable_layout_collection.rb +2 -14
- data/lib/nanoc/cli/commands/create-site.rb +44 -40
- data/lib/nanoc/data_sources/filesystem.rb +1 -1
- data/lib/nanoc/data_sources/filesystem_unified.rb +3 -3
- data/lib/nanoc/data_sources/filesystem_verbose.rb +3 -3
- data/lib/nanoc/filters/erb.rb +2 -2
- data/lib/nanoc/filters/rdiscount.rb +1 -1
- data/lib/nanoc/filters/redcarpet.rb +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/tasks/test.rake +1 -0
- data/test/base/core_ext/array_spec.rb +0 -8
- data/test/base/core_ext/hash_spec.rb +0 -26
- data/test/base/test_compiler.rb +1 -1
- data/test/base/test_compiler_dsl.rb +13 -10
- data/test/base/test_item.rb +0 -6
- data/test/base/test_item_array.rb +8 -276
- data/test/base/test_layout.rb +1 -5
- data/test/base/test_outdatedness_checker.rb +9 -2
- data/test/base/test_site.rb +5 -5
- data/test/cli/commands/test_compile.rb +14 -0
- data/test/cli/commands/test_create_site.rb +40 -2
- data/test/cli/commands/test_prune.rb +19 -4
- data/test/data_sources/test_filesystem.rb +1 -1
- data/test/data_sources/test_filesystem_unified.rb +6 -6
- data/test/extra/checking/checks/test_stale.rb +2 -2
- data/test/helper.rb +8 -1
- data/test/helpers/test_blogging.rb +0 -235
- data/test/helpers/test_breadcrumbs.rb +31 -23
- data/test/helpers/test_xml_sitemap.rb +38 -29
- metadata +5 -3
- data/lib/nanoc/base/source_data/item_array.rb +0 -86
@@ -7,7 +7,7 @@ module Nanoc::Filters
|
|
7
7
|
|
8
8
|
# Runs the content through [RDiscount](http://github.com/rtomayko/rdiscount).
|
9
9
|
#
|
10
|
-
# @option params [Array] symbol ([]) A list of RDiscount extensions
|
10
|
+
# @option params [Array] :symbol ([]) A list of RDiscount extensions
|
11
11
|
#
|
12
12
|
# @param [String] content The content to filter
|
13
13
|
#
|
data/lib/nanoc/version.rb
CHANGED
data/tasks/test.rake
CHANGED
@@ -8,14 +8,6 @@ describe 'Array#__nanoc_symbolize_keys_recursively' do
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
describe 'Array#__nanoc_stringify_keys_recursively' do
|
12
|
-
it 'should convert keys to strings' do
|
13
|
-
array_old = [:abc, 'xyz', { :foo => 'bar', 'baz' => :qux }]
|
14
|
-
array_new = [:abc, 'xyz', { 'foo' => 'bar', 'baz' => :qux }]
|
15
|
-
array_old.__nanoc_stringify_keys_recursively.must_equal array_new
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
11
|
describe 'Array#__nanoc_freeze_recursively' do
|
20
12
|
include Nanoc::TestHelpers
|
21
13
|
|
@@ -14,32 +14,6 @@ describe 'Hash#__nanoc_symbolize_keys_recursively' do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe 'Hash#__nanoc_stringify_keys_recursively' do
|
18
|
-
it 'should leave strings as strings' do
|
19
|
-
hash_old = { 'foo' => 'bar' }
|
20
|
-
hash_new = { 'foo' => 'bar' }
|
21
|
-
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should convert symbols to strings' do
|
25
|
-
hash_old = { foo: 'bar' }
|
26
|
-
hash_new = { 'foo' => 'bar' }
|
27
|
-
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should convert integers to strings' do
|
31
|
-
hash_old = { 123 => 'bar' }
|
32
|
-
hash_new = { '123' => 'bar' }
|
33
|
-
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'should convert nil to an empty string' do
|
37
|
-
hash_old = { nil => 'bar' }
|
38
|
-
hash_new = { '' => 'bar' }
|
39
|
-
hash_old.__nanoc_stringify_keys_recursively.must_equal hash_new
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
17
|
describe 'Hash#__nanoc_freeze_recursively' do
|
44
18
|
include Nanoc::TestHelpers
|
45
19
|
|
data/test/base/test_compiler.rb
CHANGED
@@ -306,7 +306,7 @@ class Nanoc::Int::CompilerTest < Nanoc::TestCase
|
|
306
306
|
|
307
307
|
# At this point, even the already compiled items in the previous pass
|
308
308
|
# should have their compiled content assigned, so this should work:
|
309
|
-
site.items[
|
309
|
+
site.items['/index.*'].reps[0].compiled_content
|
310
310
|
end
|
311
311
|
end
|
312
312
|
|
@@ -177,10 +177,11 @@ EOS
|
|
177
177
|
def test_passthrough_with_full_identifiers
|
178
178
|
with_site do
|
179
179
|
File.open('nanoc.yaml', 'w') do |io|
|
180
|
+
io << 'string_pattern_type: legacy' << "\n"
|
180
181
|
io << 'data_sources:' << "\n"
|
181
182
|
io << ' -' << "\n"
|
182
183
|
io << ' type: filesystem_unified' << "\n"
|
183
|
-
io << '
|
184
|
+
io << ' identifier_type: full' << "\n"
|
184
185
|
end
|
185
186
|
|
186
187
|
# Create rules
|
@@ -266,15 +267,17 @@ EOS
|
|
266
267
|
end
|
267
268
|
end
|
268
269
|
|
269
|
-
def
|
270
|
+
def test_create_pattern_with_string_with_no_config
|
270
271
|
compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
|
271
272
|
|
272
|
-
|
273
|
-
|
273
|
+
err = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
|
274
|
+
compiler_dsl.create_pattern('/foo/*')
|
275
|
+
end
|
276
|
+
assert_equal 'Invalid string_pattern_type: ', err.message
|
274
277
|
end
|
275
278
|
|
276
|
-
def
|
277
|
-
compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {
|
279
|
+
def test_create_pattern_with_string_with_glob_string_pattern_type
|
280
|
+
compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { string_pattern_type: 'glob' })
|
278
281
|
|
279
282
|
pattern = compiler_dsl.create_pattern('/foo/*')
|
280
283
|
assert pattern.match?('/foo/aaaa')
|
@@ -283,19 +286,19 @@ EOS
|
|
283
286
|
end
|
284
287
|
|
285
288
|
def test_create_pattern_with_regex
|
286
|
-
compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {})
|
289
|
+
compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { string_pattern_type: 'glob' })
|
287
290
|
|
288
291
|
pattern = compiler_dsl.create_pattern(%r<\A/foo/a*/>)
|
289
292
|
assert pattern.match?('/foo/aaaa/')
|
290
293
|
end
|
291
294
|
|
292
|
-
def
|
293
|
-
compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, {
|
295
|
+
def test_create_pattern_with_string_with_unknown_string_pattern_type
|
296
|
+
compiler_dsl = Nanoc::Int::CompilerDSL.new(nil, { string_pattern_type: 'donkey' })
|
294
297
|
|
295
298
|
err = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
|
296
299
|
compiler_dsl.create_pattern('/foo/*')
|
297
300
|
end
|
298
|
-
assert_equal 'Invalid
|
301
|
+
assert_equal 'Invalid string_pattern_type: donkey', err.message
|
299
302
|
end
|
300
303
|
|
301
304
|
def test_identifier_to_regex_without_wildcards
|
data/test/base/test_item.rb
CHANGED
@@ -8,12 +8,6 @@ class Nanoc::Int::ItemTest < Nanoc::TestCase
|
|
8
8
|
assert_equal 'xyz', item.attributes[:abc]
|
9
9
|
end
|
10
10
|
|
11
|
-
def test_initialize_with_unclean_identifier
|
12
|
-
item = Nanoc::Int::Item.new('foo', {}, '/foo')
|
13
|
-
|
14
|
-
assert_equal '/foo/', item.identifier.to_s
|
15
|
-
end
|
16
|
-
|
17
11
|
def test_reference
|
18
12
|
item = Nanoc::Int::Item.new(
|
19
13
|
'content',
|
@@ -1,13 +1,13 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
class Nanoc::Int::
|
3
|
+
class Nanoc::Int::IdentifiableCollectionTest < Nanoc::TestCase
|
4
4
|
def setup
|
5
5
|
super
|
6
6
|
|
7
7
|
@one = Nanoc::Int::Item.new('Item One', {}, '/one/')
|
8
8
|
@two = Nanoc::Int::Item.new('Item Two', {}, '/two/')
|
9
9
|
|
10
|
-
@items = Nanoc::Int::
|
10
|
+
@items = Nanoc::Int::IdentifiableCollection.new({})
|
11
11
|
@items << @one
|
12
12
|
@items << @two
|
13
13
|
end
|
@@ -26,26 +26,8 @@ class Nanoc::Int::ItemArrayTest < Nanoc::TestCase
|
|
26
26
|
assert_equal @one, @items.find { |i| i.identifier == '/one/' }
|
27
27
|
end
|
28
28
|
|
29
|
-
def test_brackets_and_slice_and_at_with_index
|
30
|
-
assert_equal @one, @items[0]
|
31
|
-
assert_equal @one, @items.slice(0)
|
32
|
-
assert_equal @one, @items.at(0)
|
33
|
-
|
34
|
-
assert_equal @two, @items[1]
|
35
|
-
assert_equal @two, @items.slice(1)
|
36
|
-
assert_equal @two, @items.at(1)
|
37
|
-
|
38
|
-
assert_nil @items[2]
|
39
|
-
assert_nil @items.slice(2)
|
40
|
-
assert_nil @items.at(2)
|
41
|
-
|
42
|
-
assert_equal @two, @items[-1]
|
43
|
-
assert_equal @two, @items.slice(-1)
|
44
|
-
assert_equal @two, @items.at(-1)
|
45
|
-
end
|
46
|
-
|
47
29
|
def test_brackets_with_glob
|
48
|
-
@items = Nanoc::Int::
|
30
|
+
@items = Nanoc::Int::IdentifiableCollection.new({ string_pattern_type: 'glob' })
|
49
31
|
@items << @one
|
50
32
|
@items << @two
|
51
33
|
|
@@ -53,297 +35,47 @@ class Nanoc::Int::ItemArrayTest < Nanoc::TestCase
|
|
53
35
|
assert_equal @two, @items['/*wo/']
|
54
36
|
end
|
55
37
|
|
56
|
-
def
|
57
|
-
assert_equal [@one, @two], @items[0..1]
|
58
|
-
assert_equal [@one, @two], @items[0, 2]
|
59
|
-
|
60
|
-
assert_equal [@one, @two], @items.slice(0..1)
|
61
|
-
assert_equal [@one, @two], @items.slice(0, 2)
|
62
|
-
end
|
63
|
-
|
64
|
-
def test_brackets_and_slice_and_at_with_identifier
|
38
|
+
def test_brackets_with_identifier
|
65
39
|
assert_equal @one, @items['/one/']
|
66
|
-
assert_equal @one, @items.slice('/one/')
|
67
|
-
assert_equal @one, @items.at('/one/')
|
68
|
-
|
69
40
|
assert_equal @two, @items['/two/']
|
70
|
-
assert_equal @two, @items.slice('/two/')
|
71
|
-
assert_equal @two, @items.at('/two/')
|
72
|
-
|
73
41
|
assert_nil @items['/max-payne/']
|
74
|
-
assert_nil @items.slice('/max-payne/')
|
75
|
-
assert_nil @items.at('/max-payne/')
|
76
42
|
end
|
77
43
|
|
78
|
-
def
|
44
|
+
def test_brackets_with_malformed_identifier
|
79
45
|
assert_nil @items['one/']
|
80
|
-
assert_nil @items.slice('one/')
|
81
|
-
assert_nil @items.at('one/')
|
82
|
-
|
83
46
|
assert_nil @items['/one']
|
84
|
-
assert_nil @items.slice('/one')
|
85
|
-
assert_nil @items.at('/one')
|
86
|
-
|
87
47
|
assert_nil @items['one']
|
88
|
-
assert_nil @items.slice('one')
|
89
|
-
assert_nil @items.at('one')
|
90
|
-
|
91
48
|
assert_nil @items['//one/']
|
92
|
-
assert_nil @items.slice('//one/')
|
93
|
-
assert_nil @items.at('//one/')
|
94
49
|
end
|
95
50
|
|
96
|
-
def
|
51
|
+
def test_brackets_frozen
|
97
52
|
@items.freeze
|
98
53
|
|
99
54
|
assert_equal @one, @items['/one/']
|
100
|
-
assert_equal @one, @items.slice('/one/')
|
101
|
-
assert_equal @one, @items.at('/one/')
|
102
|
-
|
103
55
|
assert_nil @items['/tenthousand/']
|
104
|
-
assert_nil @items.slice('/tenthousand/')
|
105
|
-
assert_nil @items.at('/tenthousand/')
|
106
56
|
end
|
107
57
|
|
108
58
|
def test_regex
|
109
59
|
foo = Nanoc::Int::Item.new('Item Foo', {}, '/foo/')
|
110
60
|
@items << foo
|
111
61
|
|
112
|
-
assert_equal
|
113
|
-
assert_equal
|
62
|
+
assert_equal @one, @items[/n/]
|
63
|
+
assert_equal @two, @items[%r{o/}] # not foo
|
114
64
|
end
|
115
65
|
|
116
66
|
def test_less_than_less_than
|
117
|
-
assert_nil @items[2]
|
118
67
|
assert_nil @items['/foo/']
|
119
68
|
|
120
69
|
foo = Nanoc::Int::Item.new('Item Foo', {}, '/foo/')
|
121
70
|
@items << foo
|
122
71
|
|
123
|
-
assert_equal foo, @items[2]
|
124
72
|
assert_equal foo, @items['/foo/']
|
125
73
|
end
|
126
74
|
|
127
|
-
def test_assign
|
128
|
-
assert_raises(TypeError) do
|
129
|
-
@items['/blah/'] = Nanoc::Int::Item.new('Item blah', {}, '/blah/')
|
130
|
-
end
|
131
|
-
|
132
|
-
new_item = Nanoc::Int::Item.new('New Item One', {}, '/one-new/')
|
133
|
-
@items[0] = new_item
|
134
|
-
|
135
|
-
assert_equal new_item, @items[0]
|
136
|
-
assert_equal new_item, @items['/one-new/']
|
137
|
-
assert_nil @items['/one/']
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_assign_frozen
|
141
|
-
@items.freeze
|
142
|
-
|
143
|
-
new_item = Nanoc::Int::Item.new('New Item One', {}, '/one-new/')
|
144
|
-
|
145
|
-
assert_raises_frozen_error do
|
146
|
-
@items[0] = new_item
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
def test_clear
|
151
|
-
@items.clear
|
152
|
-
|
153
|
-
assert_nil @items[0]
|
154
|
-
assert_nil @items[1]
|
155
|
-
assert_nil @items[2]
|
156
|
-
|
157
|
-
assert_nil @items['/one/']
|
158
|
-
assert_nil @items['/two/']
|
159
|
-
end
|
160
|
-
|
161
|
-
def test_collect_bang
|
162
|
-
@items.collect! do |i|
|
163
|
-
Nanoc::Int::Item.new("New #{i.raw_content}", {}, "/new#{i.identifier}")
|
164
|
-
end
|
165
|
-
|
166
|
-
assert_nil @items['/one/']
|
167
|
-
assert_nil @items['/two/']
|
168
|
-
|
169
|
-
assert_equal 'New Item One', @items[0].raw_content
|
170
|
-
assert_equal 'New Item One', @items['/new/one/'].raw_content
|
171
|
-
|
172
|
-
assert_equal 'New Item Two', @items[1].raw_content
|
173
|
-
assert_equal 'New Item Two', @items['/new/two/'].raw_content
|
174
|
-
end
|
175
|
-
|
176
|
-
def test_collect_bang_frozen
|
177
|
-
@items.freeze
|
178
|
-
|
179
|
-
assert_raises_frozen_error do
|
180
|
-
@items.collect! do |i|
|
181
|
-
Nanoc::Int::Item.new("New #{i.raw_content}", {}, "/new#{i.identifier}")
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
75
|
def test_concat
|
187
76
|
new_item = Nanoc::Int::Item.new('New item', {}, '/new/')
|
188
77
|
@items.concat([new_item])
|
189
78
|
|
190
|
-
assert_equal new_item, @items[2]
|
191
79
|
assert_equal new_item, @items['/new/']
|
192
80
|
end
|
193
|
-
|
194
|
-
def test_delete
|
195
|
-
assert_equal @two, @items[1]
|
196
|
-
assert_equal @two, @items['/two/']
|
197
|
-
|
198
|
-
@items.delete(@two)
|
199
|
-
|
200
|
-
assert_nil @items[1]
|
201
|
-
assert_nil @items['/two/']
|
202
|
-
end
|
203
|
-
|
204
|
-
def test_delete_at
|
205
|
-
assert_equal @two, @items[1]
|
206
|
-
assert_equal @two, @items['/two/']
|
207
|
-
|
208
|
-
@items.delete_at(1)
|
209
|
-
|
210
|
-
assert_nil @items[1]
|
211
|
-
assert_nil @items['/two/']
|
212
|
-
end
|
213
|
-
|
214
|
-
def test_delete_if
|
215
|
-
assert_equal @two, @items[1]
|
216
|
-
assert_equal @two, @items['/two/']
|
217
|
-
|
218
|
-
@items.delete_if { |i| i.identifier == '/two/' }
|
219
|
-
|
220
|
-
assert_nil @items[1]
|
221
|
-
assert_nil @items['/two/']
|
222
|
-
end
|
223
|
-
|
224
|
-
def test_fill_all
|
225
|
-
@items.fill { |i| Nanoc::Int::Item.new("Item #{i}", {}, "/new/#{i}/") }
|
226
|
-
|
227
|
-
assert_nil @items['/one/']
|
228
|
-
assert_nil @items['/two/']
|
229
|
-
|
230
|
-
assert_equal 'Item 0', @items[0].raw_content
|
231
|
-
assert_equal 'Item 0', @items['/new/0/'].raw_content
|
232
|
-
assert_equal 'Item 1', @items[1].raw_content
|
233
|
-
assert_equal 'Item 1', @items['/new/1/'].raw_content
|
234
|
-
end
|
235
|
-
|
236
|
-
def test_fill_range
|
237
|
-
@items.fill(1..-1) { |i| Nanoc::Int::Item.new("Item #{i}", {}, "/new/#{i}/") }
|
238
|
-
|
239
|
-
assert_equal @one, @items['/one/']
|
240
|
-
assert_nil @items['/two/']
|
241
|
-
|
242
|
-
assert_equal @one, @items[0]
|
243
|
-
assert_equal @one, @items['/one/']
|
244
|
-
assert_equal 'Item 1', @items[1].raw_content
|
245
|
-
assert_equal 'Item 1', @items['/new/1/'].raw_content
|
246
|
-
end
|
247
|
-
|
248
|
-
if [].respond_to?(:keep_if)
|
249
|
-
def test_keep_if
|
250
|
-
assert_equal @two, @items[1]
|
251
|
-
assert_equal @two, @items['/two/']
|
252
|
-
|
253
|
-
@items.keep_if { |i| i.identifier == '/one/' }
|
254
|
-
|
255
|
-
assert_equal @one, @items[0]
|
256
|
-
assert_equal @one, @items['/one/']
|
257
|
-
assert_nil @items[1]
|
258
|
-
assert_nil @items['/two/']
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
def test_pop
|
263
|
-
@items.pop
|
264
|
-
|
265
|
-
assert_equal @one, @items[0]
|
266
|
-
assert_equal @one, @items['/one/']
|
267
|
-
assert_nil @items[1]
|
268
|
-
assert_nil @items['/two/']
|
269
|
-
end
|
270
|
-
|
271
|
-
def test_push
|
272
|
-
pushy = Nanoc::Int::Item.new('Pushy', {}, '/pushy/')
|
273
|
-
@items.push(pushy)
|
274
|
-
|
275
|
-
assert_equal @one, @items[0]
|
276
|
-
assert_equal @one, @items['/one/']
|
277
|
-
assert_equal @two, @items[1]
|
278
|
-
assert_equal @two, @items['/two/']
|
279
|
-
assert_equal pushy, @items[2]
|
280
|
-
assert_equal pushy, @items['/pushy/']
|
281
|
-
end
|
282
|
-
|
283
|
-
def test_reject_bang
|
284
|
-
assert_equal @two, @items[1]
|
285
|
-
assert_equal @two, @items['/two/']
|
286
|
-
|
287
|
-
@items.reject! { |i| i.identifier == '/two/' }
|
288
|
-
|
289
|
-
assert_nil @items[1]
|
290
|
-
assert_nil @items['/two/']
|
291
|
-
end
|
292
|
-
|
293
|
-
def test_replace
|
294
|
-
max = Nanoc::Int::Item.new('Max', {}, '/max/')
|
295
|
-
mona = Nanoc::Int::Item.new('Mona', {}, '/mona/')
|
296
|
-
|
297
|
-
@items.replace([max, mona])
|
298
|
-
|
299
|
-
assert_nil @items['/one/']
|
300
|
-
assert_nil @items['/two/']
|
301
|
-
|
302
|
-
assert_equal max, @items[0]
|
303
|
-
assert_equal max, @items['/max/']
|
304
|
-
assert_equal mona, @items[1]
|
305
|
-
assert_equal mona, @items['/mona/']
|
306
|
-
end
|
307
|
-
|
308
|
-
if [].respond_to?(:select!)
|
309
|
-
def test_select_bang
|
310
|
-
assert_equal @two, @items[1]
|
311
|
-
assert_equal @two, @items['/two/']
|
312
|
-
|
313
|
-
@items.select! { |i| i.identifier == '/two/' }
|
314
|
-
|
315
|
-
assert_nil @items[1]
|
316
|
-
assert_nil @items['/one/']
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
def test_shift
|
321
|
-
@items.shift
|
322
|
-
|
323
|
-
assert_equal @two, @items[0]
|
324
|
-
assert_equal @two, @items['/two/']
|
325
|
-
assert_nil @items['/one/']
|
326
|
-
assert_nil @items[1]
|
327
|
-
end
|
328
|
-
|
329
|
-
def test_slice_bang
|
330
|
-
@items.slice!(1)
|
331
|
-
|
332
|
-
assert_equal @one, @items[0]
|
333
|
-
assert_equal @one, @items['/one/']
|
334
|
-
assert_nil @items[1]
|
335
|
-
assert_nil @items['/two/']
|
336
|
-
end
|
337
|
-
|
338
|
-
def test_unshift
|
339
|
-
unshifty = Nanoc::Int::Item.new('Unshifty', {}, '/unshifty/')
|
340
|
-
@items.unshift(unshifty)
|
341
|
-
|
342
|
-
assert_equal unshifty, @items[0]
|
343
|
-
assert_equal unshifty, @items['/unshifty/']
|
344
|
-
assert_equal @one, @items[1]
|
345
|
-
assert_equal @one, @items['/one/']
|
346
|
-
assert_equal @two, @items[2]
|
347
|
-
assert_equal @two, @items['/two/']
|
348
|
-
end
|
349
81
|
end
|