-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathterminal_spec.rb
37 lines (31 loc) · 1.05 KB
/
terminal_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
RSpec.describe Terminal do
describe '#put' do
let(:content) { 'ignore_in_specs' }
it 'outputs content to terminal' do
expect(described_class.put(content)).to be_nil
end
it 'outputs content to terminal without new line' do
expect(described_class.put(content, new_line: false)).to be_nil
end
end
describe '#white_on_green' do
it 'wraps content in terminal color codes' do
expect(described_class.white_on_green('CONTENT')).to eq("\e[37;42;1mCONTENT\e[0m")
end
end
describe '#white_on_yellow' do
it 'wraps content in terminal color codes' do
expect(described_class.white_on_yellow('CONTENT')).to eq("\e[37;43;1mCONTENT\e[0m")
end
end
describe '#white_on_red' do
it 'wraps content in terminal color codes' do
expect(described_class.white_on_red('CONTENT')).to eq("\e[37;41;1mCONTENT\e[0m")
end
end
describe '#white_on_black' do
it 'wraps content in terminal color codes' do
expect(described_class.white_on_black('CONTENT')).to eq("\e[37;40mCONTENT\e[0m")
end
end
end