Skip to content

Commit 8c0ce28

Browse files
committed
test updates
1 parent 9867c32 commit 8c0ce28

File tree

5 files changed

+22
-26
lines changed

5 files changed

+22
-26
lines changed

spec/fixture/pages/en.menu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Menu
33
permalink: the-menu
44
lang: en
5-
lang_id: menu
5+
page_id: menu
66
---
77

88
# the menu

spec/fixture/pages/es.menu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Menu
33
permalink: el-menu
44
lang: es
5-
lang_id: menu
5+
page_id: menu
66
---
77

88
# el menú

spec/fixture/pages/fr.menu.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Menu
33
permalink: le-menu
44
lang: fr
5-
lang_id: menu
5+
page_id: menu
66
---
77

88
# français menu

spec/jekyll/polyglot/hooks/coordinate_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
expect(@site.pages.map { |doc| doc.name }).not_to include('es.samba.md')
9898
end
9999

100-
it 'should respect permalinks when lang_id is specified' do
100+
it 'should respect permalinks when page_id is specified' do
101101
@site.process_language 'en'
102102
expect(@site.pages.select { |doc| doc.name == 'en.about.md' }.first().permalink).to eq('about')
103103
expect(@site.pages.select { |doc| doc.name == 'en.menu.md' }.first().permalink).to eq('the-menu')

spec/jekyll/polyglot/patches/jekyll/site_spec.rb

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
@config['default_lang'] = @default_lang
1414
@config['exclude_from_localization'] = @exclude_from_localization
1515
@parallel_localization = @config['parallel_localization'] || true
16-
16+
1717
@site = Site.new(
1818
Jekyll.configuration(
1919
'languages' => @langs,
@@ -46,9 +46,9 @@
4646
expect(@document_url_regex).to_not match 'properties/beachside/foo'
4747
end
4848
it 'expect relativized_urls should handle different output' do
49-
expected = 'expected'
50-
collection = Jekyll::Collection.new(@site, 'test')
51-
document = Jekyll::Document.new('about.en.md', site: @site, collection:)
49+
expected = "expected"
50+
collection = Jekyll::Collection.new(@site, "test")
51+
document = Jekyll::Document.new("about.en.md", :site => @site, :collection => collection)
5252
document.output = expected
5353
@site.relativize_urls(document, @relative_url_regex)
5454
expect(document.output).to eq(expected)
@@ -244,25 +244,9 @@
244244
end
245245
end
246246

247-
describe @site do
248-
it 'should spawn no more than Etc.nprocessors processes' do
249-
forks = 0
250-
allow(Etc).to receive(:nprocessors).and_return(2)
251-
allow(@site).to receive(:fork) {
252-
forks += 1
253-
fork { sleep 2 }
254-
}
255-
thr = Thread.new {
256-
sleep 1
257-
forks
258-
}
259-
@site.process
260-
expect(thr.value).to eq(Etc.nprocessors)
261-
expect(forks).to eq((@langs + [@default_lang]).uniq.length)
262-
end
263-
247+
describe 'site prepare' do
264248
it 'should copy active_lang to additional variables' do
265-
@site.config['lang_vars'] = ['locale', 'язык']
249+
@site.config['lang_vars'] = [ 'locale', 'язык' ]
266250
@site.prepare
267251
@langs.each do |lang|
268252
@site.active_lang = lang
@@ -272,6 +256,18 @@
272256
end
273257
end
274258

259+
describe @site do
260+
it 'should spawn no more than Etc.nprocessors processes' do
261+
forks = 0
262+
allow(Etc).to receive(:nprocessors).and_return(2)
263+
allow(@site).to receive(:fork) { forks += 1; fork { sleep 2 } }
264+
thr = Thread.new { sleep 1; forks }
265+
@site.process
266+
expect(thr.value).to eq(Etc.nprocessors)
267+
expect(forks).to eq((@langs + [@default_lang]).uniq.length)
268+
end
269+
end
270+
275271
# describe @relativize_urls do
276272
# it 'does not raise' do
277273
# expect(@relativize_urls(@site.Document.new(), @relative_url_regex)).not_to raise_error

0 commit comments

Comments
 (0)