-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
configuration_spec.rb
41 lines (32 loc) · 1.15 KB
/
configuration_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
# frozen_string_literal: true
RSpec.describe RTesseract do
let(:path) { Pathname.new(File.dirname(__FILE__)).join('..') }
context 'with global spm' do
before { described_class.configure { |config| config.psm = 7 } }
it 'gets the global psm value' do
expect(described_class.config.psm).to be(7)
end
it 'gets instance psm value' do
expect(described_class.new(path, psm: 2).config.psm).to be(2)
end
end
context 'with default command' do
it 'gets the global psm value' do
expect(described_class.config.command).to eql('tesseract')
end
it 'gets instance command value' do
expect(described_class.new(path, command: '/usr/bin/tesseract4').config.command).to eql('/usr/bin/tesseract4')
end
end
context 'with other options' do
it 'allows to setup oem' do
expect(described_class.new(path, oem: 1).config.oem).to be(1)
end
it 'allows to setup lang' do
expect(described_class.new(path, lang: 'eng').config.lang).to eql('eng')
end
it 'allows to setup multiple langs' do
expect(described_class.new(path, lang: 'eng+por').config.lang).to eql('eng+por')
end
end
end