nanoc 4.8.2 → 4.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS.md +13 -1
- data/lib/nanoc/base/entities/document.rb +6 -1
- data/lib/nanoc/base/entities/identifier.rb +10 -3
- data/lib/nanoc/cli/command_runner.rb +27 -4
- data/lib/nanoc/cli/commands/view.rb +6 -2
- data/lib/nanoc/spec.rb +10 -0
- data/lib/nanoc/version.rb +1 -1
- data/spec/nanoc/base/entities/document_spec.rb +30 -0
- data/spec/nanoc/base/entities/identifier_spec.rb +13 -3
- data/spec/nanoc/base/item_rep_writer_spec.rb +1 -1
- data/spec/nanoc/base/services/executor_spec.rb +1 -1
- data/spec/nanoc/base/views/document_view_spec.rb +13 -13
- data/spec/nanoc/base/views/item_rep_view_spec.rb +15 -15
- data/spec/nanoc/base/views/item_view_spec.rb +21 -12
- data/spec/nanoc/base/views/layout_view_spec.rb +2 -2
- data/spec/nanoc/base/views/mutable_document_view_spec.rb +3 -3
- data/spec/nanoc/base/views/mutable_identifiable_collection_view_spec.rb +4 -4
- data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +5 -5
- data/spec/nanoc/base/views/mutable_item_view_spec.rb +3 -3
- data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +5 -5
- data/spec/nanoc/base/views/mutable_layout_view_spec.rb +2 -2
- data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +1 -1
- data/spec/nanoc/cli/command_runner_spec.rb +90 -0
- data/spec/nanoc/cli/commands/show_rules_spec.rb +1 -0
- data/spec/nanoc/cli/commands/view_spec.rb +13 -0
- data/spec/nanoc/cli_spec.rb +1 -1
- data/spec/nanoc/data_sources/filesystem_spec.rb +1 -1
- data/spec/nanoc/helpers/blogging_spec.rb +18 -18
- data/spec/nanoc/helpers/link_to_spec.rb +8 -8
- data/spec/spec_helper.rb +7 -8
- data/test/base/test_data_source.rb +8 -8
- data/test/base/test_item_array.rb +11 -11
- data/test/cli/commands/test_compile.rb +2 -2
- data/test/filters/test_handlebars.rb +3 -3
- data/test/filters/test_mustache.rb +2 -2
- data/test/filters/test_relativize_paths.rb +29 -29
- data/test/filters/test_sass.rb +1 -1
- data/test/filters/test_xsl.rb +6 -6
- data/test/helpers/test_capturing.rb +1 -1
- data/test/helpers/test_xml_sitemap.rb +15 -15
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b1d74ffa8fb8b247dcda27d5663209908450d0e
|
4
|
+
data.tar.gz: e3df83ea0b47564aaa41837544282f5b9ae793b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02df11311b85cfe8d451e35afd31e6fae632ae468b2f79102dadb43be76881d15573a635c7b41c18f218d600294120f52790a9616b943c2b4d0fe449955668f1
|
7
|
+
data.tar.gz: 6f4c42e24182f4df836e10f4207c3fcb475462e439d2d0fd1e3e82a6bedda0d30a7e43ca0b82cd1ff4f03a793c8d078281cb42fdfdb15eee3c7fa28b15cfaa3b
|
data/NEWS.md
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
# Nanoc news
|
2
2
|
|
3
|
+
## 4.8.3 (2017-08-30)
|
4
|
+
|
5
|
+
Fixes:
|
6
|
+
|
7
|
+
* Disallowed full identifiers from ending with a slash (#1206)
|
8
|
+
* Made `nanoc view` listen on 127.0.0.1, not 0.0.0.0, by default (#1205)
|
9
|
+
|
10
|
+
Enhancements:
|
11
|
+
|
12
|
+
* Made `nanoc view` print site URL (#1204)
|
13
|
+
* Made `nanoc` search for parent directory containing Nanoc site (#1210)
|
14
|
+
|
3
15
|
## 4.8.2 (2017-08-19)
|
4
16
|
|
5
|
-
|
17
|
+
Fixes:
|
6
18
|
|
7
19
|
* Fixed compatibility issue with guard-nanoc
|
8
20
|
|
@@ -15,7 +15,7 @@ module Nanoc
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# @return [Nanoc::Identifier]
|
18
|
-
|
18
|
+
attr_reader :identifier
|
19
19
|
|
20
20
|
# @return [String, nil]
|
21
21
|
attr_accessor :checksum_data
|
@@ -81,6 +81,11 @@ module Nanoc
|
|
81
81
|
raise NotImplementedError
|
82
82
|
end
|
83
83
|
|
84
|
+
contract C::Or[Nanoc::Identifier, String] => Nanoc::Identifier
|
85
|
+
def identifier=(new_identifier)
|
86
|
+
@identifier = Nanoc::Identifier.from(new_identifier)
|
87
|
+
end
|
88
|
+
|
84
89
|
contract C::None => String
|
85
90
|
def inspect
|
86
91
|
"<#{self.class} identifier=\"#{identifier}\">"
|
@@ -12,6 +12,13 @@ module Nanoc
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
+
# @api private
|
16
|
+
class InvalidFullIdentifierError < ::Nanoc::Error
|
17
|
+
def initialize(string)
|
18
|
+
super("Invalid full identifier (ends with a slash): #{string.inspect}")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
15
22
|
# @api private
|
16
23
|
class InvalidTypeError < ::Nanoc::Error
|
17
24
|
def initialize(type)
|
@@ -60,9 +67,9 @@ module Nanoc
|
|
60
67
|
when :legacy
|
61
68
|
@string = "/#{string}/".gsub(/^\/+|\/+$/, '/').freeze
|
62
69
|
when :full
|
63
|
-
if string !~ /\A\//
|
64
|
-
|
65
|
-
|
70
|
+
raise InvalidIdentifierError.new(string) if string !~ /\A\//
|
71
|
+
raise InvalidFullIdentifierError.new(string) if string =~ /\/\z/
|
72
|
+
|
66
73
|
@string = string.dup.freeze
|
67
74
|
else
|
68
75
|
raise InvalidTypeError.new(@type)
|
@@ -43,17 +43,40 @@ module Nanoc::CLI
|
|
43
43
|
end
|
44
44
|
alias is_in_site_dir? in_site_dir?
|
45
45
|
|
46
|
+
def self.find_site_dir
|
47
|
+
start_here = Dir.pwd
|
48
|
+
|
49
|
+
here = start_here
|
50
|
+
until Nanoc::Int::SiteLoader.cwd_is_nanoc_site?
|
51
|
+
Dir.chdir('..')
|
52
|
+
return nil if Dir.pwd == here
|
53
|
+
here = Dir.pwd
|
54
|
+
end
|
55
|
+
here
|
56
|
+
ensure
|
57
|
+
Dir.chdir(start_here)
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.enter_site_dir
|
61
|
+
dir = find_site_dir
|
62
|
+
if dir.nil?
|
63
|
+
raise ::Nanoc::Int::Errors::GenericTrivial, 'The current working directory, nor any of its parents, seems to be a Nanoc site.'
|
64
|
+
end
|
65
|
+
|
66
|
+
return if Dir.getwd == dir
|
67
|
+
$stderr.puts "Using Nanoc site in #{dir}"
|
68
|
+
Dir.chdir(dir)
|
69
|
+
end
|
70
|
+
|
46
71
|
# Asserts that the current working directory contains a site and loads the site into memory.
|
47
72
|
#
|
48
73
|
# @return [void]
|
49
74
|
def load_site(preprocess: false)
|
75
|
+
self.class.enter_site_dir
|
76
|
+
|
50
77
|
$stderr.print 'Loading site… '
|
51
78
|
$stderr.flush
|
52
79
|
|
53
|
-
if site.nil?
|
54
|
-
raise ::Nanoc::Int::Errors::GenericTrivial, 'The current working directory does not seem to be a Nanoc site.'
|
55
|
-
end
|
56
|
-
|
57
80
|
if preprocess
|
58
81
|
site.compiler.action_provider.preprocess(site)
|
59
82
|
end
|
@@ -9,7 +9,7 @@ description <<~EOS
|
|
9
9
|
EOS
|
10
10
|
|
11
11
|
required :H, :handler, 'specify the handler to use (webrick/mongrel/...)'
|
12
|
-
required :o, :host, 'specify the host to listen on (default:
|
12
|
+
required :o, :host, 'specify the host to listen on (default: 127.0.0.1)'
|
13
13
|
required :p, :port, 'specify the port to listen on (default: 3000)'
|
14
14
|
|
15
15
|
module Nanoc::CLI::Commands
|
@@ -25,7 +25,7 @@ module Nanoc::CLI::Commands
|
|
25
25
|
# Set options
|
26
26
|
options_for_rack = {
|
27
27
|
Port: (options[:port] || 3000).to_i,
|
28
|
-
Host: (options[:host] || '
|
28
|
+
Host: (options[:host] || '127.0.0.1'),
|
29
29
|
}
|
30
30
|
|
31
31
|
# Get handler
|
@@ -52,6 +52,10 @@ module Nanoc::CLI::Commands
|
|
52
52
|
run Rack::File.new(site.config[:output_dir])
|
53
53
|
end.to_app
|
54
54
|
|
55
|
+
# Print a link
|
56
|
+
url = "http://#{options_for_rack[:Host]}:#{options_for_rack[:Port]}/"
|
57
|
+
puts "View the site at #{url}"
|
58
|
+
|
55
59
|
# Run autocompiler
|
56
60
|
handler.run(app, options_for_rack)
|
57
61
|
end
|
data/lib/nanoc/spec.rb
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
module Nanoc
|
4
4
|
# @api private
|
5
5
|
module Spec
|
6
|
+
module Helper
|
7
|
+
def chdir(dir)
|
8
|
+
here = Dir.getwd
|
9
|
+
Dir.chdir(dir)
|
10
|
+
yield
|
11
|
+
ensure
|
12
|
+
Dir.chdir(here)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
class HelperContext
|
7
17
|
# @return [Nanoc::Int::DependencyTracker]
|
8
18
|
attr_reader :dependency_tracker
|
data/lib/nanoc/version.rb
CHANGED
@@ -225,4 +225,34 @@ shared_examples 'a document' do
|
|
225
225
|
expect(subject.attributes).to eq(at: 'ribut')
|
226
226
|
end
|
227
227
|
end
|
228
|
+
|
229
|
+
describe '#identifier=' do
|
230
|
+
let(:document) { described_class.new('stuff', {}, '/foo.md') }
|
231
|
+
|
232
|
+
it 'allows changing to a string that contains a full identifier' do
|
233
|
+
expect { document.identifier = '/thing' }.not_to raise_error
|
234
|
+
|
235
|
+
expect(document.identifier).to eq('/thing')
|
236
|
+
expect(document.identifier).to be_full
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'refuses changing to a string that does not contain a full identifier' do
|
240
|
+
expect { document.identifier = '/thing/' }
|
241
|
+
.to raise_error(Nanoc::Identifier::InvalidFullIdentifierError)
|
242
|
+
end
|
243
|
+
|
244
|
+
it 'allos changing to a full identifier' do
|
245
|
+
document.identifier = Nanoc::Identifier.new('/thing')
|
246
|
+
|
247
|
+
expect(document.identifier.to_s).to eq('/thing')
|
248
|
+
expect(document.identifier).to be_full
|
249
|
+
end
|
250
|
+
|
251
|
+
it 'allos changing to a legacy identifier' do
|
252
|
+
document.identifier = Nanoc::Identifier.new('/thing/', type: :legacy)
|
253
|
+
|
254
|
+
expect(document.identifier).to eq('/thing/')
|
255
|
+
expect(document.identifier).to be_legacy
|
256
|
+
end
|
257
|
+
end
|
228
258
|
end
|
@@ -67,6 +67,16 @@ describe Nanoc::Identifier do
|
|
67
67
|
.to raise_error(Nanoc::Identifier::InvalidIdentifierError)
|
68
68
|
end
|
69
69
|
|
70
|
+
it 'refuses string ending with a slash' do
|
71
|
+
expect { described_class.new('/foo/') }
|
72
|
+
.to raise_error(Nanoc::Identifier::InvalidFullIdentifierError)
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'refuses string with only slash' do
|
76
|
+
expect { described_class.new('/') }
|
77
|
+
.to raise_error(Nanoc::Identifier::InvalidFullIdentifierError)
|
78
|
+
end
|
79
|
+
|
70
80
|
it 'has proper string representation' do
|
71
81
|
expect(described_class.new('/foo').to_s).to eql('/foo')
|
72
82
|
end
|
@@ -422,7 +432,7 @@ describe Nanoc::Identifier do
|
|
422
432
|
end
|
423
433
|
|
424
434
|
context 'full type' do
|
425
|
-
let(:identifier) { described_class.new('/foo
|
435
|
+
let(:identifier) { described_class.new('/foo', type: :full) }
|
426
436
|
it { is_expected.to eql(false) }
|
427
437
|
end
|
428
438
|
end
|
@@ -436,7 +446,7 @@ describe Nanoc::Identifier do
|
|
436
446
|
end
|
437
447
|
|
438
448
|
context 'full type' do
|
439
|
-
let(:identifier) { described_class.new('/foo
|
449
|
+
let(:identifier) { described_class.new('/foo', type: :full) }
|
440
450
|
it { is_expected.to eql(true) }
|
441
451
|
end
|
442
452
|
end
|
@@ -445,7 +455,7 @@ describe Nanoc::Identifier do
|
|
445
455
|
subject { identifier.components }
|
446
456
|
|
447
457
|
context 'no components' do
|
448
|
-
let(:identifier) { described_class.new('/') }
|
458
|
+
let(:identifier) { described_class.new('/', type: :legacy) }
|
449
459
|
it { is_expected.to eql([]) }
|
450
460
|
end
|
451
461
|
|
@@ -4,7 +4,7 @@ describe Nanoc::Int::ItemRepWriter do
|
|
4
4
|
describe '#write' do
|
5
5
|
let(:raw_path) { 'output/blah.dat' }
|
6
6
|
|
7
|
-
let(:item) { Nanoc::Int::Item.new(orig_content, {}, '/') }
|
7
|
+
let(:item) { Nanoc::Int::Item.new(orig_content, {}, '/foo') }
|
8
8
|
|
9
9
|
let(:item_rep) do
|
10
10
|
Nanoc::Int::ItemRep.new(item, :default).tap do |ir|
|
@@ -653,7 +653,7 @@ describe Nanoc::Int::Executor do
|
|
653
653
|
let(:arg) { '/default' }
|
654
654
|
|
655
655
|
let(:layouts) do
|
656
|
-
[Nanoc::Int::Layout.new('head <%= @foo %> foot', {}, '/default/')]
|
656
|
+
[Nanoc::Int::Layout.new('head <%= @foo %> foot', {}, Nanoc::Identifier.new('/default/', type: :legacy))]
|
657
657
|
end
|
658
658
|
|
659
659
|
it { is_expected.to eq(layouts[0]) }
|
@@ -27,7 +27,7 @@ shared_examples 'a document view' do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
describe '#frozen?' do
|
30
|
-
let(:document) { entity_class.new('content', {}, '/asdf
|
30
|
+
let(:document) { entity_class.new('content', {}, '/asdf') }
|
31
31
|
|
32
32
|
subject { view.frozen? }
|
33
33
|
|
@@ -42,10 +42,10 @@ shared_examples 'a document view' do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
describe '#== and #eql?' do
|
45
|
-
let(:document) { entity_class.new('content', {}, '/asdf
|
45
|
+
let(:document) { entity_class.new('content', {}, '/asdf') }
|
46
46
|
|
47
47
|
context 'comparing with document with same identifier' do
|
48
|
-
let(:other) { entity_class.new('content', {}, '/asdf
|
48
|
+
let(:other) { entity_class.new('content', {}, '/asdf') }
|
49
49
|
|
50
50
|
it 'is ==' do
|
51
51
|
expect(view).to eq(other)
|
@@ -57,7 +57,7 @@ shared_examples 'a document view' do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
context 'comparing with document with different identifier' do
|
60
|
-
let(:other) { entity_class.new('content', {}, '/fdsa
|
60
|
+
let(:other) { entity_class.new('content', {}, '/fdsa') }
|
61
61
|
|
62
62
|
it 'is not ==' do
|
63
63
|
expect(view).not_to eq(other)
|
@@ -69,7 +69,7 @@ shared_examples 'a document view' do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
context 'comparing with document view with same identifier' do
|
72
|
-
let(:other) { other_view_class.new(entity_class.new('content', {}, '/asdf
|
72
|
+
let(:other) { other_view_class.new(entity_class.new('content', {}, '/asdf'), nil) }
|
73
73
|
|
74
74
|
it 'is ==' do
|
75
75
|
expect(view).to eq(other)
|
@@ -81,7 +81,7 @@ shared_examples 'a document view' do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
context 'comparing with document view with different identifier' do
|
84
|
-
let(:other) { other_view_class.new(entity_class.new('content', {}, '/fdsa
|
84
|
+
let(:other) { other_view_class.new(entity_class.new('content', {}, '/fdsa'), nil) }
|
85
85
|
|
86
86
|
it 'is not ==' do
|
87
87
|
expect(view).not_to eq(other)
|
@@ -106,7 +106,7 @@ shared_examples 'a document view' do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
describe '#[]' do
|
109
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo
|
109
|
+
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
110
110
|
|
111
111
|
subject { view[key] }
|
112
112
|
|
@@ -154,7 +154,7 @@ shared_examples 'a document view' do
|
|
154
154
|
end
|
155
155
|
|
156
156
|
describe '#attributes' do
|
157
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo
|
157
|
+
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
158
158
|
|
159
159
|
subject { view.attributes }
|
160
160
|
|
@@ -179,7 +179,7 @@ shared_examples 'a document view' do
|
|
179
179
|
end
|
180
180
|
|
181
181
|
describe '#fetch' do
|
182
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo
|
182
|
+
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
183
183
|
|
184
184
|
context 'with existant key' do
|
185
185
|
let(:key) { :animal }
|
@@ -260,7 +260,7 @@ shared_examples 'a document view' do
|
|
260
260
|
end
|
261
261
|
|
262
262
|
describe '#key?' do
|
263
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo
|
263
|
+
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
264
264
|
|
265
265
|
subject { view.key?(key) }
|
266
266
|
|
@@ -308,15 +308,15 @@ shared_examples 'a document view' do
|
|
308
308
|
end
|
309
309
|
|
310
310
|
describe '#hash' do
|
311
|
-
let(:document) { double(:document, identifier: '/foo
|
311
|
+
let(:document) { double(:document, identifier: '/foo') }
|
312
312
|
|
313
313
|
subject { view.hash }
|
314
314
|
|
315
|
-
it { should == described_class.hash ^ '/foo
|
315
|
+
it { should == described_class.hash ^ '/foo'.hash }
|
316
316
|
end
|
317
317
|
|
318
318
|
describe '#raw_content' do
|
319
|
-
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo
|
319
|
+
let(:document) { entity_class.new('stuff', { animal: 'donkey' }, '/foo') }
|
320
320
|
|
321
321
|
subject { view.raw_content }
|
322
322
|
|
@@ -31,7 +31,7 @@ describe Nanoc::ItemRepView do
|
|
31
31
|
|
32
32
|
describe '#frozen?' do
|
33
33
|
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
34
|
-
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo
|
34
|
+
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo') }
|
35
35
|
let(:view) { described_class.new(item_rep, view_context) }
|
36
36
|
|
37
37
|
subject { view.frozen? }
|
@@ -48,11 +48,11 @@ describe Nanoc::ItemRepView do
|
|
48
48
|
|
49
49
|
describe '#== and #eql?' do
|
50
50
|
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
51
|
-
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo
|
51
|
+
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo') }
|
52
52
|
let(:view) { described_class.new(item_rep, view_context) }
|
53
53
|
|
54
54
|
context 'comparing with item rep with same identifier' do
|
55
|
-
let(:other_item) { double(:other_item, identifier: '/foo
|
55
|
+
let(:other_item) { double(:other_item, identifier: '/foo') }
|
56
56
|
let(:other) { double(:other_item_rep, item: other_item, name: :jacques) }
|
57
57
|
|
58
58
|
it 'is ==' do
|
@@ -65,7 +65,7 @@ describe Nanoc::ItemRepView do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
context 'comparing with item rep with different identifier' do
|
68
|
-
let(:other_item) { double(:other_item, identifier: '/bar
|
68
|
+
let(:other_item) { double(:other_item, identifier: '/bar') }
|
69
69
|
let(:other) { double(:other_item_rep, item: other_item, name: :jacques) }
|
70
70
|
|
71
71
|
it 'is not ==' do
|
@@ -78,7 +78,7 @@ describe Nanoc::ItemRepView do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
context 'comparing with item rep with different name' do
|
81
|
-
let(:other_item) { double(:other_item, identifier: '/foo
|
81
|
+
let(:other_item) { double(:other_item, identifier: '/foo') }
|
82
82
|
let(:other) { double(:other_item_rep, item: other_item, name: :marvin) }
|
83
83
|
|
84
84
|
it 'is not ==' do
|
@@ -91,7 +91,7 @@ describe Nanoc::ItemRepView do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
context 'comparing with item rep with same identifier' do
|
94
|
-
let(:other_item) { double(:other_item, identifier: '/foo
|
94
|
+
let(:other_item) { double(:other_item, identifier: '/foo') }
|
95
95
|
let(:other) { described_class.new(double(:other_item_rep, item: other_item, name: :jacques), view_context) }
|
96
96
|
|
97
97
|
it 'is ==' do
|
@@ -104,7 +104,7 @@ describe Nanoc::ItemRepView do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
context 'comparing with item rep with different identifier' do
|
107
|
-
let(:other_item) { double(:other_item, identifier: '/bar
|
107
|
+
let(:other_item) { double(:other_item, identifier: '/bar') }
|
108
108
|
let(:other) { described_class.new(double(:other_item_rep, item: other_item, name: :jacques), view_context) }
|
109
109
|
|
110
110
|
it 'is not equal' do
|
@@ -114,7 +114,7 @@ describe Nanoc::ItemRepView do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
context 'comparing with item rep with different name' do
|
117
|
-
let(:other_item) { double(:other_item, identifier: '/foo
|
117
|
+
let(:other_item) { double(:other_item, identifier: '/foo') }
|
118
118
|
let(:other) { described_class.new(double(:other_item_rep, item: other_item, name: :marvin), view_context) }
|
119
119
|
|
120
120
|
it 'is not equal' do
|
@@ -124,7 +124,7 @@ describe Nanoc::ItemRepView do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
context 'comparing with something that is not an item rep' do
|
127
|
-
let(:other_item) { double(:other_item, identifier: '/foo
|
127
|
+
let(:other_item) { double(:other_item, identifier: '/foo') }
|
128
128
|
let(:other) { :donkey }
|
129
129
|
|
130
130
|
it 'is not equal' do
|
@@ -136,12 +136,12 @@ describe Nanoc::ItemRepView do
|
|
136
136
|
|
137
137
|
describe '#hash' do
|
138
138
|
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
139
|
-
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo
|
139
|
+
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo') }
|
140
140
|
let(:view) { described_class.new(item_rep, view_context) }
|
141
141
|
|
142
142
|
subject { view.hash }
|
143
143
|
|
144
|
-
it { should == described_class.hash ^ Nanoc::Identifier.new('/foo
|
144
|
+
it { should == described_class.hash ^ Nanoc::Identifier.new('/foo').hash ^ :jacques.hash }
|
145
145
|
end
|
146
146
|
|
147
147
|
describe '#snapshot?' do
|
@@ -349,7 +349,7 @@ describe Nanoc::ItemRepView do
|
|
349
349
|
|
350
350
|
describe '#binary?' do
|
351
351
|
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
352
|
-
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo
|
352
|
+
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo') }
|
353
353
|
let(:view) { described_class.new(item_rep, view_context) }
|
354
354
|
|
355
355
|
subject { view.binary? }
|
@@ -383,7 +383,7 @@ describe Nanoc::ItemRepView do
|
|
383
383
|
|
384
384
|
describe '#item' do
|
385
385
|
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
386
|
-
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo
|
386
|
+
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo') }
|
387
387
|
let(:view) { described_class.new(item_rep, view_context) }
|
388
388
|
|
389
389
|
subject { view.item }
|
@@ -399,11 +399,11 @@ describe Nanoc::ItemRepView do
|
|
399
399
|
|
400
400
|
describe '#inspect' do
|
401
401
|
let(:item_rep) { Nanoc::Int::ItemRep.new(item, :jacques) }
|
402
|
-
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo
|
402
|
+
let(:item) { Nanoc::Int::Item.new('asdf', {}, '/foo') }
|
403
403
|
let(:view) { described_class.new(item_rep, view_context) }
|
404
404
|
|
405
405
|
subject { view.inspect }
|
406
406
|
|
407
|
-
it { is_expected.to eql('<Nanoc::ItemRepView item.identifier=/foo
|
407
|
+
it { is_expected.to eql('<Nanoc::ItemRepView item.identifier=/foo name=jacques>') }
|
408
408
|
end
|
409
409
|
end
|