summaryrefslogtreecommitdiff
path: root/spec/logic/cartridge/streaming_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/logic/cartridge/streaming_spec.rb')
-rw-r--r--spec/logic/cartridge/streaming_spec.rb75
1 files changed, 75 insertions, 0 deletions
diff --git a/spec/logic/cartridge/streaming_spec.rb b/spec/logic/cartridge/streaming_spec.rb
new file mode 100644
index 0000000..e5ad012
--- /dev/null
+++ b/spec/logic/cartridge/streaming_spec.rb
@@ -0,0 +1,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