Skip to content

Commit bfa80b8

Browse files
committed
Fix syntax
1 parent ec9d18a commit bfa80b8

1 file changed

Lines changed: 51 additions & 51 deletions

File tree

spec/docx/document_spec.rb

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -233,44 +233,44 @@
233233
end
234234

235235
it 'should detect centered paragraphs' do
236-
@doc.paragraphs[5].aligned_center?.should be_false
237-
@doc.paragraphs[6].aligned_center?.should be_true
238-
@doc.paragraphs[7].aligned_center?.should be_false
236+
expect(@doc.paragraphs[5].aligned_center?).to eq(false)
237+
expect(@doc.paragraphs[6].aligned_center?).to eq(true)
238+
expect(@doc.paragraphs[7].aligned_center?).to eq(false)
239239
end
240240

241241
it 'should detect left justified paragraphs' do
242-
@doc.paragraphs[6].aligned_left?.should be_false
243-
@doc.paragraphs[7].aligned_left?.should be_true
244-
@doc.paragraphs[8].aligned_left?.should be_false
242+
expect(@doc.paragraphs[6].aligned_left?).to eq(false)
243+
expect(@doc.paragraphs[7].aligned_left?).to eq(true)
244+
expect(@doc.paragraphs[8].aligned_left?).to eq(false)
245245
end
246246

247247
it 'should detect right justified paragraphs' do
248-
@doc.paragraphs[7].aligned_right?.should be_false
249-
@doc.paragraphs[8].aligned_right?.should be_true
250-
@doc.paragraphs[9].aligned_right?.should be_false
248+
expect(@doc.paragraphs[7].aligned_right?).to eq(false)
249+
expect(@doc.paragraphs[8].aligned_right?).to eq(true)
250+
expect(@doc.paragraphs[9].aligned_right?).to eq(false)
251251
end
252252

253253
# ECMA-376 Office Open XML spec (4th edition), 17.3.2.38, size is
254254
# defined in half-points, meaning 14pt text returns a value of 28.
255255
# http://www.ecma-international.org/publications/standards/Ecma-376.htm
256256
it 'should return proper font size for paragraphs' do
257-
@doc.font_size.should eq 11
258-
@doc.paragraphs[5].font_size.should eq 11
257+
expect(@doc.font_size).to eq 11
258+
expect(@doc.paragraphs[5].font_size).to eq 11
259259
paragraph = @doc.paragraphs[9]
260-
paragraph.font_size.should eq 14
261-
paragraph.text_runs[0].font_size.should eq 14
260+
expect(paragraph.font_size).to eq 14
261+
expect(paragraph.text_runs[0].font_size).to eq 14
262262
end
263263

264264
it 'should return proper font size for runs' do
265-
@doc.font_size.should eq 11
265+
expect(@doc.font_size).to eq 11
266266
paragraph = @doc.paragraphs[10]
267-
paragraph.font_size.should eq 11
267+
expect(paragraph.font_size).to eq 11
268268
text_runs = paragraph.text_runs
269-
text_runs[0].font_size.should eq 11
270-
text_runs[1].font_size.should eq 16
271-
text_runs[2].font_size.should eq 11
272-
text_runs[3].font_size.should eq 11
273-
text_runs[4].font_size.should eq 11
269+
expect(text_runs[0].font_size).to eq 11
270+
expect(text_runs[1].font_size).to eq 16
271+
expect(text_runs[2].font_size).to eq 11
272+
expect(text_runs[3].font_size).to eq 11
273+
expect(text_runs[4].font_size).to eq 11
274274
end
275275
end
276276

@@ -318,77 +318,77 @@
318318

319319
it 'should wrap pragraphs in a p tag' do
320320
scan = @doc.paragraphs[0].to_html.scan(@p_regex).flatten
321-
scan.first.should eq '<p'
322-
scan.last.should eq '</p>'
323-
scan[1].should eq 'Normal'
321+
expect(scan.first).to eq('<p')
322+
expect(scan.last).to eq('</p>')
323+
expect(scan[1]).to eq('Normal')
324324
end
325325

326326
it 'should emphasize italicized text' do
327327
scan = @doc.paragraphs[1].to_html.scan(@em_regex).flatten
328-
scan.first.should eq '<em'
329-
scan.last.should eq '</em>'
330-
scan[1].should eq 'Italic'
328+
expect(scan.first).to eq('<em')
329+
expect(scan.last).to eq('</em>')
330+
expect(scan[1]).to eq('Italic')
331331
end
332332

333333
it 'should strong bolded text' do
334334
scan = @doc.paragraphs[2].to_html.scan(@strong_regex).flatten
335-
scan.first.should eq '<strong'
336-
scan.last.should eq '</strong>'
337-
scan[1].should eq 'Bold'
335+
expect(scan.first).to eq '<strong'
336+
expect(scan.last).to eq '</strong>'
337+
expect(scan[1]).to eq 'Bold'
338338
end
339339

