-
Notifications
You must be signed in to change notification settings - Fork 0
/
typeright_spec.rb
57 lines (47 loc) · 1.68 KB
/
typeright_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'spec_helper'
describe Typeright do
it 'should change minus to hyphens' do
expect(Typeright.s('And suddenly -- No more.'))
.to eq('And suddenly — No more.')
end
it 'should change dots to ellipse' do
expect(Typeright.s('And suddenly... No more.'))
.to eq('And suddenly… No more.')
end
it 'should make beautiful quotes' do
expect(Typeright.s('And suddenly... "No more".'))
.to eq('And suddenly… “No more”.')
end
it 'should make beautiful quotes' do
expect(Typeright.s("Walk among us... 'Nevermind!'"))
.to eq('Walk among us… ‘Nevermind!’')
end
it 'should do some math Pi π' do
expect(Typeright.s('So, Pi = 3.14...')).to eq('So, π = 3.14…')
end
it 'should do some math != π' do
expect(Typeright.s('So, Pi != 1???')).to eq('So, π ≠ 1???')
end
it 'should do some math +-' do
expect(Typeright.s('So, Pi +- 3.1?')).to eq('So, π ± 3.1?')
end
it 'should do some math ->' do
expect(Typeright.s('So, Pi -> 3.1?')).to eq('So, π → 3.1?')
end
it 'should do some math %o' do
expect(Typeright.s('It means 10%o')).to eq('It means 10‰')
end
{
# 'pretty :-) So good' => 'pretty :-) So good',
'place, I\'d rewrite it' => 'place, I’d rewrite it',
'by 50 more reviewers...' => 'by 50 more reviewers…',
'So "Why don\'t you" -- implied' => 'So “Why don’t you” — implied',
'So "Why don\'t you?"' => 'So “Why don’t you?”',
'So "Why don\'t you".' => 'So “Why don’t you”.',
'So "Why don\'t you?".' => 'So “Why don’t you?”.'
}.each do |k, v|
it "should work nice with #{k} -> #{v}" do
expect(Typeright.s(k)).to eq(v)
end
end
end