blob: e5ad012ef92a03bb6503414a29278d159cc77546 (
about) (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# frozen_string_literal: true
require 'yaml'
require_relative '../../../logic/cartridge/streaming'
RSpec.describe NanoBot::Logic::Cartridge::Streaming do
context 'provider' do
let(:cartridge) { load_cartridge('streaming.yml') }
it 'checks if stream is enabled' do
cartridge[:provider][:settings][:stream] = false
expect(described_class.enabled?(cartridge, :repl)).to be(false)
end
end
context 'repl' do
let(:cartridge) { load_cartridge('streaming.yml') }
it 'checks if stream is enabled' do
cartridge[:interfaces][:repl][:output][:stream] = false
expect(described_class.enabled?(cartridge, :repl)).to be(false)
end
end
context 'interface + repl' do
let(:cartridge) { load_cartridge('streaming.yml') }
it 'checks if stream is enabled' do
cartridge[:interfaces][:output][:stream] = false
cartridge[:interfaces][:repl][:output][:stream] = true
expect(described_class.enabled?(cartridge, :repl)).to be(true)
end
end
context 'interface' do
let(:cartridge) { load_cartridge('streaming.yml') }
it 'checks if stream is enabled' do
cartridge[:interfaces][:output][:stream] = false
cartridge[:interfaces][:repl][:output].delete(:stream)
expect(described_class.enabled?(cartridge, :repl)).to be(false)
end
end
context '- repl' do
let(:cartridge) { load_cartridge('streaming.yml') }
it 'checks if stream is enabled' do
cartridge[:interfaces][:repl][:output].delete(:stream)
expect(described_class.enabled?(cartridge, :repl)).to be(true)
end
end
context '- interface' do
let(:cartridge) { load_cartridge('streaming.yml') }
it 'checks if stream is enabled' do
cartridge[:interfaces][:output].delete(:stream)
cartridge[:interfaces][:repl][:output].delete(:stream)
expect(described_class.enabled?(cartridge, :repl)).to be(true)
end
end
context '- provider' do
let(:cartridge) { load_cartridge('streaming.yml') }
it 'checks if stream is enabled' do
cartridge[:provider][:settings].delete(:stream)
cartridge[:interfaces][:output].delete(:stream)
cartridge[:interfaces][:repl][:output].delete(:stream)
expect(described_class.enabled?(cartridge, :repl)).to be(true)
end
end
end
|