340340
it 'should underline underlined text' do
341341
scan = @doc.paragraphs[3].to_html.scan(/\<span\s+([^\>]+)/).flatten
342-
scan.first.should eq 'style="text-decoration:underline;"'
342+
expect(scan.first).to eq 'style="text-decoration:underline;"'
343343
end
344344

345345
it 'should justify paragraphs' do
346346
regex = /^<p[^\"]+.(?<=\")([^\"]+)/
347-
@doc.paragraphs[6].to_html.scan(regex).flatten.first.split(';').include?('text-align:center').should be_true
348-
@doc.paragraphs[7].to_html.scan(regex).flatten.first.split(';').include?('text-align:left').should be_false
349-
@doc.paragraphs[8].to_html.scan(regex).flatten.first.split(';').include?('text-align:right').should be_true
347+
expect(@doc.paragraphs[6].to_html.scan(regex).flatten.first.split(';').include?('text-align:center')).to eq(true)
348+
expect(@doc.paragraphs[7].to_html.scan(regex).flatten.first.split(';').include?('text-align:left')).to eq(false)
349+
expect(@doc.paragraphs[8].to_html.scan(regex).flatten.first.split(';').include?('text-align:right')).to eq(true)
350350
end
351351

352352
it "should set font size on styled paragraphs" do
353353
regex = /(\<p{1})[^\>]+style\=\"([^\"]+).+(<\/p>)/
354354
scan = @doc.paragraphs[9].to_html.scan(regex).flatten
355-
scan.first.should eq '<p'
356-
scan.last.should eq '</p>'
357-
scan[1].split(';').include?('font-size:14pt').should be_true
355+
expect(scan.first).to eq '<p'
356+
expect(scan.last).to eq '</p>'
357+
expect(scan[1].split(';').include?('font-size:14pt')).to eq(true)
358358
end
359359

360360
it 'should set font size on styled text runs' do
361361
regex = /(\<span)[^\>]+style\=\"([^\"]+)[^\<]+(<\/span>)/
362362
scan = @doc.paragraphs[10].to_html.scan(regex).flatten
363-
scan.first.should eq '<span'
364-
scan.last.should eq '</span>'
365-
scan[1].split(';').include?('font-size:16pt').should be_true
363+
expect(scan.first).to eq '<span'
364+
expect(scan.last).to eq '</span>'
365+
expect(scan[1].split(';').include?('font-size:16pt')).to eq(true)
366366
end
367367

368368
it 'should properly highlight different text in different places in a sentence' do
369369
paragraph = @doc.paragraphs[11]
370370
scan = paragraph.to_html.scan(@em_regex).flatten
371-
scan.first.should eq '<em'
372-
scan.last.should eq '</em>'
373-
scan[1].should eq 'sentence'
371+
expect(scan.first).to eq '<em'
372+
expect(scan.last).to eq '</em>'
373+
expect(scan[1]).to eq 'sentence'
374374
scan = paragraph.to_html.scan(@strong_regex).flatten
375-
scan.first.should eq '<strong'
376-
scan.last.should eq '</strong>'
377-
scan[1].should eq 'formatting'
375+
expect(scan.first).to eq '<strong'
376+
expect(scan.last).to eq '</strong>'
377+
expect(scan[1]).to eq 'formatting'
378378
scan = paragraph.to_html.scan(@span_regex).flatten
379-
scan.first.should eq '<span'
380-
scan.last.should eq '</span>'
381-
scan[1].should eq 'different'
379+
expect(scan.first).to eq '<span'
380+
expect(scan.last).to eq '</span>'
381+
expect(scan[1]).to eq 'different'
382382
scan = paragraph.to_html.scan(/\<span\s+([^\>]+)/).flatten
383-
scan.first.should eq 'style="text-decoration:underline;"'
383+
expect(scan.first).to eq 'style="text-decoration:underline;"'
384384
end
385385

386386
it 'should output an entire document as html fragment' do
387-
@doc.to_html.scan(/(\<p)/).flatten.size.should eq @formatting_line_count
387+
expect(@doc.to_html.scan(/(\<p)/).flatten.size).to eq(@formatting_line_count)
388388
end
389389

390390
it 'should output styled html' do
391-
@formatted_line.to_html.scan('<span style="text-decoration:underline;"><strong><em>all</em></strong></span>').size.should eq 1
391+
expect(@formatted_line.to_html.scan('<span style="text-decoration:underline;"><strong><em>all</em></strong></span>').size).to eq 1
392392
end
393393

394394
end

0 commit comments

Comments
 (0)