|
13 | 13 | @config['default_lang'] = @default_lang |
14 | 14 | @config['exclude_from_localization'] = @exclude_from_localization |
15 | 15 | @parallel_localization = @config['parallel_localization'] || true |
16 | | - |
| 16 | + |
17 | 17 | @site = Site.new( |
18 | 18 | Jekyll.configuration( |
19 | 19 | 'languages' => @langs, |
|
46 | 46 | expect(@document_url_regex).to_not match 'properties/beachside/foo' |
47 | 47 | end |
48 | 48 | 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) |
52 | 52 | document.output = expected |
53 | 53 | @site.relativize_urls(document, @relative_url_regex) |
54 | 54 | expect(document.output).to eq(expected) |
|
244 | 244 | end |
245 | 245 | end |
246 | 246 |
|
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 |
264 | 248 | it 'should copy active_lang to additional variables' do |
265 | | - @site.config['lang_vars'] = ['locale', 'язык'] |
| 249 | + @site.config['lang_vars'] = [ 'locale', 'язык' ] |
266 | 250 | @site.prepare |
267 | 251 | @langs.each do |lang| |
268 | 252 | @site.active_lang = lang |
|
272 | 256 | end |
273 | 257 | end |
274 | 258 |
|
| 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 | + |
275 | 271 | # describe @relativize_urls do |
276 | 272 | # it 'does not raise' do |
277 | 273 | # expect(@relativize_urls(@site.Document.new(), @relative_url_regex)).not_to raise_error |
|
0 commit comments